You've already forked al-installer
Cleanup some dialogs, improve text, and offer more output during install
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
# Some ideas and code has been taken from other installers
|
||||
# AIF, Cnichi, Calamares, The Arch Wiki.. Credit where credit is due
|
||||
|
||||
VER="1.8.15" # version
|
||||
VER="1.8.16" # version
|
||||
DIST="ArchLabs" # distributor
|
||||
MNT="/mnt" # mountpoint
|
||||
|
||||
@ -28,7 +28,7 @@ main()
|
||||
tput civis
|
||||
SELECTED=$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
||||
--title " $_PrepTitle " --default-item $SELECTED \
|
||||
--cancel-label 'Exit' --menu "$_PrepBody" 0 0 14 \
|
||||
--cancel-label 'Exit' --menu "$_PrepBody" 0 0 0 \
|
||||
"1" "$_PrepShowDev" \
|
||||
"2" "$_PrepParts" \
|
||||
"3" "$_PrepLUKS" \
|
||||
@ -134,7 +134,8 @@ cfg_menu()
|
||||
fi
|
||||
|
||||
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
|
||||
fi
|
||||
|
||||
@ -156,7 +157,7 @@ mkuser()
|
||||
local values
|
||||
if ! values="$(dialog --stdout --no-cancel --separator '~' \
|
||||
--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 \
|
||||
"$_Password" 2 1 "" 2 $((${#_Password} + 2)) $COLUMNS 0 1 \
|
||||
"$_Password2" 3 1 "" 3 $((${#_Password2} + 2)) $COLUMNS 0 1 \
|
||||
@ -200,7 +201,8 @@ mkuser()
|
||||
select_keymap()
|
||||
{
|
||||
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' \
|
||||
'za' 'English' 'ng' 'English' 'ca' 'French' 'cd' 'French' 'gn' 'French' \
|
||||
'tg' 'French' 'fr' 'French' 'de' 'German' 'at' 'German' 'ch' 'German' \
|
||||
@ -257,7 +259,8 @@ select_timezone()
|
||||
return 1
|
||||
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
|
||||
fi
|
||||
|
||||
@ -344,7 +347,7 @@ select_packages()
|
||||
tput civis
|
||||
SELECTED=$(dialog --cr-wrap --no-cancel --stdout \
|
||||
--backtitle "$BT" --title " $_Packages " \
|
||||
--default-item $SELECTED --menu "$_PackageMenu" 0 0 14 \
|
||||
--default-item $SELECTED --menu "$_PackageMenu" 0 0 0 \
|
||||
1 "Browsers" \
|
||||
2 "Editors" \
|
||||
3 "Terminals" \
|
||||
@ -388,11 +391,11 @@ select_mirrorcmd()
|
||||
local key="5f29642060ab983b31fdf4c2935d8c56"
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
MIRROR_CMD="$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" \
|
||||
@ -412,13 +415,12 @@ select_mirrorcmd()
|
||||
local w="https://www.archlinux.org/mirrorlist"
|
||||
if [[ $c ]]; 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
|
||||
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
|
||||
else
|
||||
local countries="country=US&country=CA&country=NZ&country=GB&country=AU"
|
||||
MIRROR_CMD="curl -s '$w/?$countries&protocol=https&use_mirror_status=on'"
|
||||
MIRROR_CMD="curl -s '$w/?country=US&country=CA&country=NZ&country=GB&country=AU&use_mirror_status=on'"
|
||||
fi
|
||||
fi
|
||||
return 0
|
||||
@ -431,7 +433,7 @@ edit_configs()
|
||||
tput civis
|
||||
local choice
|
||||
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]}" \
|
||||
"console" "${EDIT_FILES[console]}" \
|
||||
"locale" "${EDIT_FILES[locale]}" \
|
||||
@ -730,14 +732,10 @@ confirm_mount()
|
||||
local part="$1"
|
||||
local mount="$2"
|
||||
|
||||
if [[ $mount == "$MNT" ]]; then
|
||||
local msg="Partition: $part\nMountpoint: / (root)"
|
||||
else
|
||||
local msg="Partition: $part\nMountpoint: ${mount#$MNT}"
|
||||
fi
|
||||
[[ $mount == "$MNT" ]] && local m="/ (root)" || local m="${mount#$MNT}"
|
||||
|
||||
if [[ $(mount) == *"$mount"* ]]; then
|
||||
infobox "$_MntTitle" "$_MntSucc\n$msg\n" 1
|
||||
infobox "$_MntTitle" "$_MntSucc\nPartition: $part\nMountpoint: $m\n" 1
|
||||
decr_count "$part"
|
||||
else
|
||||
infobox "$_MntTitle" "$_MntFail\n$msg\n" 1
|
||||
@ -758,7 +756,6 @@ check_cryptlvm()
|
||||
if [[ $(lsblk -lno TYPE "$part") =~ 'crypt' ]]; then
|
||||
LUKS='encrypted'
|
||||
LUKS_NAME="${part#/dev/mapper/}"
|
||||
|
||||
for dev in $(awk '/lvm/ && /crypto_LUKS/ {print "/dev/mapper/"$1}' <<< "$devs" | uniq); do
|
||||
if grep -q "$LUKS_NAME" <<< "$(lsblk -lno NAME "$dev")"; then
|
||||
LUKS_DEV="$LUKS_DEV cryptdevice=$dev:$LUKS_NAME"
|
||||
@ -773,11 +770,9 @@ check_cryptlvm()
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
elif [[ $(lsblk -lno TYPE "$part") =~ 'lvm' ]]; then
|
||||
LVM='logical volume'
|
||||
VOLUME_NAME="${part#/dev/mapper/}"
|
||||
|
||||
for dev in $(awk '/crypt/ && /lvm2_member/ {print "/dev/mapper/"$1}' <<< "$devs" | uniq); do
|
||||
if grep -q "$VOLUME_NAME" <<< "$(lsblk -lno NAME "$dev")"; then
|
||||
LUKS_NAME="$(sed 's~/dev/mapper/~~g' <<< "$dev")"
|
||||
@ -975,11 +970,7 @@ select_swap()
|
||||
{
|
||||
# Ask user to select partition or create swapfile
|
||||
tput civis
|
||||
if ! SWAP_PART="$(menubox "$_SelSwpSetup" "$_SelSwpBody" \
|
||||
"$_SelSwpNone" "-" \
|
||||
"$_SelSwpFile" "$SYS_MEM" \
|
||||
$PARTS)" ||
|
||||
[[ $SWAP_PART == "$_SelSwpNone" ]]
|
||||
if ! SWAP_PART="$(menubox "$_SelSwpSetup" "$_SelSwpBody" "$_SelSwpNone" "-" "$_SelSwpFile" "$SYS_MEM" $PARTS)" || [[ $SWAP_PART == "$_SelSwpNone" ]]
|
||||
then
|
||||
SWAP_PART=""
|
||||
return 0
|
||||
@ -1034,8 +1025,8 @@ select_mount_opts()
|
||||
ssd "$part" >/dev/null 2>&1 && opts=$(sed 's/discard - off/discard - on/' <<< "$opts")
|
||||
|
||||
tput civis
|
||||
if ! MNT_OPTS="$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" --title " $title " \
|
||||
--checklist "$_MntBody" 0 0 0 $opts)" || [[ $MNT_OPTS == "" ]]; then
|
||||
if ! MNT_OPTS="$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" --title " $title " --checklist "$_MntBody" 0 0 0 $opts)" || [[ $MNT_OPTS == "" ]]
|
||||
then
|
||||
return 1
|
||||
fi
|
||||
|
||||
@ -1067,6 +1058,7 @@ select_filesystem()
|
||||
"nilfs2" "${FS_CMDS[nilfs2]}" \
|
||||
"reiserfs" "${FS_CMDS[reiserfs]}" \
|
||||
"xfs" "${FS_CMDS[xfs]}")"
|
||||
[[ $fs == "$_Skip" ]] && return 0
|
||||
else
|
||||
fs="$(menubox "$_FSTitle: $part" "${msg}${part}$_FSBody" \
|
||||
"ext4" "${FS_CMDS[ext4]}" \
|
||||
@ -1080,12 +1072,7 @@ select_filesystem()
|
||||
"reiserfs" "${FS_CMDS[reiserfs]}" \
|
||||
"xfs" "${FS_CMDS[xfs]}")"
|
||||
fi
|
||||
|
||||
if ! [[ $fs ]]; then
|
||||
return 1
|
||||
elif [[ $fs == "$_Skip" ]]; then
|
||||
return 0
|
||||
fi
|
||||
[[ $fs ]] || return 1
|
||||
|
||||
if yesno "$_FSTitle" "\nFormat $part as $fs?\n" "Format" "Go Back"; then
|
||||
format $part $fs
|
||||
@ -1186,6 +1173,7 @@ install()
|
||||
clear
|
||||
tput cnorm
|
||||
install_base
|
||||
printf "\nGenerating system /etc/fstab\n\n"
|
||||
genfstab -U $MNT >$MNT/etc/fstab 2>$ERR
|
||||
echeck "genfstab -U $MNT >$MNT/etc/fstab"
|
||||
[[ -f $MNT/swapfile ]] && sed -i "s~${MNT}~~" $MNT/etc/fstab
|
||||
@ -1203,21 +1191,24 @@ install()
|
||||
install_base()
|
||||
{
|
||||
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
|
||||
mirrorlist_sort
|
||||
local packages
|
||||
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
|
||||
|
||||
printf "\n"
|
||||
printf "\nRemoving archiso remains\n\n"
|
||||
rm -rf $MNT/etc/mkinitcpio-archiso.conf
|
||||
find $MNT/usr/lib/initcpio -name 'archiso*' -type f -exec rm -rf '{}' \;
|
||||
sed -i 's/volatile/auto/g' $MNT/etc/systemd/journald.conf
|
||||
|
||||
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
|
||||
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
|
||||
Section "Device"
|
||||
Identifier "Intel Graphics"
|
||||
@ -1228,16 +1219,18 @@ EOF
|
||||
fi
|
||||
|
||||
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
|
||||
[[ $UCODE && ! $VM ]] && cp -vf $RUN/${UCODE/-/_}.img $MNT/boot/${UCODE}.img
|
||||
fi
|
||||
|
||||
printf "\n"
|
||||
printf "\nCopying network settings to /etc\n\n"
|
||||
cp -fv /etc/resolv.conf $MNT/etc/
|
||||
if [[ -e /etc/NetworkManager/system-connections ]]; then
|
||||
cp -rvf /etc/NetworkManager/system-connections $MNT/etc/NetworkManager/
|
||||
fi
|
||||
|
||||
printf "\nSetting locale to $LOCALE\n\n"
|
||||
cat > $MNT/etc/locale.conf << EOF
|
||||
LANG=$LOCALE
|
||||
EOF
|
||||
@ -1246,14 +1239,16 @@ LANG=$LOCALE
|
||||
EOF
|
||||
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
|
||||
printf "\n"
|
||||
printf "\nSetting timezone: $ZONE/$SUBZONE\n\n"
|
||||
chrun "ln -svf /usr/share/zoneinfo/$ZONE/$SUBZONE /etc/localtime" 2>/dev/null
|
||||
|
||||
if [[ $BROADCOM_WL == true ]]; then
|
||||
printf "\nBlacklisting modules for broadcom wireless: bmca\n\n"
|
||||
echo 'blacklist bcma' >> $MNT/etc/modprobe.d/blacklist.conf
|
||||
rm -f $MNT/etc/modprobe/
|
||||
fi
|
||||
|
||||
printf "\nCreating keyboard configurations for keymap: $KEYMAP\n\n"
|
||||
cat > $MNT/etc/X11/xorg.conf.d/00-keyboard.conf <<EOF
|
||||
# Use localectl(1) to instruct systemd-localed to update it.
|
||||
Section "InputClass"
|
||||
@ -1275,6 +1270,7 @@ EOF
|
||||
KEYMAP=$CMAP
|
||||
FONT=$FONT
|
||||
EOF
|
||||
printf "\nSetting system hostname: $HOSTNAME\n\n"
|
||||
cat > $MNT/etc/hostname << EOF
|
||||
$HOSTNAME
|
||||
EOF
|
||||
@ -1290,8 +1286,11 @@ EOF
|
||||
|
||||
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'"
|
||||
cp -rf /etc/skel/. $MNT/root/
|
||||
if [[ $MYSHELL != *zsh ]]; then
|
||||
chrun "usermod -s $MYSHELL root"
|
||||
if [[ $MYSHELL == "/usr/bin/mksh" ]]; then
|
||||
@ -1403,15 +1402,23 @@ EOF
|
||||
|
||||
login_manager()
|
||||
{
|
||||
printf "\nSetting up $LOGIN_TYPE\n\n"
|
||||
SERVICE="$MNT/etc/systemd/system/getty@tty1.service.d"
|
||||
|
||||
# remove welcome message
|
||||
sed -i '/printf/d' $MNT/root/.zshrc
|
||||
|
||||
# remove unneeded shell files from installation
|
||||
case $MYSHELL in
|
||||
"/bin/bash") rm -rf $MNT/home/$NEWUSER/.{zsh,mksh}* ;;
|
||||
"/usr/bin/mksh") rm -rf $MNT/home/$NEWUSER/.{zsh,bash}* $MNT/home/$NEWUSER/.inputrc ;;
|
||||
"/usr/bin/zsh") rm -rf $MNT/home/$NEWUSER/.{bash,mksh}* $MNT/home/$NEWUSER/.inputrc ;;
|
||||
"/bin/bash")
|
||||
rm -rf $MNT/home/$NEWUSER/.{zsh,mksh}* $MNT/root/.{zsh,mksh}*
|
||||
;;
|
||||
"/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
|
||||
|
||||
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
|
||||
else
|
||||
{ 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
|
||||
}
|
||||
|
||||
@ -1867,7 +1874,7 @@ lvm_extra_lvs()
|
||||
lvm_volume_count()
|
||||
{
|
||||
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 \
|
||||
"6" "-" off "7" "-" off "8" "-" off "9" "-" off); then
|
||||
return 1
|
||||
@ -2147,49 +2154,6 @@ luks_keyfile()
|
||||
###############################################################################
|
||||
# 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()
|
||||
{
|
||||
arch-chroot $MNT /bin/bash -c "$1"
|
||||
@ -2409,7 +2373,7 @@ errshow()
|
||||
local 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"
|
||||
else
|
||||
msgbox "$_ErrTitle" "\nThe command exited abnormally: $1\n\nWith the no error message.\n"
|
||||
@ -2424,13 +2388,13 @@ echeck()
|
||||
local 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"
|
||||
else
|
||||
msgbox "$_ErrTitle" "\nThe command exited abnormally: $1\n\nWith the no error message.\n"
|
||||
fi
|
||||
|
||||
[[ -e $DBG && $TERM == 'linux' ]] && more $DBG
|
||||
[[ -e $DBG && $TERM == 'linux' ]] && less $DBG
|
||||
|
||||
die 1
|
||||
}
|
||||
@ -2462,8 +2426,8 @@ menubox()
|
||||
local body="$2"
|
||||
shift 2
|
||||
local response
|
||||
if ! response="$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" \
|
||||
--title " $title " --menu "$body" 0 0 0 "$@")"; then
|
||||
if ! response="$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" --title " $title " --menu "$body" 0 0 0 "$@")"
|
||||
then
|
||||
return 1
|
||||
fi
|
||||
printf "%s" "$response"
|
||||
@ -2475,8 +2439,8 @@ checkbox()
|
||||
local body="$2"
|
||||
shift 2
|
||||
local response
|
||||
if ! response="$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" \
|
||||
--title " $title " --checklist "$body" 0 0 0 "$@")"; then
|
||||
if ! response="$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" --title " $title " --checklist "$body" 0 0 0 "$@")"
|
||||
then
|
||||
return 1
|
||||
fi
|
||||
printf "%s" "$response"
|
||||
@ -2486,11 +2450,9 @@ getinput()
|
||||
{
|
||||
local answer
|
||||
if [[ $# -eq 4 && $4 == 'nolimit' ]]; then
|
||||
answer="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
||||
--title " $1 " --inputbox "$2" 0 0 "$3")"
|
||||
answer="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $1 " --inputbox "$2" 0 0 "$3")"
|
||||
else
|
||||
answer="$(dialog --cr-wrap --max-input 63 --stdout --backtitle "$BT" \
|
||||
--title " $1 " --inputbox "$2" 0 0 "$3")"
|
||||
answer="$(dialog --cr-wrap --max-input 63 --stdout --backtitle "$BT" --title " $1 " --inputbox "$2" 0 0 "$3")"
|
||||
fi
|
||||
|
||||
local e=$?
|
||||
@ -2510,16 +2472,57 @@ yesno()
|
||||
{
|
||||
tput civis
|
||||
if [[ $# -eq 5 && $5 == "no" ]]; then
|
||||
dialog --cr-wrap --backtitle "$BT" --defaultno --title " $1 " \
|
||||
--yes-label "$3" --no-label "$4" --yesno "$2\n" 0 0
|
||||
dialog --cr-wrap --backtitle "$BT" --defaultno --title " $1 " --yes-label "$3" --no-label "$4" --yesno "$2\n" 0 0
|
||||
elif [[ $# -eq 4 ]]; then
|
||||
dialog --cr-wrap --backtitle "$BT" --title " $1 " --yes-label "$3" \
|
||||
--no-label "$4" --yesno "$2\n" 0 0
|
||||
dialog --cr-wrap --backtitle "$BT" --title " $1 " --yes-label "$3" --no-label "$4" --yesno "$2\n" 0 0
|
||||
else
|
||||
dialog --cr-wrap --backtitle "$BT" --title " $1 " --yesno "$2\n" 0 0
|
||||
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
|
||||
|
||||
|
Reference in New Issue
Block a user