diff --git a/build_script/build.sh b/build_script/build.sh new file mode 100755 index 0000000000000000000000000000000000000000..6d229f37ec4306366aeab41a4366340c253fbe1b --- /dev/null +++ b/build_script/build.sh @@ -0,0 +1,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 " + 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 \ No newline at end of file diff --git a/build_script/freifunk_root.sh b/build_script/freifunk_root.sh new file mode 100755 index 0000000000000000000000000000000000000000..3ac52d51e7a4828987c1362df588f01c3c4b74f9 --- /dev/null +++ b/build_script/freifunk_root.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# Installing QoL packages and then (after build-essential incl.) dependencies +apt update && apt install -y htop tmux vim sudo mosh build-essential git python3 python-is-python3 python3-distutils ecdsautils gawk unzip libncurses5-dev zlib1g-dev libssl-dev libelf-dev wget rsync time qemu-utils + +# Create `user` user with `sudo` group +useradd -ms /bin/bash -G sudo user +# `sudo` group w/o password +sed -i /etc/sudoers -re 's/^%sudo.*/%sudo ALL=(ALL:ALL) NOPASSWD: ALL/g' + +mkdir -v /home/user/.ssh +# my public key +echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOLFCOqpPOTZEQiWcY9TyVQnMoc5bCYlxLaRKhiB/uxo xbr 2024-06-16" >> /home/user/.ssh/authorized_keys +# projects.c3l.lu public key +echo "|1|X2M4bHKf8E+plhJ6KoDZzCfw5LI=|EpHLDWOmOq4SLelYTGd8SH+7hvU= ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIXfRmGmfbxPoErs5lpTnz+PZRQdh0QvPGTiswxFkXOx" >> /home/user/.ssh/known_hosts +chown -vR user:user /home/user/.ssh +chmod -v 700 /home/user/.ssh +chmod -v 600 /home/user/.ssh/* +chmod -v 644 /home/user/.ssh/known_hosts +# make a key to have access to projects.c3l.lu +sudo -u user ssh-keygen -t ed25519 -N '' -C 'freifunk-hetzner-builder' -f /home/user/.ssh/id_ed25519 <<