rss2discordwh/Makefile

67 lines
1.8 KiB
Makefile

MKFILE:=$(shell realpath $(lastword $(MAKEFILE_LIST)))
MKFILE_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
help:
@ echo "make help - displays this text"
@ echo "make install - installs this software into your system"
@ echo "make uninstall - uninstalls this software from your system"
@ echo "make purge - uninstalls and removes configuration files"
init-config:
-mkdir -p watched_rss.d
-touch webhook.url
run: guard-has-cfgdir
python3 -m rss2discordwh $(CFGDIR)
put-in-startup: guard-is-root
install ./deploy/rss2discordwh-daemon.service /etc/systemd/system
systemctl daemon-reload
- systemctl enable rss2discordwh-daemon.service
- systemctl restart rss2discordwh-daemon.service
remove-from-startup: guard-is-root
- systemctl disable rss2discordwh-daemon.service
- systemctl stop rss2discordwh-daemon.service
rm -f /etc/systemd/system/rss2discordwh-daemon.service
uninstall: guard-is-root
-rm -rf /opt/rss2discordwh
make remove-from-startup
purge: guard-is-root
make uninstall
make deconfigure
deconfigure: guard-is-root
-rm -rf /etc/rss2discordwh
configure: guard-is-root
-mkdir -p /etc/rss2discordwh
cp $(MKFILE) /etc/rss2discordwh/
make -C /etc/rss2discordwh init-config
rm /etc/rss2discordwh/Makefile
copy-install: guard-is-root
-mkdir -p /opt/rss2discordwh/rss2discordwh
cp -Rf ./rss2discordwh/. /opt/rss2discordwh/rss2discordwh/.
cp -f ./Makefile /opt/rss2discordwh/Makefile
install: guard-is-root
make uninstall
make copy-install
make configure
make put-in-startup
guard-has-cfgdir:
@ if [ "$(CFGDIR)" = "" ]; then \
echo -e "Environment variable CFGDIR not set"; \
exit 1; \
fi
guard-is-root:
@ if [ "$(shell id -u)" != "0" ]; then \
echo -e "UID expected: 0; UID found: $(shell id -u). Try again with sudo."; \
exit 1; \
fi