Compare commits

...

2 commits

Author SHA1 Message Date
A.M. Rowsell
1787d4da99
fix: bail install if on a non-systemd machine
Instead suggest using cron. At some point I can probably write
up some simple instructions for a basic cron setup.
2025-04-25 23:59:24 -04:00
A.M. Rowsell
b243bc7bb4
dev: Added more prompts to install script 2025-04-22 17:29:45 -04:00

View file

@ -13,7 +13,20 @@ printf "\e[1;34mDisco\e[1;38;5;208mRSS\e[0m Install Helper Script\n\n"
workingDir=$(pwd)
cat << EOF > discorss.service
# bail if we're on a non-systemd system, suggest cron
if [[ -d /run/systemd/system ]]; then
printf "systemd detected..."
else
printf "This script and DiscoRSS in general are optimized for systemd! You can use cron as a substitute but I haven't written any documentation for it, so you're on your own for now!"
exit 127 # command not found exit code
fi
printf "Would you like the systemd service and timer files created for you? [y/n]: "
read answer
if [[ "$answer" =~ ^([yY])$ ]]; then
cat << EOF > discorss.service
# Autogenerated by install.sh
[Unit]
Description=Discord RSS feeder
Wants=discorss.timer
@ -28,7 +41,8 @@ WantedBy=default.target
EOF
cat << EOF > discorss.timer
cat << EOF > discorss.timer
# Autogenerated by install.sh
[Unit]
Description=Timer for DiscoRSS
Requires=discorss.service
@ -43,13 +57,18 @@ WantedBy=timers.target
EOF
mkdir -p ~/.config/systemd/user/
cp discorss.service ~/.config/systemd/user/
cp discorss.timer ~/.config/systemd/user/
rm -f discorss.service
rm -f discorss.timer
systemctl --user daemon-reload
printf "Making ~/.config/systemd/user in case it doesn't exist ...\n"
mkdir -p -v ~/.config/systemd/user/
printf "Copying service and timer files there ... \n"
cp discorss.service ~/.config/systemd/user/
cp discorss.timer ~/.config/systemd/user/
rm -f discorss.service
rm -f discorss.timer
printf "Reloading systemd daemon ... \n\n"
systemctl --user daemon-reload
else
printf "This script is intended to be automatically run. It's designed with systemd in mind, but you are free to use any automation tools. You can look at this script for examples of how to structure systemd user services and timers.\nOf course, you could always run it by hand, if you really want to :)\n\n"
fi
printf "Would you like a basic example config created for you? [y/n]: "
read answer1
@ -84,4 +103,4 @@ fi
printf "\n\nYou should be almost ready to go! Double-check your config files, and check \e[1;32msystemctl --user list-timers\e[0m once the discorss.timer is enabled to see when it will fire next. The default is every 5 minutes."
printf "\nRemember, if you need help or encounter any bugs, contact me via the issues tracker on the git repository where you got this from!"
printf "\nRemember, if you need help or encounter any bugs, contact me via the issues tracker on the git repository where you got this from!\n"