refactor: use tools dir

This commit is contained in:
Strix 2023-10-20 00:10:39 +02:00
parent 7c4160effc
commit 6b06453d37
No known key found for this signature in database
GPG key ID: 49B2E37B8915B774
9 changed files with 102 additions and 59 deletions

View file

@ -0,0 +1,6 @@
#!/bin/sh
if ! [ -f "/etc/ixvd/version" ]; then
echo "applying overlay..."
cp -r skel/. /
fi

View file

@ -0,0 +1,6 @@
#!/bin/sh
if ! [ -d "/etc/ixvd/secrets" ]; then
echo "setting up ixvd/secrets"
git clone git@git.ixvd.net:ixvd/secrets /etc/ixvd/secrets
fi

View file

@ -0,0 +1,12 @@
#!/bin/sh
if ! [ -f "/root/.ssh/authorized_keys" ]; then
echo "importing authorized_keys..."
mkdir -p /root/.ssh
cp /etc/ixvd/secrets/ssh/authorized_keys /root/.ssh/authorized_keys
else
if ! grep -q "# IXVD keys" /root/.ssh/authorized_keys; then
echo "importing authorized_keys..."
cat /etc/ixvd/secrets/ssh/authorized_keys >> /root/.ssh/authorized_keys
fi
fi

17
tools/setup/30-cifs.sh Normal file
View file

@ -0,0 +1,17 @@
#!/bin/sh
if ! grep -q "# cifs mount backups" /etc/fstab; then
echo "modifying fstab..."
cp /etc/fstab /etc/fstab.$(date +"%H-%M-%S_%d-%m-%y").bak
. /etc/ixvd/secrets/backups.cifs
cat<<EOF>>/etc/fstab
# cifs mount backups
//$domain/backup /mnt/backups cifs credentials=/etc/ixvd/secrets/backups.cifs,file_mode=0777,dir_mode=0777,noperm 0 0
EOF
fi
if ! [ -d "/mnt/backups" ]; then
echo "mounting share..."
mkdir /mnt/backups
mount /mnt/backups
fi