This repository has been archived on 2026-01-10. You can view files and clone it, but cannot push or open issues or pull requests.
coder-templates/startup_scripts/alpine_aports.sh.j2
Steve McMaster ae25b438a1
Some checks failed
continuous-integration/drone/push Build is failing
Update startup scripts
2025-04-27 13:16:54 -04:00

41 lines
1.2 KiB
Django/Jinja

sudo adduser coder abuild
# Ensure host key verification passes
if [ ! -f $HOME/.ssh/known_hosts ]; then
mkdir -p .ssh
ssh-keyscan gitlab.alpinelinux.org > .ssh/known_hosts
fi
# Clone the aports repository
(
cd $HOME
if [ ! -d $HOME/aports/.git ]; then
git clone git@gitlab.alpinelinux.org:alpine/aports.git
git config remote.origin.pushurl git@gitlab.alpinelinux.org:mcm/aports.git
else
cd aports
git remote set-url origin git@gitlab.alpinelinux.org:alpine/aports.git
git config remote.origin.pushurl git@gitlab.alpinelinux.org:mcm/aports.git
fi
)
# Generate abuild keys if needed
if [ ! -f "$HOME/.abuild/abuild.conf" ]; then
abuild-keygen -a -i -n
fi
if [ -e "$HOME/.abuild/abuild.conf" ]; then
. $HOME/.abuild/abuild.conf
if [ -n "$PACKAGER_PRIVKEY" ]; then
sudo cp ${PACKAGER_PRIVKEY}.pub /etc/apk/keys/
fi
fi
# Update apk
for repo in main community testing ; do
REPO="$HOME/packages/$repo"
grep -q "^$REPO" /etc/apk/repositories || (echo $REPO | sudo tee -a /etc/apk/repositories)
done
sudo apk update
sudo apk add --no-cache alpine-sdk