diff --git a/CAAIS b/CAAIS index 4df9079..12bd4f4 100644 --- a/CAAIS +++ b/CAAIS @@ -2,20 +2,24 @@ # Made by RaptaG, terminalmaid and TruncatedDinosour # Definitions -ver="1.9-dev" +ver="1.9" fname="$(basename $0)" -GHrelease="https://github.com/RaptaG/CAAIS/releases/tag/$ver" +appendInPacmanConf=$(grep 'chaotic-aur' /etc/pacman.conf) isArchBased="$(grep 'ID_LIKE=arch' /etc/os-release)" +isArtix="$(grep 'ID=artix' /etc/os-release)" +isInstalled="$(pacman -Q chaotic-keyring chaotic-mirrorlist | awk '{print $1}')" startup() { echo "CAAIS, version $ver" echo "Current operation: $action Chaotic-AUR" } -# Check if the OS is based on Arch Linux (Artix Linux currently broken) +# Check if the OS is based on Arch Linux/ is Artix Linux if [ "$isArchBased" == "" ]; then echo "Error: Your system is not (based on) Arch Linux. Chaotic-AUR cannot be installed." exit 1 +elif [ "isArtix" == "ID=artix" ]; then + sleep 0s fi # Root permission checker @@ -27,6 +31,14 @@ fi # Download & install Chaotic-AUR install() { startup + + # Checks + if [ "$isInstalled" == "chaotic-keyring + chaotic-mirrorlist" ]; then + echo "Error: Chaotic-AUR is alread installed and it's pointless to be reinstalled." + exit 1 + fi + echo -n "Do you wish to proceed [Y/n] " read answer @@ -37,12 +49,12 @@ install() { fi unset answer - # Download & install the Chaotic-AUR key - echo "Installing the Chaotic-AUR key..." + # Key + echo "Installing the key..." pacman-key --recv-key FBA220DFC880C036 --keyserver keyserver.ubuntu.com > /dev/null 2>&1 pacman-key --lsign-key FBA220DFC880C036 > /dev/null 2>&1 - # Download Chaotic-AUR's keyring and mirrorlist + # Keyring & mirrorlist echo "Downloading the keyring..." pacman -U 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst' --noconfirm > /dev/null 2>&1 @@ -50,16 +62,14 @@ install() { pacman -U 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst' --noconfirm > /dev/null 2>&1 # Append in pacman.conf - appendInPacmanConf=$(grep 'chaotic-aur' /etc/pacman.conf) - if [ "$appendInPacmanConf" == "[chaotic-aur]" ]; then echo "Chaotic-AUR is already append in pacman.conf, skipping..." else - echo "Appending Chaotic-AUR to the mirrorlist..." + echo "Appending Chaotic-AUR in pacman.conf..." echo -e "\r\n[chaotic-aur]\nInclude = /etc/pacman.d/chaotic-mirrorlist" >> /etc/pacman.conf fi - # Refresh the mirrorlists + # Refresh mirrorlists echo "Refreshing the mirrorlists..." pacman -Sy > /dev/null 2>&1 @@ -71,6 +81,14 @@ install() { # Uninstall Chaotic-AUR remove() { startup + + # Checks + if [ "$isInstalled" == "error: package 'chaotic-keyring' was not found + error: package 'chaotic-mirrorlist' was not found" ]; then + echo "Error: Chaotic-AUR is not installed and cannot be removed." + exit 1 + fi + echo -n "This will break ALL the packages you may have installed with Chaotic-AUR. Do you wish to proceed? [y/N] " read answer @@ -83,23 +101,23 @@ remove() { fi unset answer - # Delete the Chaotic-AUR key - echo "Deleting the Chaotic-AUR key..." + # Key + echo "Deleting the key..." pacman-key --delete 3FFA0B5E092ED4095E26F69B8ADB4AEC585061CF > /dev/null 2>&1 - # Uninstall the keyring and the mirrorlist + # Keyring & mirrorlist echo "Uninstalling the keyring..." pacman -Rns chaotic-keyring --no-confirm > /dev/null 2>&1 echo "Uninstalling the mirrorlist..." pacman -Rns chaotic-mirrorlist --no-confirm > /dev/null 2>&1 - # Remove Chaotic-AUR from pacman.conf + # Remove from pacman.conf echo "Removing Chaotic-AUR from pacman.conf..." sed -i '/chaotic-aur/d' /etc/pacman.conf sed -i '/chaotic-mirrorlist/d' /etc/pacman.conf - # Refresh the mirrorlists + # Refresh mirrorlists echo "Refreshing the mirrorlists..." pacman -Sy > /dev/null 2>&1 @@ -110,7 +128,7 @@ remove() { # Find the option selected and run the correct command case "$1" in --h | --help) +-h | --help | "") echo -e "Usage: $fname [OPTION]" echo -e "\n-h, --help This help menu" echo -e "\n-a, --about Display informaton about CAAIS (eg. version)" @@ -120,7 +138,7 @@ case "$1" in ;; -a | --about) echo "Version of CAAIS currently used: $ver" - echo -e "GitHub release: $GHrelease\n" + echo -e "GitHub release: https://github.com/RaptaG/CAAIS/releases/tag/$ver\n" echo "Current contributors:" echo "1) RaptaG (main developer)" echo "2) terminalmaid (Pull Request #1)" @@ -135,7 +153,7 @@ case "$1" in remove ;; *) - echo "Invalid selection. Please run 'sudo ./$fname' to see the list of all the options availiable." + echo "Invalid option '$1'. Please run 'sudo ./$fname' to see the list of all the options availiable." exit 1 ;; esac diff --git a/README.md b/README.md index a3f4b5e..9969ad3 100644 --- a/README.md +++ b/README.md @@ -7,23 +7,23 @@ The **Chaotic-AUR Automated Install Script** (or _CAAIS_ for short) is a program (written in [Bash](https://www.gnu.org/software/bash)) which installs Chaotic-AUR **automatically** inside your system! It is based on the commands provided by [the Chaotic-AUR website](https://aur.chaotic.cx) and does pretty much everything that is shown there, with some extra options! -Chaotic-AUR is, like the AUR (Arch User Repository), availiable only on Arch-based Linux distributions. If you try to install it anywhere else, CAAIS will tell that you that trying to install Chaotic-AUR there is impossible. Also, since Chaotic-AUR is preinstalled in Garuda Linux, CAAIS will also tell you to that it's useless there. +Chaotic-AUR is, like the AUR (Arch User Repository), availiable only on Arch-based Linux distributions. So, if you try to install it anywhere else, CAAIS will tell that you that it is not possible. -## Installation/Usage +## Installation ### 1. Via the Releases Tab (recommended, stable) -- Enter the [Releases Tab](https://github.com/RaptaG/CAAIS/releases) and download the latest version available - -- Enter the folder you downloaded CAAIS, press Right Click -> Open in Terminal. Then, copy the following command, paste it inside the terminal and hit Enter +- Enter the [Releases Tab](https://github.com/RaptaG/CAAIS/releases) and download the latest version available and run the following command in the folder you installed CAAIS: ``` -chmod +x CAAIS.sh && sudo ./CAAIS --install +chmod +x CAAIS.sh ``` -### 2. By cloning the source code (unstable) +This will make it executable (working). + +### 2. By cloning the source code (possibly unstable) - Open a terminal and run the command below. This will download the script and make it executable: @@ -31,16 +31,19 @@ chmod +x CAAIS.sh && sudo ./CAAIS --install curl -Os https://raw.githubusercontent.com/RaptaG/CAAIS/main/CAAIS && chmod +x CAAIS ``` -- In the same terminal, run the following command, which will start the script: +## Usage + +Open up aterminal inside the folder where CAAIS is installed and run one of the following, according to what you want to do: ``` - sudo ./CAAIS --install +sudo ./CAAIS -h or --help: Display the help menu +sudo ./CAAIS -a or --about: Display info related to CAAIS +sudo ./CAAIS -i or --install: Download and install Chaotic-AUR +sudo ./CAAIS -r or --remove: Uninstall Chaotic-AUR ``` -That's it! Now Chaotic-AUR should be installed in your system. - ## Credits - + - [terminalmaid](https://github.com/terminalmaid), for some imporant fixes and additions, on [#1](https://github.com/RaptaG/CAAIS/pull/1) - [TruncatedDinosour](https://github.com/TruncatedDinosour), for improving the original code, on [#2](https://github.com/RaptaG/CAAIS/pull/2) - [Linux.Chat](https://linux.chat/) [Discord server](https://discord.com/invite/fA7UuAAhzt), and its member who helped me with some parts of the code
(special thanks to [Theros](https://github.com/therosin)) @@ -48,8 +51,12 @@ That's it! Now Chaotic-AUR should be installed in your system. ## Feedback/Support -You can use [the Issues section](https://github.com/RaptaG/CAAIS/issues) to report bugs, make suggestions or even ask a question. - +You can use the [Issues section](https://github.com/RaptaG/CAAIS/issues) to report bugs, make suggestions or even ask a question. + +## Contact with me/Discuss about CAAIS + +[GitHub Discussions](https://github.com/RaptaG/CAAIS/discussions) were recently activated. Feel free to start a discussion there! + ## License This project is licensed under the [`Apache-2.0`](LICENSE) license.