34 lines
1003 B
Bash
Executable File
34 lines
1003 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
run_directory=$(dirname $(readlink -f "$0"))
|
|
user=$(whoami)
|
|
|
|
source "$run_directory/variables.conf"
|
|
|
|
if [ -f $run_directory/.disabled ]; then
|
|
echo "Installation is disabled. Exiting..."
|
|
exit 0
|
|
fi
|
|
|
|
echo "Copying WebSSH unit to system directory..."
|
|
if [[ $user != 'root' ]]; then
|
|
sudo cp webssh.service /etc/systemd/system/
|
|
sudo sed -i -e "s:PH_PATH:$webssh_path:g" /etc/systemd/system/webssh.service
|
|
sudo sed -i -e "s:PH_ADDR:$address:g" /etc/systemd/system/webssh.service
|
|
sudo sed -i -e "s:PH_PORT:$port:g" /etc/systemd/system/webssh.service
|
|
else
|
|
cp webssh.service /etc/systemd/system/
|
|
sed -i -e "s:PH_PATH:$webssh_path:g" /etc/systemd/system/webssh.service
|
|
sed -i -e "s:PH_ADDR:$address:g" /etc/systemd/system/webssh.service
|
|
sed -i -e "s:PH_PORT:$port:g" /etc/systemd/system/webssh.service
|
|
fi
|
|
echo "Reloading Systemd..."
|
|
if [[ $user != 'root' ]]; then
|
|
sudo systemctl daemon-reload
|
|
else
|
|
systemctl daemon-reload
|
|
fi
|
|
|
|
echo "Finished install. Exiting..."
|
|
exit 0
|