Moving toward working gui installation.

This commit is contained in:
Storm Dragon
2025-11-29 03:54:28 -05:00
parent dfd2609461
commit 013b3d11ac
13 changed files with 351 additions and 43 deletions

View File

@@ -18,10 +18,12 @@ declare -a userNames=()
declare -a userPasswords=()
declare -a userIsAdmin=()
desktopEnvironment="" # "none", "i3", "mate"
hasDesktop=false # true if a desktop environment is selected
timezone=""
enableSsh="no" # "yes" or "no"
installLinuxGameManager="no" # "yes" or "no"
installAudiogameManager="no" # "yes" or "no"
autoLoginUser="" # User to auto-login for desktop environments
#
@@ -666,24 +668,49 @@ gather_system_info() {
case "$desktop" in
"Console only"*)
desktopEnvironment="none"
hasDesktop=false
log_info "Desktop environment: none"
break
;;
"i3"*)
desktopEnvironment="i3"
hasDesktop=true
log_info "Desktop environment: i3"
break
;;
"MATE"*)
desktopEnvironment="mate"
hasDesktop=true
log_info "Desktop environment: mate"
break
;;
esac
done
# Auto-login user selection (only if desktop environment selected)
if [[ "$hasDesktop" == true ]]; then
echo ""
echo "=== Auto-Login Configuration ==="
if [[ ${#userNames[@]} -eq 1 ]]; then
autoLoginUser="${userNames[0]}"
echo "Auto-login user set to: $autoLoginUser"
log_info "Auto-login user: $autoLoginUser"
else
echo "Select which user should automatically login to the graphical session:"
PS3="Enter user number: "
select selectedUser in "${userNames[@]}"; do
if [[ -n "$selectedUser" ]]; then
autoLoginUser="$selectedUser"
echo "Auto-login user set to: $autoLoginUser"
log_info "Auto-login user: $autoLoginUser"
break
fi
done
fi
fi
# Game manager installation (only if desktop environment selected)
if [[ "$desktopEnvironment" != "none" ]]; then
if [[ "$hasDesktop" == true ]]; then
echo ""
echo "=== Optional Game Managers ==="
echo ""
@@ -804,7 +831,7 @@ install_base_system() {
)
local utilityPackages=(
vim nano screen magic-wormhole
vi vim nano screen magic-wormhole
man man-pages
xdg-user-dirs xdg-utils
poppler socat parted
@@ -820,30 +847,22 @@ install_base_system() {
# Combine all packages
local allPackages=("${basePackages[@]}" "${audioPackages[@]}" "${accessibilityPackages[@]}" "${utilityPackages[@]}")
# Add wine packages for audiogame-manager
if [[ "$installAudiogameManager" == "yes" ]]; then
local winePackages=(
wine winetricks wine_gecko wine-mono
cabextract dos2unix translate-shell
gst-plugins-bad gst-plugins-good gst-plugins-ugly gst-libav
)
allPackages+=("${winePackages[@]}")
log_info "Adding wine packages for audiogame-manager"
fi
# Add desktop-specific packages
case "$desktopEnvironment" in
i3)
allPackages+=(i3-wm xclip)
allPackages+=(i3-wm orca lxterminal pluma)
allPackages+=(discount jq libnotify xfce4-notifyd pamixer playerctl)
allPackages+=(python-i3ipc python-wxpython sox yad)
allPackages+=(lxsession magic-wormhole pcmanfm)
allPackages+=(python-gobject python-pillow python-pytesseract scrot tesseract)
allPackages+=(tesseract-data-eng udiskie xorg-setxkbmap)
# Add Stormux-specific i3 packages
stormuxPackages+=(xlibre-server xlibre-input-libinput nodm-dgw)
stormuxPackages+=(xlibre-xserver xlibre-input-libinput nodm-dgw)
;;
mate)
allPackages+=(mate mate-extra orca lightdm lightdm-gtk-greeter)
allPackages+=(mate mate-extra orca)
# Add Stormux-specific MATE packages
stormuxPackages+=(xlibre-server xlibre-input-libinput)
stormuxPackages+=(xlibre-xserver xlibre-input-libinput nodm-dgw)
;;
esac
@@ -1052,6 +1071,23 @@ pacman -Sy --noconfirm --needed ${stormuxPackages[*]} 2>/dev/null || true
"
fi
# Build game manager packages installation command
local gameManagerPackagesCmd=""
if [[ "$installAudiogameManager" == "yes" ]]; then
gameManagerPackagesCmd+="
# Install wine packages for audiogame-manager
echo \"Installing wine packages for audiogame-manager...\"
pacman -S --noconfirm --needed wine winetricks wine_gecko wine-mono cabextract dos2unix translate-shell gst-plugins-bad gst-plugins-good gst-plugins-ugly gst-libav 2>/dev/null || true
"
fi
if [[ "$installLinuxGameManager" == "yes" ]]; then
gameManagerPackagesCmd+="
# Install packages for linux-game-manager
echo \"Installing packages for linux-game-manager...\"
pacman -S --noconfirm --needed linux-game-manager 2>/dev/null || true
"
fi
# Build pipewire configuration command for all users
local pipewireConfigCmd=""
for username in "${userNames[@]}"; do
@@ -1093,6 +1129,8 @@ export GTK_MODULES=gail:atk-bridge
export GNOME_ACCESSIBILITY=1
export QT_ACCESSIBILITY=1
export QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1
export EDITOR=nano
export VISUAL=nano
ENV_EOF
# Note: realtime group is created by realtime-privileges package
@@ -1161,7 +1199,6 @@ elif [[ "${desktopEnvironment}" == "mate" ]]; then
#
# Executed by startx (run your window manager from here)
dbus-launch
[[ -f ~/.Xresources ]] && xrdb -merge -I\$HOME ~/.Xresources
if [ -d /etc/X11/xinit/xinitrc.d ]; then
@@ -1171,30 +1208,24 @@ if [ -d /etc/X11/xinit/xinitrc.d ]; then
unset f
fi
# Source xprofile if it exists
[[ -f ~/.xprofile ]] && . ~/.xprofile
[ -f /etc/xprofile ] && . /etc/xprofile
[ -f ~/.xprofile ] && . ~/.xprofile
exec mate-session
exec dbus-run-session -- mate-session
XINITRC_MATE_EOF
chmod 755 /home/\$firstUser/.xinitrc
chown \$firstUser:users /home/\$firstUser/.xinitrc
# Create .xprofile for MATE with accessibility variables
cat > /home/\$firstUser/.xprofile <<'XPROFILE_MATE_EOF'
#!/bin/sh
#
# ~/.xprofile
#
# Executed by display managers and sourced by .xinitrc
# Accessibility environment variables
# Accessibility variables
export ACCESSIBILITY_ENABLED=1
export GTK_MODULES=gail:atk-bridge:canberra-gtk-module
export CHROME_FLAGS="--force-renderer-accessibility"
export GTK_MODULES=gail:atk-bridge
export GNOME_ACCESSIBILITY=1
export QT_ACCESSIBILITY=1
export QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1
export DBUS_SESSION_BUS_PID
export DBUS_SESSION_BUS_ADDRESS
export SAL_USE_VCLPLUGIN=gtk3
# Enable Orca screen reader
gsettings set org.gnome.desktop.a11y.applications screen-reader-enabled true 2>/dev/null || true
@@ -1220,13 +1251,12 @@ if [[ -f /usr/share/pacman/keyrings/stormux.gpg ]]; then
pacman-key --lsign-key 52ADA49000F1FF0456F8AEEFB4CDE1CD56EF8E82 2>/dev/null || true
fi
# Import xlibre key
pacman-key --recv-keys 73580DE2EDDFA6D6 2>/dev/null || true
pacman-key --lsign-key 73580DE2EDDFA6D6 2>/dev/null || true
# Install Stormux-specific packages (built dynamically before chroot)
$stormuxPackagesCmd
# Install game manager packages (built dynamically before chroot)
$gameManagerPackagesCmd
# Enable pipewire globally for all users (creates symlinks in /etc/systemd/user/)
systemctl --global enable pipewire.service pipewire-pulse.service wireplumber.service
@@ -1241,9 +1271,9 @@ $pipewireConfigCmd
# Configure nodm for automatic login (only after nodm package is installed)
if [[ "${desktopEnvironment}" == "i3" ]] || [[ "${desktopEnvironment}" == "mate" ]]; then
if [[ -f /etc/nodm.conf ]]; then
sed -i "s/{user}/${userNames[0]}/g" /etc/nodm.conf
sed -i "s/{user}/${autoLoginUser}/g" /etc/nodm.conf
systemctl enable nodm.service
echo "Display manager (nodm) configured for ${userNames[0]}"
echo "Display manager (nodm) configured for ${autoLoginUser}"
else
echo "Warning: /etc/nodm.conf not found, skipping nodm configuration"
fi
@@ -1262,6 +1292,10 @@ export GNOME_ACCESSIBILITY=1
export QT_ACCESSIBILITY=1
export QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1
# Default editor (users can override in their own shell config)
export EDITOR=nano
export VISUAL=nano
# Dialog accessibility options
export DIALOGOPTS='--no-lines --visit-items'
PROFILE_EOF
@@ -1356,6 +1390,10 @@ install_game_managers() {
# Clone repository
git clone https://git.stormux.org/storm/linux-game-manager "$mountPoint/opt/linux-game-manager"
# Configure git repository for shared group access
arch-chroot "$mountPoint" git -C /opt/linux-game-manager config core.sharedRepository group
arch-chroot "$mountPoint" git -C /opt/linux-game-manager config safe.directory /opt/linux-game-manager
# Set ownership to root:games with group-writable permissions
chown -R root:games "$mountPoint/opt/linux-game-manager"
chmod -R 775 "$mountPoint/opt/linux-game-manager"
@@ -1366,7 +1404,13 @@ install_game_managers() {
cat > "$mountPoint/usr/local/bin/linux-game-manager" <<'EOF'
#!/usr/bin/env bash
cd /opt/linux-game-manager || exit 1
# Set umask for group-writable files
umask 002
# Try to update - only members of games group can write
git pull --quiet 2>/dev/null || true
./linux-game-manager.sh "$@"
EOF
chmod 755 "$mountPoint/usr/local/bin/linux-game-manager"
@@ -1383,6 +1427,10 @@ EOF
# Clone repository
git clone https://git.stormux.org/storm/audiogame-manager "$mountPoint/opt/audiogame-manager"
# Configure git repository for shared group access
arch-chroot "$mountPoint" git -C /opt/audiogame-manager config core.sharedRepository group
arch-chroot "$mountPoint" git -C /opt/audiogame-manager config safe.directory /opt/audiogame-manager
# Set ownership to root:games with group-writable permissions
chown -R root:games "$mountPoint/opt/audiogame-manager"
chmod -R 775 "$mountPoint/opt/audiogame-manager"
@@ -1393,7 +1441,13 @@ EOF
cat > "$mountPoint/usr/local/bin/audiogame-manager" <<'EOF'
#!/usr/bin/env bash
cd /opt/audiogame-manager || exit 1
# Set umask for group-writable files
umask 002
# Try to update - only members of games group can write
git pull --quiet 2>/dev/null || true
./audiogame-manager.sh "$@"
EOF
chmod 755 "$mountPoint/usr/local/bin/audiogame-manager"