Created
February 12, 2024 14:47
-
-
Save Simon-L/d57c3138f5f2879eed099a0803a87f49 to your computer and use it in GitHub Desktop.
WIP: Bash script to build on Scaleway VPS in one command!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
REPO="https://github.com/JustEnoughLinuxOS/distribution" | |
BRANCH="main" | |
BUILD_OPTS="EMULATION_DEVICE=no ENABLE_32BIT=no" | |
BUILD_DEVICE="RK3326" | |
BUILDER="<VPS ip>" | |
SSH_OPTS="-o PubkeyAuthentication=yes" | |
BOOTSTRAPPED=$(ssh root@${BUILDER} ${SSH_OPTS} stat "/root/.jelos-builder-boostrapped") | |
if [[ ! ${BOOTSTRAPPED} ]]; then | |
ssh root@${BUILDER} ${SSH_OPTS} "DEBIAN_FRONTEND=noninteractive apt-get -y install passwd docker.io build-essential tmux && | |
adduser --gecos \"\" --disabled-password builder && | |
echo \"builder:builder\" | chpasswd && | |
mkdir /work && | |
chown -R builder:builder /work && | |
usermod -aG docker builder && | |
sudo -i -u builder mkdir -p /home/builder/.ssh && | |
sudo -i -u builder touch /home/builder/.ssh/authorized_keys && | |
cp /root/.ssh/authorized_keys /home/builder/.ssh/authorized_keys && | |
chown builder:builder /home/builder/.ssh/authorized_keys && | |
touch /root/.jelos-builder-boostrapped" | |
BOOTSTRAPPED=$(ssh root@${BUILDER} ${SSH_OPTS} stat "/root/.jelos-builder-boostrapped") | |
fi | |
if [[ ${BOOTSTRAPPED} ]]; then | |
echo "Bootstrapping done, building now." | |
ssh builder@${BUILDER} ${SSH_OPTS} "cd /work && | |
git clone ${REPO} distribution && | |
cd distribution && | |
git checkout ${BRANCH} && | |
${BUILD_OPTS} make docker-${BUILD_DEVICE}" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment