clean up script

This commit is contained in:
2026-03-28 00:51:48 +01:00
parent ffdf84c626
commit b54e7218c6

View File

@@ -1,37 +1,47 @@
#!/bin/sh
set -e
# install basic packages
if [ ! -f /etc/alpine-release ]; then
echo "Error: This script only runs on Alpine Linux."
exit 1
fi
echo "Installing packages..."
apk add gnupg gnupg-scdaemon pinentry-tty git
# gnupg config
echo "Configuring GPG..."
mkdir -p ~/.gnupg
chmod -R 700 ~/.gnupg
echo 'enable-ssh-support' > ~/.gnupg/gpg-agent.conf
echo 'pinentry-program /usr/bin/pinentry-tty' >> ~/.gnupg/gpg-agent.conf
# setup env
echo "Setting up environment..."
export GPG_TTY="$(tty)"
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
# trust key on card
echo "Importing and trusting GPG key..."
gpg --recv-keys "56FB101D4E094804B1666859083A2C9A046554D6"
echo "56FB101D4E094804B1666859083A2C9A046554D6:6:" | gpg --import-ownertrust
# restart agent
echo "Restarting GPG agent..."
gpgconf --kill gpg-agent
gpg-agent --daemon
# test
ssh -T git@g.eliaskohout.de
echo "Testing SSH connection..."
ssh -T git@g.eliaskohout.de || true
# setup projects
mkdir ~/projects/
cd ~/projects/
echo "Setting up projects directory..."
mkdir -p ~/projects
cd ~/projects
git clone "git@g.eliaskohout.de:eliaskohout/env.git"
# setup env
echo "Adding community repository..."
grep main /etc/apk/repositories | sed 's/main/community/' >> /etc/apk/repositories
apk update
echo "Running env setup..."
cd env
./runs/up.python.sh
./scripts/conf-run up
./scripts/conf-run up
echo "Setup complete!"