Update install script with new good practices (sudo and run_directory)
This commit is contained in:
parent
bf62bfda98
commit
0ffb223a4b
54
install.sh
54
install.sh
@ -10,47 +10,29 @@ if [ -f $run_directory/.disabled ]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Copying Systemd units to system directory..."
|
|
||||||
if [[ $user != 'root' ]]; then
|
if [[ $user != 'root' ]]; then
|
||||||
sudo cp systemd-templates/cont-snap@.service /etc/systemd/system/
|
sudo="sudo"
|
||||||
sudo cp systemd-templates/conts-snap.service /etc/systemd/system/
|
|
||||||
sudo sed -i -e "s:PH_DIRECTORY:$(pwd):g" /etc/systemd/system/conts-snap.service
|
|
||||||
sudo cp systemd-templates/conts-snap.timer /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:$(pwd):g" /etc/systemd/system/docker-upgrade.service
|
|
||||||
sudo cp systemd-templates/docker-upgrade.timer /etc/systemd/system/
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
cp systemd-templates/cont-snap@.service /etc/systemd/system/
|
sudo=""
|
||||||
cp systemd-templates/conts-snap.service /etc/systemd/system/
|
fi
|
||||||
sed -i -e "s:PH_DIRECTORY:$(pwd):g" /etc/systemd/system/conts-snap.service
|
|
||||||
cp systemd-templates/conts-snap.timer /etc/systemd/system/
|
echo "Copying Systemd units to system directory..."
|
||||||
cp systemd-templates/machines-start.timer /etc/systemd/system/
|
$sudo cp systemd-templates/cont-snap@.service /etc/systemd/system/
|
||||||
if [ $docker -eq 1 ]; then
|
$sudo cp systemd-templates/conts-snap.service /etc/systemd/system/
|
||||||
cp systemd-templates/docker-upgrade.service /etc/systemd/system/
|
$sudo sed -i -e "s:PH_DIRECTORY:$run_directory:g" /etc/systemd/system/conts-snap.service
|
||||||
sed -i -e "s:PH_DIRECTORY:$(pwd):g" /etc/systemd/system/docker-upgrade.service
|
$sudo cp systemd-templates/conts-snap.timer /etc/systemd/system/
|
||||||
cp systemd-templates/docker-upgrade.timer /etc/systemd/system/
|
$sudo cp systemd-templates/machines-start.timer /etc/systemd/system/
|
||||||
fi
|
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/
|
||||||
fi
|
fi
|
||||||
echo "Reloading Systemd..."
|
echo "Reloading Systemd..."
|
||||||
if [[ $user != 'root' ]]; then
|
$sudo systemctl daemon-reload
|
||||||
sudo systemctl daemon-reload
|
|
||||||
else
|
|
||||||
systemctl daemon-reload
|
|
||||||
fi
|
|
||||||
echo "Enabling timer(s) (not starting it, either do it manually or reboot)..."
|
echo "Enabling timer(s) (not starting it, either do it manually or reboot)..."
|
||||||
if [[ $user != 'root' ]]; then
|
$sudo systemctl enable conts-snap.timer
|
||||||
sudo systemctl enable conts-snap.timer
|
if [ $docker -eq 1 ]; then
|
||||||
if [ $docker -eq 1 ]; then
|
$sudo systemctl enable docker-upgrade.timer
|
||||||
sudo systemctl enable docker-upgrade.timer
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
systemctl enable conts-snap.timer
|
|
||||||
if [ $docker -eq 1 ]; then
|
|
||||||
systemctl enable docker-upgrade.timer
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Finished install. Exiting..."
|
echo "Finished install. Exiting..."
|
||||||
|
Loading…
Reference in New Issue
Block a user