fix: rewrite netinstall and calamares launcher
- netinstall.conf: add required:true, file:// prefix, label config - netinstall.yaml: flat group structure with proper DE package lists - settings_online.conf: fix netinstall exec ordering - calamares-next.sh: comprehensive yad-based launcher with logging - PKGBUILD: pkgrel 9, yad as dependency
This commit is contained in:
@@ -1,64 +1,198 @@
|
||||
#!/bin/bash
|
||||
# Antergos NeXT Installer Launcher
|
||||
# Presents offline/online choice and launches Calamares with the right config
|
||||
|
||||
set -e
|
||||
# Antergos NeXT Calamares Installer Launcher
|
||||
|
||||
# Prefer zenity (GTK), fall back to dialog (curses)
|
||||
if command -v zenity &>/dev/null; then
|
||||
DIALOG="zenity"
|
||||
elif command -v kdialog &>/dev/null; then
|
||||
DIALOG="kdialog"
|
||||
else
|
||||
DIALOG=""
|
||||
fi
|
||||
GUIDIE() {
|
||||
echo "calamares-next: $1" | sed -e 's|<tt>||g' -e 's|</tt>||g'
|
||||
|
||||
# Check for internet connectivity
|
||||
check_net() {
|
||||
ping -c 1 -W 2 archlinux.org &>/dev/null
|
||||
local prog=yad
|
||||
command -v yad &>/dev/null || prog=zenity
|
||||
|
||||
local cmd=(
|
||||
"$prog" --form --title="Error detected"
|
||||
--text="<b>calamares-next:</b>\n$1\n"
|
||||
--image=dialog-error
|
||||
--button=yad-quit:1
|
||||
)
|
||||
"${cmd[@]}"
|
||||
exit 1
|
||||
}
|
||||
|
||||
CHOICE=""
|
||||
if [ -n "$DIALOG" ]; then
|
||||
if [ "$DIALOG" = "zenity" ]; then
|
||||
CHOICE=$(zenity --list \
|
||||
--title="Antergos NeXT Installer" \
|
||||
--text="Choose installation mode:" \
|
||||
--width=500 --height=300 \
|
||||
--column="Mode" --column="Description" \
|
||||
"Offline" "Install GNOME desktop from the live ISO. No internet required." \
|
||||
"Online" "Choose a desktop environment and install from the internet.")
|
||||
else
|
||||
CHOICE=$(kdialog --menu "Antergos NeXT Installer\nChoose installation mode:" \
|
||||
"Offline" "Install GNOME desktop from the live ISO. No internet required." \
|
||||
"Online" "Choose a desktop environment and install from the internet.")
|
||||
fi
|
||||
else
|
||||
echo "Antergos NeXT Installer"
|
||||
echo "======================"
|
||||
echo "1) Offline — Install GNOME from ISO (no internet)"
|
||||
echo "2) Online — Choose DE and install from internet"
|
||||
echo ""
|
||||
read -rp "Choice [1]: " n
|
||||
case "$n" in
|
||||
2|online|Online) CHOICE="Online" ;;
|
||||
*) CHOICE="Offline" ;;
|
||||
esac
|
||||
fi
|
||||
FollowFile() {
|
||||
local tailfile="$1"
|
||||
local term_title="$2"
|
||||
local xpos="$3"
|
||||
local ypos="$4"
|
||||
|
||||
case "$CHOICE" in
|
||||
"Online")
|
||||
# Online mode: use netinstall for DE selection, no unpackfs
|
||||
if ! check_net; then
|
||||
if [ -n "$DIALOG" ]; then
|
||||
"$DIALOG" --error --text="No internet connection detected.\n\nOnline installation requires a working network connection.\nPlease connect to the internet and try again."
|
||||
fi
|
||||
exit 1
|
||||
case "$CurrentDesktop" in
|
||||
xfce) xfce4-terminal -T "$term_title" --geometry="120x20+$xpos+$ypos" -x tail -f "$tailfile" & ;;
|
||||
kde) setsid konsole -e tail -f "$tailfile" &> /dev/null ;;
|
||||
esac
|
||||
}
|
||||
|
||||
CatchChrootedPacmanLog() {
|
||||
local pacmanlog=""
|
||||
local lockfile="$HOME/.$progname.lck"
|
||||
|
||||
while true ; do
|
||||
sleep 2
|
||||
pacmanlog="$(/usr/bin/ls -1 /tmp/calamares-root-*/var/log/pacman.log 2>/dev/null | /usr/bin/tail -n 1)"
|
||||
if [ -n "$pacmanlog" ] ; then
|
||||
[ -r "$lockfile" ] && return
|
||||
/usr/bin/touch "$lockfile"
|
||||
FollowFile "$pacmanlog" "Pacman log" 400 50
|
||||
break
|
||||
fi
|
||||
exec calamares -c /etc/calamares-online
|
||||
;;
|
||||
*)
|
||||
# Offline mode: use unpackfs with GNOME squashfs
|
||||
exec calamares -c /etc/calamares-offline
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
LogHeader() {
|
||||
local calamares_version date
|
||||
calamares_version="$(pacman -Q calamares 2>/dev/null | awk '{print $NF}')"
|
||||
date=$(date -u "+%x %X")
|
||||
|
||||
cat <<EOF > $log
|
||||
########## $log by calamares-next
|
||||
########## Started (UTC): $date
|
||||
########## Install mode: $mode
|
||||
########## Calamares version: $calamares_version
|
||||
EOF
|
||||
}
|
||||
|
||||
InstallLog_Start() {
|
||||
LogHeader
|
||||
|
||||
if [ "$ShowInstallLog" = "TRUE" ] ; then
|
||||
FollowFile "$log" "Install log" 20 20
|
||||
fi
|
||||
}
|
||||
|
||||
Calamares_Start() {
|
||||
local kdesu=/usr/lib/kf6/kdesu
|
||||
[ -x $kdesu ] || kdesu=kdesu
|
||||
|
||||
case "$CurrentDesktop" in
|
||||
kde) $kdesu -t -c "calamares -D8" >> $log & ;;
|
||||
*) pkexec calamares -D8 >> $log & ;;
|
||||
esac
|
||||
}
|
||||
|
||||
AskMode() {
|
||||
local ICO="/usr/share/calamares/branding/antergos-next/antergos-icon.png"
|
||||
[ -f "$ICO" ] || ICO="system-software-install"
|
||||
|
||||
local cmd=(
|
||||
yad --form
|
||||
--title="Antergos NeXT Installer"
|
||||
--text="Choose installation mode:"
|
||||
--image="$ICO"
|
||||
--columns=2 --borders=10 --homogeneous
|
||||
--height=180 --width=600 --scroll
|
||||
--buttons-layout=spread
|
||||
)
|
||||
|
||||
if [ "$has_connection" = yes ] ; then
|
||||
cmd+=(
|
||||
--field="Online: Full desktop selection from the internet\nChoose your desktop environment, customize packages,\nget the latest updates.":LBL ""
|
||||
--field="Offline: Quick install from the live ISO\nInstall GNOME desktop directly from the ISO.\nNo internet required.":LBL ""
|
||||
--button="Online":11
|
||||
--button="Offline":13
|
||||
)
|
||||
else
|
||||
cmd+=(
|
||||
--field="Offline: Quick install from the live ISO\nInstall GNOME desktop directly from the ISO.":LBL ""
|
||||
--button="Offline":13
|
||||
)
|
||||
fi
|
||||
|
||||
"${cmd[@]}"
|
||||
}
|
||||
|
||||
InstallWithLogs() {
|
||||
InstallLog_Start
|
||||
Calamares_Start
|
||||
|
||||
if [ "$ShowPacmanLog" = "FALSE" ] ; then
|
||||
sleep 5
|
||||
return
|
||||
fi
|
||||
|
||||
case "$mode" in
|
||||
online) CatchChrootedPacmanLog ;;
|
||||
offline) CatchChrootedPacmanLog ;;
|
||||
esac
|
||||
}
|
||||
|
||||
SetConfig() {
|
||||
local cfolder=/etc/calamares
|
||||
|
||||
case "$mode" in
|
||||
online)
|
||||
sudo cp "$cfolder/settings_online.conf" "$cfolder/settings.conf"
|
||||
PreLog "Using online settings"
|
||||
;;
|
||||
offline)
|
||||
sudo cp "$cfolder/settings_offline.conf" "$cfolder/settings.conf"
|
||||
PreLog "Using offline settings"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
PreLog() {
|
||||
echo "==> $1" >> "$prelogfile"
|
||||
}
|
||||
|
||||
Main() {
|
||||
progname="${0##*/}"
|
||||
has_connection=no
|
||||
show_mode=yes
|
||||
|
||||
[ -x /usr/bin/calamares ] || GUIDIE "<tt>/usr/bin/calamares</tt> is needed for installing Antergos NeXT"
|
||||
|
||||
ping -c 1 -W 2 archlinux.org &>/dev/null && has_connection=yes
|
||||
|
||||
local CurrentDesktop=""
|
||||
if [ "$XDG_CURRENT_DESKTOP" ]; then
|
||||
CurrentDesktop=$(echo "$XDG_CURRENT_DESKTOP" | tr '[:upper:]' '[:lower:]')
|
||||
elif [ "$DESKTOP_SESSION" ]; then
|
||||
CurrentDesktop=$(echo "$DESKTOP_SESSION" | tr '[:upper:]' '[:lower:]')
|
||||
fi
|
||||
|
||||
local ShowInstallLog="FALSE"
|
||||
local ShowPacmanLog="FALSE"
|
||||
local Home=/home/liveuser
|
||||
local log=$Home/antergos-install.log
|
||||
local cfolder=/etc/calamares
|
||||
local workdir=""
|
||||
local prelogfile=""
|
||||
|
||||
workdir="$Home/work.$progname.xyz"
|
||||
mkdir -p "$workdir"
|
||||
|
||||
prelogfile="$workdir/preliminary.log"
|
||||
rm -f "$prelogfile"
|
||||
|
||||
if [ "$show_mode" = yes ] ; then
|
||||
AskMode
|
||||
ret=$?
|
||||
case $ret in
|
||||
11) mode=online ;;
|
||||
13) mode=offline ;;
|
||||
*) exit $ret ;;
|
||||
esac
|
||||
else
|
||||
mode=offline
|
||||
fi
|
||||
|
||||
case "$mode" in
|
||||
online|offline)
|
||||
SetConfig
|
||||
InstallWithLogs
|
||||
;;
|
||||
*)
|
||||
GUIDIE "unsupported mode '$mode'"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
Main "$@"
|
||||
|
||||
Reference in New Issue
Block a user