diff --git a/Makefile b/Makefile
new file mode 100644
index 00000000..a2bcdc26
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,39 @@
+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/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"
+
+ install -Dm 644 README.md "${DESTDIR}${PREFIX}/share/doc/${pkgname}/README.md"
+
+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}/"
+
+test:
+ "src/script/${pkgname}.sh" --help
diff --git a/README.md b/README.md
index d7527b63..20eb82e7 100644
--- a/README.md
+++ b/README.md
@@ -2,22 +2,40 @@
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)
-
+* [Contributing](#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*
+
+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
+
+*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 +45,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).
+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
+
+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 /usr/local/bin/arch-update 2>/dev/null || true
+```
-## 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 !
diff --git a/src/man/arch-update.1 b/doc/man/arch-update.1
old mode 100644
new mode 100755
similarity index 96%
rename from src/man/arch-update.1
rename to doc/man/arch-update.1
index 01150552..7a744d91
--- a/src/man/arch-update.1
+++ b/doc/man/arch-update.1
@@ -1,4 +1,4 @@
-.TH "ARCH-UPDATE" "1" "March 2022" "Arch-Update v1" "Arch-Update Manual"
+.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
@@ -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
+.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),
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/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/script/arch-update.sh
old mode 100644
new mode 100755
similarity index 82%
rename from src/bin/arch-update.sh
rename to src/script/arch-update.sh
index 27c4bc97..8a476603
--- a/src/bin/arch-update.sh
+++ b/src/script/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
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"