134 lines
4.8 KiB
Bash
Executable File

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 "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() {
# Make sure system is up to date
yay --sudoflags "${sudoFlags[@]}" --sudoloop --noconfirm -Syu
# Check if we have internet connectivity
if ! ping -c 1 aarch64.stormux.org &>/dev/null; then
msgbox "No internet connection detected. X11Libre installation requires internet access."
return 1
fi
# Add StormUX repository with proper key management
if ! add_stormux_repo; then
msgbox "Failed to add StormUX repository. Installation aborted."
return 1
fi
# Remove conflicting packages
infobox "Removing conflicting Xorg packages..."
sudo "${sudoFlags[@]}" pacman -R --noconfirm xorg-server xf86-input-libinput xf86-video-fbdev 2>/dev/null || true
# Install X11Libre packages from StormUX repository
infobox "Installing X11Libre server and drivers..."
if ! sudo "${sudoFlags[@]}" pacman -S --noconfirm xlibre-server-common-git xlibre-server-devel-git; then
msgbox "Failed to install X11Libre server components."
return 1
fi
if ! sudo "${sudoFlags[@]}" pacman -Sdd --noconfirm xlibre-server-git; then
msgbox "Failed to install X11Libre server main package."
return 1
fi
# Install input and video drivers from StormUX repository
if ! sudo "${sudoFlags[@]}" pacman -S --noconfirm stormux/xf86-input-libinput-xlibre stormux/xf86-video-dummy-with-vt stormux/xf86-video-fbdev; then
msgbox "Failed to install X11Libre input and video drivers."
return 1
fi
infobox "X11Libre installation completed successfully!"
return 0
}