Skip to content
This repository has been archived by the owner on Jan 1, 2023. It is now read-only.

Commit

Permalink
Version 1.9
Browse files Browse the repository at this point in the history
- Feat: CAAIS checks if Chaotic-AUR is already installed or not

- Fix: Added a workaround for Artix Linux

- Planned for 2.0:
Standart AUR package converter if Chaotic-AUR is removed

 - No longer planned:
 Wiki
  • Loading branch information
RaptaG authored Aug 8, 2022
1 parent a969d57 commit 17402bd
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 32 deletions.
54 changes: 36 additions & 18 deletions CAAIS
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -37,29 +49,27 @@ 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

echo "Downloading the mirrorlist..."
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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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)"
Expand All @@ -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)"
Expand All @@ -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
35 changes: 21 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,49 +7,56 @@

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.

</div>

## 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 -> <kbd>Open in Terminal</kbd>. Then, copy the following command, paste it inside the terminal and hit <kbd>Enter</kbd>
- 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:

```
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 <br />(special thanks to [Theros](https://github.com/therosin))
- [RaptaG](https://github.com/RaptaG) (myself), for the idea and for making the script itself

## 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.

0 comments on commit 17402bd

Please sign in to comment.