Add Stormux repository if not found.
This commit is contained in:
		| @@ -27,6 +27,69 @@ attention() { | |||||||
|     play -qnV0 synth 3 pluck D3 pluck A3 pluck D4 pluck F4 pluck A4 delay 0 .1 .2 .3 .4 remix - chorus 0.9 0.9 38 0.75 0.3 0.5 -t |     play -qnV0 synth 3 pluck D3 pluck A3 pluck D4 pluck F4 pluck A4 delay 0 .1 .2 .3 .4 remix - chorus 0.9 0.9 38 0.75 0.3 0.5 -t | ||||||
| } | } | ||||||
|  |  | ||||||
|  | add_stormux_repo() { | ||||||
|  |     # Check if StormUX repository is already configured | ||||||
|  |     if grep -q "aarch64.stormux.org" /etc/pacman.conf; then | ||||||
|  |         return 0 | ||||||
|  |     fi | ||||||
|  |      | ||||||
|  |     infobox "Adding StormUX repository and importing signing key..." | ||||||
|  |      | ||||||
|  |     # Import the repository signing key | ||||||
|  |     if ! curl -s https://aarch64.stormux.org/stormux-repo.pub | sudo "${sudoFlags[@]}" pacman-key --add -; then | ||||||
|  |         msgbox "Failed to download StormUX repository key." | ||||||
|  |         return 1 | ||||||
|  |     fi | ||||||
|  |      | ||||||
|  |     # Locally sign the key | ||||||
|  |     if ! sudo "${sudoFlags[@]}" pacman-key --lsign-key storm_dragon@stormux.org; then | ||||||
|  |         msgbox "Failed to sign StormUX repository key." | ||||||
|  |         return 1 | ||||||
|  |     fi | ||||||
|  |      | ||||||
|  |     # Add repository to pacman.conf before any AUR-related sections | ||||||
|  |     # Create a temporary file with the repository configuration | ||||||
|  |     local temp_conf=$(mktemp) | ||||||
|  |     local added_repo=false | ||||||
|  |      | ||||||
|  |     while IFS= read -r line; do | ||||||
|  |         # Add StormUX repo before any AUR or custom repo sections | ||||||
|  |         if [[ "$line" =~ ^\[.*\]$ ]] && [[ ! "$line" =~ ^\[(core|extra|multilib|testing|multilib-testing)\]$ ]] && [[ "$added_repo" == false ]]; then | ||||||
|  |             echo "[stormux]" >> "$temp_conf" | ||||||
|  |             echo "SigLevel = Required" >> "$temp_conf" | ||||||
|  |             echo "Server = https://aarch64.stormux.org/" >> "$temp_conf" | ||||||
|  |             echo "" >> "$temp_conf" | ||||||
|  |             added_repo=true | ||||||
|  |         fi | ||||||
|  |         echo "$line" >> "$temp_conf" | ||||||
|  |     done < /etc/pacman.conf | ||||||
|  |      | ||||||
|  |     # If we didn't add it yet (no custom repos found), add it at the end | ||||||
|  |     if [[ "$added_repo" == false ]]; then | ||||||
|  |         echo "" >> "$temp_conf" | ||||||
|  |         echo "[stormux]" >> "$temp_conf" | ||||||
|  |         echo "SigLevel = Required" >> "$temp_conf" | ||||||
|  |         echo "Server = https://aarch64.stormux.org/" >> "$temp_conf" | ||||||
|  |     fi | ||||||
|  |      | ||||||
|  |     # Replace the original pacman.conf | ||||||
|  |     if ! sudo "${sudoFlags[@]}" cp "$temp_conf" /etc/pacman.conf; then | ||||||
|  |         rm -f "$temp_conf" | ||||||
|  |         msgbox "Failed to update pacman.conf with StormUX repository." | ||||||
|  |         return 1 | ||||||
|  |     fi | ||||||
|  |      | ||||||
|  |     rm -f "$temp_conf" | ||||||
|  |      | ||||||
|  |     # Refresh package databases | ||||||
|  |     if ! sudo "${sudoFlags[@]}" pacman -Syy; then | ||||||
|  |         msgbox "Failed to refresh package databases after adding StormUX repository." | ||||||
|  |         return 1 | ||||||
|  |     fi | ||||||
|  |      | ||||||
|  |     return 0 | ||||||
|  | } | ||||||
|  |  | ||||||
| install_xlibre() { | install_xlibre() { | ||||||
|     # Make sure system is up to date |     # Make sure system is up to date | ||||||
|     yay --sudoflags "${sudoFlags[@]}" --sudoloop --noconfirm -Syu |     yay --sudoflags "${sudoFlags[@]}" --sudoloop --noconfirm -Syu | ||||||
| @@ -37,11 +100,10 @@ install_xlibre() { | |||||||
|         return 1 |         return 1 | ||||||
|     fi |     fi | ||||||
|      |      | ||||||
|     # Add StormUX repository to pacman.conf if not already present |     # Add StormUX repository with proper key management | ||||||
|     if ! grep -q "aarch64.stormux.org" /etc/pacman.conf; then |     if ! add_stormux_repo; then | ||||||
|         infobox "Adding StormUX repository..." |         msgbox "Failed to add StormUX repository. Installation aborted." | ||||||
|         echo -e "\n[stormux]\nSigLevel = Never\nServer = https://aarch64.stormux.org" | sudo "${sudoFlags[@]}" tee -a /etc/pacman.conf > /dev/null |         return 1 | ||||||
|         sudo "${sudoFlags[@]}" pacman -Syy |  | ||||||
|     fi |     fi | ||||||
|      |      | ||||||
|     # Remove conflicting packages |     # Remove conflicting packages | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user