fix: install.sh works properly now (with colour!)

This commit is contained in:
A.M. Rowsell 2025-04-22 03:17:16 -04:00
commit b0f08c405b
Signed by: amr
GPG key ID: 0B6E2D8375CF79A9

View file

@ -9,6 +9,8 @@
# use systemctl --user edit --full discorss.service or discorss.timer # use systemctl --user edit --full discorss.service or discorss.timer
# after installing them. # after installing them.
printf "\e[1;34mDisco\e[1;38;5;208mRSS\e[0m Install Helper Script\n\n"
cat << EOF > discorss.service cat << EOF > discorss.service
[Unit] [Unit]
Description=Discord RSS feeder Description=Discord RSS feeder
@ -39,14 +41,16 @@ WantedBy=timers.target
EOF EOF
mkdir -p ~/.config/systemd/user/
cp discorss.service ~/.config/systemd/user/ cp discorss.service ~/.config/systemd/user/
cp discorss.timer ~/.config/systemd/user/ cp discorss.timer ~/.config/systemd/user/
systemctl --user daemon-reload systemctl --user daemon-reload
printf "Would you like a basic example config created for you? [y/n]" printf "Would you like a basic example config created for you? [y/n]: "
read answer1 read answer1
if [ "$answer1" =~ ^[yYnN]$ ]; then if [[ "$answer1" =~ ^([yY])$ ]]; then
mkdir -p -v ~/.config/discorss mkdir -p -v ~/.config/discorss
cat << EOF > ~/.config/discorss/discorss.conf cat << EOF > ~/.config/discorss/discorss.conf
{ {
@ -61,20 +65,20 @@ if [ "$answer1" =~ ^[yYnN]$ ]; then
], ],
} }
EOF EOF
printf "Make sure to edit ~/.config/discorss/discorss.conf and add in your custom feeds and webhook URLS! The script will just error out if you don't do this." printf "\nMake sure to edit \e[1;34m~/.config/discorss/discorss.conf\e[0m and add in your custom feeds and webhook URLS! The script will just error out if you don't do this."
else else
printf "Make sure to create a config at ~/.config/discorss/discorss.conf and follow the pattern shown in the README." printf "\nMake sure to create a config at \e[1;34m~/.config/discorss/discorss.conf\e[0m and follow the pattern shown in the README."
fi fi
printf "Would you like to have the timer enabled and started now? [y/n]" printf "\nWould you like to have the timer enabled and started now? [y/n]: "
read answer read answer
if [ "$answer" =~ ^[yYnN]$ ]; then if [[ "$answer" =~ ^([yY])$ ]]; then
systemctl --user enable --now discorss.timer systemctl --user enable --now discorss.timer
printf "discorss.timer enabled and started. Don't enable or start discorss.service -- the timer does this automatically." printf "\ndiscorss.timer enabled and started. \e[1;31mDon't enable or start discorss.service\e[0m -- the timer does this automatically."
else else
printf "Don't forget to run systemctl --user enable --now discorss.timer when you are ready! Don't enable or start discorss.service -- the timer does this automatically." printf "\nDon't forget to run \e[1;32msystemctl --user enable --now discorss.timer\e[0m when you are ready! \e[1;31mDon't enable or start discorss.service\e[0m -- the timer does this automatically."
fi fi
printf "You should be almost ready to go! Double-check your config files, and check systemctl --user list-timers once the discorss.timer is enabled to see when it will fire next. The default is every 5 minutes." 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 "Remember, 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!"