view sources/native-builds/hello-world.sh @ 1274:b41dbea3ba14

When building control images, the working directory should be in build/control-images.
author Rob Landley <rob@landley.net>
date Sun, 07 Nov 2010 15:54:37 -0600
parents 6b20e20bb291
children
line wrap: on
line source

#!/bin/bash

# Download all the source tarballs we haven't got up-to-date copies of.

# The tarballs are downloaded into the "packages" directory, which is
# created as needed.

source sources/include.sh || exit 1

[ $# -ne 1 ] && echo "usage: $0 FILENAME" >&2 && exit 1
[ -e "$1" ] && echo "$1 exists" && exit 0

# Set up working directories

WORK="$BUILD/control-images/hello-world"
blank_tempdir "$WORK"

cat > "$WORK"/init << 'EOF' || dienow
#!/bin/bash

echo Started second stage init

cd /home &&
gcc -lpthread /usr/src/thread-hello2.c -o hello &&
./hello

# Upload our hello world file to the output directory (named hello-$HOST).
# No reason, just an example.

ftpput $FTP_SERVER -P $FTP_PORT hello-$HOST hello

sync

EOF

chmod +x "$WORK"/init || dienow

cd "$TOP"

mksquashfs "$WORK" "$1" -noappend -all-root