update/makefile

33 lines
1.1 KiB
Makefile
Raw Normal View History

2024-09-08 16:36:19 +02:00
IGREEN := \033[0;92m
NO_COLOR := \033[0m
2024-09-08 00:23:20 +02:00
help:
@echo "Usage: make [OPTION]"
@echo "Available options are:"
@echo "help"
2024-09-08 16:36:19 +02:00
@echo "compile"
@echo "install This will also compile"
2024-09-08 00:23:20 +02:00
@echo "uninstall"
compile:
2024-09-08 16:36:19 +02:00
@echo -e "$(IGREEN)==> Compiling backup$(NO_COLOR)"
2024-09-08 00:23:20 +02:00
go build .
install: compile
2024-09-08 16:36:19 +02:00
@echo -e "$(IGREEN)==> Copying the hooks into /etc/pacman.d/hooks$(NO_COLOR)"
2024-09-08 00:23:20 +02:00
[[ -d /etc/pacman.d/hooks ]] || sudo mkdir /etc/pacman.d/hooks
sudo cp pre_backup.hook post_backup.hook /etc/pacman.d/hooks
2024-09-08 16:36:19 +02:00
@echo -e "$(IGREEN)==> Copying backup into /usr/local/bin$(NO_COLOR)"
2024-09-08 00:23:20 +02:00
sudo install -Dm755 backup /usr/local/bin/backup
2024-09-08 16:36:19 +02:00
@echo -e "$(IGREEN)==> Copying the config into /etc$(NO_COLOR)"
2024-09-08 00:23:20 +02:00
[[ -f /etc/update.toml ]] || sudo cp update.toml /etc
2024-09-08 16:36:19 +02:00
@echo -e "$(IGREEN)==> Finished.$(NO_COLOR)"
uninstall:
2024-09-08 16:36:19 +02:00
@echo -e "$(IGREEN)==> Removing the hooks from /etc/pacman.d/hooks$(NO_COLOR)"
2024-09-08 00:23:20 +02:00
sudo rm /etc/pacman.d/hooks/pre_backup.hook /etc/pacman.d/hooks/post_backup.hook
2024-09-08 16:36:19 +02:00
@echo -e "$(IGREEN)==> Removing backup into /usr/local/bin$(NO_COLOR)"
2024-09-08 00:23:20 +02:00
sudo rm /usr/local/bin/backup
2024-09-08 16:36:19 +02:00
@echo -e "$(IGREEN)==> /etc/update.toml will remain$(NO_COLOR)"
@echo -e "$(IGREEN)==> Finished.$(NO_COLOR)"