From 288c6f8293cb03fbfcfe0c7a685c760634bf46c6 Mon Sep 17 00:00:00 2001 From: Robin Candau Date: Wed, 14 Sep 2022 23:46:09 +0200 Subject: [PATCH 01/19] Bump to v1.3.2 --- src/bin/arch-update.sh | 50 +++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/bin/arch-update.sh b/src/bin/arch-update.sh index 27c4bc97..8a476603 100644 --- a/src/bin/arch-update.sh +++ b/src/bin/arch-update.sh @@ -1,7 +1,7 @@ #!/bin/bash #Current version -version="1.3.1" +version="1.3.2" #Check for optionnal dependencies ("yay" or "paru" for AUR support and "notify-send" (libnotify) for desktop notifications support) YAY=$(command -v yay) @@ -9,9 +9,9 @@ PARU=$(command -v paru) NOTIF=$(command -v notify-send) #Replace the $1 var by "option" just to make the script more readable/less complex -option="$1" +option="${1}" -case "$option" in +case "${option}" in #If no option is passed to the "arch-update" command, execute the main update function #This is triggered by cliking on the desktop icon "") @@ -22,26 +22,26 @@ case "$option" in PACKAGES=$(checkupdates | awk '{print $1}') #Get the available updates list for AUR (if "yay" or "paru" is installed) - if [ -n "$YAY" ]; then + if [ -n "${YAY}" ]; then AURPACKAGES=$(yay -Qua | awk '{print $1}') - elif [ -n "$PARU" ]; then + elif [ -n "${PARU}" ]; then AURPACKAGES=$(paru -Qua | awk '{print $1}') else AURPACKAGES="" fi #If there are updates available for pacman, print them - if [ -n "$PACKAGES" ]; then - echo -e "Packages :\n" && echo -e "$PACKAGES\n" + if [ -n "${PACKAGES}" ]; then + echo -e "Packages :\n" && echo -e "${PACKAGES}\n" fi #If there are updates available for AUR, print them - if [ -n "$AURPACKAGES" ]; then - echo -e "AUR Packages :\n" && echo -e "$AURPACKAGES\n" + if [ -n "${AURPACKAGES}" ]; then + echo -e "AUR Packages :\n" && echo -e "${AURPACKAGES}\n" fi #If there is no update available for Pacman nor AUR, change the desktop icon to "up-to-date" and quit - if [ -z "$PACKAGES" ] && [ -z "$AURPACKAGES" ]; then + if [ -z "${PACKAGES}" ] && [ -z "${AURPACKAGES}" ]; then cp -f /usr/share/icons/arch-update/arch-update_up-to-date.svg /usr/share/icons/arch-update/arch-update.svg echo -e "No update available\n" && read -n 1 -r -s -p $'Press \"enter\" to quit\n' exit 0 @@ -50,24 +50,24 @@ case "$option" in cp -f /usr/share/icons/arch-update/arch-update_updates-available.svg /usr/share/icons/arch-update/arch-update.svg read -rp $'Proceed with installation ? [Y/n] ' answer - case "$answer" in + case "${answer}" in #If the user gives the confirmation, change the desktop icon to "installing" and apply updates... [Yy]|"") cp -f /usr/share/icons/arch-update/arch-update_installing.svg /usr/share/icons/arch-update/arch-update.svg #...for both pacman and AUR (if there are) - if [ -n "$PACKAGES" ] && [ -n "$AURPACKAGES" ]; then - if [ -n "$YAY" ]; then + if [ -n "${PACKAGES}" ] && [ -n "${AURPACKAGES}" ]; then + if [ -n "${YAY}" ]; then sudo pacman -Syu && yay -Syu else sudo pacman -Syu && paru -Syu fi #... for pacman only (if there are) - elif [ -n "$PACKAGES" ]; then + elif [ -n "${PACKAGES}" ]; then sudo pacman -Syu #... for AUR only (if there are) else - if [ -n "$YAY" ]; then + if [ -n "${YAY}" ]; then yay -Syu else paru -Syu @@ -101,23 +101,23 @@ case "$option" in cp -f /usr/share/icons/arch-update/arch-update_checking.svg /usr/share/icons/arch-update/arch-update.svg #Get the number of available - if [ -n "$YAY" ]; then + if [ -n "${YAY}" ]; then UPDATE_NUMBER=$( (checkupdates ; yay -Qua) | wc -l) - elif [ -n "$PARU" ]; then + elif [ -n "${PARU}" ]; then UPDATE_NUMBER=$( (checkupdates ; paru -Qua) | wc -l) else UPDATE_NUMBER=$(checkupdates | wc -l) fi #If there are updates available, change the desktop icon to "updates-available" and quit - if [ "$UPDATE_NUMBER" -gt 0 ]; then + if [ "${UPDATE_NUMBER}" -gt 0 ]; then cp -f /usr/share/icons/arch-update/arch-update_updates-available.svg /usr/share/icons/arch-update/arch-update.svg #If notify-send (libnotify) is installed, also send a desktop notification before quitting - if [ -n "$NOTIF" ]; then - if [ "$UPDATE_NUMBER" -eq 1 ]; then - notify-send -i /usr/share/icons/arch-update/arch-update_updates-available.svg "Arch Update" "$UPDATE_NUMBER update available" + if [ -n "${NOTIF}" ]; then + if [ "${UPDATE_NUMBER}" -eq 1 ]; then + notify-send -i /usr/share/icons/arch-update/arch-update_updates-available.svg "Arch Update" "${UPDATE_NUMBER} update available" else - notify-send -i /usr/share/icons/arch-update/arch-update_updates-available.svg "Arch Update" "$UPDATE_NUMBER updates available" + notify-send -i /usr/share/icons/arch-update/arch-update_updates-available.svg "Arch Update" "${UPDATE_NUMBER} updates available" fi fi exit 0 @@ -129,12 +129,12 @@ case "$option" in ;; #If the -v (or --version) option is passed to the "malias" command, print the current version -v|--version) - echo "$version" + echo "${version}" exit 0 ;; #If the -h (or --help) option is passed to the script, print the documentation (man page) #This can be triggered directly by the user, by typing the following command in a terminal : arch-update --help - #The documentation is also readable here https://github.com/Antiz96/Arch-Update/blob/main/README.md or by typing the following command in a terminal : man arch-update + #The documentation is also readable here https://github.com/Antiz96/Arch-Update or by typing the following command in a terminal : man arch-update -h|--help) #Print the documentation (man page) and quit man arch-update | col @@ -143,7 +143,7 @@ case "$option" in #If any other option(s) are passed to the script, print an error and quit *) - echo -e >&2 "arch-update : invalid option -- '$option'\nTry 'arch-update --help' for more information." + echo -e >&2 "arch-update : invalid option -- '${option}'\nTry 'arch-update --help' for more information." exit 1 ;; esac From bc5ac22aa43bcae702f74ef547fe62a71bdffd44 Mon Sep 17 00:00:00 2001 From: Robin Candau Date: Thu, 15 Sep 2022 00:03:05 +0200 Subject: [PATCH 02/19] Made the script executable by default --- src/script/arch-update.sh | 149 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100755 src/script/arch-update.sh diff --git a/src/script/arch-update.sh b/src/script/arch-update.sh new file mode 100755 index 00000000..8a476603 --- /dev/null +++ b/src/script/arch-update.sh @@ -0,0 +1,149 @@ +#!/bin/bash + +#Current version +version="1.3.2" + +#Check for optionnal dependencies ("yay" or "paru" for AUR support and "notify-send" (libnotify) for desktop notifications support) +YAY=$(command -v yay) +PARU=$(command -v paru) +NOTIF=$(command -v notify-send) + +#Replace the $1 var by "option" just to make the script more readable/less complex +option="${1}" + +case "${option}" in + #If no option is passed to the "arch-update" command, execute the main update function + #This is triggered by cliking on the desktop icon + "") + #Change the desktop icon to "checking" + cp -f /usr/share/icons/arch-update/arch-update_checking.svg /usr/share/icons/arch-update/arch-update.svg + + #Get the available updates list for Pacman + PACKAGES=$(checkupdates | awk '{print $1}') + + #Get the available updates list for AUR (if "yay" or "paru" is installed) + if [ -n "${YAY}" ]; then + AURPACKAGES=$(yay -Qua | awk '{print $1}') + elif [ -n "${PARU}" ]; then + AURPACKAGES=$(paru -Qua | awk '{print $1}') + else + AURPACKAGES="" + fi + + #If there are updates available for pacman, print them + if [ -n "${PACKAGES}" ]; then + echo -e "Packages :\n" && echo -e "${PACKAGES}\n" + fi + + #If there are updates available for AUR, print them + if [ -n "${AURPACKAGES}" ]; then + echo -e "AUR Packages :\n" && echo -e "${AURPACKAGES}\n" + fi + + #If there is no update available for Pacman nor AUR, change the desktop icon to "up-to-date" and quit + if [ -z "${PACKAGES}" ] && [ -z "${AURPACKAGES}" ]; then + cp -f /usr/share/icons/arch-update/arch-update_up-to-date.svg /usr/share/icons/arch-update/arch-update.svg + echo -e "No update available\n" && read -n 1 -r -s -p $'Press \"enter\" to quit\n' + exit 0 + #If there are updates available, change the desktop icon to "updates-available" and ask the confirmation to apply them to the user + else + cp -f /usr/share/icons/arch-update/arch-update_updates-available.svg /usr/share/icons/arch-update/arch-update.svg + read -rp $'Proceed with installation ? [Y/n] ' answer + + case "${answer}" in + #If the user gives the confirmation, change the desktop icon to "installing" and apply updates... + [Yy]|"") + cp -f /usr/share/icons/arch-update/arch-update_installing.svg /usr/share/icons/arch-update/arch-update.svg + + #...for both pacman and AUR (if there are) + if [ -n "${PACKAGES}" ] && [ -n "${AURPACKAGES}" ]; then + if [ -n "${YAY}" ]; then + sudo pacman -Syu && yay -Syu + else + sudo pacman -Syu && paru -Syu + fi + #... for pacman only (if there are) + elif [ -n "${PACKAGES}" ]; then + sudo pacman -Syu + #... for AUR only (if there are) + else + if [ -n "${YAY}" ]; then + yay -Syu + else + paru -Syu + fi + fi + ;; + + #If the user didn't give the confirmation, quit + *) + exit 1 + ;; + esac + + #If there was an error during the update process, change the desktop icon to "updates-available" and quit + if [ "$?" -ne 0 ]; then + cp -f /usr/share/icons/arch-update/arch-update_updates-available.svg /usr/share/icons/arch-update/arch-update.svg + echo -e >&2 "\nAn error has occured\nUpdates have been aborted\n" && read -n 1 -r -s -p $'Press \"enter\" to quit\n' + exit 1 + #If everything went well, change the desktop icon to "up-to-date" and quit + else + cp -f /usr/share/icons/arch-update/arch-update_up-to-date.svg /usr/share/icons/arch-update/arch-update.svg + echo -e "\nUpdates have been applied\n" && read -n 1 -r -s -p $'Press \"enter\" to quit\n' + exit 0 + fi + fi + ;; + #If the -c (or --check) option is passed to the "arch-update" command, execute the check function + #This is triggered by the systemd --user arch-update.service, which is automatically launched at boot and then every hour by the systemd --user arch-update.timer (that has to be enabled) + -c|--check) + #Change the desktop icon to "checking" + cp -f /usr/share/icons/arch-update/arch-update_checking.svg /usr/share/icons/arch-update/arch-update.svg + + #Get the number of available + if [ -n "${YAY}" ]; then + UPDATE_NUMBER=$( (checkupdates ; yay -Qua) | wc -l) + elif [ -n "${PARU}" ]; then + UPDATE_NUMBER=$( (checkupdates ; paru -Qua) | wc -l) + else + UPDATE_NUMBER=$(checkupdates | wc -l) + fi + + #If there are updates available, change the desktop icon to "updates-available" and quit + if [ "${UPDATE_NUMBER}" -gt 0 ]; then + cp -f /usr/share/icons/arch-update/arch-update_updates-available.svg /usr/share/icons/arch-update/arch-update.svg + #If notify-send (libnotify) is installed, also send a desktop notification before quitting + if [ -n "${NOTIF}" ]; then + if [ "${UPDATE_NUMBER}" -eq 1 ]; then + notify-send -i /usr/share/icons/arch-update/arch-update_updates-available.svg "Arch Update" "${UPDATE_NUMBER} update available" + else + notify-send -i /usr/share/icons/arch-update/arch-update_updates-available.svg "Arch Update" "${UPDATE_NUMBER} updates available" + fi + fi + exit 0 + #If there is no update available, change the desktop icon to "up-to-date" and quit + else + cp -f /usr/share/icons/arch-update/arch-update_up-to-date.svg /usr/share/icons/arch-update/arch-update.svg + exit 0 + fi + ;; + #If the -v (or --version) option is passed to the "malias" command, print the current version + -v|--version) + echo "${version}" + exit 0 + ;; + #If the -h (or --help) option is passed to the script, print the documentation (man page) + #This can be triggered directly by the user, by typing the following command in a terminal : arch-update --help + #The documentation is also readable here https://github.com/Antiz96/Arch-Update or by typing the following command in a terminal : man arch-update + -h|--help) + #Print the documentation (man page) and quit + man arch-update | col + exit 0 + ;; + + #If any other option(s) are passed to the script, print an error and quit + *) + echo -e >&2 "arch-update : invalid option -- '${option}'\nTry 'arch-update --help' for more information." + exit 1 + ;; +esac From c2a049c74047f1ef124ad858cdadb215ea41e012 Mon Sep 17 00:00:00 2001 From: Robin Candau Date: Thu, 15 Sep 2022 03:47:03 +0200 Subject: [PATCH 03/19] Moved the wiki pages into the README, documented the new installation process via a Makefile, small improvements here and there --- README.md | 209 ++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 139 insertions(+), 70 deletions(-) diff --git a/README.md b/README.md index d7527b63..e9c08872 100644 --- a/README.md +++ b/README.md @@ -2,22 +2,38 @@ A (.desktop) clickeable icon that automatically changes to act as a pacman update notifier/applier. - ## Table of contents * [Description](#description) -* [Installation](#installation) * [Dependencies](#dependencies) +* [Installation](#installation) * [Usage](#usage) * [Documentation](#documentation) * [Tips and tricks](#tips-and-tricks) - +* [Contributin](#contributing) ## Description -A (.desktop) clickeable icon that automatically changes to act as a pacman update notifier/applier, easy to integrate with any DE/WM, docks, launch bars or app menus. -
+A (.desktop) clickeable icon that automatically changes to act as a pacman update notifier/applier, easy to integrate with any DE/WM, docks, launch bars or app menus. Optionnal support for the AUR (through [yay](https://aur.archlinux.org/packages/yay "yay") or [paru](https://aur.archlinux.org/packages/paru "paru")) and desktop notifications. +## Dependencies + +Arch-Update depends on: +- [pacman-contrib](https://archlinux.org/packages/community/x86_64/pacman-contrib/ "pacman-contrib package") to check and print the list packages available updates. + +Arch-Update **optionnally** depends on: +- [yay](https://aur.archlinux.org/packages/yay "yay package") or [paru](https://aur.archlinux.org/packages/paru "paru package") to check, list and apply AUR packages available updates. +- [libnotify](https://archlinux.org/packages/extra/x86_64/libnotify/ "libnotify package") (`notify-send`) to send desktop notifications when checking for available updates. +*In order to get `libnotify` (and thus `notify-send`) you have to install a notification server (if you don't already have one).* +*See https://wiki.archlinux.org/title/Desktop_notifications#Notification_servers* + +### Installing dependencies + +*You don't need to install dependencies if you install `arch-update` via the [AUR](#aur) as it already takes care of them* + +``` +sudo pacman -S pacman-contrib +``` ## Installation @@ -27,96 +43,149 @@ Install the [arch-update](https://aur.archlinux.org/packages/arch-update "arch-u ### From Source -#### Installation - -Launch the following command in your terminal to execute the install script (requires "curl" and "sudo") : +After [installing dependencies](#installing-dependencies) on your system, download the archive of the [latest stable release](https://github.com/Antiz96/arch-update/releases/latest) and extract it. +*Alternatively, you can clone this repository via `git`.* + +To install `arch-update`, go into the extracted/cloned directory and run the following command: +``` +sudo make install +``` + +To uninstall `arch-update`, go into the extracted/cloned directory and run the following command: ``` -curl -s https://raw.githubusercontent.com/Antiz96/arch-update/main/install.sh | bash +sudo make uninstall ``` -#### Update +## Usage + +The usage consist of integrating [the .desktop file](#the-.desktop-file) anywhere (could be your desktop, your dock, your launch bar and/or your app menu) and enabling the [systemd timer](#the-systemd-service-and-timer). + +### The .desktop file -Simply re-execute the install script (requires "curl" and "sudo") : +The .desktop file is located in `/usr/share/applications/arch-update.desktop` (or `/usr/local/share/applications/arch-update.desktop` if you installed `arch-update` [from source](#from-source). +It will automatically change depending on different states (cheking for updates, updates available, installing updates, up to date). +It will launch the main `update` function when clicked. It is easy to integrate with any DE/WM, docks, launch bars or app menus. + +## The systemd service and timer + +There is a systemd service in `/usr/lib/systemd/user/arch-update.service` (or in `/etc/systemd/user/arch-update.service` if you installed `arch-update` [from source](#from-source)) that launches the `--check` function. + +There's also a systemd timer in `/usr/lib/systemd/user/arch-update.timer` (or in `/etc/systemd/user/arch-update.timer` if you installed `arch-update` [from source](#from-source)) that automatically launches the systemd service at boot and then every hour. + +In order to make the systemd timer work, you need to enable it with the following command: + ``` -curl -s https://raw.githubusercontent.com/Antiz96/arch-update/main/install.sh | bash +systemctl --user enable --now arch-update.timer ``` + +Check the screenshots below for more information. -#### Uninstalling +### Screenshot + +Personally, I integrated the (.desktop) file on my dock. + +It is the penultimate icon from left to right (next to the red "Power Sign" icon). +This is how it looks like when `arch-update` is checking for available updates (*the check is automatically triggered at boot and then every hour if you enabled the [systemd timer](#the-systemd-service-and-timer) and can be manually triggered with the `arch-update -c` command:* +![Arch-Update_Check](https://user-images.githubusercontent.com/53110319/161241670-8cab8a54-199b-41f1-80e3-95b171bbb70f.png) + +If there are available updates, the icon will change and a desktop notification indicating the number of available updates will be sent (*requires [libnotify/notify-send](https://archlinux.org/packages/extra/x86_64/libnotify/ "libnotify package")*): +![Arch-Update_Updates_Available+Notif](https://user-images.githubusercontent.com/53110319/161244079-b2ce8f2f-d4d3-42ad-83c1-62161d6da62f.png) + +When the icon is clicked, it refreshes the list of packages available for updates and print it inside a terminal window. Then it asks for the user's confirmation to proceed (*requires [yay](https://aur.archlinux.org/packages/yay "yay") or [paru](https://aur.archlinux.org/packages/paru "paru") for AUR packages support*): +![Arch-Update_List_Packages](https://user-images.githubusercontent.com/53110319/161244601-8ddeb5c4-b6cd-47a7-a035-debdbad75936.png) + +If you chose to show the packages version changes (refer to the [Tips and tricks](#tips-and-tricks) section below), this is how it looks like: +![Arch-Update_List_Packages_With_Version_Changes](https://user-images.githubusercontent.com/53110319/161244783-bb0de764-04bb-4c39-b17a-54dcfb9de449.png) + +Once the user gave the confirmation to proceed, the update process will begin and the icon will change accordingly: +![Arch-Update_Installing](https://user-images.githubusercontent.com/53110319/161245498-35bb8f9d-c050-40f5-ae67-d7a01b0bae19.png) + +Finally, when the update is over and your machine is up to date, the icon will look like this: +![Arch-Update_up_to_date](https://user-images.githubusercontent.com/53110319/161245726-b3adff52-f91e-40b6-9acc-a7f0d35fa7a5.png) -Launch the following command in your terminal to execute the uninstall script : +## Documentation + +See the documentation below: + +*The documentation is also available as a man page and with the "--help" function* +*Type `man arch-update` or `arch-update --help` after you've installed the **arch-update** package.* + +### SYNOPSIS + +arch-update [OPTION] + +### DESCRIPTION + +A (.desktop) clickeable icon that automatically changes to act as a pacman update notifier/applier, easy to integrate with any DE/WM, docks, launch bars or app menus. +Optionnal support for the AUR (through [yay](https://aur.archlinux.org/packages/yay) or [paru](https://aur.archlinux.org/packages/paru)) and desktop notifications. + +### OPTIONS + +If no option is passed, perform the main update function: Check for available updates and print the list of packages available for update, then ask for the user's confirmation to proceed with the installation (``pacman -Syu``). +It also supports AUR packages if [yay](https://aur.archlinux.org/packages/yay) or [paru](https://aur.archlinux.org/packages/paru) is installed. +The update function is launched when you click on the (.desktop) icon. + +#### -c, --check + +Check for available updates and change the (.desktop) icon if there are. +It sends a desktop notification if [libnotify](https://archlinux.org/packages/extra/x86_64/libnotify/) is installed. +It supports AUR updates if [yay](https://aur.archlinux.org/packages/yay) or [paru](https://aur.archlinux.org/packages/paru) is installed. +The `--check` option is automatically launched at boot and then every hour if you enabled the `systemd.timer` with the following command: ``` -curl -s https://raw.githubusercontent.com/Antiz96/arch-update/main/uninstall.sh | bash +systemctl --user enable --now arch-update.timer ``` -**Be aware that the installation from source doesn't provide any automatic update or uninstall process. You'll need to relaunch the install script manually each time there's a new release in order to get the latest version and you'll need to manually launch the uninstall script as well if you want to completly remove Arch-Update from your system.** -
-**With that said, unless you have specific reasons to perform a manual installation, I'd recommend using the AUR package installation method.** +#### -v, --version +Print the current version. -## Dependencies +#### -h, --help -### Required dependencies +Print the help. -Arch-Update depends on the [pacman-contrib](https://archlinux.org/packages/community/x86_64/pacman-contrib/ "pacman-contrib package") package. +### EXIT STATUS -### Optionnal dependencies +#### 0 + +if OK -Arch-Update optionnaly depends on the [yay](https://aur.archlinux.org/packages/yay "yay package") package or the [paru](https://aur.archlinux.org/packages/paru "paru package") package to check and apply AUR's packages updates. -
-
-Arch-Update optionnaly depends on the [libnotify](https://archlinux.org/packages/extra/x86_64/libnotify/ "libnotify package") package (notify-send) to send desktop notifications when checking for available updates. -
-*In order to get "libnotify" (and thus "notify-send") you have to install a notification server (if you don't already have one).* -
-*See https://wiki.archlinux.org/title/Desktop_notifications#Notification_servers* +#### 1 + +if problems (user didn't gave confirmation to proceed with the installation, a problem happened during the update process, the user passed an invalid option, ...) +## Tips and tricks -## Usage +### AUR Support -The usage consist of integrating the **(.desktop) icon** anywhere (could be your desktop, your dock, your launch bar and/or your app menu) and enabling the [systemd timer](https://github.com/Antiz96/arch-update/wiki/Usage#the-systemd-service-and-timer "enable the systemd timer"). +Arch-Update supports AUR packages when checking and installing updates if **yay** or **paru** is installed: +See https://github.com/Jguer/yay and https://aur.archlinux.org/packages/yay +See https://github.com/morganamilo/paru and https://aur.archlinux.org/packages/paru -Refer to the [Wiki Usage Page](https://github.com/Antiz96/arch-update/wiki/Usage "Wiki Usage Page") and to the screenshots below for more information. +### Desktop notifications Support -### Screenshot +Arch-Update supports desktop notifications when performing the `--check` function if **libnotify (notify-send)** is installed: +See https://wiki.archlinux.org/title/Desktop_notifications -Personally, I integrated the (.desktop) icon on my dock. -
-
-It is the penultimate icon from left to right (next to the red "Power Sign" icon). -
-This is how it looks like when **arch-update** is checking for available updates (*the check is automatically triggered at boot and then every hour if you enabled the [systemd timer](https://github.com/Antiz96/arch-update/wiki/Usage#the-systemd-service-and-timer "enable the systemd timer") and can be manually triggered with the `arch-update -c` command* : -![Arch-Update_Check](https://user-images.githubusercontent.com/53110319/161241670-8cab8a54-199b-41f1-80e3-95b171bbb70f.png) -
-
-If there are available updates, the icon will change and a desktop notification indicating the number of available updates will be sent (*requires [libnotify/notify-send](https://archlinux.org/packages/extra/x86_64/libnotify/ "libnotify package")*) : -![Arch-Update_Updates_Available+Notif](https://user-images.githubusercontent.com/53110319/161244079-b2ce8f2f-d4d3-42ad-83c1-62161d6da62f.png) -
-
-When the icon is clicked, it refreshes the package list available for updates and print it inside a terminal window. Then it asks for the user's confirmation to proceed (*requires [yay](https://aur.archlinux.org/packages/yay "yay") or [paru](https://aur.archlinux.org/packages/paru "paru") for AUR packages support*) : -![Arch-Update_List_Packages](https://user-images.githubusercontent.com/53110319/161244601-8ddeb5c4-b6cd-47a7-a035-debdbad75936.png) -
-
-If you chose to show the packages version changes (refer to the **Tips and tricks** section below), this is how it looks like : -![Arch-Update_List_Packages_With_Version_Changes](https://user-images.githubusercontent.com/53110319/161244783-bb0de764-04bb-4c39-b17a-54dcfb9de449.png) -
-
-Once the user gave the confirmation to proceed, the update process will begin and the icon will change accordingly : -![Arch-Update_Installing](https://user-images.githubusercontent.com/53110319/161245498-35bb8f9d-c050-40f5-ae67-d7a01b0bae19.png) -
-
-Finally, when the computer is up to date, the icon will look like this : -![Arch-Update_up_to_date](https://user-images.githubusercontent.com/53110319/161245726-b3adff52-f91e-40b6-9acc-a7f0d35fa7a5.png) +### Modify the auto-check cycle +If you enabled the systemd.timer, the `--check` option is launched automatically at boot and then every hour. + +If you want to change that cycle, you can edit the `/usr/lib/systemd/user/arch-update.timer` file (or `/etc/systemd/user/arch-update.timer` if you installed `arch-update` [from source](#from-source)) and modify the `OnUnitActiveSec` value. +The timer needs to be re-enabled to apply changes, you can do so by typing the following command: +``` +systemctl --user enable --now arch-update.timer +``` + +See https://www.freedesktop.org/software/systemd/man/systemd.time.html -## Documentation +### Show packages version changes -Refer to the [Wiki Documentation Page](https://github.com/Antiz96/arch-update/wiki/Documentation "Wiki Documentation Page"). -
-
-The full documentation is also available as a man page and with the "--help" function. -
-Type `man arch-update` or `arch-update --help` after you've installed the **arch-update** package. +If you want `arch-update` to show the packages version changes in the main `update` function, run the following command: +``` +sudo sed -i "s/ | awk '{print \$1}'//g" /usr/bin/arch-update +``` -## Tips and tricks +## Contributing -Refer to the [Wiki Tips and tricks Page](https://github.com/Antiz96/arch-update/wiki/Tips-and-tricks "Wiki Tricks and tips Page"). +You can raise your issues, feedbacks and ideas in the [issues tab](https://github.com/Antiz96/arch-update/issues). +[Pull requests](https://github.com/Antiz96/arch-update/pulls) are welcomed as well ! From e2d8d99ba76c6c84e9c7bfdf86e327bac07404cf Mon Sep 17 00:00:00 2001 From: Robin Candau Date: Thu, 15 Sep 2022 03:50:04 +0200 Subject: [PATCH 04/19] Moved the wiki pages into the README, documented the new installation process via a Makefile, small improvements here and there --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e9c08872..668bbc14 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ sudo make uninstall ## Usage -The usage consist of integrating [the .desktop file](#the-.desktop-file) anywhere (could be your desktop, your dock, your launch bar and/or your app menu) and enabling the [systemd timer](#the-systemd-service-and-timer). +The usage consist of integrating [the .desktop file](#the-\.desktop-file) anywhere (could be your desktop, your dock, your launch bar and/or your app menu) and enabling the [systemd timer](#the-systemd-service-and-timer). ### The .desktop file From 6dc29fbb19d97a89369c1c57bbab2c740d1032bc Mon Sep 17 00:00:00 2001 From: Robin Candau Date: Thu, 15 Sep 2022 03:50:54 +0200 Subject: [PATCH 05/19] Moved the wiki pages into the README, documented the new installation process via a Makefile, small improvements here and there --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 668bbc14..b413efc3 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ sudo make uninstall ## Usage -The usage consist of integrating [the .desktop file](#the-\.desktop-file) anywhere (could be your desktop, your dock, your launch bar and/or your app menu) and enabling the [systemd timer](#the-systemd-service-and-timer). +The usage consist of integrating [the .desktop file](#the-desktop-file) anywhere (could be your desktop, your dock, your launch bar and/or your app menu) and enabling the [systemd timer](#the-systemd-service-and-timer). ### The .desktop file From 38afacaf0da286f85bb85d4547ec6550abdb1649 Mon Sep 17 00:00:00 2001 From: Robin Candau Date: Thu, 15 Sep 2022 03:52:56 +0200 Subject: [PATCH 06/19] Moved the wiki pages into the README, documented the new installation process via a Makefile, small improvements here and there --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b413efc3..59477365 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ The usage consist of integrating [the .desktop file](#the-desktop-file) anywhere ### The .desktop file The .desktop file is located in `/usr/share/applications/arch-update.desktop` (or `/usr/local/share/applications/arch-update.desktop` if you installed `arch-update` [from source](#from-source). -It will automatically change depending on different states (cheking for updates, updates available, installing updates, up to date). +Its icon will automatically change depending on different states (cheking for updates, updates available, installing updates, up to date). It will launch the main `update` function when clicked. It is easy to integrate with any DE/WM, docks, launch bars or app menus. ## The systemd service and timer From 298a57e60989f3fb1293bd346abd21e7a02add4a Mon Sep 17 00:00:00 2001 From: Robin Candau Date: Thu, 15 Sep 2022 04:00:32 +0200 Subject: [PATCH 07/19] Moved the wiki pages into the README, documented the new installation process via a Makefile, small improvements here and there --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 59477365..d19f7994 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ The .desktop file is located in `/usr/share/applications/arch-update.desktop` (o Its icon will automatically change depending on different states (cheking for updates, updates available, installing updates, up to date). It will launch the main `update` function when clicked. It is easy to integrate with any DE/WM, docks, launch bars or app menus. -## The systemd service and timer +### The systemd service and timer There is a systemd service in `/usr/lib/systemd/user/arch-update.service` (or in `/etc/systemd/user/arch-update.service` if you installed `arch-update` [from source](#from-source)) that launches the `--check` function. From 822dda7b52e02081607888f775e440f146ad54bb Mon Sep 17 00:00:00 2001 From: Robin Candau Date: Thu, 15 Sep 2022 04:10:25 +0200 Subject: [PATCH 08/19] Moved the wiki pages into the README, documented the new installation process via a Makefile, small improvements here and there --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d19f7994..0c9fad58 100644 --- a/README.md +++ b/README.md @@ -182,7 +182,7 @@ See https://www.freedesktop.org/software/systemd/man/systemd.time.html If you want `arch-update` to show the packages version changes in the main `update` function, run the following command: ``` -sudo sed -i "s/ | awk '{print \$1}'//g" /usr/bin/arch-update +sudo sed -i "s/ | awk '{print \$1}'//g" /usr/bin/arch-update 2>/dev/null || sudo sed -i "s/ | awk '{print \$1}'//g" /usr/local/bin/arch-update 2>/dev/null ``` ## Contributing From 7d7b3049fc460a08f82a713aa1a3b9b839ba526a Mon Sep 17 00:00:00 2001 From: Robin Candau Date: Thu, 15 Sep 2022 04:11:21 +0200 Subject: [PATCH 09/19] Moved the wiki pages into the README, documented the new installation process via a Makefile, small improvements here and there --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0c9fad58..e84088b7 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ A (.desktop) clickeable icon that automatically changes to act as a pacman updat * [Usage](#usage) * [Documentation](#documentation) * [Tips and tricks](#tips-and-tricks) -* [Contributin](#contributing) +* [Contributing](#contributing) ## Description From 475a03bdefe6948d77098811bbcb6cf29b590e31 Mon Sep 17 00:00:00 2001 From: Robin Candau Date: Thu, 15 Sep 2022 04:16:38 +0200 Subject: [PATCH 10/19] Moved the wiki pages into the README, documented the new installation process via a Makefile, small improvements here and there --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e84088b7..80d84c38 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ The usage consist of integrating [the .desktop file](#the-desktop-file) anywhere ### The .desktop file The .desktop file is located in `/usr/share/applications/arch-update.desktop` (or `/usr/local/share/applications/arch-update.desktop` if you installed `arch-update` [from source](#from-source). -Its icon will automatically change depending on different states (cheking for updates, updates available, installing updates, up to date). +Its icon will automatically change depending on the different states (cheking for updates, updates available, installing updates, up to date). It will launch the main `update` function when clicked. It is easy to integrate with any DE/WM, docks, launch bars or app menus. ### The systemd service and timer From 9eee986ba276914bd20b20f8527cc473059d132e Mon Sep 17 00:00:00 2001 From: Robin Candau Date: Thu, 15 Sep 2022 04:24:10 +0200 Subject: [PATCH 11/19] Corrected the command to show packages version when performing the check function --- doc/man/arch-update.1 | 124 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 doc/man/arch-update.1 diff --git a/doc/man/arch-update.1 b/doc/man/arch-update.1 new file mode 100644 index 00000000..f16959c9 --- /dev/null +++ b/doc/man/arch-update.1 @@ -0,0 +1,124 @@ +.TH "ARCH-UPDATE" "1" "September 2022" "Arch-Update v1" "Arch-Update Manual" + +.SH NAME +arch-update \- A (.desktop) clickeable icon that automatically changes to act as an update notifier/applier + +.SH SYNOPSIS +.B arch-update +[\fI\,OPTION\/\fR] + +.SH DESCRIPTION +A (.desktop) clickeable icon that automatically changes to act as a pacman update notifier/applier, easy to integrate with any DE/WM, docks, launch bars or app menus. +.br +.RB "Optionnal support for the AUR (through " "yay " "or " "paru" ") and desktop notifications." + +.SH OPTIONS +.PP +.RB "If no option is passed, perform the main " "update " "function : Check for available updates and print the list of packages available for update, then ask for the user's confirmation to proceed with the installation (" "pacman -Syu" ")." +.br +.RB "It also supports AUR packages if " "yay " "or " "paru " "is installed." +.br +.RB "The " "update " "function is launched when you click on the (.desktop) icon." +.PP + +.TP +.B \-c, \-\-check +.RB "Check for available updates and change the (.desktop) icon if there are." +.br +.RB "It sends a desktop notification if " "libnotify " "is installed." +.br +.RB "It supports AUR updates if " "yay " "or " "paru " "is installed." +.br +.RB "The " "\-\-check " "option is automatically launched at boot and then every hour if you enabled the " "systemd.timer " "with the following command :" +.br +.B systemctl \-\-user enable \-\-now arch-update.timer + +.TP +.B \-v, \-\-version +Print the current version + +.TP +.B \-h, \-\-help +Print the help + +.SH EXIT STATUS +.TP +.B 0 +if OK + +.TP +.B 1 +if problems (user didn't gave confirmation to proceed with the installation, a problem happened during the update process, the user passed an invalid option, ...) + +.SH USAGE +.TP +.B The (.desktop) icon +.RB "The (.desktop) icon is located in " "/usr/share/applications/arch-update.desktop". +.br +.RB "It will automatically change depending on different states (cheking for updates, updates available, installing updates, up to date). It will launch the main " "update " "function when clicked. It is easy to integrate with any DE/WM, docks, launch bars or app menus." + +.TP +.B The systemd service and timer +.RB "There is a systemd service in " "/usr/lib/systemd/user/arch-update.service " "(or in " "/etc/systemd/user/arch-update.service " "if you installed arch-update from source) that launches the " "\-\-check " "function." +.br +.RB "There's also a systemd timer in " "/usr/lib/systemd/user/arch-update.timer " "(or in " "/etc/systemd/user/arch-update.timer " "if you installed arch-update from source) that automatically launches the systemd service at boot and then every hour. +.br +In order to make the systemd timer work, you need to enable it with the following command : +.br +.B systemctl \-\-user enable \-\-now arch-update.timer + +.SH TIPS AND TRICKS +.TP +.B AUR Support +.RB "Arch-Update supports AUR packages when checking and installing updates if " "yay " "or " "paru " "is installed" +.br +See https://github.com/Jguer/yay and https://aur.archlinux.org/packages/yay +.br +See https://github.com/morganamilo/paru and https://aur.archlinux.org/packages/paru + +.TP +.B Desktop notifications Support +.RB "Arch-Update supports desktop notifications when performing the " "--check " "function if " "libnotify (notify-send) " "is installed" +.br +See https://wiki.archlinux.org/title/Desktop_notifications + +.TP +.B Modify the auto-check cycle +.RB "If you enabled the " "systemd.timer" ", the " "--check " "option is launched automatically at boot and then every hour" +.br +.RB "If you want to change that cycle, you can edit the " "/usr/lib/systemd/user/arch-update.timer " "(or "/etc/systemd/user/arch-update.timer " if you installed arch-update from source) file and modify the " "OnUnitActiveSec " "value" +.br +The timer needs to be re-enabled to apply changes, you can do so by launching the following command : +.br +.B systemctl --user enable --now arch-update.timer +.br +See https://www.freedesktop.org/software/systemd/man/systemd.time.html + +.TP +.B Show packages version changes +.RB "If you want Arch-Update to show the packages version changes in the main " "update " "function, launch the following command :" +.br +.B sudo sed -i "s/ | awk '{print \$1}'//g" /usr/bin/arch-update 2>/dev/null || sudo sed -i "s/ | awk '{print \$1}'//g" /usr/local/bin/arch-update 2>/dev/null + +.SH SEE ALSO +.BR cp (1), +.BR checkupdates (8), +.BR echo (1), +.BR sudo (8), +.BR pacman (8), +.BR pacman.conf (5), +.BR systemd.service (5), +.BR systemd.timer (5), +.BR man (1), +.BR col (1), +.BR yay (8), +.BR paru (8), +.BR notify-send (1) +.br +The documentation is also available on the GitHub page https://github.com/Antiz96/arch-update + +.SH BUGS +Please report bugs to the GitHub page https://github.com/Antiz96/arch-update + +.SH AUTHOR +Robin Candau From 07a994b00e38da5ef9c160b997c4536be44a3fba Mon Sep 17 00:00:00 2001 From: Robin Candau Date: Thu, 15 Sep 2022 04:28:00 +0200 Subject: [PATCH 12/19] Make the arch-update script executable by default --- doc/man/arch-update.1 | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 doc/man/arch-update.1 diff --git a/doc/man/arch-update.1 b/doc/man/arch-update.1 old mode 100644 new mode 100755 From 7ab1d76c8bedf3b0695a0d4a535154f1675fe351 Mon Sep 17 00:00:00 2001 From: Robin Candau Date: Thu, 15 Sep 2022 04:31:21 +0200 Subject: [PATCH 13/19] Modified the structure of the repo --- {src => res}/desktop/arch-update.desktop | 0 {src => res}/systemd/arch-update.service | 0 {src => res}/systemd/arch-update.timer | 0 src/bin/arch-update.sh | 149 ------------------ src/{icons => img}/arch-update.svg | 0 src/{icons => img}/arch-update_checking.svg | 0 src/{icons => img}/arch-update_installing.svg | 0 src/{icons => img}/arch-update_up-to-date.svg | 0 .../arch-update_updates-available.svg | 0 src/man/arch-update.1 | 124 --------------- 10 files changed, 273 deletions(-) rename {src => res}/desktop/arch-update.desktop (100%) rename {src => res}/systemd/arch-update.service (100%) rename {src => res}/systemd/arch-update.timer (100%) delete mode 100644 src/bin/arch-update.sh rename src/{icons => img}/arch-update.svg (100%) rename src/{icons => img}/arch-update_checking.svg (100%) rename src/{icons => img}/arch-update_installing.svg (100%) rename src/{icons => img}/arch-update_up-to-date.svg (100%) rename src/{icons => img}/arch-update_updates-available.svg (100%) delete mode 100644 src/man/arch-update.1 diff --git a/src/desktop/arch-update.desktop b/res/desktop/arch-update.desktop similarity index 100% rename from src/desktop/arch-update.desktop rename to res/desktop/arch-update.desktop diff --git a/src/systemd/arch-update.service b/res/systemd/arch-update.service similarity index 100% rename from src/systemd/arch-update.service rename to res/systemd/arch-update.service diff --git a/src/systemd/arch-update.timer b/res/systemd/arch-update.timer similarity index 100% rename from src/systemd/arch-update.timer rename to res/systemd/arch-update.timer diff --git a/src/bin/arch-update.sh b/src/bin/arch-update.sh deleted file mode 100644 index 8a476603..00000000 --- a/src/bin/arch-update.sh +++ /dev/null @@ -1,149 +0,0 @@ -#!/bin/bash - -#Current version -version="1.3.2" - -#Check for optionnal dependencies ("yay" or "paru" for AUR support and "notify-send" (libnotify) for desktop notifications support) -YAY=$(command -v yay) -PARU=$(command -v paru) -NOTIF=$(command -v notify-send) - -#Replace the $1 var by "option" just to make the script more readable/less complex -option="${1}" - -case "${option}" in - #If no option is passed to the "arch-update" command, execute the main update function - #This is triggered by cliking on the desktop icon - "") - #Change the desktop icon to "checking" - cp -f /usr/share/icons/arch-update/arch-update_checking.svg /usr/share/icons/arch-update/arch-update.svg - - #Get the available updates list for Pacman - PACKAGES=$(checkupdates | awk '{print $1}') - - #Get the available updates list for AUR (if "yay" or "paru" is installed) - if [ -n "${YAY}" ]; then - AURPACKAGES=$(yay -Qua | awk '{print $1}') - elif [ -n "${PARU}" ]; then - AURPACKAGES=$(paru -Qua | awk '{print $1}') - else - AURPACKAGES="" - fi - - #If there are updates available for pacman, print them - if [ -n "${PACKAGES}" ]; then - echo -e "Packages :\n" && echo -e "${PACKAGES}\n" - fi - - #If there are updates available for AUR, print them - if [ -n "${AURPACKAGES}" ]; then - echo -e "AUR Packages :\n" && echo -e "${AURPACKAGES}\n" - fi - - #If there is no update available for Pacman nor AUR, change the desktop icon to "up-to-date" and quit - if [ -z "${PACKAGES}" ] && [ -z "${AURPACKAGES}" ]; then - cp -f /usr/share/icons/arch-update/arch-update_up-to-date.svg /usr/share/icons/arch-update/arch-update.svg - echo -e "No update available\n" && read -n 1 -r -s -p $'Press \"enter\" to quit\n' - exit 0 - #If there are updates available, change the desktop icon to "updates-available" and ask the confirmation to apply them to the user - else - cp -f /usr/share/icons/arch-update/arch-update_updates-available.svg /usr/share/icons/arch-update/arch-update.svg - read -rp $'Proceed with installation ? [Y/n] ' answer - - case "${answer}" in - #If the user gives the confirmation, change the desktop icon to "installing" and apply updates... - [Yy]|"") - cp -f /usr/share/icons/arch-update/arch-update_installing.svg /usr/share/icons/arch-update/arch-update.svg - - #...for both pacman and AUR (if there are) - if [ -n "${PACKAGES}" ] && [ -n "${AURPACKAGES}" ]; then - if [ -n "${YAY}" ]; then - sudo pacman -Syu && yay -Syu - else - sudo pacman -Syu && paru -Syu - fi - #... for pacman only (if there are) - elif [ -n "${PACKAGES}" ]; then - sudo pacman -Syu - #... for AUR only (if there are) - else - if [ -n "${YAY}" ]; then - yay -Syu - else - paru -Syu - fi - fi - ;; - - #If the user didn't give the confirmation, quit - *) - exit 1 - ;; - esac - - #If there was an error during the update process, change the desktop icon to "updates-available" and quit - if [ "$?" -ne 0 ]; then - cp -f /usr/share/icons/arch-update/arch-update_updates-available.svg /usr/share/icons/arch-update/arch-update.svg - echo -e >&2 "\nAn error has occured\nUpdates have been aborted\n" && read -n 1 -r -s -p $'Press \"enter\" to quit\n' - exit 1 - #If everything went well, change the desktop icon to "up-to-date" and quit - else - cp -f /usr/share/icons/arch-update/arch-update_up-to-date.svg /usr/share/icons/arch-update/arch-update.svg - echo -e "\nUpdates have been applied\n" && read -n 1 -r -s -p $'Press \"enter\" to quit\n' - exit 0 - fi - fi - ;; - #If the -c (or --check) option is passed to the "arch-update" command, execute the check function - #This is triggered by the systemd --user arch-update.service, which is automatically launched at boot and then every hour by the systemd --user arch-update.timer (that has to be enabled) - -c|--check) - #Change the desktop icon to "checking" - cp -f /usr/share/icons/arch-update/arch-update_checking.svg /usr/share/icons/arch-update/arch-update.svg - - #Get the number of available - if [ -n "${YAY}" ]; then - UPDATE_NUMBER=$( (checkupdates ; yay -Qua) | wc -l) - elif [ -n "${PARU}" ]; then - UPDATE_NUMBER=$( (checkupdates ; paru -Qua) | wc -l) - else - UPDATE_NUMBER=$(checkupdates | wc -l) - fi - - #If there are updates available, change the desktop icon to "updates-available" and quit - if [ "${UPDATE_NUMBER}" -gt 0 ]; then - cp -f /usr/share/icons/arch-update/arch-update_updates-available.svg /usr/share/icons/arch-update/arch-update.svg - #If notify-send (libnotify) is installed, also send a desktop notification before quitting - if [ -n "${NOTIF}" ]; then - if [ "${UPDATE_NUMBER}" -eq 1 ]; then - notify-send -i /usr/share/icons/arch-update/arch-update_updates-available.svg "Arch Update" "${UPDATE_NUMBER} update available" - else - notify-send -i /usr/share/icons/arch-update/arch-update_updates-available.svg "Arch Update" "${UPDATE_NUMBER} updates available" - fi - fi - exit 0 - #If there is no update available, change the desktop icon to "up-to-date" and quit - else - cp -f /usr/share/icons/arch-update/arch-update_up-to-date.svg /usr/share/icons/arch-update/arch-update.svg - exit 0 - fi - ;; - #If the -v (or --version) option is passed to the "malias" command, print the current version - -v|--version) - echo "${version}" - exit 0 - ;; - #If the -h (or --help) option is passed to the script, print the documentation (man page) - #This can be triggered directly by the user, by typing the following command in a terminal : arch-update --help - #The documentation is also readable here https://github.com/Antiz96/Arch-Update or by typing the following command in a terminal : man arch-update - -h|--help) - #Print the documentation (man page) and quit - man arch-update | col - exit 0 - ;; - - #If any other option(s) are passed to the script, print an error and quit - *) - echo -e >&2 "arch-update : invalid option -- '${option}'\nTry 'arch-update --help' for more information." - exit 1 - ;; -esac diff --git a/src/icons/arch-update.svg b/src/img/arch-update.svg similarity index 100% rename from src/icons/arch-update.svg rename to src/img/arch-update.svg diff --git a/src/icons/arch-update_checking.svg b/src/img/arch-update_checking.svg similarity index 100% rename from src/icons/arch-update_checking.svg rename to src/img/arch-update_checking.svg diff --git a/src/icons/arch-update_installing.svg b/src/img/arch-update_installing.svg similarity index 100% rename from src/icons/arch-update_installing.svg rename to src/img/arch-update_installing.svg diff --git a/src/icons/arch-update_up-to-date.svg b/src/img/arch-update_up-to-date.svg similarity index 100% rename from src/icons/arch-update_up-to-date.svg rename to src/img/arch-update_up-to-date.svg diff --git a/src/icons/arch-update_updates-available.svg b/src/img/arch-update_updates-available.svg similarity index 100% rename from src/icons/arch-update_updates-available.svg rename to src/img/arch-update_updates-available.svg diff --git a/src/man/arch-update.1 b/src/man/arch-update.1 deleted file mode 100644 index 01150552..00000000 --- a/src/man/arch-update.1 +++ /dev/null @@ -1,124 +0,0 @@ -.TH "ARCH-UPDATE" "1" "March 2022" "Arch-Update v1" "Arch-Update Manual" - -.SH NAME -arch-update \- A (.desktop) clickeable icon that automatically changes to act as an update notifier/applier - -.SH SYNOPSIS -.B arch-update -[\fI\,OPTION\/\fR] - -.SH DESCRIPTION -A (.desktop) clickeable icon that automatically changes to act as a pacman update notifier/applier, easy to integrate with any DE/WM, docks, launch bars or app menus. -.br -.RB "Optionnal support for the AUR (through " "yay " "or " "paru" ") and desktop notifications." - -.SH OPTIONS -.PP -.RB "If no option is passed, perform the main " "update " "function : Check for available updates and print the list of packages available for update, then ask for the user's confirmation to proceed with the installation (" "pacman -Syu" ")." -.br -.RB "It also supports AUR packages if " "yay " "or " "paru " "is installed." -.br -.RB "The " "update " "function is launched when you click on the (.desktop) icon." -.PP - -.TP -.B \-c, \-\-check -.RB "Check for available updates and change the (.desktop) icon if there are." -.br -.RB "It sends a desktop notification if " "libnotify " "is installed." -.br -.RB "It supports AUR updates if " "yay " "or " "paru " "is installed." -.br -.RB "The " "\-\-check " "option is automatically launched at boot and then every hour if you enabled the " "systemd.timer " "with the following command :" -.br -.B systemctl \-\-user enable \-\-now arch-update.timer - -.TP -.B \-v, \-\-version -Print the current version - -.TP -.B \-h, \-\-help -Print the help - -.SH EXIT STATUS -.TP -.B 0 -if OK - -.TP -.B 1 -if problems (user didn't gave confirmation to proceed with the installation, a problem happened during the update process, the user passed an invalid option, ...) - -.SH USAGE -.TP -.B The (.desktop) icon -.RB "The (.desktop) icon is located in " "/usr/share/applications/arch-update.desktop". -.br -.RB "It will automatically change depending on different states (cheking for updates, updates available, installing updates, up to date). It will launch the main " "update " "function when clicked. It is easy to integrate with any DE/WM, docks, launch bars or app menus." - -.TP -.B The systemd service and timer -.RB "There is a systemd service in " "/usr/lib/systemd/user/arch-update.service " "(or in " "/etc/systemd/user/arch-update.service " "if you installed arch-update from source) that launches the " "\-\-check " "function." -.br -.RB "There's also a systemd timer in " "/usr/lib/systemd/user/arch-update.timer " "(or in " "/etc/systemd/user/arch-update.timer " "if you installed arch-update from source) that automatically launches the systemd service at boot and then every hour. -.br -In order to make the systemd timer work, you need to enable it with the following command : -.br -.B systemctl \-\-user enable \-\-now arch-update.timer - -.SH TIPS AND TRICKS -.TP -.B AUR Support -.RB "Arch-Update supports AUR packages when checking and installing updates if " "yay " "or " "paru " "is installed" -.br -See https://github.com/Jguer/yay and https://aur.archlinux.org/packages/yay -.br -See https://github.com/morganamilo/paru and https://aur.archlinux.org/packages/paru - -.TP -.B Desktop notifications Support -.RB "Arch-Update supports desktop notifications when performing the " "--check " "function if " "libnotify (notify-send) " "is installed" -.br -See https://wiki.archlinux.org/title/Desktop_notifications - -.TP -.B Modify the auto-check cycle -.RB "If you enabled the " "systemd.timer" ", the " "--check " "option is launched automatically at boot and then every hour" -.br -.RB "If you want to change that cycle, you can edit the " "/usr/lib/systemd/user/arch-update.timer " "(or "/etc/systemd/user/arch-update.timer " if you installed arch-update from source) file and modify the " "OnUnitActiveSec " "value" -.br -The timer needs to be re-enabled to apply changes, you can do so by launching the following command : -.br -.B systemctl --user enable --now arch-update.timer -.br -See https://www.freedesktop.org/software/systemd/man/systemd.time.html - -.TP -.B Show packages version changes -.RB "If you want Arch-Update to show the packages version changes in the main " "update " "function, launch the following command :" -.br -.B sudo sed -i "s/ | awk '{print \$1}'//g" /usr/bin/arch-update - -.SH SEE ALSO -.BR cp (1), -.BR checkupdates (8), -.BR echo (1), -.BR sudo (8), -.BR pacman (8), -.BR pacman.conf (5), -.BR systemd.service (5), -.BR systemd.timer (5), -.BR man (1), -.BR col (1), -.BR yay (8), -.BR paru (8), -.BR notify-send (1) -.br -The documentation is also available on the GitHub page https://github.com/Antiz96/arch-update - -.SH BUGS -Please report bugs to the GitHub page https://github.com/Antiz96/arch-update - -.SH AUTHOR -Robin Candau From 409ba1a18cc7c681f205c3575bfb3f3fa2980bec Mon Sep 17 00:00:00 2001 From: Robin Candau Date: Thu, 15 Sep 2022 04:55:26 +0200 Subject: [PATCH 14/19] Replaced install/uninstall.sh scripts by a Makefile --- Makefile | 35 ++++++++++++++++++++++++++++ install.sh | 57 ---------------------------------------------- latest_release.txt | 1 - uninstall.sh | 15 ------------ 4 files changed, 35 insertions(+), 73 deletions(-) create mode 100644 Makefile delete mode 100644 install.sh delete mode 100644 latest_release.txt delete mode 100644 uninstall.sh diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..3049578d --- /dev/null +++ b/Makefile @@ -0,0 +1,35 @@ +pkgname=arch-update + +PREFIX ?= /usr/local + +.PHONY: all install uninstall + +all: + +install: + install -Dm 755 "src/script/${pkgname}.sh" "${DESTDIR}${PREFIX}/bin/${pkgname}" + + install -Dm 666 "src/img/${pkgname}.svg" "${DESTDIR}${PREFIX}/share/icons/${pkgname}/${pkgname}.svg" + install -Dm 666 "src/img/${pkgname}_checking.svg" "${DESTDIR}${PREFIX}/share/icons/${pkgname}/${pkgname}_checking.svg" + install -Dm 666 "src/img/${pkgname}_installing.svg" "${DESTDIR}${PREFIX}/share/icons/${pkgname}/${pkgname}_installing.svg" + install -Dm 666 "src/img/${pkgname}_up-to-date.svg" "${DESTDIR}${PREFIX}/share/icons/${pkgname}/${pkgname}_up-to-date.svg" + install -Dm 666 "src/img/${pkgname}_updates-available.svg" "${DESTDIR}${PREFIX}/share/icons/${pkgname}/${pkgname}_updates-available.svg" + + install -Dm 644 "res/desktop/${pkgname}.desktop" "${DESTDIR}${PREFIX}/share/applications/${pkgname}.desktop" + + install -Dm 644 "res/systemd/${pkgname}.service" "${DESTDIR}${PREFIX}/lib/systemd/user/${pkgname}.service" + install -Dm 644 "res/systemd/${pkgname}.timer" "${DESTDIR}${PREFIX}/lib/systemd/user/${pkgname}.timer" + + gzip -c "doc/man/${pkgname}.1" > "${pkgname}.1.gz" + install -Dm 644 "${pkgname}.1.gz" "${DESTDIR}${PREFIX}/share/man/man1/${pkgname}.1.gz" + rm -f "${pkgname}.1.gz" + + install -Dm 644 README.md "${DESTDIR}${PREFIX}/share/doc/${pkgname}/README.md" + +uninstall: + rm -f "${DESTDIR}${PREFIX}/bin/${pkgname}" + rm -f "${DESTDIR}${PREFIX}/share/man/man1/${pkgname}.1.gz" + rm -rf "${DESTDIR}${PREFIX}/share/doc/${pkgname}/" + +test: + "src/script/${pkgname}.sh" --help diff --git a/install.sh b/install.sh deleted file mode 100644 index e12fc701..00000000 --- a/install.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash - -pkgname="arch-update" -url="https://github.com/Antiz96/arch-update" -latest_release=$(curl -s https://raw.githubusercontent.com/Antiz96/arch-update/main/latest_release.txt) - -checksum=$(curl -Ls "$url"/releases/download/v"$latest_release"/sha256sum.txt) -installed=$(command -v "$pkgname") -current_version=$("$pkgname" -v 2>/dev/null) - -package() { - - pacman_contrib=$(command -v checkupdates) - if [ -z "$pacman_contrib" ]; then - echo "Installing dependencies (pacman-contrib)..." - sudo pacman -S --noconfirm pacman-contrib > /dev/null - fi - - curl -Ls "$url"/archive/v"$latest_release".tar.gz -o /tmp/"$pkgname"-"$latest_release".tar.gz || { echo -e >&2 "An error occured during the download of the $pkgname's archive\n\nPlease, verify that you have a working internet connexion and curl installed on your machine\nIf the problem persists anyway, you can open an issue at $url/issues" ; exit 1; } - - if ! echo "$checksum /tmp/$pkgname-$latest_release.tar.gz" | sha256sum -c --status -; then - echo -e >&2 "\n$pkgname's archive integrity check failed\nAborting\n\nPlease, verify that you have a working internet connexion and curl installed on your machine\nIf the problem persists anyway, you can open an issue at $url/issues" - rm -f /tmp/"$pkgname"-"$latest_release".tar.gz - exit 1 - else - echo -e "\n$pkgname's archive integrity validated\nProceeding to installation..." - fi - - tar -xf /tmp/"$pkgname"-"$latest_release".tar.gz -C /tmp/ || exit 1 - chmod +x /tmp/"$pkgname"-"$latest_release"/src/bin/"$pkgname".sh || exit 1 - gzip /tmp/"$pkgname"-"$latest_release"/src/man/"$pkgname".1 || exit 1 - sudo cp -f /tmp/"$pkgname"-"$latest_release"/src/bin/"$pkgname".sh /usr/local/bin/"$pkgname" || exit 1 - sudo cp -rf /tmp/"$pkgname"-"$latest_release"/src/icons/ /usr/share/icons/"$pkgname"/ || exit 1 - sudo chmod 666 /usr/share/icons/"$pkgname"/* - sudo cp -f /tmp/"$pkgname"-"$latest_release"/src/desktop/"$pkgname".desktop /usr/share/applications/ || exit 1 - sudo mkdir -p /usr/local/share/man/man1 || exit 1 - sudo cp -f /tmp/"$pkgname"-"$latest_release"/src/man/"$pkgname".1.gz /usr/local/share/man/man1/ || exit 1 - sudo cp -f /tmp/"$pkgname"-"$latest_release"/src/systemd/"$pkgname".* /etc/systemd/user/ || exit 1 - rm -rf /tmp/"$pkgname"-"$latest_release" /tmp/"$pkgname"-"$latest_release".tar.gz || exit 1 -} - -if [ -z "$installed" ]; then - echo "$pkgname is going to be installed" - package - echo -e "\n$pkgname has been successfully installed\nPlease, visit $url for more information\n\nThanks for downloading !" - exit 0 -elif [ "$current_version" != "$latest_release" ]; then - echo "A new update is available for $pkgname" - package - echo -e "\n$pkgname has been successfully updated to version $latest_release\nPlease, visit $url for more information" - exit 0 -else - echo "$pkgname is up to date -- reinstallation" - package - echo -e "\n$pkgname has been successfully reinstalled\nPlease, visit $url for more information" - exit 0 -fi diff --git a/latest_release.txt b/latest_release.txt deleted file mode 100644 index 3a3cd8cc..00000000 --- a/latest_release.txt +++ /dev/null @@ -1 +0,0 @@ -1.3.1 diff --git a/uninstall.sh b/uninstall.sh deleted file mode 100644 index 5bf831e0..00000000 --- a/uninstall.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -pkgname="arch-update" -url="https://github.com/Antiz96/arch-update" - -echo -e "$pkgname is going to be uninstalled\n" - -sudo rm -f /usr/local/bin/"$pkgname" || exit 1 -sudo rm -rf /usr/share/icons/"$pkgname"/ || exit 1 -sudo rm -f /usr/share/applications/"$pkgname".desktop || exit 1 -sudo rm -f /usr/local/share/man/man1/"$pkgname".1.gz || exit 1 -sudo rm -f /etc/systemd/user/"$pkgname".timer || exit 1 -sudo rm -f /etc/systemd/user/"$pkgname".service || exit 1 - -echo -e "$pkgname has been successfully uninstalled\nPlease, visit $url for more information" From 3ba3042682ee3cbd8473ad99bbe3b41b9f778940 Mon Sep 17 00:00:00 2001 From: Robin Candau Date: Thu, 15 Sep 2022 14:39:59 +0200 Subject: [PATCH 15/19] Modified the repo structure --- src/{img => icons}/arch-update.svg | 0 src/{img => icons}/arch-update_checking.svg | 0 src/{img => icons}/arch-update_installing.svg | 0 src/{img => icons}/arch-update_up-to-date.svg | 0 src/{img => icons}/arch-update_updates-available.svg | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename src/{img => icons}/arch-update.svg (100%) rename src/{img => icons}/arch-update_checking.svg (100%) rename src/{img => icons}/arch-update_installing.svg (100%) rename src/{img => icons}/arch-update_up-to-date.svg (100%) rename src/{img => icons}/arch-update_updates-available.svg (100%) diff --git a/src/img/arch-update.svg b/src/icons/arch-update.svg similarity index 100% rename from src/img/arch-update.svg rename to src/icons/arch-update.svg diff --git a/src/img/arch-update_checking.svg b/src/icons/arch-update_checking.svg similarity index 100% rename from src/img/arch-update_checking.svg rename to src/icons/arch-update_checking.svg diff --git a/src/img/arch-update_installing.svg b/src/icons/arch-update_installing.svg similarity index 100% rename from src/img/arch-update_installing.svg rename to src/icons/arch-update_installing.svg diff --git a/src/img/arch-update_up-to-date.svg b/src/icons/arch-update_up-to-date.svg similarity index 100% rename from src/img/arch-update_up-to-date.svg rename to src/icons/arch-update_up-to-date.svg diff --git a/src/img/arch-update_updates-available.svg b/src/icons/arch-update_updates-available.svg similarity index 100% rename from src/img/arch-update_updates-available.svg rename to src/icons/arch-update_updates-available.svg From 451ad2cee450d76455a40cd1ba301900b19139bb Mon Sep 17 00:00:00 2001 From: Robin Candau Date: Thu, 15 Sep 2022 14:42:00 +0200 Subject: [PATCH 16/19] Modified the install path of the icons --- Makefile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 3049578d..5d5bd9c7 100644 --- a/Makefile +++ b/Makefile @@ -9,17 +9,17 @@ all: install: install -Dm 755 "src/script/${pkgname}.sh" "${DESTDIR}${PREFIX}/bin/${pkgname}" - install -Dm 666 "src/img/${pkgname}.svg" "${DESTDIR}${PREFIX}/share/icons/${pkgname}/${pkgname}.svg" - install -Dm 666 "src/img/${pkgname}_checking.svg" "${DESTDIR}${PREFIX}/share/icons/${pkgname}/${pkgname}_checking.svg" - install -Dm 666 "src/img/${pkgname}_installing.svg" "${DESTDIR}${PREFIX}/share/icons/${pkgname}/${pkgname}_installing.svg" - install -Dm 666 "src/img/${pkgname}_up-to-date.svg" "${DESTDIR}${PREFIX}/share/icons/${pkgname}/${pkgname}_up-to-date.svg" - install -Dm 666 "src/img/${pkgname}_updates-available.svg" "${DESTDIR}${PREFIX}/share/icons/${pkgname}/${pkgname}_updates-available.svg" - + install -Dm 666 "src/icons/${pkgname}.svg" "${DESTDIR}/usr/share/icons/${pkgname}/${pkgname}.svg" + install -Dm 666 "src/icons/${pkgname}_checking.svg" "${DESTDIR}/usr/share/icons/${pkgname}/${pkgname}_checking.svg" + install -Dm 666 "src/icons/${pkgname}_installing.svg" "${DESTDIR}/usr/share/icons/${pkgname}/${pkgname}_installing.svg" + install -Dm 666 "src/icons/${pkgname}_up-to-date.svg" "${DESTDIR}/usr/share/icons/${pkgname}/${pkgname}_up-to-date.svg" + install -Dm 666 "src/icons/${pkgname}_updates-available.svg" "${DESTDIR}/usr/share/icons/${pkgname}/${pkgname}_updates-available.svg" + install -Dm 644 "res/desktop/${pkgname}.desktop" "${DESTDIR}${PREFIX}/share/applications/${pkgname}.desktop" - + install -Dm 644 "res/systemd/${pkgname}.service" "${DESTDIR}${PREFIX}/lib/systemd/user/${pkgname}.service" install -Dm 644 "res/systemd/${pkgname}.timer" "${DESTDIR}${PREFIX}/lib/systemd/user/${pkgname}.timer" - + gzip -c "doc/man/${pkgname}.1" > "${pkgname}.1.gz" install -Dm 644 "${pkgname}.1.gz" "${DESTDIR}${PREFIX}/share/man/man1/${pkgname}.1.gz" rm -f "${pkgname}.1.gz" From 15ee54ecd7ebea40155f50413dcbcfd7302a36e4 Mon Sep 17 00:00:00 2001 From: Robin Candau Date: Thu, 15 Sep 2022 15:33:19 +0200 Subject: [PATCH 17/19] Corrected the uninstall section --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index 5d5bd9c7..a2bcdc26 100644 --- a/Makefile +++ b/Makefile @@ -28,6 +28,10 @@ install: uninstall: rm -f "${DESTDIR}${PREFIX}/bin/${pkgname}" + rm -rf "${DESTDIR}/usr/share/icons/${pkgname}/" + rm -f "${DESTDIR}${PREFIX}/share/applications/${pkgname}.desktop" + rm -f "${DESTDIR}${PREFIX}/lib/systemd/user/${pkgname}.service" + rm -f "${DESTDIR}${PREFIX}/lib/systemd/user/${pkgname}.timer" rm -f "${DESTDIR}${PREFIX}/share/man/man1/${pkgname}.1.gz" rm -rf "${DESTDIR}${PREFIX}/share/doc/${pkgname}/" From fd16d5ee58d50bdc0bbd84e76db68b7e75c71a0b Mon Sep 17 00:00:00 2001 From: Robin Candau Date: Thu, 15 Sep 2022 17:22:58 +0200 Subject: [PATCH 18/19] Added the dependencies section --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 80d84c38..13dc0f42 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,8 @@ Arch-Update **optionnally** depends on: - [libnotify](https://archlinux.org/packages/extra/x86_64/libnotify/ "libnotify package") (`notify-send`) to send desktop notifications when checking for available updates. *In order to get `libnotify` (and thus `notify-send`) you have to install a notification server (if you don't already have one).* *See https://wiki.archlinux.org/title/Desktop_notifications#Notification_servers* + +The [make](https://www.gnu.org/software/make/) package is necessary to install/uninstall `arch-update`, install it via your package manager if needed. ### Installing dependencies From eee752de9f5f5779d52cff60f047a0f74538cd62 Mon Sep 17 00:00:00 2001 From: Robin Candau Date: Thu, 15 Sep 2022 18:28:52 +0200 Subject: [PATCH 19/19] Improved the command that allows showing the package version changes during the listing of available update --- README.md | 2 +- doc/man/arch-update.1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 13dc0f42..20eb82e7 100644 --- a/README.md +++ b/README.md @@ -184,7 +184,7 @@ See https://www.freedesktop.org/software/systemd/man/systemd.time.html If you want `arch-update` to show the packages version changes in the main `update` function, run the following command: ``` -sudo sed -i "s/ | awk '{print \$1}'//g" /usr/bin/arch-update 2>/dev/null || sudo sed -i "s/ | awk '{print \$1}'//g" /usr/local/bin/arch-update 2>/dev/null +sudo sed -i "s/ | awk '{print \$1}'//g" /usr/bin/arch-update /usr/local/bin/arch-update 2>/dev/null || true ``` ## Contributing diff --git a/doc/man/arch-update.1 b/doc/man/arch-update.1 index f16959c9..7a744d91 100755 --- a/doc/man/arch-update.1 +++ b/doc/man/arch-update.1 @@ -98,7 +98,7 @@ See https://www.freedesktop.org/software/systemd/man/systemd.time.html .B Show packages version changes .RB "If you want Arch-Update to show the packages version changes in the main " "update " "function, launch the following command :" .br -.B sudo sed -i "s/ | awk '{print \$1}'//g" /usr/bin/arch-update 2>/dev/null || sudo sed -i "s/ | awk '{print \$1}'//g" /usr/local/bin/arch-update 2>/dev/null +.B sudo sed -i "s/ | awk '{print \$1}'//g" /usr/bin/arch-update /usr/local/bin/arch-update 2>/dev/null || true .SH SEE ALSO .BR cp (1),