#!/usr/bin/env bash install_package() { # If for some reason we have to change AUR helpers, this function should make it easy to update everything all at once. # make sure system is up to date yay --sudoflags "${sudoFlags[@]}" --sudoloop --noconfirm -Syu yay --sudoflags "${sudoFlags[@]}" --sudoloop --needed --noconfirm -Sy "$@" } url_install() { local url="$1" local tmpfile tmpfile=$(mktemp /tmp/pkg.XXXXXX.pkg.tar.xz) # Make sure system is up to date yay --sudoflags "${sudoFlags[@]}" --sudoloop --noconfirm -Syu if curl -fL --retry 10 -o "$tmpfile" "$url"; then yay --sudoflags "${sudoFlags[@]}" --sudoloop --noconfirm -U "$tmpfile" fi rm -f "$tmpfile" } restart() { if dialog --clear --backtitle "Stormux" --yesno "Would you like to reboot now to apply changes?" 10 80 ; then sudo "${sudoFlags[@]}" reboot fi } 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 } add_stormux_repo() { # Check if StormUX repository is already configured if grep -q "\[stormux\]" /etc/pacman.conf; then msgbox "StormUX repository is already configured." return 0 fi infobox "Adding StormUX repository and importing signing key..." # Import the repository signing key if ! curl -s https://packages.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 52ADA49000F1FF0456F8AEEFB4CDE1CD56EF8E82; then msgbox "Failed to sign StormUX repository key." return 1 fi # Add repository to pacman.conf before [core] to give it highest priority local temp_conf temp_conf=$(mktemp) local added_repo=false while IFS= read -r line; do # Add StormUX repo before [core] section if [[ "$line" == "[core]" ]] && [[ "$added_repo" == false ]]; then { echo "[stormux]" echo "SigLevel = Required DatabaseOptional" echo "Server = https://packages.stormux.org/\$arch" echo "" } >> "$temp_conf" added_repo=true fi echo "$line" >> "$temp_conf" done < /etc/pacman.conf # If we didn't find [core] section, add it at the end if [[ "$added_repo" == false ]]; then { echo "" echo "[stormux]" echo "SigLevel = Required DatabaseOptional" echo "Server = https://packages.stormux.org/\$arch" } >> "$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 msgbox "StormUX repository added successfully!" return 0 }