apt-autoremove/install.sh
2023-06-24 19:57:57 +02:00

28 lines
617 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 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