Cleanup some dialogs, improve text, and offer more output during install

This commit is contained in:
natemaia 2019-01-12 16:30:43 -08:00
parent e0bb71db98
commit b4e5e00147
2 changed files with 115 additions and 112 deletions

View File

@ -25,7 +25,7 @@ _NoNetwork="\nThis installer needs to be run with an active internet connection
# Preparation Menu # Preparation Menu
_PrepTitle="Prepare System for Install" _PrepTitle="Prepare System for Install"
_PrepBody="\nFollow the below steps in order.\n\nTo begin the install, a root (/) partition must first be mounted and the system settings must be configured (UEFI systems also require a boot partition to be mounted).\n\nIf you have already created a partition table and partition(s) you can begin mounting and skip over the editing step." _PrepBody="\nThis is the menu in which you will prepare your system for the install.\n\nTo begin the install you must first have:\n\n - A root (/) partition mounted (UEFI systems also require a seperate boot partition)\n - System settings must be configured\n - A new user must be created and the passwords set.\n\nIf you have already created your partition(s) there is no need to use the edit partition step, simply move on to mounting."
_PrepLayout="Select keyboard layout" _PrepLayout="Select keyboard layout"
_PrepShowDev="Show device tree (optional)" _PrepShowDev="Show device tree (optional)"
_PrepParts="Edit partitions (optional)" _PrepParts="Edit partitions (optional)"
@ -72,29 +72,29 @@ _WMChoice="Select WMs or DEs"
_WMChoiceBody="\nUse [Space] to toggle the selection of your desired window manager(s) or desktop environment(s).\n\nDepending on your choice additional packages may be installed to improve the experience." _WMChoiceBody="\nUse [Space] to toggle the selection of your desired window manager(s) or desktop environment(s).\n\nDepending on your choice additional packages may be installed to improve the experience."
_Packages="Install Packages" _Packages="Install Packages"
_PackageMenu="\nSelect a package category to choose packages from that category.\n\nWhen finished select '$_Done' to finalize choices and continue.\n\nAdditional packages can be added by simply re-visiting the menu, however removing choices will require starting from the beginning of the configure menu." _PackageMenu="\nSelect a package category to choose packages from, when finished select '$_Done' to finalize choices and continue."
_PackageBody="\nUse [Space] to (de)select packages(s) to install from the list below.\n\nNOTE: Some packages may already be installed by your DE (if any) or added automatically depending on your choice of WM. Additionally, extra packages may be installed to improve the experience for another choice eg. when installing qutebrowser qt5ct (the Qt5 theme tool) will also be installed." _PackageBody="\nUse [Space] to toggle the selection of packages(s) and press [Enter] to accept the selection.\n\nNOTE: Some packages may already be installed by your desktop environment (if any). Extra packages may also be installed for the chosen packages eg. install qutebrowser and qt5ct (the Qt5 theme tool) will also be installed."
# login setup # login setup
_WMLogin="Setup Login Managment" _WMLogin="Setup Login Managment"
_LoginTypeBody="\nSelect which login managment to use." _LoginTypeBody="\nSelect which login managment to use."
_AutoLoginBody="\nDo you want auto login+startx enabled?" _AutoLoginBody="\nDo you want auto login+startx enabled?"
_WMLoginBody="\nSelect which to use as your primary login session.\n\nThis can be changed by editing your ~/.xinitrc" _WMLoginBody="\nSelect which to use as your primary login session.\n\nThis can be changed by editing your ~/.xinitrc."
# Set keymap, hwclock, local and timezone # Set keymap, hwclock, local and timezone
_CMapTitle="Virtual Console Keymap" _CMapTitle="Virtual Console Keymap"
_CMapBody="\nSelect virtual console keymap.\n\nVirtual console is the shell prompt before reaching a graphical environment (Xorg).\n\nIts keymap is seperate from the one used by Xorg.\n\nDefault: us" _CMapBody="\nSelect virtual console keymap.\n\nVirtual console is the shell prompt before reaching a graphical environment (Xorg).\n\nIts keymap is seperate from the one used by Xorg.\n\nDefault: us"
_XMapBody="\nSelect the system wide keymap, this is the keyboard layout used once a graphical environment (Xorg) is running.\n\nIf a matching virtual console keymap exists it will be used, otherwise you will be asked to pick one.\n\nDefault: us" _XMapBody="\nSelect the system wide keymap, this is the keyboard layout used once a graphical environment (Xorg) is running.\n\nIf a matching virtual console keymap exists it will be used, otherwise you will be asked to pick one.\n\nDefault: us"
_LocaleBody="\nLocale determines the date, time, currency, and language.\n\nThe format is language_COUNTRY\n\neg. en_US: english United States\n en_GB: english Great Britain" _LocaleBody="\nLocale determines the system language and currency formats.\n\nThe format for locale name structure is languagecode_COUNTRYCODE\n\neg. en_US is: english United States\n en_GB is: english Great Britain"
# Configure # Configure
_ConfLocale="System Language and Locale" _ConfLocale="System Language and Locale"
_ConfHost="System Hostname" _ConfHost="System Hostname"
_HostNameBody="\nEnter the hostname for the new system.\n\nA hostname is used to identify systems on the network.\n\nIt's restricted to alphanumeric characters (a-z, A-Z, 0-9).\nIt can contain hyphens (-) BUT NOT at the beggining or end." _HostNameBody="\nEnter a hostname for the new system.\n\nA hostname is used to identify systems on the network.\n\nIt's restricted to alphanumeric characters (a-z, A-Z, 0-9).\nIt can contain hyphens (-) BUT NOT at the beggining or end."
# Create new user and set password # Create new user and set password
_UserTitle="Create New User" _UserTitle="Create New User"
_UserBody="\nEnter the name and password for your new user account.\n\nThe name must not use capital letters, contain any periods (.), end with a hyphen (-), or include any colons (:)\n\nNOTE: Use the arrow keys to switch between input fields, [Tab] to toggle between input fields and the buttons, or just press [Enter] to accept." _UserBody="\nEnter a name and password for the new user account.\n\nThe name must not use capital letters, contain any periods (.), end with a hyphen (-), or include any colons (:)\n\nNOTE: Use the arrow keys to switch between input fields, [Tab] to toggle between input fields and the buttons, or just press [Enter] to accept."
_UserSetBody="\nCreating user and setting groups..\n" _UserSetBody="\nCreating user and setting groups..\n"
_Username="Username:" _Username="Username:"
_Password="Password:" _Password="Password:"

