install stage 2: start implementing
parent
a8a62834d4
commit
657f5f1d47
|
@ -1,4 +1,115 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
#debugging
|
||||
exec bash --norc --noprofile
|
||||
LOGFILE=/tmp/void-usb-install-log
|
||||
|
||||
function press_any_key {
|
||||
echo "Press any key to continue or Ctrl+c to abort..."
|
||||
read -n1 DISCARD_ME
|
||||
echo ""
|
||||
}
|
||||
|
||||
function yesno {
|
||||
unset DISCARD_ME
|
||||
while [ -z "$DISCARD_ME" ]; do
|
||||
read -p "[y/n] " -n1 DISCARD_ME
|
||||
case "$DISCARD_ME" in
|
||||
y)
|
||||
return 0
|
||||
;;
|
||||
n)
|
||||
return 1
|
||||
;;
|
||||
*)
|
||||
echo " Please enter y for yes or n for no."
|
||||
unset DISCARD_ME
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
[ -z "$TERM" ] && export TERM=linux
|
||||
|
||||
echo -n "Checking for internet connection..."
|
||||
INTERNET="down"
|
||||
WAITING=0
|
||||
while [ "$INTERNET" = "down" -a "$WAITING" -lt 15 ]; do
|
||||
sleep 1
|
||||
if ping -c2 repo-default.voidlinux.org >> $LOGFILE 2>&1; then
|
||||
INTERNET="up"
|
||||
fi
|
||||
WAITING=$((WAITING+1))
|
||||
echo -n "."
|
||||
done
|
||||
echo " $INTERNET"
|
||||
|
||||
if [ "$INTERNET" = "down" ]; then
|
||||
clear
|
||||
echo "Connect to WiFi?
|
||||
|
||||
Any network settings from before the reboot have not been saved and need to be entered again.
|
||||
Use 'Activate a connection' in the dialog to select your network.
|
||||
|
||||
Alternatively, you can continue without internet but the system will be left in a barebones state.
|
||||
"
|
||||
if yesno; then
|
||||
nmtui
|
||||
clear
|
||||
|
||||
echo -n "Checking for internet connection..."
|
||||
WAITING=0
|
||||
while [ "$INTERNET" = "down" -a "$WAITING" -lt 15 ]; do
|
||||
sleep 1
|
||||
if ping -c2 repo-default.voidlinux.org >> $LOGFILE 2>&1; then
|
||||
INTERNET="up"
|
||||
fi
|
||||
WAITING=$((WAITING+1))
|
||||
echo -n "."
|
||||
done
|
||||
echo " $INTERNET"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$INTERNET" = "up" ]; then
|
||||
echo -n "Retrieving package lists... "
|
||||
xbps-install --sync >>$LOGFILE 2>&1
|
||||
echo "done"
|
||||
fi
|
||||
|
||||
readarray -t SECTIONS < /opt/void-usb/installer/package_selections/sections.lst
|
||||
for I in ${!SECTIONS[@]}; do
|
||||
readarray -t OPTIONS < "/opt/void-usb/installer/package_selections/${SECTIONS[$I]}/options.lst"
|
||||
AVAILABLE_OPTIONS=()
|
||||
for J in ${!OPTIONS[@]}; do
|
||||
source "/opt/void-usb/installer/package_selections/${SECTIONS[$I]}/${OPTIONS[$J]}"
|
||||
if check; then
|
||||
AVAILABLE_OPTIONS+=("${OPTIONS[$J]}")
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "${AVAILABLE_OPTIONS[1]}" ]; then
|
||||
# no need to ask, there is only one option anyway
|
||||
CHOICE="${AVAILABLE_OPTIONS[0]}"
|
||||
else
|
||||
clear
|
||||
cat "/opt/void-usb/installer/package_selections/${SECTIONS[$I]}/description.txt"
|
||||
for J in ${!AVAILABLE_OPTIONS[@]}; do
|
||||
source "/opt/void-usb/installer/package_selections/${SECTIONS[$I]}/${AVAILABLE_OPTIONS[$J]}"
|
||||
echo "$J: $DESCRIPTION"
|
||||
done
|
||||
CHOICE=""
|
||||
while [ -z "$CHOICE" ]; do
|
||||
echo "Select by entering the corresponding number."
|
||||
read -p "> " CHOICE_NUMBER
|
||||
CHOICE="${AVAILABLE_OPTIONS[$CHOICE_NUMBER]}"
|
||||
done
|
||||
fi
|
||||
|
||||
source "/opt/void-usb/installer/package_selections/${SECTIONS[$I]}/$CHOICE"
|
||||
if [ -n "$PACKAGES" ]; then
|
||||
xbps-install --yes $PACKAGES
|
||||
fi
|
||||
post_install
|
||||
done
|
||||
|
||||
bash --norc --noprofile
|
||||
|
|
Loading…
Reference in New Issue