Update more english translation text
This commit is contained in:
parent
89c95254ed
commit
ce18eabd60
@ -46,7 +46,6 @@ _EditBody="\nBefore exiting the installer you may select configuration files to
|
||||
# Close Installer
|
||||
_CloseInst="Close Installer"
|
||||
_CloseInstBody="\nUnmount partitions and close the installer?\n"
|
||||
_InstFinBody="\nThe installation is now finished.\n\nWould you like to close the installer and reboot?\n"
|
||||
|
||||
# error message
|
||||
_ErrChoice="\nUnmount the partitions and shutdown or keep them mounted and continue?\n"
|
||||
@ -59,7 +58,7 @@ _TimeSubZBody="\nSelect the nearest city to your location from the list below."
|
||||
_TimeZQ="\nSet time zone as:"
|
||||
|
||||
# bootloader
|
||||
_MntBootBody="\nSelect bootloader and boot partition mountpoint (if any)."
|
||||
_MntBootBody="\nSelect bootloader and boot partition mountpoint (if any).\n\nSystemd-boot automatically detects other bootloaders and is recommended for multiboot, grub also does this however you will need to run 'grub-mkconfig' to detect other bootloaders."
|
||||
_InstSysTitle="Install Syslinux"
|
||||
_InstSysBody="\nInstall syslinux to the master boot record (MBR) or to root (/)?"
|
||||
|
||||
@ -70,13 +69,13 @@ _MirrorCmd="\nThe command below will be used to sort the mirrorlist, a short des
|
||||
|
||||
# window managers and packages
|
||||
_WMChoice="Select WM or DE"
|
||||
_WMChoiceBody="\nUse [Space] to (de)select window manager(s) or desktop environment(s) to install.\n\nDepending on the choice additional packages may be installed to improve the experience."
|
||||
_WMChoiceBody="\nUse [Space] to (de)select window manager(s) or desktop environment(s) to install.\n\nDepending on your choice additional packages may be installed to improve the experience."
|
||||
_ExtraPackages="Extra Packages"
|
||||
_ExtraPackagesBody="\nUse [Space] to (de)select packages(s) to install from the list below."
|
||||
|
||||
# login setup
|
||||
_WMLogin="Select Login Type"
|
||||
_LoginTypeBody="\nUse console login (xinit) or a display manager (lightdm)?"
|
||||
_LoginTypeBody="\nSelect how you want to log in to the computer, with a display manager or xinit."
|
||||
_WMLoginBody="\nSelect which window manager or desktop to use for login."
|
||||
_AutoLoginBody="\nDo you want to automatically log in when the computer starts?"
|
||||
|
||||
@ -114,11 +113,6 @@ _DevSelBody="\nSelect a device from the list below.\n\nDevices (/dev) are the av
|
||||
_ExtPartBody="\nYou can now select additional partitions you want mounted, once choosed you will be asked to enter where you want it mounted.\n\nSelect '$_Done' to finish the mounting step and return to the main menu."
|
||||
_ExtPartBody1="\nWhere do you want the partition mounted?\n\nEnsure the name begins with a forward slash (/).\nSome examples include:"
|
||||
|
||||
# Auto partition
|
||||
_PartBody1="\nWARNING: ALL data on"
|
||||
_PartBody2="will be destroyed and the following partitions will be created\n\n- 512M partition with boot/esp flag enabled (ext4 for BIOS, vfat/fat32 for UEFI)\n- ext4 partition using all remaining space.\n\nDo you want to continue?\n"
|
||||
_PartWipeBody2="will be destroyed using 'wipe -Ifre'.\n\nThis process can take a long time depending on the size of the drive.\n\nDo you want to continue?\n"
|
||||
|
||||
|
||||
# Partitioning Menu
|
||||
_PartTitle="Partitioning Tool"
|
||||
@ -127,6 +121,12 @@ _PartAuto="Automatic Partitioning"
|
||||
_PartWipe="Secure Wipe Device"
|
||||
_PartShowTree="Show Partition Tree"
|
||||
|
||||
# Auto partition
|
||||
_PartBody1="\nWARNING: ALL data on"
|
||||
_PartBody2="will be destroyed and the following partitions will be created\n\n- A 512M partition with boot/esp flag enabled (ext4 for BIOS, vfat/fat32 for UEFI)\n- An ext4 partition using all remaining space"
|
||||
_PartBody3="\n\nDo you want to continue?\n"
|
||||
_PartWipeBody2="will be destroyed using 'wipe -Ifre'.\n\nThis process can take a long time depending on the size of the drive.\n\nDo you want to continue?\n"
|
||||
|
||||
# bootloader
|
||||
_InstSysTitle="Install Syslinux"
|
||||
_InstSysBody="\nInstall syslinux to the Master Boot Record (MBR) or to root (/)?"
|
||||
|
@ -12,7 +12,7 @@
|
||||
# immutable {
|
||||
|
||||
readonly DIST="ArchLabs" # Linux distributor
|
||||
readonly VER="1.6.94" # Installer version
|
||||
readonly VER="1.7.1" # Installer version
|
||||
readonly LIVE="liveuser" # Live session user
|
||||
readonly MNT="/mnt/install" # Install mountpoint
|
||||
readonly ERR="/tmp/errlog" # Built-in error log
|
||||
@ -108,7 +108,6 @@ init() {
|
||||
declare -g MKINIT_HOOKS="shutdown"
|
||||
|
||||
declare -g WARN=false
|
||||
declare -g IS_64BIT=false
|
||||
declare -g AUTOLOGIN=false
|
||||
declare -g CONFIG_DONE=false
|
||||
declare -g SEPERATE_BOOT=false
|
||||
@ -133,17 +132,6 @@ init() {
|
||||
)
|
||||
}
|
||||
|
||||
devices() {
|
||||
IGNORE_DEV="$(lsblk -lno NAME,MOUNTPOINT | awk '/\/run\/archiso\/bootmnt/ {sub(/[1-9]/, ""); print $1}')"
|
||||
if [[ $IGNORE_DEV ]]; then
|
||||
SYS_DEVS="$(lsblk -lno NAME,SIZE,TYPE | awk '/disk/ && !'"/$IGNORE_DEV/"' {print "/dev/" $1 " " $2}')"
|
||||
else
|
||||
SYS_DEVS="$(lsblk -lno NAME,SIZE,TYPE | awk '/disk/ {print "/dev/" $1 " " $2}')"
|
||||
fi
|
||||
DEV_COUNT="$(wc -l <<< "$SYS_DEVS")"
|
||||
declare -gr SYS_DEVS IGNORE_DEV DEV_COUNT
|
||||
}
|
||||
|
||||
user() {
|
||||
tput cnorm
|
||||
local values
|
||||
@ -264,9 +252,9 @@ keymap() {
|
||||
fi
|
||||
|
||||
if [[ $DISPLAY && $TERM != 'linux' ]]; then
|
||||
(type setxkbmap >/dev/null 2>&1) && setxkbmap $KEYMAP >/dev/null 2>&1
|
||||
hash setxkbmap >/dev/null 2>&1 && setxkbmap $KEYMAP >/dev/null 2>&1
|
||||
else
|
||||
(type loadkeys >/dev/null 2>&1) && loadkeys $CONSOLE_MAP >/dev/null 2>&1
|
||||
hash loadkeys >/dev/null 2>&1 && loadkeys $CONSOLE_MAP >/dev/null 2>&1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
@ -285,6 +273,20 @@ timezone() {
|
||||
yesno "$_TimeZTitle" "$_TimeZQ $ZONE/$SUBZONE?\n" && return 0 || timezone
|
||||
}
|
||||
|
||||
choose_dm() {
|
||||
LOGIN_TYPE="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
||||
--title " $_WMLogin " --menu "$_LoginTypeBody" 0 0 0 \
|
||||
"xinit" "Console login without a display manager" \
|
||||
"lightdm" "Lightweight display manager with the gtk greeter")"
|
||||
[[ $? -eq 0 ]] || return 1
|
||||
if [[ $LOGIN_TYPE == 'lightdm' ]]; then
|
||||
WM_PACKAGES+=" lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice"
|
||||
FILES[11]="/etc/lightdm/lightdm.conf /etc/lightdm/lightdm-gtk-greeter.conf"
|
||||
else
|
||||
FILES[11]="/home/$NEWUSER/.xinitrc /home/$NEWUSER/.zprofile /home/$NEWUSER/.xprofile"
|
||||
fi
|
||||
}
|
||||
|
||||
sessions() {
|
||||
INSTALL_WMS="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
||||
--title " $_WMChoice " --checklist "$_WMChoiceBody\n" 0 0 0 \
|
||||
@ -295,11 +297,13 @@ sessions() {
|
||||
"gnome" "A desktop environment that aims to be simple and easy to use" off \
|
||||
"cinnamon" "A desktop environment combining a traditional desktop layout with modern graphical effects" off \
|
||||
"xfce4" "A lightweight and modular desktop environment based on GTK+ 2 and 3" off)"
|
||||
[[ $? != 0 || $INSTALL_WMS == "" ]] && return 1
|
||||
[[ $? -eq 0 ]] || return 1
|
||||
[[ $INSTALL_WMS ]] || INSTALL_WMS='openbox'
|
||||
|
||||
WM_NUM=$(awk '{print NF}' <<< "$INSTALL_WMS")
|
||||
WM_PACKAGES="$INSTALL_WMS"
|
||||
|
||||
# packages needed for the selected WM/DE
|
||||
# packages needed for the selected WMs/DEs
|
||||
for wm in $INSTALL_WMS; do
|
||||
LOGIN_CHOICES="${LOGIN_CHOICES}$wm - "
|
||||
case $wm in
|
||||
@ -319,25 +323,19 @@ sessions() {
|
||||
WM_PACKAGES+=" archlabs-oblogout archlabs-screenlock archlabs-paranoid"
|
||||
fi
|
||||
|
||||
# choose which to login
|
||||
if [[ $WM_NUM -eq 1 ]]; then
|
||||
# choose which WM/DE to start at login
|
||||
if (( WM_NUM == 1 )); then
|
||||
LOGIN_WM="$INSTALL_WMS"
|
||||
else
|
||||
LOGIN_WM="$(dialog --cr-wrap --stdout --no-cancel --backtitle "$BT" \
|
||||
--title " $_WMLogin " --menu "$_WMLoginBody" 0 0 0 $LOGIN_CHOICES)"
|
||||
[[ $LOGIN_WM == "" ]] && LOGIN_WM="$(awk '{print $1}' <<< "$INSTALL_WMS")"
|
||||
[[ $? -eq 0 ]] || return 1
|
||||
fi
|
||||
|
||||
# chose login type
|
||||
if yesno "$_WMLogin" "$_LoginTypeBody\n" "xinit" "lightdm"; then
|
||||
LOGIN_TYPE='xinit'
|
||||
FILES[11]="/home/$NEWUSER/.xinitrc"
|
||||
else
|
||||
LOGIN_TYPE='lightdm'
|
||||
WM_PACKAGES+=" lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice"
|
||||
FILES[11]="/etc/lightdm/lightdm.conf /etc/lightdm/lightdm-gtk-greeter.conf"
|
||||
fi
|
||||
# choose how to log in
|
||||
choose_dm || return 1
|
||||
|
||||
# add all the packages to the main package list
|
||||
EXTRA_PACKAGES="$WM_PACKAGES"
|
||||
|
||||
# autologin
|
||||
@ -349,7 +347,6 @@ sessions() {
|
||||
openbox) LOGIN_WM='openbox-session' ;;
|
||||
cinnamon) LOGIN_WM='cinnamon-session' ;;
|
||||
esac
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
@ -447,38 +444,31 @@ packages() {
|
||||
|
||||
mirrors() {
|
||||
local key="5f29642060ab983b31fdf4c2935d8c56"
|
||||
local ip="$(curl -s "http://api.ipstack.com/check&fields=ip&?access_key=${key}" |
|
||||
json 'ip')"
|
||||
|
||||
if hash reflector >/dev/null 2>&1; then
|
||||
MIRROR_CMD="reflector --score 100 -l 50 -f 10 --sort rate --verbose"
|
||||
yesno "$_MirrorTitle" "$_MirrorSetup" "Automatic" "Custom" && return 0
|
||||
|
||||
local c="$(curl -s "http://api.ipstack.com/${ip}?access_key=${key}&fields=country_name" |
|
||||
json 'country_name')"
|
||||
if [[ $c != "" ]]; then
|
||||
MIRROR_CMD="reflector --country $c --score 80 --latest 40 --fastest 10 --sort rate --verbose"
|
||||
fi
|
||||
local ip="$(json 'ip' "check&?access_key=${key}&fields=ip")"
|
||||
local c="$(json 'country_name' "${ip}?access_key=${key}&fields=country_name")"
|
||||
MIRROR_CMD="reflector --country $c --score 80 --latest 40 --fastest 10 --sort rate --verbose"
|
||||
|
||||
tput cnorm
|
||||
MIRROR_CMD="$(dialog --cr-wrap --no-cancel --stdout --backtitle "$BT" \
|
||||
--title " $_MirrorTitle " --inputbox "$_MirrorCmd\n
|
||||
--score n Limit the list to the n servers with the highest score.
|
||||
--latest n Limit the list to the n most recently synchronized servers.
|
||||
--fastest n Return the n fastest mirrors that meet the other criteria.
|
||||
--sort {age,rate,country,score,delay}
|
||||
--score n Limit the list to the n servers with the highest score.
|
||||
--latest n Limit the list to the n most recently synchronized servers.
|
||||
--fastest n Return the n fastest mirrors that meet the other criteria.
|
||||
--sort {age,rate,country,score,delay}
|
||||
|
||||
'age': Last server synchronization;
|
||||
'rate': Download rate;
|
||||
'country': Server location;
|
||||
'score': MirrorStatus score;
|
||||
'delay': MirrorStatus delay.\n" 0 0 "$MIRROR_CMD")"
|
||||
'age': Last server synchronization;
|
||||
'rate': Download rate;
|
||||
'country': Server location;
|
||||
'score': MirrorStatus score;
|
||||
'delay': MirrorStatus delay.\n" 0 0 "$MIRROR_CMD")"
|
||||
else
|
||||
local c="$(curl -s "http://api.ipstack.com/${ip}?access_key=${key}&fields=country_code" |
|
||||
json 'country_code')"
|
||||
|
||||
local ip="$(json 'ip' "check&?access_key=${key}&fields=ip")"
|
||||
local c="$(json 'country_code' "${ip}?access_key=${key}&fields=country_code")"
|
||||
local w="https://www.archlinux.org/mirrorlist"
|
||||
if [[ $c != "" ]]; then
|
||||
if [[ $c ]]; then
|
||||
if [[ $c =~ (CA|US) ]]; then
|
||||
MIRROR_CMD="curl -s '$w/?country=US&country=CA&protocol=https&use_mirror_status=on'"
|
||||
else
|
||||
@ -544,8 +534,7 @@ configure() {
|
||||
|
||||
configs() {
|
||||
if [[ $CURRENT_MENU != "edit" ]]; then
|
||||
SELECTED=1
|
||||
CURRENT_MENU="edit"
|
||||
SELECTED=1; CURRENT_MENU="edit"
|
||||
elif (( SELECTED < 11 )); then
|
||||
(( SELECTED++ ))
|
||||
fi
|
||||
@ -558,13 +547,27 @@ configs() {
|
||||
"11" "${LOGIN_TYPE^}")
|
||||
|
||||
if [[ ! $SELECTED || $SELECTED -eq 1 ]]; then
|
||||
wrap_up "$_InstFinBody" 'Reboot' 'Back' 'reboot'
|
||||
die 'reboot'
|
||||
else
|
||||
local existing_files=""
|
||||
for f in $(echo "${FILES[$SELECTED]}"); do
|
||||
[[ -e ${MNT}$f ]] && existing_files+=" ${MNT}$f"
|
||||
done
|
||||
[[ ! $existing_files ]] && msgbox "$_ErrTitle" "$_NoFileErr" || vim -O $existing_files
|
||||
if [[ ! $existing_files ]]; then
|
||||
msgbox "$_ErrTitle" "$_NoFileErr"
|
||||
else
|
||||
if hash vim >/dev/null 2>&1; then
|
||||
vim -O $existing_files
|
||||
else
|
||||
for f in $existing_files; do
|
||||
if hash nano >/dev/null 2>&1; then
|
||||
nano $f
|
||||
else
|
||||
vi $f
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
configs
|
||||
}
|
||||
@ -590,8 +593,7 @@ main() {
|
||||
if [[ $SELECTED -eq 8 ]]; then
|
||||
icheck || return 1
|
||||
elif [[ ($SELECTED -eq 2 || $SELECTED -eq 5) && $WARN != true ]]; then
|
||||
msgbox "$_PrepTitle" "$_WarnMount"
|
||||
WARN=true
|
||||
msgbox "$_PrepTitle" "$_WarnMount" && WARN=true
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -603,17 +605,14 @@ main() {
|
||||
5) mountp || SELECTED=4 ;;
|
||||
6) configure || SELECTED=5 ;;
|
||||
7) display ;;
|
||||
8) install || SELECTED=7 ;;
|
||||
*) wrap_up "$_CloseInstBody" 'Exit' 'Back' 'exit'
|
||||
8) install ;;
|
||||
*) yesno "$_CloseInst" "$_CloseInstBody" "Exit" "Back" && die 0
|
||||
esac
|
||||
}
|
||||
|
||||
# must be done first
|
||||
init
|
||||
|
||||
# declares system device list
|
||||
devices
|
||||
|
||||
# source all the lib files
|
||||
for i in /usr/share/archlabs/installer/lib/?*.sh; do
|
||||
. "$i" || { printf "\nFailed to source library file %s\n" "$i"; die 1; }
|
||||
@ -627,6 +626,7 @@ for arg in $@; do case $arg in
|
||||
esac done
|
||||
|
||||
# initial choices/prep
|
||||
devices
|
||||
language
|
||||
keymap
|
||||
checks
|
||||
|
@ -8,34 +8,6 @@
|
||||
|
||||
# set -n
|
||||
|
||||
uefi_boot_fallback() {
|
||||
# some UEFI firmware requires a directory in the ESP and a generic bootx64.efi
|
||||
# see: https://wiki.archlinux.org/index.php/GRUB#UEFI
|
||||
# also: https://wiki.archlinux.org/index.php/syslinux#UEFI_Systems
|
||||
|
||||
local esp="${MNT}${BMNTS[$SYS-$BOOTLDR]}"
|
||||
|
||||
local default="boot"
|
||||
default="$(find $esp/EFI/ -maxdepth 1 -mindepth 1 -name '[Bb][oO][oO][tT]' -type d)"
|
||||
[[ $default ]] && default="$(basename $default)"
|
||||
|
||||
# directory exists: remove everything inside, otherwise mkdir it
|
||||
[[ -d $esp/EFI/$default ]] && rm -rf $esp/EFI/$default/* || mkdir -p $esp/EFI/$default
|
||||
|
||||
# copy efi stub to the new default location
|
||||
if [[ $BOOTLDR == 'syslinux' ]]; then
|
||||
# syslinux requires the whole boot setup be copied, not just the stub
|
||||
cp -rf $esp/EFI/syslinux/* $esp/EFI/$default/
|
||||
cp -f $esp/EFI/syslinux/syslinux.efi $esp/EFI/$default/bootx64.efi
|
||||
elif [[ $BOOTLDR == 'grub' ]]; then
|
||||
# grub uses different names for the stub depending on architecture
|
||||
local ext="ia32"
|
||||
[[ $IS_64BIT == true ]] && ext="x64"
|
||||
cp -f $esp/EFI/$DIST/grub${ext}.efi $esp/EFI/$default/boot${ext}.efi
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
prep_for_grub() {
|
||||
local cfg="$MNT/etc/default/grub"
|
||||
sed -i "s/GRUB_DISTRIBUTOR=.*/GRUB_DISTRIBUTOR=\"${DIST}\"/g;
|
||||
@ -146,6 +118,34 @@ install_bootloader() {
|
||||
return 0
|
||||
}
|
||||
|
||||
uefi_boot_fallback() {
|
||||
# some UEFI firmware requires a directory in the ESP and a generic bootx64.efi
|
||||
# see: https://wiki.archlinux.org/index.php/GRUB#UEFI
|
||||
# also: https://wiki.archlinux.org/index.php/syslinux#UEFI_Systems
|
||||
|
||||
local esp="${MNT}${BMNTS[$SYS-$BOOTLDR]}"
|
||||
|
||||
local default="boot"
|
||||
default="$(find $esp/EFI/ -maxdepth 1 -mindepth 1 -name '[Bb][oO][oO][tT]' -type d)"
|
||||
[[ $default ]] && default="$(basename $default)"
|
||||
|
||||
# directory exists: remove everything inside, otherwise mkdir it
|
||||
[[ -d $esp/EFI/$default ]] && rm -rf $esp/EFI/$default/* || mkdir -p $esp/EFI/$default
|
||||
|
||||
# copy efi stub to the new default location
|
||||
if [[ $BOOTLDR == 'syslinux' ]]; then
|
||||
# syslinux requires the whole boot setup be copied, not just the stub
|
||||
cp -rf $esp/EFI/syslinux/* $esp/EFI/$default/
|
||||
cp -f $esp/EFI/syslinux/syslinux.efi $esp/EFI/$default/bootx64.efi
|
||||
elif [[ $BOOTLDR == 'grub' ]]; then
|
||||
# grub uses different names for the stub depending on architecture
|
||||
local ext="ia32"
|
||||
[[ $IS_64BIT == true ]] && ext="x64"
|
||||
cp -f $esp/EFI/$DIST/grub${ext}.efi $esp/EFI/$default/boot${ext}.efi
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
shim_secure_boot() {
|
||||
# still a W.I.P
|
||||
local shim_file="shim.efi"
|
||||
|
@ -45,19 +45,6 @@ install() {
|
||||
configs
|
||||
}
|
||||
|
||||
mirrorlist_sort() {
|
||||
printf "%s\n\n" "Sorting the mirrorlist"
|
||||
if hash reflector >/dev/null 2>&1; then
|
||||
$MIRROR_CMD --save $MNT/etc/pacman.d/mirrorlist --verbose ||
|
||||
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
|
||||
fi
|
||||
}
|
||||
|
||||
install_base() {
|
||||
printf "\nUnpacking base file system --- Total: ~ 2.9G\n\n"
|
||||
rsync -ah --info=progress2 /run/archiso/sfs/airootfs/ $MNT/
|
||||
@ -160,6 +147,7 @@ create_user() {
|
||||
[[ $INSTALL_WMS =~ bspwm ]] || rm -rf $MNT/home/$LIVE/.config/{bspwm,sxhkd}
|
||||
[[ $INSTALL_WMS =~ i3-gaps ]] || rm -rf $MNT/home/$LIVE/.config/i3
|
||||
[[ $INSTALL_WMS =~ openbox ]] || rm -rf $MNT/home/$LIVE/.config/{openbox,skippy-xd,jgmenu,conky,tint2}
|
||||
[[ $INSTALL_WMS =~ (openbox|i3-gaps|bspwm) ]] || rm -rf $MNT/home/$LIVE/.config/polybar
|
||||
chrun "mv -f /home/$LIVE /home/$NEWUSER"
|
||||
fi
|
||||
chrun "usermod -aG rfkill,wheel,network,storage,power,video,audio,lp,autologin $NEWUSER"
|
||||
@ -167,6 +155,54 @@ create_user() {
|
||||
chrun "chown -Rf $NEWUSER:users /home/$NEWUSER"
|
||||
}
|
||||
|
||||
login_manager() {
|
||||
local service="$MNT/etc/systemd/system/getty@tty1.service.d"
|
||||
if [[ $LOGIN_TYPE == 'lightdm' ]]; then
|
||||
rm -rf $service
|
||||
for f in $MNT/home/$LIVE/.{xinitrc,zprofile}; do
|
||||
awk '{if($0 && $0 !~ "^#") print "# "$0; else print $0}' $f > $f
|
||||
done
|
||||
chrun 'systemctl enable lightdm.service && systemctl set-default graphical.target'
|
||||
cat > $MNT/etc/lightdm/lightdm-gtk-greeter.conf << EOF
|
||||
# LightDM GTK+ Configuration
|
||||
|
||||
[greeter]
|
||||
active-monitor=0
|
||||
default-user-image=/usr/share/icons/ArchLabs-Dark/64x64/places/distributor-logo-archlabs.png
|
||||
background=/usr/share/backgrounds/archlabs/archlabs.jpg
|
||||
theme-name=ArchLabs-dARK
|
||||
icon-theme-name=Adwaita
|
||||
font-name=DejaVu Sans Mono 11
|
||||
position=30%,end 50%,end
|
||||
EOF
|
||||
if [[ $AUTOLOGIN == true ]]; then
|
||||
chrun "groupadd -r nopasswdlogin && usermod -aG nopasswdlogin $NEWUSER"
|
||||
sed -i '/#%PAM-1.0/ a auth sufficient pam_succeed_if.so user ingroup nopasswdlogin' $MNT/etc/pam.d/lightdm
|
||||
sed -i "/#autologin-session=/ c autologin-session=${LOGIN_WM}" $MNT/etc/lightdm/lightdm.conf
|
||||
sed -i "/#autologin-user=/ c autologin-user=${NEWUSER}" $MNT/etc/lightdm/lightdm.conf
|
||||
fi
|
||||
else # xinit login
|
||||
sed -i "s/openbox-session/${LOGIN_WM}/g" $MNT/home/$LIVE/.xinitrc
|
||||
if grep -q '#exec' $MNT/home/$LIVE/.zprofile; then
|
||||
sed -i 's/#exec/exec/' $MNT/home/$LIVE/.zprofile
|
||||
elif grep -q 'exec sudo archlabs-installer' $MNT/home/$LIVE/.zprofile; then
|
||||
sed -i 's|exec sudo archlabs-installer|exec startx -- vt1 >/dev/null 2>&1|' $MNT/home/$LIVE/.zprofile
|
||||
else
|
||||
cat > $MNT/home/$LIVE/.zprofile << EOF
|
||||
if [[ ! \$DISPLAY && \$XDG_VTNR -eq 1 ]]; then
|
||||
exec startx -- vt1 >/dev/null 2>&1
|
||||
fi
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [[ $AUTOLOGIN == true ]]; then
|
||||
sed -i "s/${LIVE}/${NEWUSER}/g" $service/autologin.conf
|
||||
else
|
||||
rm -rf $service
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
run_mkinitcpio() {
|
||||
local add=""
|
||||
# setup a keyfile for LUKS.. Only when choosing grub and system is UEFI
|
||||
@ -181,6 +217,19 @@ run_mkinitcpio() {
|
||||
echeck "mkinitcpio -p $KERNEL"
|
||||
}
|
||||
|
||||
mirrorlist_sort() {
|
||||
printf "%s\n\n" "Sorting the mirrorlist"
|
||||
if hash reflector >/dev/null 2>&1; then
|
||||
$MIRROR_CMD --save $MNT/etc/pacman.d/mirrorlist --verbose ||
|
||||
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
|
||||
fi
|
||||
}
|
||||
|
||||
package_operations() {
|
||||
local inpkg="$EXTRA_PACKAGES" # add the packages chosen during setup
|
||||
local rmpkg="archlabs-installer" # always remove the installer
|
||||
@ -241,51 +290,3 @@ package_operations() {
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
login_manager() {
|
||||
local service="$MNT/etc/systemd/system/getty@tty1.service.d"
|
||||
if [[ $LOGIN_TYPE == 'lightdm' ]]; then
|
||||
rm -rf $service
|
||||
for f in $MNT/home/$LIVE/.{xinitrc,zprofile}; do
|
||||
awk '{if($0 && $0 !~ "^#") print "# "$0; else print $0}' $f > $f
|
||||
done
|
||||
chrun 'systemctl enable lightdm.service && systemctl set-default graphical.target'
|
||||
cat > $MNT/etc/lightdm/lightdm-gtk-greeter.conf << EOF
|
||||
# LightDM GTK+ Configuration
|
||||
|
||||
[greeter]
|
||||
active-monitor=0
|
||||
default-user-image=/usr/share/icons/ArchLabs-Dark/64x64/places/distributor-logo-archlabs.png
|
||||
background=/usr/share/backgrounds/archlabs/archlabs.jpg
|
||||
theme-name=ArchLabs-dARK
|
||||
icon-theme-name=Adwaita
|
||||
font-name=DejaVu Sans Mono 11
|
||||
position=30%,end 50%,end
|
||||
EOF
|
||||
if [[ $AUTOLOGIN == true ]]; then
|
||||
chrun "groupadd -r nopasswdlogin && usermod -aG nopasswdlogin $NEWUSER"
|
||||
sed -i '/#%PAM-1.0/ a auth sufficient pam_succeed_if.so user ingroup nopasswdlogin' $MNT/etc/pam.d/lightdm
|
||||
sed -i "/#autologin-session=/ c autologin-session=${LOGIN_WM}" $MNT/etc/lightdm/lightdm.conf
|
||||
sed -i "/#autologin-user=/ c autologin-user=${NEWUSER}" $MNT/etc/lightdm/lightdm.conf
|
||||
fi
|
||||
else # xinit login
|
||||
sed -i "s/openbox-session/${LOGIN_WM}/g" $MNT/home/$LIVE/.xinitrc
|
||||
if grep -q '#exec' $MNT/home/$LIVE/.zprofile; then
|
||||
sed -i 's/#exec/exec/' $MNT/home/$LIVE/.zprofile
|
||||
elif grep -q 'exec sudo archlabs-installer' $MNT/home/$LIVE/.zprofile; then
|
||||
sed -i 's|exec sudo archlabs-installer|exec startx -- vt1 >/dev/null 2>&1|' $MNT/home/$LIVE/.zprofile
|
||||
else
|
||||
cat > $MNT/home/$LIVE/.zprofile << EOF
|
||||
if [[ ! \$DISPLAY && \$XDG_VTNR -eq 1 ]]; then
|
||||
exec startx -- vt1 >/dev/null 2>&1
|
||||
fi
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [[ $AUTOLOGIN == true ]]; then
|
||||
sed -i "s/${LIVE}/${NEWUSER}/g" $service/autologin.conf
|
||||
else
|
||||
rm -rf $service
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
285
src/lib/mount.sh
285
src/lib/mount.sh
@ -18,6 +18,38 @@ format() {
|
||||
echeck "${FS_CMDS[$2]} $1"
|
||||
}
|
||||
|
||||
partition() {
|
||||
local device
|
||||
if [[ $# -eq 0 ]]; then
|
||||
select_device 'root' || return 1
|
||||
device="$DEVICE"
|
||||
else
|
||||
device="$1"
|
||||
fi
|
||||
|
||||
tput civis
|
||||
local choice
|
||||
choice="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_PartTitle " \
|
||||
--menu "$_PartBody" 0 0 0 "$_PartShowTree" "-" "$_PartAuto" "-" \
|
||||
$( ([[ $DISPLAY ]] && hash gparted >/dev/null 2>&1) && printf "gparted -") \
|
||||
"cfdisk" "-" "parted" "-" "$_PartWipe" "-")"
|
||||
[[ $? != 0 || $choice == "" ]] && return 1
|
||||
|
||||
tput civis
|
||||
if [[ $choice != "$_PartWipe" && $choice != "$_PartAuto" && $choice != "$_PartShowTree" ]]; then
|
||||
clear; tput cnorm; $choice $device
|
||||
elif [[ $choice == "$_PartShowTree" ]]; then
|
||||
msgbox "$_PrepShowDev" "\n$(lsblk -o NAME,MODEL,TYPE,FSTYPE,SIZE,MOUNTPOINT "$device")\n"
|
||||
partition $device
|
||||
elif [[ $choice == "$_PartWipe" ]]; then
|
||||
yesno "$_PartWipe" "$_PartBody1 $device $_PartWipeBody2" && wipe -Ifrev $device
|
||||
partition $device
|
||||
else
|
||||
# if auto_partition fails we need to re-initialize the variables, just to be sure
|
||||
auto_partition $device || { init; return 1; }
|
||||
fi
|
||||
}
|
||||
|
||||
decr_count() {
|
||||
# remove a partition from the dialog list and decrement the number partitions left
|
||||
(( $# == 1 )) || return 1
|
||||
@ -42,23 +74,42 @@ enable_swap() {
|
||||
return 0
|
||||
}
|
||||
|
||||
mount_partition() {
|
||||
local part="$1"
|
||||
local mount="${MNT}$2"
|
||||
local fs="$(lsblk -lno FSTYPE $part)"
|
||||
|
||||
mkdir -p "$mount"
|
||||
|
||||
if [[ ${FS_OPTS[$fs]} != "" && $part != "$BOOT_PART" ]] && select_mount_opts "$part" "$fs"; then
|
||||
mount -o $MNT_OPTS $part "$mount" # 2>$ERR
|
||||
echeck "mount -o $MNT_OPTS $part $mount"
|
||||
device_tree() {
|
||||
tput civis
|
||||
local msg
|
||||
if [[ $IGNORE_DEV != "" ]]; then
|
||||
msg="$(lsblk -o NAME,MODEL,TYPE,FSTYPE,SIZE,MOUNTPOINT |
|
||||
awk "!/$IGNORE_DEV/"' && /disk|part|lvm|crypt|NAME/ {print $0}')"
|
||||
else
|
||||
mount $part "$mount" # 2>$ERR
|
||||
echeck "mount $part $mount"
|
||||
msg="$(lsblk -o NAME,MODEL,TYPE,FSTYPE,SIZE,MOUNTPOINT |
|
||||
awk '/disk|part|lvm|crypt|NAME/ {print $0}')"
|
||||
fi
|
||||
msgbox "$_PrepShowDev" "$msg"
|
||||
}
|
||||
|
||||
select_device() {
|
||||
local dev
|
||||
local msg
|
||||
[[ $1 == 'boot' ]] && msg="$_DevSelTitle for bootloader\n" || unmountp
|
||||
|
||||
if [[ $DEV_COUNT -eq 1 && $SYS_DEVS ]]; then
|
||||
DEVICE="$(awk '{print $1}' <<< "$SYS_DEVS")"
|
||||
msg="\nOnly one device available$([[ $1 == 'boot' ]] && printf " for grub bootloader"):"
|
||||
infobox "$_DevSelTitle" "$msg $DEVICE\n" 1
|
||||
elif (( DEV_COUNT > 1 )); then
|
||||
tput civis
|
||||
DEVICE="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_DevSelTitle " \
|
||||
--menu "${msg}$_DevSelBody" 0 0 0 $SYS_DEVS)"
|
||||
[[ $? != 0 || $DEVICE == "" ]] && return 1
|
||||
else
|
||||
msg="\nNo available devices for installation to use$([[ $1 == 'boot' ]] && printf " for grub bootloader")."
|
||||
msgbox "$_ErrTitle" "$msg\n$_Exit"
|
||||
die 1
|
||||
fi
|
||||
|
||||
confirm_mount $part "$mount" || return 1
|
||||
check_cryptlvm "$part"
|
||||
# if the device selected was for grub bootloader, set the BOOT_DEVICE
|
||||
# this is needed because grub uses the base device for BIOS, not the partition
|
||||
[[ $1 == 'boot' ]] && BOOT_DEVICE="$DEVICE"
|
||||
return 0
|
||||
}
|
||||
|
||||
@ -79,39 +130,6 @@ confirm_mount() {
|
||||
return 0
|
||||
}
|
||||
|
||||
find_partitions() {
|
||||
local str="$1"
|
||||
local err=''
|
||||
|
||||
# string of partitions as /TYPE/PART SIZE
|
||||
if [[ $IGNORE_DEV != "" ]]; then
|
||||
PARTS="$(lsblk -lno TYPE,NAME,SIZE |
|
||||
awk "/$str/"' && !'"/$IGNORE_DEV/"' {sub(/^part/, "/dev/");
|
||||
sub(/^lvm|^crypt/, "/dev/mapper/"); print $1$2 " " $3}')"
|
||||
else
|
||||
PARTS="$(lsblk -lno TYPE,NAME,SIZE |
|
||||
awk "/$str/"' {sub(/^part/, "/dev/") sub(/^lvm|^crypt/, "/dev/mapper/")
|
||||
print $1$2 " " $3}')"
|
||||
fi
|
||||
|
||||
# number of partitions total
|
||||
COUNT=$(wc -l <<< "$PARTS")
|
||||
|
||||
# ensure we have enough partitions for the system and action type
|
||||
case $str in
|
||||
'part|lvm|crypt') [[ $COUNT -eq 0 || ($SYS == 'UEFI' && $COUNT -lt 2) ]] && err="$_PartErrBody" ;;
|
||||
'part|crypt') (( COUNT == 0 )) && err="$_LvmPartErrBody" ;;
|
||||
'part|lvm') (( COUNT < 2 )) && err="$_LuksPartErrBody" ;;
|
||||
esac
|
||||
|
||||
# if there aren't enough partitions show the error message
|
||||
if [[ $err ]]; then
|
||||
msgbox "$_ErrTitle" "$err"
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
check_cryptlvm() {
|
||||
local part="$1"
|
||||
local dev=""
|
||||
@ -160,11 +178,17 @@ check_cryptlvm() {
|
||||
|
||||
auto_partition() {
|
||||
local device="$1"
|
||||
local size=$(lsblk -lno SIZE $device | awk 'NR == 1 {
|
||||
if ($1 ~ "G") {
|
||||
sub(/G/, ""); print ($1 * 1000 - 512) / 1000"G"
|
||||
} else {
|
||||
sub(/M/, ""); print ($1 - 512)"M"
|
||||
}}')
|
||||
|
||||
# confirm or bail
|
||||
yesno "$_PrepParts" "$_PartBody1 $device $_PartBody2" || return 0
|
||||
yesno "$_PrepParts" "$_PartBody1 $device $_PartBody2 ($size)$_PartBody3" || return 0
|
||||
infobox "$_PrepParts" "\nAuto partitioning device: $device\n" 0
|
||||
swapoff -a # make sure swap is disabled in case the device was used for swap
|
||||
swapoff -a # in case the device was previously used for swap
|
||||
local dev_info="$(parted -s $device print)"
|
||||
|
||||
# walk the partitions on the device in reverse order and delete them
|
||||
@ -184,8 +208,9 @@ auto_partition() {
|
||||
parted -s $device mkpart ESP fat32 1MiB 513MiB >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
sleep 0.1; BOOT_PART=$(lsblk -lno NAME $device | awk 'NR==2 {print}')
|
||||
sleep 0.1
|
||||
BOOT_DEVICE="$device"
|
||||
BOOT_PART=$(lsblk -lno NAME,TYPE $device | awk 'NR == 2 {print "/dev/"$1}')
|
||||
|
||||
if [[ $SYS == "BIOS" ]]; then
|
||||
mkfs.ext4 -q $BOOT_PART >/dev/null 2>&1
|
||||
@ -194,11 +219,65 @@ auto_partition() {
|
||||
fi
|
||||
|
||||
parted -s $device mkpart primary ext4 513MiB 100% >/dev/null 2>&1
|
||||
sleep 0.1; ROOT_PART=$(lsblk -lno NAME $device | awk 'NR==3 {print}')
|
||||
sleep 0.1
|
||||
ROOT_PART=$(lsblk -lno NAME,TYPE $device | awk 'NR == 3 {print "/dev/"$1}')
|
||||
mkfs.ext4 -q $ROOT_PART >/dev/null 2>&1
|
||||
|
||||
tput civis; sleep 0.5
|
||||
msgbox "$_PrepParts" "\nAuto partitioning complete.\n$(lsblk $device -o NAME,MODEL,TYPE,FSTYPE,SIZE)"
|
||||
msgbox "$_PrepParts" "\nAuto partitioning complete.\n\n$(lsblk $device -o NAME,MODEL,TYPE,FSTYPE,SIZE)"
|
||||
}
|
||||
|
||||
mount_partition() {
|
||||
local part="$1"
|
||||
local mount="${MNT}$2"
|
||||
local fs="$(lsblk -lno FSTYPE $part)"
|
||||
|
||||
mkdir -p "$mount"
|
||||
|
||||
if [[ ${FS_OPTS[$fs]} != "" && $part != "$BOOT_PART" ]] && select_mount_opts "$part" "$fs"; then
|
||||
mount -o $MNT_OPTS $part "$mount" # 2>$ERR
|
||||
echeck "mount -o $MNT_OPTS $part $mount"
|
||||
else
|
||||
mount $part "$mount" # 2>$ERR
|
||||
echeck "mount $part $mount"
|
||||
fi
|
||||
|
||||
confirm_mount $part "$mount" || return 1
|
||||
check_cryptlvm "$part"
|
||||
return 0
|
||||
}
|
||||
|
||||
find_partitions() {
|
||||
local str="$1"
|
||||
local err=''
|
||||
|
||||
# string of partitions as /TYPE/PART SIZE
|
||||
if [[ $IGNORE_DEV != "" ]]; then
|
||||
PARTS="$(lsblk -lno TYPE,NAME,SIZE |
|
||||
awk "/$str/"' && !'"/$IGNORE_DEV/"' {sub(/^part/, "/dev/");
|
||||
sub(/^lvm|^crypt/, "/dev/mapper/"); print $1$2 " " $3}')"
|
||||
else
|
||||
PARTS="$(lsblk -lno TYPE,NAME,SIZE |
|
||||
awk "/$str/"' {sub(/^part/, "/dev/") sub(/^lvm|^crypt/, "/dev/mapper/")
|
||||
print $1$2 " " $3}')"
|
||||
fi
|
||||
|
||||
# number of partitions total
|
||||
COUNT=$(wc -l <<< "$PARTS")
|
||||
|
||||
# ensure we have enough partitions for the system and action type
|
||||
case $str in
|
||||
'part|lvm|crypt') [[ $COUNT -eq 0 || ($SYS == 'UEFI' && $COUNT -lt 2) ]] && err="$_PartErrBody" ;;
|
||||
'part|crypt') (( COUNT == 0 )) && err="$_LvmPartErrBody" ;;
|
||||
'part|lvm') (( COUNT < 2 )) && err="$_LuksPartErrBody" ;;
|
||||
esac
|
||||
|
||||
# if there aren't enough partitions show the error message
|
||||
if [[ $err ]]; then
|
||||
msgbox "$_ErrTitle" "$err"
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
setup_boot_device() {
|
||||
@ -213,77 +292,6 @@ setup_boot_device() {
|
||||
return 0
|
||||
}
|
||||
|
||||
device_tree() {
|
||||
tput civis
|
||||
local msg
|
||||
if [[ $IGNORE_DEV != "" ]]; then
|
||||
msg="$(lsblk -o NAME,MODEL,TYPE,FSTYPE,SIZE,MOUNTPOINT |
|
||||
awk "!/$IGNORE_DEV/"' && /disk|part|lvm|crypt|NAME/ {print $0}')"
|
||||
else
|
||||
msg="$(lsblk -o NAME,MODEL,TYPE,FSTYPE,SIZE,MOUNTPOINT |
|
||||
awk '/disk|part|lvm|crypt|NAME/ {print $0}')"
|
||||
fi
|
||||
msgbox "$_PrepShowDev" "$msg"
|
||||
}
|
||||
|
||||
select_device() {
|
||||
local dev
|
||||
local msg
|
||||
[[ $1 == 'boot' ]] && msg="$_DevSelTitle for bootloader\n" || unmountp
|
||||
|
||||
if [[ $DEV_COUNT -eq 1 && $SYS_DEVS ]]; then
|
||||
DEVICE="$(awk '{print $1}' <<< "$SYS_DEVS")"
|
||||
msg="\nOnly one device available$([[ $1 == 'boot' ]] && printf " for grub bootloader"):"
|
||||
infobox "$_DevSelTitle" "$msg $DEVICE\n" 1
|
||||
elif (( DEV_COUNT > 1 )); then
|
||||
tput civis
|
||||
DEVICE="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_DevSelTitle " \
|
||||
--menu "${msg}$_DevSelBody" 0 0 0 $SYS_DEVS)"
|
||||
[[ $? != 0 || $DEVICE == "" ]] && return 1
|
||||
else
|
||||
msg="\nNo available devices for installation to use$([[ $1 == 'boot' ]] && printf " for grub bootloader")."
|
||||
msgbox "$_ErrTitle" "$msg\n$_Exit"
|
||||
die 1
|
||||
fi
|
||||
|
||||
# if the device selected was for grub bootloader, set the BOOT_DEVICE
|
||||
# this is needed because grub uses the base device for BIOS, not the partition
|
||||
[[ $1 == 'boot' ]] && BOOT_DEVICE="$DEVICE"
|
||||
return 0
|
||||
}
|
||||
|
||||
partition() {
|
||||
local device
|
||||
if [[ $# -eq 0 ]]; then
|
||||
select_device 'root' || return 1
|
||||
device="$DEVICE"
|
||||
else
|
||||
device="$1"
|
||||
fi
|
||||
|
||||
tput civis
|
||||
local choice
|
||||
choice="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $_PartTitle " \
|
||||
--menu "$_PartBody" 0 0 0 "$_PartShowTree" "-" "$_PartAuto" "-" \
|
||||
$( ([[ $DISPLAY ]] && hash gparted >/dev/null 2>&1) && printf "gparted -") \
|
||||
"cfdisk" "-" "parted" "-" "$_PartWipe" "-")"
|
||||
[[ $? != 0 || $choice == "" ]] && return 1
|
||||
|
||||
tput civis
|
||||
if [[ $choice != "$_PartWipe" && $choice != "$_PartAuto" && $choice != "$_PartShowTree" ]]; then
|
||||
clear; tput cnorm; $choice $device
|
||||
elif [[ $choice == "$_PartShowTree" ]]; then
|
||||
msgbox "$_PrepShowDev" "\n$(lsblk -o NAME,MODEL,TYPE,FSTYPE,SIZE,MOUNTPOINT "$device")\n"
|
||||
partition $device
|
||||
elif [[ $choice == "$_PartWipe" ]]; then
|
||||
yesno "$_PartWipe" "$_PartBody1 $device $_PartWipeBody2" && wipe -Ifrev $device
|
||||
partition $device
|
||||
else
|
||||
# if auto_partition fails we need to re-initialize the variables, just to be sure
|
||||
auto_partition $device || { init; return 1; }
|
||||
fi
|
||||
}
|
||||
|
||||
########################################################
|
||||
## Mount functions ##
|
||||
########################################################
|
||||
@ -312,6 +320,7 @@ mountp() {
|
||||
select_boot_setup || { BOOTLDR=""; return 1; }
|
||||
|
||||
if [[ $BOOT_PART != "" ]]; then
|
||||
infobox "$_PrepMount" "\nSetting up for the bootloader and mounting the boot partition.\n" 1
|
||||
setup_boot_device
|
||||
mount_partition "$BOOT_PART" "${BMNTS[$SYS-$BOOTLDR]}" || return 1
|
||||
SEPERATE_BOOT=true
|
||||
@ -356,6 +365,19 @@ select_swap() {
|
||||
return 0
|
||||
}
|
||||
|
||||
select_mountpoint() {
|
||||
tput cnorm
|
||||
EXTRA_MNT="$(getinput "$_PrepMount $part" "$_ExtPartBody1 /home /var\n" "/")"
|
||||
[[ $? != 0 || $EXTRA_MNT == "" ]] && return 1
|
||||
|
||||
# bad mountpoint
|
||||
if [[ ${EXTRA_MNT:0:1} != "/" || ${#EXTRA_MNT} -le 1 || $EXTRA_MNT =~ \ |\' ]]; then
|
||||
msgbox "$_ErrTitle" "$_ExtErrBody"
|
||||
select_mountpoint || return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
select_boot_setup() {
|
||||
# choose bootloader and mountpoint (if needed)
|
||||
tput civis
|
||||
@ -493,9 +515,7 @@ select_root_partition() {
|
||||
decr_count "$LUKS_PART"
|
||||
elif (( LVM == 1 )); then
|
||||
(( LUKS == 1 )) && decr_count "$LUKS_PART"
|
||||
for part in $(echo "$GROUP_PARTS"); do
|
||||
decr_count "$part"
|
||||
done
|
||||
for part in $(echo "$GROUP_PARTS"); do decr_count "$part"; done
|
||||
ROOT_PART=""
|
||||
fi
|
||||
|
||||
@ -539,16 +559,3 @@ select_extra_partitions() {
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
select_mountpoint() {
|
||||
tput cnorm
|
||||
EXTRA_MNT="$(getinput "$_PrepMount $part" "$_ExtPartBody1 /home /var\n" "/")"
|
||||
[[ $? != 0 || $EXTRA_MNT == "" ]] && return 1
|
||||
|
||||
# bad mountpoint
|
||||
if [[ ${EXTRA_MNT:0:1} != "/" || ${#EXTRA_MNT} -le 1 || $EXTRA_MNT =~ \ |\' ]]; then
|
||||
msgbox "$_ErrTitle" "$_ExtErrBody"
|
||||
select_mountpoint || return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
125
src/lib/utils.sh
125
src/lib/utils.sh
@ -13,7 +13,7 @@ chrun() {
|
||||
}
|
||||
|
||||
json() {
|
||||
python3 -c "import sys, json; print(json.load(sys.stdin)['$1'])"
|
||||
curl -s "http://api.ipstack.com/$2" | python3 -c "import sys, json; print(json.load(sys.stdin)['$1'])"
|
||||
}
|
||||
|
||||
src() {
|
||||
@ -27,6 +27,55 @@ ssd() {
|
||||
[[ $(cat /sys/block/$dev/queue/rotational) -eq 0 ]] || return 1
|
||||
}
|
||||
|
||||
die() {
|
||||
tput cnorm && unmountp
|
||||
pgrep -f "$TERM_CMD -e tail" && pkill -f "$TERM_CMD -e tail"
|
||||
[[ $1 =~ [0-9] ]] && exit $1 || $1
|
||||
}
|
||||
|
||||
sigint() {
|
||||
printf "\n** CTRL-C caught"
|
||||
die 1
|
||||
}
|
||||
|
||||
msgbox() {
|
||||
tput civis
|
||||
dialog --cr-wrap --backtitle "$BT" --title " $1 " --msgbox "$2\n" 0 0
|
||||
}
|
||||
|
||||
oneshot() {
|
||||
[[ -e /tmp/.ai_$1 || ! $(type $1) ]] && return 0
|
||||
$1 || return 1
|
||||
touch "/tmp/.ai_$1"
|
||||
return 0
|
||||
}
|
||||
|
||||
getinput() {
|
||||
local answer
|
||||
answer="$(dialog --cr-wrap --max-input 63 --stdout --no-cancel \
|
||||
--backtitle "$BT" --title " $1 " --inputbox "$2" 0 0 "$3")"
|
||||
[[ $? != 0 || $answer == "" ]] && return 1
|
||||
printf "$answer"
|
||||
}
|
||||
|
||||
infobox() {
|
||||
local sec="$3"
|
||||
tput civis
|
||||
dialog --cr-wrap --backtitle "$BT" --title " $1 " --infobox "$2\n" 0 0
|
||||
sleep ${sec:-2}
|
||||
}
|
||||
|
||||
devices() {
|
||||
IGNORE_DEV="$(lsblk -lno NAME,MOUNTPOINT | awk '/\/run\/archiso\/bootmnt/ {sub(/[1-9]/, ""); print $1}')"
|
||||
if [[ $IGNORE_DEV ]]; then
|
||||
SYS_DEVS="$(lsblk -lno NAME,SIZE,TYPE | awk '/disk/ && !'"/$IGNORE_DEV/"' {print "/dev/" $1 " " $2}')"
|
||||
else
|
||||
SYS_DEVS="$(lsblk -lno NAME,SIZE,TYPE | awk '/disk/ {print "/dev/" $1 " " $2}')"
|
||||
fi
|
||||
DEV_COUNT="$(wc -l <<< "$SYS_DEVS")"
|
||||
declare -gr SYS_DEVS IGNORE_DEV DEV_COUNT
|
||||
}
|
||||
|
||||
sysid() {
|
||||
if grep -qi 'apple' /sys/class/dmi/id/sys_vendor; then
|
||||
modprobe -r -q efivars
|
||||
@ -34,6 +83,8 @@ sysid() {
|
||||
modprobe -q efivarfs
|
||||
fi
|
||||
|
||||
declare -g IS_64BIT=false
|
||||
|
||||
if [[ -d /sys/firmware/efi ]]; then
|
||||
SYS="UEFI"
|
||||
[[ $(cat /sys/firmware/efi/fw_platform_size) == 64 ]] && IS_64BIT=true
|
||||
@ -41,22 +92,20 @@ sysid() {
|
||||
SYS="BIOS"
|
||||
fi
|
||||
|
||||
readonly BT="$DIST Installer - $SYS (x86_64) - Version $VER"
|
||||
declare -g BT="$DIST Installer - $SYS (x86_64) - Version $VER"
|
||||
return 0
|
||||
}
|
||||
|
||||
checks() {
|
||||
if [[ $(whoami) != "root" ]]; then
|
||||
infobox "$_ErrTitle" "$_NotRoot\n$_Exit" && die 1
|
||||
elif ! grep -qw 'lm' /proc/cpuinfo; then
|
||||
infobox "$_ErrTitle" "$_Not64Bit\n$_Exit" && die 1
|
||||
elif ! curl -s --head 'https://www.archlinux.org/mirrorlist/all/' | head -n 1 | grep -q '200'; then
|
||||
[[ $(whoami) == "root" ]] || { infobox "$_ErrTitle" "$_NotRoot\n$_Exit" && die 1; }
|
||||
grep -qw 'lm' /proc/cpuinfo || { infobox "$_ErrTitle" "$_Not64Bit\n$_Exit" && die 1; }
|
||||
|
||||
if ! curl -s --head 'https://www.archlinux.org/mirrorlist/all/' | head -n 1 | grep -q '200'; then
|
||||
if [[ $(systemctl is-active NetworkManager) == "active" ]] && hash nmtui >/dev/null 2>&1; then
|
||||
tput civis; nmtui
|
||||
fi
|
||||
if ! curl -s --head 'https://www.archlinux.org/mirrorlist/all/' | head -n 1 | grep -q '200'; then
|
||||
curl -s --head 'https://www.archlinux.org/mirrorlist/all/' | head -n 1 | grep -q '200' ||
|
||||
infobox "$_ErrTitle" "$_NoNetwork\n"
|
||||
fi
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
@ -79,41 +128,13 @@ echeck() {
|
||||
else
|
||||
yesno "$_ErrTitle" "$msg" "Exit & Shutdown" "Ignore & Continue" && die 'shutdown -h now'
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
icheck() {
|
||||
[[ $(lsblk -o MOUNTPOINT) =~ $MNT && $CONFIG_DONE == true ]] && return 0
|
||||
|
||||
if ! [[ $(lsblk -o MOUNTPOINT) =~ $MNT ]]; then
|
||||
msgbox "$_ErrTitle" "$_ErrNoMount"
|
||||
SELECTED=4
|
||||
else
|
||||
msgbox "$_ErrTitle" "$_ErrNoConfig"
|
||||
SELECTED=5
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
getinput() {
|
||||
local answer
|
||||
answer="$(dialog --cr-wrap --max-input 63 --stdout --no-cancel \
|
||||
--backtitle "$BT" --title " $1 " --inputbox "$2" 0 0 "$3")"
|
||||
[[ $? != 0 || $answer == "" ]] && return 1
|
||||
printf "$answer"
|
||||
}
|
||||
|
||||
msgbox() {
|
||||
tput civis
|
||||
dialog --cr-wrap --backtitle "$BT" --title " $1 " --msgbox "$2\n" 0 0
|
||||
}
|
||||
|
||||
infobox() {
|
||||
local sec="$3"
|
||||
tput civis
|
||||
dialog --cr-wrap --backtitle "$BT" --title " $1 " --infobox "$2\n" 0 0
|
||||
sleep ${sec:-2}
|
||||
[[ $(lsblk -o MOUNTPOINT) =~ $MNT ]] || { msgbox "$_ErrTitle" "$_ErrNoMount"; SELECTED=4; return 1; }
|
||||
[[ $CONFIG_DONE == true ]] || { msgbox "$_ErrTitle" "$_ErrNoConfig"; SELECTED=5; return 1; }
|
||||
return 0
|
||||
}
|
||||
|
||||
yesno() {
|
||||
@ -132,30 +153,6 @@ yesno() {
|
||||
fi
|
||||
}
|
||||
|
||||
wrap_up() {
|
||||
yesno "$_CloseInst" "$1" "$2" "$3" || return 0
|
||||
[[ $4 == 'reboot' ]] && die 'reboot' || die 0
|
||||
}
|
||||
|
||||
die() {
|
||||
tput cnorm
|
||||
punmount
|
||||
pgrep -f "$TERM_CMD -e tail" && pkill -f "$TERM_CMD -e tail"
|
||||
[[ $1 =~ [0-9] ]] && exit $1 || $1
|
||||
}
|
||||
|
||||
sigint() {
|
||||
printf "\n** CTRL-C caught"
|
||||
die 1
|
||||
}
|
||||
|
||||
oneshot() {
|
||||
[[ -e /tmp/.ai_$1 || ! $(type $1) ]] && return 0
|
||||
$1 || return 1
|
||||
touch "/tmp/.ai_$1"
|
||||
return 0
|
||||
}
|
||||
|
||||
debug() {
|
||||
set -x
|
||||
exec 3>| /tmp/debug-log
|
||||
|
Reference in New Issue
Block a user