diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ec76ec2 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +backup diff --git a/README.md b/README.md index a071038..4acdad0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Update -Update script written in Bash for Arch Linux only. Keeps all your official, aur packages and your flatpaks up to date with one simple script. It also backups a list of all your installed packages and flatpaks. +Alpm hooks for the pacman package manager. This project consists of two hooks, one for pre-transaction and the other for post-transaction. ## Installation @@ -11,17 +11,7 @@ git clone https://gitea.hopeless-cloud.xyz/AustrianToast/update.git && cd update Before installing, please edit the config and configure it to your liking. Then install using ```bash -make -``` - -## Usage - -``` -Usage: update [OPTION] -options: ---help displays this message ---preview shows a preview of which pkg's will be updates ---version prints out the version number +make install ``` ## Contributing diff --git a/legacy/README.md b/legacy/README.md new file mode 100644 index 0000000..a071038 --- /dev/null +++ b/legacy/README.md @@ -0,0 +1,28 @@ +# Update + +Update script written in Bash for Arch Linux only. Keeps all your official, aur packages and your flatpaks up to date with one simple script. It also backups a list of all your installed packages and flatpaks. + +## Installation + +```bash +git clone https://gitea.hopeless-cloud.xyz/AustrianToast/update.git && cd update +``` + +Before installing, please edit the config and configure it to your liking. +Then install using +```bash +make +``` + +## Usage + +``` +Usage: update [OPTION] +options: +--help displays this message +--preview shows a preview of which pkg's will be updates +--version prints out the version number +``` + +## Contributing +Contributions are always welcome! diff --git a/legacy/makefile b/legacy/makefile new file mode 100644 index 0000000..0c34d80 --- /dev/null +++ b/legacy/makefile @@ -0,0 +1,10 @@ +install: + @echo "==> Installing update into /usr/local/bin" + @sudo install -Dm755 update /usr/local/bin/update + @[[ -f ${HOME}/.config/update.conf ]] || cp update.conf ${HOME}/.config/ + @echo "==> Finished." + +uninstall: + @echo "==> Uninstalling update from /usr/local/bin" + @sudo rm /usr/local/bin/update ${HOME}/.config/update.conf + @echo "==> Finished." diff --git a/update b/legacy/update similarity index 100% rename from update rename to legacy/update diff --git a/update.conf b/legacy/update.conf similarity index 100% rename from update.conf rename to legacy/update.conf diff --git a/makefile b/makefile index 336c288..5794ed9 100644 --- a/makefile +++ b/makefile @@ -1,28 +1,32 @@ +IGREEN := \033[0;92m +NO_COLOR := \033[0m + help: @echo "Usage: make [OPTION]" @echo "Available options are:" @echo "help" - @echo "install" + @echo "compile" + @echo "install This will also compile" @echo "uninstall" compile: - @echo "==> Compiling backup" + @echo -e "$(IGREEN)==> Compiling backup$(NO_COLOR)" go build . install: compile - @echo "==> Copying the hooks into /etc/pacman.d/hooks" + @echo -e "$(IGREEN)==> Copying the hooks into /etc/pacman.d/hooks$(NO_COLOR)" [[ -d /etc/pacman.d/hooks ]] || sudo mkdir /etc/pacman.d/hooks sudo cp pre_backup.hook post_backup.hook /etc/pacman.d/hooks - @echo "==> Copying backup into /usr/local/bin" + @echo -e "$(IGREEN)==> Copying backup into /usr/local/bin$(NO_COLOR)" sudo install -Dm755 backup /usr/local/bin/backup - @echo "==> Copying the config into /etc" + @echo -e "$(IGREEN)==> Copying the config into /etc$(NO_COLOR)" [[ -f /etc/update.toml ]] || sudo cp update.toml /etc - @echo "==> Finished." + @echo -e "$(IGREEN)==> Finished.$(NO_COLOR)" uninstall: - @echo "==> Removing the hooks from /etc/pacman.d/hooks" + @echo -e "$(IGREEN)==> Removing the hooks from /etc/pacman.d/hooks$(NO_COLOR)" sudo rm /etc/pacman.d/hooks/pre_backup.hook /etc/pacman.d/hooks/post_backup.hook - @echo "==> Removing backup into /usr/local/bin" + @echo -e "$(IGREEN)==> Removing backup into /usr/local/bin$(NO_COLOR)" sudo rm /usr/local/bin/backup - @echo "==> /etc/update.toml will remain" - @echo "==> Finished." + @echo -e "$(IGREEN)==> /etc/update.toml will remain$(NO_COLOR)" + @echo -e "$(IGREEN)==> Finished.$(NO_COLOR)" diff --git a/post_backup.hook b/post_backup.hook index 3483cb5..0bf6567 100644 --- a/post_backup.hook +++ b/post_backup.hook @@ -6,6 +6,6 @@ Type = Package Target = * [Action] -Description = Backing up the pacman db... +Description = Backing up a list of all packages... When = PostTransaction Exec = /usr/local/bin/backup post diff --git a/update.toml b/update.toml index 3f6873e..54117ec 100644 --- a/update.toml +++ b/update.toml @@ -1,4 +1,6 @@ # Config for update [backup] -locations = ['/opt'] # All locations need to be an absolute path +# All locations need to be an absolute path +# Don't specify a path multiple times, else the zip will likely be broken +locations = ['/opt']