Files
@ cf4f965e2938
Branch filter:
Location: freifunk/Firmware-building/build_script/build.sh
cf4f965e2938
1.8 KiB
text/x-sh
Add scripts for automation of building and build machine setup
This allows us to use a powerful Hetzner VM for not very long to
build our firmware in almost no time.
This allows us to use a powerful Hetzner VM for not very long to
build our firmware in almost no time.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | #!/usr/bin/env bash
USER_DIR=/home/user
GLUON_DIR=$USER_DIR/gluon
SITE_DIR=$USER_DIR/Firmware-building/site_config
EXPERIMENTAL_SITE=$SITE_DIR/experimental/site
BETA_SITE=$SITE_DIR/beta/site
STABLE_SITE=$SITE_DIR/stable/site
# $1: site directory
set_site_directory() {
pushd $GLUON_DIR
# if site file exists, remove it
if [ -a site ]; then
unlink site
fi
ln -s $1
popd $GLUON_DIR
}
build() {
pushd $GLUON_DIR
for TARGET in $(make list-targets); do
make -j16 GLUON_TARGET=$TARGET
done
popd
}
# $1: autoupdater branch
move_output_images() {
pushd $GLUON_DIR
mv output/images output-images-$1
popd
}
#unset multiple env vars
unset BUILD_EXPERIMENTAL BUILD_BETA BUILD_STABLE
case $1 in
exp)
BUILD_EXPERIMENTAL=1
;;
beta)
BUILD_BETA=1
;;
stable)
BUILD_STABLE=1
;;
all)
BUILD_EXPERIMENTAL=1
BUILD_BETA=1
BUILD_STABLE=1
;;
*)
echo "fflux firmware building script"
echo "Usage: build.sh <all|exp|beta|stable>"
exit 1
;;
esac
pushd $GLUON_DIR
if [ -d $GLUON_DIR/output/images ]; then
echo "Error: output images directory contains images. Please remove them before building."
echo "Delete `gluon/output/images` directory and try again."
exit 1
fi
set_site_directory() {
echo "Linking $1"
}
build() {
echo "Building images"
}
move_output_images() {
echo "Moving output images to output-images-$1"
}
if [ -n $BUILD_EXPERIMENTAL ]; then
set_site_directory $EXPERIMENTAL_SITE
build
move_output_images experimental
fi
if [ -n $BUILD_BETA ]; then
set_site_directory $BETA_SITE
build
move_output_images beta
fi
if [ -n $BUILD_STABLE ]; then
set_site_directory $STABLE_SITE
build
move_output_images stable
fi
popd
|