View File

@ -8,7 +8,7 @@
# Some ideas and code has been taken from other installers # Some ideas and code has been taken from other installers
# AIF, Cnichi, Calamares, The Arch Wiki.. Credit where credit is due # AIF, Cnichi, Calamares, The Arch Wiki.. Credit where credit is due
VER="1.8.15" # version VER="1.8.16" # version
DIST="ArchLabs" # distributor DIST="ArchLabs" # distributor
MNT="/mnt" # mountpoint MNT="/mnt" # mountpoint
@ -28,7 +28,7 @@ main()
tput civis tput civis
SELECTED=$(dialog --cr-wrap --stdout --backtitle "$BT" \ SELECTED=$(dialog --cr-wrap --stdout --backtitle "$BT" \
--title " $_PrepTitle " --default-item $SELECTED \ --title " $_PrepTitle " --default-item $SELECTED \
--cancel-label 'Exit' --menu "$_PrepBody" 0 0 14 \ --cancel-label 'Exit' --menu "$_PrepBody" 0 0 0 \
"1" "$_PrepShowDev" \ "1" "$_PrepShowDev" \
"2" "$_PrepParts" \ "2" "$_PrepParts" \
"3" "$_PrepLUKS" \ "3" "$_PrepLUKS" \
@ -134,7 +134,8 @@ cfg_menu()
fi fi
tput civis tput civis
if ! LOCALE="$(menubox "$_ConfLocale" "$_LocaleBody" $LOCALES)"; then if ! LOCALE="$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" \
--title " $_ConfLocale " --menu "$_LocaleBody" 0 0 $((LINES - 10)) $LOCALES)"; then
return 1 return 1
fi fi
@ -156,7 +157,7 @@ mkuser()
local values local values
if ! values="$(dialog --stdout --no-cancel --separator '~' \ if ! values="$(dialog --stdout --no-cancel --separator '~' \
--ok-label "Submit" --backtitle "$BT" --title " $_UserTitle " \ --ok-label "Submit" --backtitle "$BT" --title " $_UserTitle " \
--insecure --mixedform "$_UserBody" 0 0 14 \ --insecure --mixedform "$_UserBody" 0 0 0 \
"$_Username" 1 1 "" 1 $((${#_Username} + 2)) $COLUMNS 0 0 \ "$_Username" 1 1 "" 1 $((${#_Username} + 2)) $COLUMNS 0 0 \
"$_Password" 2 1 "" 2 $((${#_Password} + 2)) $COLUMNS 0 1 \ "$_Password" 2 1 "" 2 $((${#_Password} + 2)) $COLUMNS 0 1 \
"$_Password2" 3 1 "" 3 $((${#_Password2} + 2)) $COLUMNS 0 1 \ "$_Password2" 3 1 "" 3 $((${#_Password2} + 2)) $COLUMNS 0 1 \
@ -200,7 +201,8 @@ mkuser()
select_keymap() select_keymap()
{ {
tput civis tput civis
if ! KEYMAP="$(menubox "$_PrepLayout" "$_XMapBody" \ if ! KEYMAP="$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" \
--title " $_PrepLayout " --menu "$_XMapBody" 0 0 $((LINES - 10)) \
'us' 'English' 'cm' 'English' 'gb' 'English' 'au' 'English' 'gh' 'English' \ 'us' 'English' 'cm' 'English' 'gb' 'English' 'au' 'English' 'gh' 'English' \
'za' 'English' 'ng' 'English' 'ca' 'French' 'cd' 'French' 'gn' 'French' \ 'za' 'English' 'ng' 'English' 'ca' 'French' 'cd' 'French' 'gn' 'French' \
'tg' 'French' 'fr' 'French' 'de' 'German' 'at' 'German' 'ch' 'German' \ 'tg' 'French' 'fr' 'French' 'de' 'German' 'at' 'German' 'ch' 'German' \
@ -257,7 +259,8 @@ select_timezone()
return 1 return 1
fi fi
if ! SUBZONE="$(menubox "$_TimeZTitle" "$_TimeSubZBody" ${SUBZONES[$ZONE]})"; then if ! SUBZONE="$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" \
--title " $_TimeZTitle " --menu "$_TimeSubZBody" 0 0 $((LINES - 10)) ${SUBZONES[$ZONE]})"; then
return 1 return 1
fi fi
@ -344,7 +347,7 @@ select_packages()
tput civis tput civis
SELECTED=$(dialog --cr-wrap --no-cancel --stdout \ SELECTED=$(dialog --cr-wrap --no-cancel --stdout \
--backtitle "$BT" --title " $_Packages " \ --backtitle "$BT" --title " $_Packages " \
--default-item $SELECTED --menu "$_PackageMenu" 0 0 14 \ --default-item $SELECTED --menu "$_PackageMenu" 0 0 0 \
1 "Browsers" \ 1 "Browsers" \
2 "Editors" \ 2 "Editors" \
3 "Terminals" \ 3 "Terminals" \
@ -388,11 +391,11 @@ select_mirrorcmd()
local key="5f29642060ab983b31fdf4c2935d8c56" local key="5f29642060ab983b31fdf4c2935d8c56"
if hash reflector >/dev/null 2>&1; then if hash reflector >/dev/null 2>&1; then
MIRROR_CMD="reflector --score 100 -l 50 -f 10 --sort rate --verbose" MIRROR_CMD="reflector --score 100 -l 50 -f 5 --sort rate --verbose"
yesno "$_MirrorTitle" "$_MirrorSetup" "Automatic" "Custom" && return 0 yesno "$_MirrorTitle" "$_MirrorSetup" "Automatic" "Custom" && return 0
c="$(json 'country_name' "$(json 'ip' "check&?access_key=${key}&fields=ip")?access_key=${key}&fields=country_name")" c="$(json 'country_name' "$(json 'ip' "check&?access_key=${key}&fields=ip")?access_key=${key}&fields=country_name")"
MIRROR_CMD="reflector --country $c --score 80 --latest 40 --fastest 10 --sort rate --verbose" MIRROR_CMD="reflector --country $c --fastest 5 --sort rate --verbose"
tput cnorm tput cnorm
MIRROR_CMD="$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" \ MIRROR_CMD="$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" \
@ -412,13 +415,12 @@ select_mirrorcmd()
local w="https://www.archlinux.org/mirrorlist" local w="https://www.archlinux.org/mirrorlist"
if [[ $c ]]; then if [[ $c ]]; then
if [[ $c =~ (CA|US) ]]; then if [[ $c =~ (CA|US) ]]; then
MIRROR_CMD="curl -s '$w/?country=US&country=CA&protocol=https&use_mirror_status=on'" MIRROR_CMD="curl -s '$w/?country=US&country=CA&use_mirror_status=on'"
else else
MIRROR_CMD="curl -s '$w/?country=${c}&protocol=https&use_mirror_status=on'" MIRROR_CMD="curl -s '$w/?country=${c}&use_mirror_status=on'"
fi fi
else else
local countries="country=US&country=CA&country=NZ&country=GB&country=AU" MIRROR_CMD="curl -s '$w/?country=US&country=CA&country=NZ&country=GB&country=AU&use_mirror_status=on'"
MIRROR_CMD="curl -s '$w/?$countries&protocol=https&use_mirror_status=on'"
fi fi
fi fi
return 0 return 0
@ -431,7 +433,7 @@ edit_configs()
tput civis tput civis
local choice local choice
choice=$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" \ choice=$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" \
--title " $_EditTitle " --menu "$_EditBody" 0 0 14 "$str" "-" \ --title " $_EditTitle " --menu "$_EditBody" 0 0 0 "$str" "-" \
"keyboard" "${EDIT_FILES[keyboard]}" \ "keyboard" "${EDIT_FILES[keyboard]}" \
"console" "${EDIT_FILES[console]}" \ "console" "${EDIT_FILES[console]}" \
"locale" "${EDIT_FILES[locale]}" \ "locale" "${EDIT_FILES[locale]}" \
@ -730,14 +732,10 @@ confirm_mount()
local part="$1" local part="$1"
local mount="$2" local mount="$2"
if [[ $mount == "$MNT" ]]; then [[ $mount == "$MNT" ]] && local m="/ (root)" || local m="${mount#$MNT}"
local msg="Partition: $part\nMountpoint: / (root)"
else
local msg="Partition: $part\nMountpoint: ${mount#$MNT}"
fi
if [[ $(mount) == *"$mount"* ]]; then if [[ $(mount) == *"$mount"* ]]; then
infobox "$_MntTitle" "$_MntSucc\n$msg\n" 1 infobox "$_MntTitle" "$_MntSucc\nPartition: $part\nMountpoint: $m\n" 1
decr_count "$part" decr_count "$part"
else else
infobox "$_MntTitle" "$_MntFail\n$msg\n" 1 infobox "$_MntTitle" "$_MntFail\n$msg\n" 1
@ -758,7 +756,6 @@ check_cryptlvm()
if [[ $(lsblk -lno TYPE "$part") =~ 'crypt' ]]; then if [[ $(lsblk -lno TYPE "$part") =~ 'crypt' ]]; then
LUKS='encrypted' LUKS='encrypted'
LUKS_NAME="${part#/dev/mapper/}" LUKS_NAME="${part#/dev/mapper/}"
for dev in $(awk '/lvm/ && /crypto_LUKS/ {print "/dev/mapper/"$1}' <<< "$devs" | uniq); do for dev in $(awk '/lvm/ && /crypto_LUKS/ {print "/dev/mapper/"$1}' <<< "$devs" | uniq); do
if grep -q "$LUKS_NAME" <<< "$(lsblk -lno NAME "$dev")"; then if grep -q "$LUKS_NAME" <<< "$(lsblk -lno NAME "$dev")"; then
LUKS_DEV="$LUKS_DEV cryptdevice=$dev:$LUKS_NAME" LUKS_DEV="$LUKS_DEV cryptdevice=$dev:$LUKS_NAME"
@ -773,11 +770,9 @@ check_cryptlvm()
break break
fi fi
done done
elif [[ $(lsblk -lno TYPE "$part") =~ 'lvm' ]]; then elif [[ $(lsblk -lno TYPE "$part") =~ 'lvm' ]]; then
LVM='logical volume' LVM='logical volume'
VOLUME_NAME="${part#/dev/mapper/}" VOLUME_NAME="${part#/dev/mapper/}"
for dev in $(awk '/crypt/ && /lvm2_member/ {print "/dev/mapper/"$1}' <<< "$devs" | uniq); do for dev in $(awk '/crypt/ && /lvm2_member/ {print "/dev/mapper/"$1}' <<< "$devs" | uniq); do
if grep -q "$VOLUME_NAME" <<< "$(lsblk -lno NAME "$dev")"; then if grep -q "$VOLUME_NAME" <<< "$(lsblk -lno NAME "$dev")"; then
LUKS_NAME="$(sed 's~/dev/mapper/~~g' <<< "$dev")" LUKS_NAME="$(sed 's~/dev/mapper/~~g' <<< "$dev")"
@ -975,11 +970,7 @@ select_swap()
{ {
# Ask user to select partition or create swapfile # Ask user to select partition or create swapfile
tput civis tput civis
if ! SWAP_PART="$(menubox "$_SelSwpSetup" "$_SelSwpBody" \ if ! SWAP_PART="$(menubox "$_SelSwpSetup" "$_SelSwpBody" "$_SelSwpNone" "-" "$_SelSwpFile" "$SYS_MEM" $PARTS)" || [[ $SWAP_PART == "$_SelSwpNone" ]]
"$_SelSwpNone" "-" \
"$_SelSwpFile" "$SYS_MEM" \
$PARTS)" ||
[[ $SWAP_PART == "$_SelSwpNone" ]]
then then
SWAP_PART="" SWAP_PART=""
return 0 return 0
@ -1034,8 +1025,8 @@ select_mount_opts()
ssd "$part" >/dev/null 2>&1 && opts=$(sed 's/discard - off/discard - on/' <<< "$opts") ssd "$part" >/dev/null 2>&1 && opts=$(sed 's/discard - off/discard - on/' <<< "$opts")
tput civis tput civis
if ! MNT_OPTS="$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" --title " $title " \ if ! MNT_OPTS="$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" --title " $title " --checklist "$_MntBody" 0 0 0 $opts)" || [[ $MNT_OPTS == "" ]]
--checklist "$_MntBody" 0 0 0 $opts)" || [[ $MNT_OPTS == "" ]]; then then
return 1 return 1
fi fi
@ -1067,6 +1058,7 @@ select_filesystem()
"nilfs2" "${FS_CMDS[nilfs2]}" \ "nilfs2" "${FS_CMDS[nilfs2]}" \
"reiserfs" "${FS_CMDS[reiserfs]}" \ "reiserfs" "${FS_CMDS[reiserfs]}" \
"xfs" "${FS_CMDS[xfs]}")" "xfs" "${FS_CMDS[xfs]}")"
[[ $fs == "$_Skip" ]] && return 0
else else
fs="$(menubox "$_FSTitle: $part" "${msg}${part}$_FSBody" \ fs="$(menubox "$_FSTitle: $part" "${msg}${part}$_FSBody" \
"ext4" "${FS_CMDS[ext4]}" \ "ext4" "${FS_CMDS[ext4]}" \
@ -1080,12 +1072,7 @@ select_filesystem()
"reiserfs" "${FS_CMDS[reiserfs]}" \ "reiserfs" "${FS_CMDS[reiserfs]}" \
"xfs" "${FS_CMDS[xfs]}")" "xfs" "${FS_CMDS[xfs]}")"
fi fi
[[ $fs ]] || return 1
if ! [[ $fs ]]; then
return 1
elif [[ $fs == "$_Skip" ]]; then
return 0
fi
if yesno "$_FSTitle" "\nFormat $part as $fs?\n" "Format" "Go Back"; then if yesno "$_FSTitle" "\nFormat $part as $fs?\n" "Format" "Go Back"; then
format $part $fs format $part $fs
@ -1186,6 +1173,7 @@ install()
clear clear
tput cnorm tput cnorm
install_base install_base
printf "\nGenerating system /etc/fstab\n\n"
genfstab -U $MNT >$MNT/etc/fstab 2>$ERR genfstab -U $MNT >$MNT/etc/fstab 2>$ERR
echeck "genfstab -U $MNT >$MNT/etc/fstab" echeck "genfstab -U $MNT >$MNT/etc/fstab"
[[ -f $MNT/swapfile ]] && sed -i "s~${MNT}~~" $MNT/etc/fstab [[ -f $MNT/swapfile ]] && sed -i "s~${MNT}~~" $MNT/etc/fstab
@ -1203,21 +1191,24 @@ install()
install_base() install_base()
{ {
if [[ -e /run/archiso/sfs/airootfs/etc/skel ]]; then if [[ -e /run/archiso/sfs/airootfs/etc/skel ]]; then
rsync -ahv /run/archiso/sfs/airootfs/ $MNT/ 2>/dev/null rsync -ahv /run/archiso/sfs/airootfs/ $MNT/ 2>$ERR
echeck "rsync -ahv /run/archiso/sfs/airootfs/ $MNT/"
else else
mirrorlist_sort mirrorlist_sort
local packages
pacstrap $MNT base $KERNEL $UCODE $(grep -hv '^#' /usr/share/archlabs/installer/packages.txt) pacstrap $MNT base $KERNEL $UCODE $(grep -hv '^#' /usr/share/archlabs/installer/packages.txt)
echeck "pacstrap $MNT base $KERNEL $UCODE $(grep -hv '^#' /usr/share/archlabs/installer/packages.txt)"
fi fi
printf "\n" printf "\nRemoving archiso remains\n\n"
rm -rf $MNT/etc/mkinitcpio-archiso.conf rm -rf $MNT/etc/mkinitcpio-archiso.conf
find $MNT/usr/lib/initcpio -name 'archiso*' -type f -exec rm -rf '{}' \; find $MNT/usr/lib/initcpio -name 'archiso*' -type f -exec rm -rf '{}' \;
sed -i 's/volatile/auto/g' $MNT/etc/systemd/journald.conf sed -i 's/volatile/auto/g' $MNT/etc/systemd/journald.conf
if [[ $VM ]]; then if [[ $VM ]]; then
printf "\nRemoving xorg configs in /etc/X11/xorg.conf.d/ to avoid conflict in VMs\n\n"
rm -rfv $MNT/etc/X11/xorg.conf.d/*?.conf rm -rfv $MNT/etc/X11/xorg.conf.d/*?.conf
elif [[ $(lspci | grep ' VGA ' | grep 'Intel') != "" ]]; then elif [[ $(lspci | grep ' VGA ' | grep 'Intel') != "" ]]; then
printf "\nCreating intel GPU 'TearFree' config in /etc/X11/xorg.conf.d/20-intel.conf\n\n"
cat > $MNT/etc/X11/xorg.conf.d/20-intel.conf <<EOF cat > $MNT/etc/X11/xorg.conf.d/20-intel.conf <<EOF
Section "Device" Section "Device"
Identifier "Intel Graphics" Identifier "Intel Graphics"
@ -1228,16 +1219,18 @@ EOF
fi fi
if [[ -e /run/archiso/sfs/airootfs ]]; then if [[ -e /run/archiso/sfs/airootfs ]]; then
printf "\nCopying vmlinuz and ucode to /boot\n\n"
[[ $KERNEL != 'linux-lts' ]] && cp -vf $RUN/x86_64/vmlinuz $MNT/boot/vmlinuz-linux [[ $KERNEL != 'linux-lts' ]] && cp -vf $RUN/x86_64/vmlinuz $MNT/boot/vmlinuz-linux
[[ $UCODE && ! $VM ]] && cp -vf $RUN/${UCODE/-/_}.img $MNT/boot/${UCODE}.img [[ $UCODE && ! $VM ]] && cp -vf $RUN/${UCODE/-/_}.img $MNT/boot/${UCODE}.img
fi fi
printf "\n" printf "\nCopying network settings to /etc\n\n"
cp -fv /etc/resolv.conf $MNT/etc/ cp -fv /etc/resolv.conf $MNT/etc/
if [[ -e /etc/NetworkManager/system-connections ]]; then if [[ -e /etc/NetworkManager/system-connections ]]; then
cp -rvf /etc/NetworkManager/system-connections $MNT/etc/NetworkManager/ cp -rvf /etc/NetworkManager/system-connections $MNT/etc/NetworkManager/
fi fi
printf "\nSetting locale to $LOCALE\n\n"
cat > $MNT/etc/locale.conf << EOF cat > $MNT/etc/locale.conf << EOF
LANG=$LOCALE LANG=$LOCALE
EOF EOF
@ -1246,14 +1239,16 @@ LANG=$LOCALE
EOF EOF
sed -i "s/#en_US.UTF-8/en_US.UTF-8/g; s/#${LOCALE}/${LOCALE}/g" $MNT/etc/locale.gen sed -i "s/#en_US.UTF-8/en_US.UTF-8/g; s/#${LOCALE}/${LOCALE}/g" $MNT/etc/locale.gen
chrun "echo && locale-gen" 2>/dev/null chrun "echo && locale-gen" 2>/dev/null
printf "\n" printf "\nSetting timezone: $ZONE/$SUBZONE\n\n"
chrun "ln -svf /usr/share/zoneinfo/$ZONE/$SUBZONE /etc/localtime" 2>/dev/null chrun "ln -svf /usr/share/zoneinfo/$ZONE/$SUBZONE /etc/localtime" 2>/dev/null
if [[ $BROADCOM_WL == true ]]; then if [[ $BROADCOM_WL == true ]]; then
printf "\nBlacklisting modules for broadcom wireless: bmca\n\n"
echo 'blacklist bcma' >> $MNT/etc/modprobe.d/blacklist.conf echo 'blacklist bcma' >> $MNT/etc/modprobe.d/blacklist.conf
rm -f $MNT/etc/modprobe/ rm -f $MNT/etc/modprobe/
fi fi
printf "\nCreating keyboard configurations for keymap: $KEYMAP\n\n"
cat > $MNT/etc/X11/xorg.conf.d/00-keyboard.conf <<EOF cat > $MNT/etc/X11/xorg.conf.d/00-keyboard.conf <<EOF
# Use localectl(1) to instruct systemd-localed to update it. # Use localectl(1) to instruct systemd-localed to update it.
Section "InputClass" Section "InputClass"
@ -1275,6 +1270,7 @@ EOF
KEYMAP=$CMAP KEYMAP=$CMAP
FONT=$FONT FONT=$FONT
EOF EOF
printf "\nSetting system hostname: $HOSTNAME\n\n"
cat > $MNT/etc/hostname << EOF cat > $MNT/etc/hostname << EOF
$HOSTNAME $HOSTNAME
EOF EOF
@ -1290,8 +1286,11 @@ EOF
create_user() create_user()
{ {
# set root password and shell if needed printf "\nCreating user $NEWUSER, setting passwords, and setting shell\n\n"
# set root password, shell if needed
chrun "chpasswd <<< 'root:$ROOT_PASS'" chrun "chpasswd <<< 'root:$ROOT_PASS'"
cp -rf /etc/skel/. $MNT/root/
if [[ $MYSHELL != *zsh ]]; then if [[ $MYSHELL != *zsh ]]; then
chrun "usermod -s $MYSHELL root" chrun "usermod -s $MYSHELL root"
if [[ $MYSHELL == "/usr/bin/mksh" ]]; then if [[ $MYSHELL == "/usr/bin/mksh" ]]; then
@ -1403,15 +1402,23 @@ EOF
login_manager() login_manager()
{ {
printf "\nSetting up $LOGIN_TYPE\n\n"
SERVICE="$MNT/etc/systemd/system/getty@tty1.service.d" SERVICE="$MNT/etc/systemd/system/getty@tty1.service.d"
# remove welcome message # remove welcome message
sed -i '/printf/d' $MNT/root/.zshrc sed -i '/printf/d' $MNT/root/.zshrc
# remove unneeded shell files from installation
case $MYSHELL in case $MYSHELL in
"/bin/bash") rm -rf $MNT/home/$NEWUSER/.{zsh,mksh}* ;; "/bin/bash")
"/usr/bin/mksh") rm -rf $MNT/home/$NEWUSER/.{zsh,bash}* $MNT/home/$NEWUSER/.inputrc ;; rm -rf $MNT/home/$NEWUSER/.{zsh,mksh}* $MNT/root/.{zsh,mksh}*
"/usr/bin/zsh") rm -rf $MNT/home/$NEWUSER/.{bash,mksh}* $MNT/home/$NEWUSER/.inputrc ;; ;;
"/usr/bin/mksh")
rm -rf $MNT/home/$NEWUSER/.{zsh,bash}* $MNT/home/$NEWUSER/.inputrc $MNT/root/.{zsh,bash}* $MNT/root/.inputrc
;;
"/usr/bin/zsh")
rm -rf $MNT/home/$NEWUSER/.{bash,mksh}* $MNT/home/$NEWUSER/.inputrc $MNT/root/.{bash,mksh}* $MNT/root/.inputrc
;;
esac esac
if [[ $LOGIN_TYPE == 'lightdm' ]]; then if [[ $LOGIN_TYPE == 'lightdm' ]]; then
@ -1440,7 +1447,7 @@ mirrorlist_sort()
reflector --score 100 -l 50 -f 10 --sort rate --verbose --save $MNT/etc/pacman.d/mirrorlist reflector --score 100 -l 50 -f 10 --sort rate --verbose --save $MNT/etc/pacman.d/mirrorlist
else else
{ eval $MIRROR_CMD || curl -s 'https://www.archlinux.org/mirrorlist/all/'; } | { eval $MIRROR_CMD || curl -s 'https://www.archlinux.org/mirrorlist/all/'; } |
sed -e 's/^#Server/Server/' -e '/^#/d' | rankmirrors -n 10 - > $MNT/etc/pacman.d/mirrorlist sed -e 's/^#Server/Server/' -e '/^#/d' | rankmirrors -v -t -n 10 - > $MNT/etc/pacman.d/mirrorlist
fi fi
} }
@ -1867,7 +1874,7 @@ lvm_extra_lvs()
lvm_volume_count() lvm_volume_count()
{ {
if ! VOL_COUNT=$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" --title " $_LvmCreateVG " \ if ! VOL_COUNT=$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" --title " $_LvmCreateVG " \
--radiolist "$_LvmLvNumBody1 $VOLUME_GROUP\n$_LvmLvNumBody2" 0 0 14 \ --radiolist "$_LvmLvNumBody1 $VOLUME_GROUP\n$_LvmLvNumBody2" 0 0 0 \
"1" "-" off "2" "-" off "3" "-" off "4" "-" off "5" "-" off \ "1" "-" off "2" "-" off "3" "-" off "4" "-" off "5" "-" off \
"6" "-" off "7" "-" off "8" "-" off "9" "-" off); then "6" "-" off "7" "-" off "8" "-" off "9" "-" off); then
return 1 return 1
@ -2147,49 +2154,6 @@ luks_keyfile()
############################################################################### ###############################################################################
# helper functions # helper functions
select_language()
{
tput civis
local lang
lang=$(menubox "Select Language" "\nLanguage - sprache - taal - språk - lingua - idioma - nyelv - língua\n" \
"1" "English (en_**)" \
"2" "Español (es_ES)" \
"3" "Português [Brasil] (pt_BR)" \
"4" "Português (pt_PT)" \
"5" "Français (fr_FR)" \
"6" "Russkiy (ru_RU)" \
"7" "Italiano (it_IT)" \
"8" "Nederlands (nl_NL)" \
"9" "Magyar (hu_HU)" \
"10" "Chinese (zh_CN)")
src $LNG/english.trans
FONT="ter-i16n"
case $lang in
1) LOC="en_US.UTF-8" ;;
2) src $LNG/spanish.trans && LOC="es_ES.UTF-8" ;;
3) src $LNG/p_brasil.trans && LOC="pt_BR.UTF-8" ;;
4) src $LNG/portuguese.trans && LOC="pt_PT.UTF-8" ;;
5) src $LNG/french.trans && LOC="fr_FR.UTF-8" ;;
6) src $LNG/russian.trans && LOC="ru_RU.UTF-8" FONT="LatKaCyrHeb-16" ;;
7) src $LNG/italian.trans && LOC="it_IT.UTF-8" ;;
8) src $LNG/dutch.trans && LOC="nl_NL.UTF-8" ;;
9) src $LNG/hungarian.trans && LOC="hu_HU.UTF-8" FONT="lat2-16" ;;
10) src $LNG/chinese.trans && LOC="zh_CN.UTF-8" ;;
*) die
esac
sed -i "s/#en_US.UTF-8/en_US.UTF-8/" /etc/locale.gen
if [[ $LOC != "en_US.UTF-8" ]]; then
sed -i "s/#${LOC}/${LOC}/" /etc/locale.gen
locale-gen >/dev/null 2>&1
fi
[[ $TERM == 'linux' ]] && setfont $FONT >/dev/null 2>&1
export LANG="$LOC"
return 0
}
chrun() chrun()
{ {
arch-chroot $MNT /bin/bash -c "$1" arch-chroot $MNT /bin/bash -c "$1"
@ -2409,7 +2373,7 @@ errshow()
local err local err
err="$(sed 's/[^[:print:]]//g; s/\[[0-9\;:]*\?m//g; s/==> //g; s/] ERROR:/]\nERROR:/g' "$ERR")" err="$(sed 's/[^[:print:]]//g; s/\[[0-9\;:]*\?m//g; s/==> //g; s/] ERROR:/]\nERROR:/g' "$ERR")"
if [[ $err != "" ]]; then if [[ $err ]]; then
msgbox "$_ErrTitle" "\nERROR: $err" msgbox "$_ErrTitle" "\nERROR: $err"
else else
msgbox "$_ErrTitle" "\nThe command exited abnormally: $1\n\nWith the no error message.\n" msgbox "$_ErrTitle" "\nThe command exited abnormally: $1\n\nWith the no error message.\n"
@ -2424,13 +2388,13 @@ echeck()
local err local err
err="$(sed 's/[^[:print:]]//g; s/\[[0-9\;:]*\?m//g; s/==> //g; s/] ERROR:/]\nERROR:/g' "$ERR")" err="$(sed 's/[^[:print:]]//g; s/\[[0-9\;:]*\?m//g; s/==> //g; s/] ERROR:/]\nERROR:/g' "$ERR")"
if [[ $err != "" ]]; then if [[ $err ]]; then
msgbox "$_ErrTitle" "\nERROR: $err" msgbox "$_ErrTitle" "\nERROR: $err"
else else
msgbox "$_ErrTitle" "\nThe command exited abnormally: $1\n\nWith the no error message.\n" msgbox "$_ErrTitle" "\nThe command exited abnormally: $1\n\nWith the no error message.\n"
fi fi
[[ -e $DBG && $TERM == 'linux' ]] && more $DBG [[ -e $DBG && $TERM == 'linux' ]] && less $DBG
die 1 die 1
} }
@ -2462,8 +2426,8 @@ menubox()
local body="$2" local body="$2"
shift 2 shift 2
local response local response
if ! response="$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" \ if ! response="$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" --title " $title " --menu "$body" 0 0 0 "$@")"
--title " $title " --menu "$body" 0 0 0 "$@")"; then then
return 1 return 1
fi fi
printf "%s" "$response" printf "%s" "$response"
@ -2475,8 +2439,8 @@ checkbox()
local body="$2" local body="$2"
shift 2 shift 2
local response local response
if ! response="$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" \ if ! response="$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" --title " $title " --checklist "$body" 0 0 0 "$@")"
--title " $title " --checklist "$body" 0 0 0 "$@")"; then then
return 1 return 1
fi fi
printf "%s" "$response" printf "%s" "$response"
@ -2486,11 +2450,9 @@ getinput()
{ {
local answer local answer
if [[ $# -eq 4 && $4 == 'nolimit' ]]; then if [[ $# -eq 4 && $4 == 'nolimit' ]]; then
answer="$(dialog --cr-wrap --stdout --backtitle "$BT" \ answer="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $1 " --inputbox "$2" 0 0 "$3")"
--title " $1 " --inputbox "$2" 0 0 "$3")"
else else
answer="$(dialog --cr-wrap --max-input 63 --stdout --backtitle "$BT" \ answer="$(dialog --cr-wrap --max-input 63 --stdout --backtitle "$BT" --title " $1 " --inputbox "$2" 0 0 "$3")"
--title " $1 " --inputbox "$2" 0 0 "$3")"
fi fi
local e=$? local e=$?
@ -2510,16 +2472,57 @@ yesno()
{ {
tput civis tput civis
if [[ $# -eq 5 && $5 == "no" ]]; then if [[ $# -eq 5 && $5 == "no" ]]; then
dialog --cr-wrap --backtitle "$BT" --defaultno --title " $1 " \ dialog --cr-wrap --backtitle "$BT" --defaultno --title " $1 " --yes-label "$3" --no-label "$4" --yesno "$2\n" 0 0
--yes-label "$3" --no-label "$4" --yesno "$2\n" 0 0
elif [[ $# -eq 4 ]]; then elif [[ $# -eq 4 ]]; then
dialog --cr-wrap --backtitle "$BT" --title " $1 " --yes-label "$3" \ dialog --cr-wrap --backtitle "$BT" --title " $1 " --yes-label "$3" --no-label "$4" --yesno "$2\n" 0 0
--no-label "$4" --yesno "$2\n" 0 0
else else
dialog --cr-wrap --backtitle "$BT" --title " $1 " --yesno "$2\n" 0 0 dialog --cr-wrap --backtitle "$BT" --title " $1 " --yesno "$2\n" 0 0
fi fi
} }
select_language()
{
tput civis
local lang
lang=$(menubox "Select Language" "\nLanguage - sprache - taal - språk - lingua - idioma - nyelv - língua\n" \
"1" "English (en_**)" \
"2" "Español (es_ES)" \
"3" "Português [Brasil] (pt_BR)" \
"4" "Português (pt_PT)" \
"5" "Français (fr_FR)" \
"6" "Russkiy (ru_RU)" \
"7" "Italiano (it_IT)" \
"8" "Nederlands (nl_NL)" \
"9" "Magyar (hu_HU)" \
"10" "Chinese (zh_CN)")
src $LNG/english.trans
FONT="ter-i16n"
case $lang in
1) LOC="en_US.UTF-8" ;;
2) src $LNG/spanish.trans && LOC="es_ES.UTF-8" ;;
3) src $LNG/p_brasil.trans && LOC="pt_BR.UTF-8" ;;
4) src $LNG/portuguese.trans && LOC="pt_PT.UTF-8" ;;
5) src $LNG/french.trans && LOC="fr_FR.UTF-8" ;;
6) src $LNG/russian.trans && LOC="ru_RU.UTF-8" FONT="LatKaCyrHeb-16" ;;
7) src $LNG/italian.trans && LOC="it_IT.UTF-8" ;;
8) src $LNG/dutch.trans && LOC="nl_NL.UTF-8" ;;
9) src $LNG/hungarian.trans && LOC="hu_HU.UTF-8" FONT="lat2-16" ;;
10) src $LNG/chinese.trans && LOC="zh_CN.UTF-8" ;;
*) die
esac
sed -i "s/#en_US.UTF-8/en_US.UTF-8/" /etc/locale.gen
if [[ $LOC != "en_US.UTF-8" ]]; then
sed -i "s/#${LOC}/${LOC}/" /etc/locale.gen
locale-gen >/dev/null 2>&1
fi
[[ $TERM == 'linux' ]] && setfont $FONT >/dev/null 2>&1
export LANG="$LOC"
return 0
}
############################################################################### ###############################################################################
# entry point # entry point