boot-sms/install.sh

29 lines
628 B
Bash
Raw Normal View History

2022-08-19 13:50:18 +02:00
#!/usr/bin/env bash
2022-09-22 18:48:36 +02:00
run_directory=$(dirname $(readlink -f "$0"))
2022-08-19 13:50:18 +02:00
user=$(whoami)
if [ -f $run_directory/.disabled ]; then
echo "Installation is disabled. Exiting..."
exit 0
fi
if [[ $user != 'root' ]]; then
sudo="sudo"
else
sudo=""
fi
echo "Copying WebSSH unit to system directory..."
$sudo cp systemd-templates/boot-sms.service /etc/systemd/system/
$sudo sed -i -e "s:PH_DIRECTORY:$run_directory:g" /etc/systemd/system/boot-sms.service
2022-08-19 13:50:18 +02:00
echo "Reloading Systemd..."
$sudo systemctl daemon-reload
echo "Enabling boot-sms.service..."
$sudo systemctl enable boot-sms.service
echo "Finished install. Exiting..."
exit 0