Initial commit, with README and deploy script

This commit is contained in:
2024-07-24 17:07:30 +02:00
commit 3937672576
2 changed files with 62 additions and 0 deletions

40
deploy.sh Executable file
View File

@@ -0,0 +1,40 @@
#!/usr/bin/env bash
if [ "$1" = "" ]; then
echo "Please specify one of nspawn or all. Exiting."
exit 0
fi
nspawn=0
for arg in "$@"; do
if [[ $arg = "nspawn" || $arg = "all" ]]; then
nspawn=1
fi
done
if [[ $nspawn -eq 0 ]]; then
echo "Please specify one of nspawn or all. Exiting."
exit 0
fi
run_directory=$(dirname $(readlink -f "$0"))
if [[ $user != 'root' ]]; then
sudo="sudo"
else
sudo=""
fi
if [[ $nspawn -eq 1 ]]; then
echo "Deploying nspawn containers configuration..."
echo "WARNING: Mind that containers will not be stopped or started, neither will subvolumes be mounted or unmounted."
$sudo rm /etc/systemd/nspawn/*
$sudo cp $run_directory/nspawn/*.nspawn /etc/systemd/nspawn/
$sudo cp $run_directory/nspawn/fstab /etc/fstab
fi
echo "Reloading Systemd..."
$sudo systemctl daemon-reload
echo "Finished deployment. Exiting..."
exit 0