containers/install.sh

42 lines
1.3 KiB
Bash
Raw Normal View History

2022-07-24 20:28:08 +02:00
#!/usr/bin/env bash
2022-09-22 18:50:02 +02:00
run_directory=$(dirname $(readlink -f "$0"))
2022-07-24 20:28:08 +02:00
user=$(whoami)
source "$run_directory/variables.conf"
if [ -f $run_directory/.disabled ]; then
echo "Installation is disabled. Exiting..."
exit 0
fi
if [[ $user != 'root' ]]; then
sudo="sudo"
2022-07-24 20:28:08 +02:00
else
sudo=""
2022-07-24 20:28:08 +02:00
fi
echo "Copying Systemd units to system directory..."
$sudo cp systemd-templates/cont-snap@.service /etc/systemd/system/
$sudo cp systemd-templates/conts-snap.service /etc/systemd/system/
$sudo sed -i -e "s:PH_DIRECTORY:$run_directory:g" /etc/systemd/system/conts-snap.service
$sudo cp systemd-templates/conts-snap.timer /etc/systemd/system/
2024-02-24 11:14:42 +01:00
$sudo cp systemd-templates/machines-start.service /etc/systemd/system/
$sudo cp systemd-templates/machines-start.timer /etc/systemd/system/
if [ $docker -eq 1 ]; then
$sudo cp systemd-templates/docker-upgrade.service /etc/systemd/system/
$sudo sed -i -e "s:PH_DIRECTORY:$run_directory:g" /etc/systemd/system/docker-upgrade.service
$sudo cp systemd-templates/docker-upgrade.timer /etc/systemd/system/
2022-07-24 20:28:08 +02:00
fi
echo "Reloading Systemd..."
$sudo systemctl daemon-reload
2022-08-18 15:41:55 +02:00
echo "Enabling timer(s) (not starting it, either do it manually or reboot)..."
$sudo systemctl enable conts-snap.timer
$sudo systemctl enable machines-start.timer
if [ $docker -eq 1 ]; then
$sudo systemctl enable docker-upgrade.timer
2022-07-24 20:28:08 +02:00
fi
echo "Finished install. Exiting..."
exit 0