Add more automation to early setup
This commit is contained in:
parent
be74c0c40f
commit
c57cc058fb
@ -2836,7 +2836,7 @@ ofn()
|
|||||||
die()
|
die()
|
||||||
{
|
{
|
||||||
# cleanup and exit the installer cleanly with exit code $1
|
# cleanup and exit the installer cleanly with exit code $1
|
||||||
local e="$1" # when e is 127 unmount /run/archiso/bootmnt and reboot
|
local e="${1:-$?}" # when e is 127 unmount /run/archiso/bootmnt and reboot
|
||||||
|
|
||||||
trap - INT
|
trap - INT
|
||||||
tput cnorm
|
tput cnorm
|
||||||
@ -3158,12 +3158,14 @@ umount_dir()
|
|||||||
|
|
||||||
chk_connect()
|
chk_connect()
|
||||||
{
|
{
|
||||||
|
if [[ ! -f /tmp/new ]]; then
|
||||||
msg "Network Connect" "\nVerifying network connection\n" 0
|
msg "Network Connect" "\nVerifying network connection\n" 0
|
||||||
if [[ $VM != 'none' ]] && hash nm-online > /dev/null 2>&1; then
|
if [[ $VM != 'none' ]] && hash nm-online > /dev/null 2>&1; then
|
||||||
nm-online > /dev/null 2>&1
|
nm-online > /dev/null 2>&1
|
||||||
else
|
else
|
||||||
ping -qc1 'archlinux.org' > /dev/null 2>&1
|
ping -qc1 'archlinux.org' > /dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
net_connect()
|
net_connect()
|
||||||
@ -3248,7 +3250,7 @@ termcol
|
|||||||
|
|
||||||
# ensure the required packages are installed and that we're running as root on x86_64 architecture
|
# ensure the required packages are installed and that we're running as root on x86_64 architecture
|
||||||
if ! hash dialog rsync find parted curl arch-chroot >/dev/null 2>&1; then
|
if ! hash dialog rsync find parted curl arch-chroot >/dev/null 2>&1; then
|
||||||
printf "One or more required packages are missing: dialog, curl, rsync, parted, findutils, arch-install-scripts"
|
echo "One or more required packages are missing: dialog, curl, rsync, parted, findutils, arch-install-scripts"
|
||||||
die 1
|
die 1
|
||||||
elif (( UID != 0 )); then
|
elif (( UID != 0 )); then
|
||||||
msg "Not Root" "\nThis installer must be run as root or using sudo.\n\nExiting..\n" 2
|
msg "Not Root" "\nThis installer must be run as root or using sudo.\n\nExiting..\n" 2
|
||||||
@ -3256,34 +3258,23 @@ elif (( UID != 0 )); then
|
|||||||
elif ! grep -qwm 1 'lm' /proc/cpuinfo; then
|
elif ! grep -qwm 1 'lm' /proc/cpuinfo; then
|
||||||
msg "Not x86_64 Architecture" "\nThis installer only supports x86_64 architectures.\n\nExiting..\n" 2
|
msg "Not x86_64 Architecture" "\nThis installer only supports x86_64 architectures.\n\nExiting..\n" 2
|
||||||
die 1
|
die 1
|
||||||
elif [[ ! -d $MNT ]]; then
|
|
||||||
msg "No Mount Directory" "\nThe installer expects an existing directory for mounting.\n\nExiting..\n" 2
|
|
||||||
die 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# trap ^C to perform cleanup
|
# trap ^C to perform cleanup
|
||||||
trap 'printf "\n^C\n" && die 1' INT
|
trap 'printf "\n^C\n" && die 1' INT
|
||||||
|
|
||||||
while getopts ":htl:dnr:b:" OPT; do
|
while getopts ":htl:Dnr:b:m:d:" OPT; do
|
||||||
case "$OPT" in
|
case "$OPT" in
|
||||||
n)
|
n)
|
||||||
NOMOUNT=true
|
NOMOUNT=true
|
||||||
;;
|
;;
|
||||||
r)
|
m)
|
||||||
if [[ ! -b $OPTARG ]]; then
|
MNT="$OPTARG"
|
||||||
echo "invalid root: $OPTARG"
|
|
||||||
die 1
|
|
||||||
fi
|
|
||||||
ROOT=$OPTARG
|
|
||||||
;;
|
|
||||||
b)
|
|
||||||
if [[ ! -b $OPTARG ]]; then
|
|
||||||
echo "invalid boot: $OPTARG"
|
|
||||||
die 1
|
|
||||||
fi
|
|
||||||
BOOT=$OPTARG
|
|
||||||
;;
|
;;
|
||||||
d)
|
d)
|
||||||
|
DIST="$OPTARG"
|
||||||
|
;;
|
||||||
|
D)
|
||||||
debug
|
debug
|
||||||
;;
|
;;
|
||||||
h)
|
h)
|
||||||
@ -3292,11 +3283,26 @@ while getopts ":htl:dnr:b:" OPT; do
|
|||||||
t)
|
t)
|
||||||
TEARFREE=true
|
TEARFREE=true
|
||||||
;;
|
;;
|
||||||
|
r)
|
||||||
|
if [[ ! -b $OPTARG ]]; then
|
||||||
|
msg "Invalid Root" "\nThe installer expects a full path to a block device for root.\n\nExiting..\n" 2
|
||||||
|
die 1
|
||||||
|
fi
|
||||||
|
ROOT="$OPTARG"
|
||||||
|
;;
|
||||||
|
b)
|
||||||
|
if [[ ! -b $OPTARG ]]; then
|
||||||
|
msg "Invalid Boot" "\nThe installer expects a full path to a block device for boot.\n\nExiting..\n" 2
|
||||||
|
die 1
|
||||||
|
fi
|
||||||
|
BOOT="$OPTARG"
|
||||||
|
;;
|
||||||
l)
|
l)
|
||||||
if [[ "${!WM_SESSIONS[*]}" =~ $OPTARG ]]; then
|
if [[ "${!WM_SESSIONS[*]}" =~ $OPTARG ]]; then
|
||||||
live "$OPTARG"
|
live "$OPTARG"
|
||||||
else
|
else
|
||||||
echo "error: invalid session for -l, see -h for help"; die 1
|
echo "error: invalid session for -l, see -h for help"
|
||||||
|
die 1
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
\?)
|
\?)
|
||||||
@ -3306,12 +3312,20 @@ while getopts ":htl:dnr:b:" OPT; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [[ ! -d $MNT ]]; then
|
||||||
|
msg "Invalid Mountpoint" "\nThe installer expects an existing directory for mounting.\n\nExiting..\n" 2
|
||||||
|
die 1
|
||||||
|
elif [[ -z $DIST ]]; then
|
||||||
|
msg "Invalid Distribution" "\nThe distribution name cannot be empty.\n\nExiting..\n" 2
|
||||||
|
die 1
|
||||||
|
fi
|
||||||
|
|
||||||
system_identify
|
system_identify
|
||||||
system_devices
|
system_devices
|
||||||
|
|
||||||
if [[ $NOMOUNT ]]; then
|
if [[ $NOMOUNT ]]; then
|
||||||
if [[ (-z $ROOT || ($SYS == 'UEFI' && -z $BOOT)) ]]; then
|
if [[ -z $ROOT || ($SYS == 'UEFI' && -z $BOOT) ]]; then
|
||||||
msg "Not Enough Partitions" "$_errpart" 0
|
msg "Invalid Partitions" "$_errpart" 0
|
||||||
die 1
|
die 1
|
||||||
fi
|
fi
|
||||||
if [[ $BOOT ]]; then
|
if [[ $BOOT ]]; then
|
||||||
@ -3320,12 +3334,13 @@ if [[ $NOMOUNT ]]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -f /tmp/hassetfont ]]; then
|
if [[ $TERM == 'linux' && -f /tmp/hassetfont ]]; then
|
||||||
FONT="$(< /tmp/hassetfont)"
|
FONT="$(< /tmp/hassetfont)"
|
||||||
setfont "$FONT"
|
setfont "$FONT"
|
||||||
else
|
else
|
||||||
fontsize=16
|
fontsize=16
|
||||||
while [[ ! -f /tmp/hassetfont ]]; do
|
FONT="ter-i${fontsize}n"
|
||||||
|
while [[ $TERM == 'linux' && ! -f /tmp/hassetfont ]]; do
|
||||||
dlg fontsize menu "Font Size" "\nSelect a font size from the list below.\n\nDefault: 16" \
|
dlg fontsize menu "Font Size" "\nSelect a font size from the list below.\n\nDefault: 16" \
|
||||||
12 "setfont ter-i12n" 14 "setfont ter-i14n" 16 "setfont ter-i16n" 18 "setfont ter-i18n" \
|
12 "setfont ter-i12n" 14 "setfont ter-i14n" 16 "setfont ter-i16n" 18 "setfont ter-i18n" \
|
||||||
20 "setfont ter-i20n" 22 "setfont ter-i22n" 24 "setfont ter-i24n" 28 "setfont ter-i28n" \
|
20 "setfont ter-i20n" 22 "setfont ter-i22n" 24 "setfont ter-i24n" 28 "setfont ter-i28n" \
|
||||||
@ -3349,6 +3364,18 @@ elif ! net_connect; then
|
|||||||
die 1
|
die 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ ! -f /tmp/new ]]; then
|
||||||
|
msg "Installer Update" "\nChecking that the installer version is the newest.\n" 0
|
||||||
|
if curl -fsSL https://bitbucket.org/archlabslinux/installer/raw/master/archlabs-installer -o /tmp/new; then
|
||||||
|
if (( $(vercmp "$(awk -F= '/^VER=/ {print $2}' /tmp/archlabs-installer)" "$VER") > 0 )); then
|
||||||
|
cp /tmp/new /usr/bin/archlabs-installer && exec archlabs-installer "$@"
|
||||||
|
die
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
msg "Download Failed" "\nUnable to download the latest version, continuing with the current.\n" 2
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ $NOMOUNT ]]; then
|
if [[ $NOMOUNT ]]; then
|
||||||
wrn="\nA background install process will begin early when using -n flag\n\nSome files may be overwritten during the process\n"
|
wrn="\nA background install process will begin early when using -n flag\n\nSome files may be overwritten during the process\n"
|
||||||
yesno "Data Warning" "$wrn\nProceed?\n" || die 0
|
yesno "Data Warning" "$wrn\nProceed?\n" || die 0
|
||||||
|
Reference in New Issue
Block a user