From b243bc7bb4991f85eab236fd7e9c6486bba39051 Mon Sep 17 00:00:00 2001 From: "A.M. Rowsell" Date: Tue, 22 Apr 2025 17:29:45 -0400 Subject: [PATCH] dev: Added more prompts to install script --- install.sh | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/install.sh b/install.sh index d3ed185..7a89398 100755 --- a/install.sh +++ b/install.sh @@ -13,7 +13,12 @@ printf "\e[1;34mDisco\e[1;38;5;208mRSS\e[0m Install Helper Script\n\n" workingDir=$(pwd) -cat << EOF > discorss.service +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 +33,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 +49,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 +95,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"