28 lines
617 B
Bash
28 lines
617 B
Bash
|
#!/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 Systemd units to system directory..."
|
||
|
$sudo cp systemd-templates/apt-autoremove.service systemd-templates/apt-autoremove.timer /etc/systemd/system/
|
||
|
|
||
|
echo "Reloading Systemd..."
|
||
|
$sudo systemctl daemon-reload
|
||
|
|
||
|
echo "Enabling timer (not starting it, either do it manually or reboot)..."
|
||
|
$sudo systemctl enable apt-autoremove.timer
|
||
|
|
||
|
echo "Finished install. Exiting..."
|
||
|
exit 0
|