boot-sms/install.sh
2022-08-19 13:50:18 +02:00

29 lines
605 B
Bash
Executable File

#!/usr/bin/env bash
run_directory=$(dirname "$0")
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:$(pwd):g" /etc/systemd/system/boot-sms.service
echo "Reloading Systemd..."
$sudo systemctl daemon-reload
echo "Enabling boot-sms.service..."
$sudo systemctl enable boot-sms.service
echo "Finished install. Exiting..."
exit 0