Fix: awk // search syntax error in part_resize()
This commit is contained in:
parent
20823f7a9a
commit
18a1170af7
@ -5,7 +5,7 @@
|
|||||||
# Some ideas and code reworked from other resources
|
# Some ideas and code reworked from other resources
|
||||||
# AIF, Cnichi, Calamares, Arch Wiki.. Credit where credit is due
|
# AIF, Cnichi, Calamares, Arch Wiki.. Credit where credit is due
|
||||||
|
|
||||||
VER="2.0.25" # version
|
VER="2.0.27" # version
|
||||||
DIST="ArchLabs" # distributor
|
DIST="ArchLabs" # distributor
|
||||||
MNT="/mnt" # mountpoint
|
MNT="/mnt" # mountpoint
|
||||||
ANS="/tmp/ans"
|
ANS="/tmp/ans"
|
||||||
@ -250,7 +250,7 @@ declare -A PKG_EXT=(
|
|||||||
_keymap="\nPick which keymap to use for the system from the list below\n\nThis is used once a graphical environment is running (Xorg).\n\nSystem default: us"
|
_keymap="\nPick which keymap to use for the system from the list below\n\nThis is used once a graphical environment is running (Xorg).\n\nSystem default: us"
|
||||||
_vconsole="\nSelect the console keymap, the console is the tty shell you reach before starting a graphical environment (Xorg).\n\nIts keymap is seperate from the one used by the graphical environments, though many do use the same such as 'us' English.\n\nSystem default: us"
|
_vconsole="\nSelect the console keymap, the console is the tty shell you reach before starting a graphical environment (Xorg).\n\nIts keymap is seperate from the one used by the graphical environments, though many do use the same such as 'us' English.\n\nSystem default: us"
|
||||||
_device="\nSelect a device to use from the list below.\n\nDevices (/dev) are the available drives on the system. /sda, /sdb, /sdc ..."
|
_device="\nSelect a device to use from the list below.\n\nDevices (/dev) are the available drives on the system. /sda, /sdb, /sdc ..."
|
||||||
_resize="\n\nSelect the new filesystem size, a new partition will then be created from the free space.\nThe lowest size is just enough to fit the currently in use space on the partition while the default is set to split the free space evenly.\n\nUse Tab or the arrow keys move the cursor between the buttons and the value, when the cursor is on the value, you can edit it by:\n\n - left/right cursor movement to select a digit to modify\n - +/- characters to increment/decrement the digit by one\n - 0 through 9 to set the digit to the given value\n\nSome keys are also recognized in all cursor positions:\n\n - Home/End set the value to its maximum or minimum\nPageup/Pagedown increment the value so that the slider moves by one column."
|
_resize="\nSelect a new filesystem size in MB, a new partition will be created from the free space but will be left unformatted.\nThe lowest size is just enough to fit the currently in use space on the partition while the default is set to split the free space evenly.\n\nUse Tab or the arrow keys move the cursor between the buttons and the value, when the cursor is on the value, you can edit it by:\n\n - left/right cursor movement to select a digit to modify\n - +/- characters to increment/decrement the digit by one\n - 0 through 9 to set the digit to the given value\n\nSome keys are also recognized in all cursor positions:\n\n - Home/End set the value to its maximum or minimum\n - Pageup/Pagedown increment the value so that the slider moves by one column."
|
||||||
_mount="\nUse [Space] to toggle mount options from below, press [Enter] when done to confirm selection.\n\nNot selecting any and confirming will run an automatic mount."
|
_mount="\nUse [Space] to toggle mount options from below, press [Enter] when done to confirm selection.\n\nNot selecting any and confirming will run an automatic mount."
|
||||||
_warn="\nIMPORTANT:\n\nChoose carefully when editing, formatting, and mounting partitions or your DATA MAY BE LOST.\n\nTo mount a partition without formatting it, select 'skip' when prompted to choose a filesystem during the mounting stage.\nThis can only be used for partitions that already contain a filesystem and cannot be the root (/) partition, it needs to be formatted before install.\n"
|
_warn="\nIMPORTANT:\n\nChoose carefully when editing, formatting, and mounting partitions or your DATA MAY BE LOST.\n\nTo mount a partition without formatting it, select 'skip' when prompted to choose a filesystem during the mounting stage.\nThis can only be used for partitions that already contain a filesystem and cannot be the root (/) partition, it needs to be formatted before install.\n"
|
||||||
_part="\nFull device auto partitioning is available for beginners otherwise cfdisk is recommended.\n\n - All systems will require a root partition (8G or greater).\n - UEFI (and BIOS using LUKS without LVM) require a separate boot partition (100-512M)."
|
_part="\nFull device auto partitioning is available for beginners otherwise cfdisk is recommended.\n\n - All systems will require a root partition (8G or greater).\n - UEFI (and BIOS using LUKS without LVM) require a separate boot partition (100-512M)."
|
||||||
@ -310,26 +310,21 @@ select_main()
|
|||||||
(( SEL < 12 )) && (( SEL++ ))
|
(( SEL < 12 )) && (( SEL++ ))
|
||||||
tput civis
|
tput civis
|
||||||
dialog --backtitle "$DIST Installer - $SYS - v$VER" --title " Prepare " --default-item $SEL --cancel-label 'Exit' --menu "$_prep" 0 0 0 \
|
dialog --backtitle "$DIST Installer - $SYS - v$VER" --title " Prepare " --default-item $SEL --cancel-label 'Exit' --menu "$_prep" 0 0 0 \
|
||||||
1 "Show lsblk output (optional)" \
|
1 "Device tree (optional)" \
|
||||||
2 "Edit partitions (optional)" \
|
2 "Partitioning (optional)" \
|
||||||
3 "LUKS encryption (optional)" \
|
3 "LUKS setup (optional)" \
|
||||||
4 "Logical volume management (optional)" \
|
4 "LVM setup (optional)" \
|
||||||
5 "Mount and format partitions" \
|
5 "Mount partitions" \
|
||||||
6 "Select system bootloader" \
|
6 "System bootloader" \
|
||||||
7 "Create user and set password" \
|
7 "User and password" \
|
||||||
8 "Configure system settings" \
|
8 "System configuration" \
|
||||||
9 "Select window manager or desktop (optional)" \
|
9 "Select WM/DE (optional)" \
|
||||||
10 "Select additional packages (optional)" \
|
10 "Select Packages (optional)" \
|
||||||
11 "Check configuration choices (optional)" \
|
11 "View configuration (optional)" \
|
||||||
12 "Start the installation" 2>"$ANS"
|
12 "Start the installation" 2>"$ANS"
|
||||||
|
|
||||||
read -r SEL < "$ANS"
|
read -r SEL < "$ANS"
|
||||||
|
[[ -z $WARN && $SEL =~ (2|5) ]] && { msg "Data Warning" "$_warn"; WARN=true; }
|
||||||
if [[ -z $WARN && $SEL =~ (2|5) ]]; then
|
|
||||||
msg "Data Warning" "$_warn"
|
|
||||||
WARN=true
|
|
||||||
fi
|
|
||||||
|
|
||||||
case $SEL in
|
case $SEL in
|
||||||
1) part_show ;;
|
1) part_show ;;
|
||||||
2) part_menu || (( SEL-- )) ;;
|
2) part_menu || (( SEL-- )) ;;
|
||||||
@ -352,31 +347,24 @@ select_boot()
|
|||||||
if [[ $SYS == 'BIOS' ]]; then
|
if [[ $SYS == 'BIOS' ]]; then
|
||||||
dlg BOOTLDR menu "BIOS Bootloader" "\nSelect which bootloader to use." \
|
dlg BOOTLDR menu "BIOS Bootloader" "\nSelect which bootloader to use." \
|
||||||
"grub" "The Grand Unified Bootloader, standard among many Linux distributions" \
|
"grub" "The Grand Unified Bootloader, standard among many Linux distributions" \
|
||||||
"syslinux" "A collection of boot loaders for booting drives, CDs, or over the network"
|
"syslinux" "A collection of boot loaders for booting drives, CDs, or over the network" || return 1
|
||||||
|
|
||||||
else
|
else
|
||||||
dlg BOOTLDR menu "UEFI Bootloader" "\nSelect which bootloader to use." \
|
dlg BOOTLDR menu "UEFI Bootloader" "\nSelect which bootloader to use." \
|
||||||
"systemd-boot" "A simple UEFI boot manager which executes configured EFI images" \
|
"systemd-boot" "A simple UEFI boot manager which executes configured EFI images" \
|
||||||
"grub" "The Grand Unified Bootloader, standard among many Linux distributions" \
|
"grub" "The Grand Unified Bootloader, standard among many Linux distributions" \
|
||||||
"refind-efi" "A UEFI boot manager that aims to be platform neutral and simplify multi-boot" \
|
"refind-efi" "A UEFI boot manager that aims to be platform neutral and simplify multi-boot" \
|
||||||
"efistub" "Boot the kernel image directly (no chainloading support)" \
|
"efistub" "Boot the kernel image directly (no chainloading support)" \
|
||||||
"syslinux" "A collection of boot loaders for booting drives, CDs, or over the network (no chainloading support)"
|
"syslinux" "A collection of boot loaders for booting drives, CDs, or over the network (no chainloading support)" || return 1
|
||||||
|
|
||||||
fi
|
fi
|
||||||
[[ $BOOTLDR ]] || return 1
|
|
||||||
setup_${BOOTLDR}
|
setup_${BOOTLDR}
|
||||||
}
|
}
|
||||||
|
|
||||||
select_show()
|
select_show()
|
||||||
{
|
{
|
||||||
|
local mnt="none"
|
||||||
local cmd="${BCMDS[$BOOTLDR]}"
|
local cmd="${BCMDS[$BOOTLDR]}"
|
||||||
if [[ $BOOT_PART ]]; then
|
|
||||||
local mnt="/$BOOTDIR"
|
|
||||||
else
|
|
||||||
local mnt="none"
|
|
||||||
fi
|
|
||||||
|
|
||||||
local pkgs="$USER_PKGS $PACKAGES"
|
local pkgs="$USER_PKGS $PACKAGES"
|
||||||
|
[[ $BOOT_PART ]] && mnt="/$BOOTDIR"
|
||||||
[[ $INSTALL_WMS == *dwm* ]] && pkgs="dwm st dmenu $pkgs"
|
[[ $INSTALL_WMS == *dwm* ]] && pkgs="dwm st dmenu $pkgs"
|
||||||
msg "Show Configuration" "
|
msg "Show Configuration" "
|
||||||
|
|
||||||
@ -431,11 +419,9 @@ select_login()
|
|||||||
{
|
{
|
||||||
dlg LOGIN_TYPE menu "Login Management" "\nSelect which login management to use." \
|
dlg LOGIN_TYPE menu "Login Management" "\nSelect which login management to use." \
|
||||||
"xinit" "Console login without a display manager" \
|
"xinit" "Console login without a display manager" \
|
||||||
"lightdm" "Lightweight display manager with a gtk greeter"
|
"lightdm" "Lightweight display manager with a gtk greeter" || return 1
|
||||||
|
|
||||||
if [[ -z $LOGIN_TYPE ]]; then
|
if [[ $LOGIN_TYPE == 'lightdm' ]]; then
|
||||||
return 1
|
|
||||||
elif [[ $LOGIN_TYPE == 'lightdm' ]]; then
|
|
||||||
WM_PKGS+=" lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice"
|
WM_PKGS+=" lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings accountsservice"
|
||||||
EDIT_FILES[login]="/etc/lightdm/lightdm.conf /etc/lightdm/lightdm-gtk-greeter.conf"
|
EDIT_FILES[login]="/etc/lightdm/lightdm.conf /etc/lightdm/lightdm-gtk-greeter.conf"
|
||||||
AUTOLOGIN=''
|
AUTOLOGIN=''
|
||||||
@ -458,7 +444,6 @@ select_login()
|
|||||||
select_config()
|
select_config()
|
||||||
{
|
{
|
||||||
local i=0
|
local i=0
|
||||||
|
|
||||||
CONFIG_DONE=''
|
CONFIG_DONE=''
|
||||||
|
|
||||||
until [[ $CONFIG_DONE ]]; do
|
until [[ $CONFIG_DONE ]]; do
|
||||||
@ -468,24 +453,22 @@ select_config()
|
|||||||
/usr/bin/zsh 'A very advanced and programmable command interpreter (shell) for UNIX' \
|
/usr/bin/zsh 'A very advanced and programmable command interpreter (shell) for UNIX' \
|
||||||
/bin/bash 'The GNU Bourne Again shell, standard in many GNU/Linux distributions' \
|
/bin/bash 'The GNU Bourne Again shell, standard in many GNU/Linux distributions' \
|
||||||
/usr/bin/mksh 'The MirBSD Korn Shell - an enhanced version of the public domain ksh' || return 1
|
/usr/bin/mksh 'The MirBSD Korn Shell - an enhanced version of the public domain ksh' || return 1
|
||||||
|
|
||||||
;;
|
;;
|
||||||
1) dlg MYHOST input "Hostname" "$_hostname" "${DIST,,}" limit || continue ;;
|
1) dlg MYHOST input "Hostname" "$_hostname" "${DIST,,}" limit || { i=0; continue; } ;;
|
||||||
2) dlg MYLOCALE menu "Locale" "$_locale" $LOCALES || continue ;;
|
2) dlg MYLOCALE menu "Locale" "$_locale" $LOCALES || { i=1; continue; } ;;
|
||||||
3) ZONE='' SUBZ=''
|
3) ZONE='' SUBZ=''
|
||||||
until [[ $ZONE && $SUBZ ]]; do
|
until [[ $ZONE && $SUBZ ]]; do
|
||||||
dlg ZONE menu "Timezone" "$_timez" America - Australia - Asia - Atlantic - Africa - Europe - Indian - Pacific - Arctic - Antarctica - || break
|
dlg ZONE menu "Timezone" "$_timez" America - Australia - Asia - Atlantic - Africa - Europe - Indian - Pacific - Arctic - Antarctica - || break
|
||||||
dlg SUBZ menu "Timezone" "$_timesubz" $(awk '/'"$ZONE"'\// {gsub(/'"$ZONE"'\//, ""); print $3 " - "}' /usr/share/zoneinfo/zone.tab | sort) || continue
|
dlg SUBZ menu "Timezone" "$_timesubz" $(awk '/'"$ZONE"'\// {gsub(/'"$ZONE"'\//, ""); print $3 " - "}' /usr/share/zoneinfo/zone.tab | sort) || continue
|
||||||
yesno "Timezone" "\nConfirm time zone: $ZONE/$SUBZ\n" || unset ZONE
|
yesno "Timezone" "\nConfirm time zone: $ZONE/$SUBZ\n" || unset ZONE
|
||||||
done
|
done
|
||||||
[[ $ZONE && $SUBZ ]] || continue ;;
|
[[ $ZONE && $SUBZ ]] || { i=2; continue; } ;;
|
||||||
4)
|
4)
|
||||||
dlg KERNEL menu "Kernel" "\nChoose which kernel to use." \
|
dlg KERNEL menu "Kernel" "\nChoose which kernel to use." \
|
||||||
linux 'Vanilla linux kernel and modules, with a few patches applied' \
|
linux 'Vanilla linux kernel and modules, with a few patches applied' \
|
||||||
linux-lts 'Long-term support (LTS) linux kernel and modules' \
|
linux-lts 'Long-term support (LTS) linux kernel and modules' \
|
||||||
linux-zen 'A effort of kernel hackers to provide the best kernel for everyday systems' \
|
linux-zen 'A effort of kernel hackers to provide the best kernel for everyday systems' \
|
||||||
linux-hardened 'A security-focused linux kernel with hardening patches to mitigate exploits' || continue
|
linux-hardened 'A security-focused linux kernel with hardening patches to mitigate exploits' || { i=3; continue; }
|
||||||
|
|
||||||
CONFIG_DONE=true
|
CONFIG_DONE=true
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@ -601,9 +584,7 @@ select_sessions()
|
|||||||
gnome "A desktop environment that aims to be simple and easy to use" "$(ofn gnome "${INSTALL_WMS[*]}")" \
|
gnome "A desktop environment that aims to be simple and easy to use" "$(ofn gnome "${INSTALL_WMS[*]}")" \
|
||||||
cinnamon "A desktop environment combining traditional desktop with modern effects" "$(ofn cinnamon "${INSTALL_WMS[*]}")" \
|
cinnamon "A desktop environment combining traditional desktop with modern effects" "$(ofn cinnamon "${INSTALL_WMS[*]}")" \
|
||||||
plasma "A kde software project currently comprising a full desktop environment" "$(ofn plasma "${INSTALL_WMS[*]}")" \
|
plasma "A kde software project currently comprising a full desktop environment" "$(ofn plasma "${INSTALL_WMS[*]}")" \
|
||||||
xfce4 "A lightweight and modular desktop environment based on gtk+2/3" "$(ofn xfce4 "${INSTALL_WMS[*]}")"
|
xfce4 "A lightweight and modular desktop environment based on gtk+2/3" "$(ofn xfce4 "${INSTALL_WMS[*]}")" || return 1
|
||||||
|
|
||||||
[[ $INSTALL_WMS ]] || return 1
|
|
||||||
|
|
||||||
WM_NUM=0
|
WM_NUM=0
|
||||||
while IFS=' ' read -r i; do
|
while IFS=' ' read -r i; do
|
||||||
@ -746,8 +727,7 @@ part_menu()
|
|||||||
"cfdisk" "Curses based variant of fdisk" \
|
"cfdisk" "Curses based variant of fdisk" \
|
||||||
"parted" "GNU partition editor" \
|
"parted" "GNU partition editor" \
|
||||||
"fdisk" "Dialog-driven creation and manipulation of partitions" \
|
"fdisk" "Dialog-driven creation and manipulation of partitions" \
|
||||||
"done" "Return to the main menu" || return 1
|
"done" "Return to the main menu" || return 0
|
||||||
|
|
||||||
else
|
else
|
||||||
dlg choice menu "Edit Partitions" "$_part" \
|
dlg choice menu "Edit Partitions" "$_part" \
|
||||||
"auto" "Whole device automatic partitioning" \
|
"auto" "Whole device automatic partitioning" \
|
||||||
@ -755,11 +735,10 @@ part_menu()
|
|||||||
"cfdisk" "Curses based variant of fdisk" \
|
"cfdisk" "Curses based variant of fdisk" \
|
||||||
"parted" "GNU partition editor" \
|
"parted" "GNU partition editor" \
|
||||||
"fdisk" "Dialog-driven creation and manipulation of partitions" \
|
"fdisk" "Dialog-driven creation and manipulation of partitions" \
|
||||||
"done" "Return to the main menu" || return 1
|
"done" "Return to the main menu" || return 0
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z $choice || $choice == 'done' ]]; then
|
if [[ $choice == 'done' ]]; then
|
||||||
return 0
|
return 0
|
||||||
elif [[ $choice == 'resize' ]]; then
|
elif [[ $choice == 'resize' ]]; then
|
||||||
part_resize "$device"
|
part_resize "$device"
|
||||||
@ -789,7 +768,10 @@ part_menu()
|
|||||||
tput cnorm
|
tput cnorm
|
||||||
$choice "$device"
|
$choice "$device"
|
||||||
fi
|
fi
|
||||||
[[ $devhash == "$(lsblk -f | base64)" ]] || { msg "Probing Partitions" "\nInforming the kernel of partition changes using partprobe.\n"; partprobe >/dev/null 2>&1; }
|
if [[ $devhash != "$(lsblk -f | base64)" ]]; then
|
||||||
|
msg "Probing Partitions" "\nInforming the kernel of partition changes using partprobe.\n" 0
|
||||||
|
partprobe >/dev/null 2>&1
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -907,7 +889,7 @@ part_mount()
|
|||||||
mkdir -p "$mountp"
|
mkdir -p "$mountp"
|
||||||
|
|
||||||
if [[ $fs && ${FS_OPTS[$fs]} && $part != "$BOOT_PART" ]] && select_mntopts "$fs"; then
|
if [[ $fs && ${FS_OPTS[$fs]} && $part != "$BOOT_PART" ]] && select_mntopts "$fs"; then
|
||||||
mount -o $MNT_OPTS "$part" "$mountp" >/dev/null 2>&1
|
mount -o "$MNT_OPTS" "$part" "$mountp" >/dev/null 2>&1
|
||||||
else
|
else
|
||||||
mount "$part" "$mountp" >/dev/null 2>&1
|
mount "$part" "$mountp" >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
@ -932,36 +914,35 @@ part_format()
|
|||||||
part_resize()
|
part_resize()
|
||||||
{
|
{
|
||||||
part=""
|
part=""
|
||||||
local device="$1" fs="" num=0
|
typeset -i size num
|
||||||
|
local device="$1" fs=""
|
||||||
|
|
||||||
part_find "${device##*/}[^ ]" || return 1
|
part_find "${device##*/}[^ ]" || return 1
|
||||||
(( COUNT == 1 )) && part="$(awk '{print $1}' <<< "${PARTS[@]}" )"
|
(( COUNT == 1 )) && part="$(awk '{print $1}' <<< "${PARTS[@]}" )"
|
||||||
|
|
||||||
if (( COUNT == 1 )) || dlg part menu "Resize" "\nWhich partition on $device do you want to resize?" $PARTS && [[ $part ]]; then
|
if (( COUNT == 1 )) || dlg part menu "Resize" "\nWhich partition on $device do you want to resize?" $PARTS && [[ $part ]]; then
|
||||||
num="${part: -1}"
|
|
||||||
end=$(parted -s "$device" print | awk '/^\s*'"$num"'/ {print $3}')
|
|
||||||
devsize=$(parted -s "$device" print | awk '/Disk '"$device"':/ {print $3}')
|
|
||||||
fs=$(lsblk -lno FSTYPE "$part")
|
fs=$(lsblk -lno FSTYPE "$part")
|
||||||
case "$fs" in
|
case "$fs" in
|
||||||
ext[2-4]|ntfs)
|
ext[2-4]|ntfs)
|
||||||
|
num="${part: -1}"
|
||||||
|
end=$(parted -s "$device" print | awk '/^\s*'"$num"'/ {print $3}')
|
||||||
|
devsize=$(parted -s "$device" print | awk '/Disk '"${device//\//\\/}"':/ {print $3}')
|
||||||
mount "$part" $MNT >/dev/null 2>&1
|
mount "$part" $MNT >/dev/null 2>&1
|
||||||
sleep 0.5
|
sleep 0.5
|
||||||
min=$(df "$part" | awk '/'"${part//\//\\/}"'/ {print int($3 / 1024)}') # used
|
min=$(df "$part" | awk '/'"${part//\//\\/}"'/ {print int($3 / 1024)}') # used
|
||||||
max=$(df "$part" | awk '/'"${part//\//\\/}"'/ {print int($4 / 1024)}') # available
|
max=$(df "$part" | awk '/'"${part//\//\\/}"'/ {print int($4 / 1024)}') # available
|
||||||
def=$((max / 2)) # 1/2 available
|
|
||||||
umount $MNT >/dev/null 2>&1
|
umount $MNT >/dev/null 2>&1
|
||||||
tput cnorm
|
tput cnorm
|
||||||
if dialog --backtitle "$DIST Installer - $SYS - v$VER" --title " Resize: $part " --rangebox "$_resize" 17 "$COLUMNS" "$min" "$max" $def 2>$ANS; then
|
if dialog --backtitle "$DIST Installer - $SYS - v$VER" --title " Resize: $part " --rangebox "$_resize" 17 "$COLUMNS" "$min" "$max" $((max / 2)) 2>$ANS; then
|
||||||
(( (size = $(< "$ANS") * 1024) + 1025 <= max )) || return 1
|
(( (size = $(< "$ANS")) + 1025 <= max )) || return 1
|
||||||
size=$(( (size / 4) * 4 ))
|
size=$((( (size * 1024) / 4 ) * 4)) # 4K block alignment
|
||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
clear
|
clear
|
||||||
case "$fs" in
|
case "$fs" in
|
||||||
ext[2-4])
|
ext[2-4])
|
||||||
e2fsck -f "$part"
|
e2fsck -f "$part"; sleep 0.5
|
||||||
sleep 0.5
|
|
||||||
resize2fs -f "$part" ${size}K 2>$ERR
|
resize2fs -f "$part" ${size}K 2>$ERR
|
||||||
errshow "resize2fs -f $part ${size}K" || return 1
|
errshow "resize2fs -f $part ${size}K" || return 1
|
||||||
;;
|
;;
|
||||||
@ -971,10 +952,10 @@ part_resize()
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
sleep 0.5
|
sleep 0.5
|
||||||
size=$(( size + 1024 ))
|
(( size += 1024 ))
|
||||||
parted "$device" resizepart "$num" ${size}Kib || return 1
|
parted "$device" resizepart "$num" ${size}Kib || return 1
|
||||||
sleep 0.5
|
sleep 0.5
|
||||||
if (( (size += 1) < max )); then
|
if (( ++size < (max * 1024) )); then
|
||||||
if [[ $devsize == "$end" ]]; then
|
if [[ $devsize == "$end" ]]; then
|
||||||
parted -s "$device" mkpart primary ext4 ${size}Kib 100% 2>$ERR
|
parted -s "$device" mkpart primary ext4 ${size}Kib 100% 2>$ERR
|
||||||
else
|
else
|
||||||
@ -982,11 +963,11 @@ part_resize()
|
|||||||
fi
|
fi
|
||||||
errshow "parted -s $device mkpart primary ext4 ${size}Kib 100%" || return 1
|
errshow "parted -s $device mkpart primary ext4 ${size}Kib 100%" || return 1
|
||||||
fi
|
fi
|
||||||
sleep 0.5
|
sleep 1
|
||||||
msg "Resize Finished" "\nThe resize of $part is now complete.\n\n$(lsblk -o NAME,MODEL,SIZE,TYPE,FSTYPE,MOUNTPOINT "$device")\n\n"
|
msg "Resize Complete" "\n$part has been successfully resized to $(( (size - 1025) / 1024 ))M.\n"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
msg "Invalid Filesystem: $fs" "\nResizing currently has support for ext2/3/4 and ntfs filesystems.\n"
|
msg "Invalid Filesystem: $fs" "\nCurrently resizing is only supported for ext2/3/4 and ntfs filesystems.\n\nFor unformatted partitions, cfdisk can be used without the need to resize the filesystem.\n"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
@ -1014,9 +995,9 @@ part_device()
|
|||||||
|
|
||||||
part_bootdev()
|
part_bootdev()
|
||||||
{
|
{
|
||||||
msg "Boot Device" "\nSetting flags for boot partition $BOOT_PART\n" 1
|
BOOT_DEV="${BOOT_PART%[1-9]}"
|
||||||
[[ $BOOT_PART = /dev/nvme* ]] && BOOT_DEV="${BOOT_PART%p[1-9]}" || BOOT_DEV="${BOOT_PART%[1-9]}"
|
|
||||||
BOOT_PART_NUM="${BOOT_PART: -1}"
|
BOOT_PART_NUM="${BOOT_PART: -1}"
|
||||||
|
[[ $BOOT_PART = /dev/nvme* ]] && BOOT_DEV="${BOOT_PART%p[1-9]}"
|
||||||
if [[ $SYS == 'UEFI' ]]; then
|
if [[ $SYS == 'UEFI' ]]; then
|
||||||
parted -s $BOOT_DEV set $BOOT_PART_NUM esp on >/dev/null 2>&1
|
parted -s $BOOT_DEV set $BOOT_PART_NUM esp on >/dev/null 2>&1
|
||||||
else
|
else
|
||||||
@ -1259,12 +1240,19 @@ select_boot_partition()
|
|||||||
|
|
||||||
select_root_partition()
|
select_root_partition()
|
||||||
{
|
{
|
||||||
|
typeset -i num
|
||||||
|
local pts
|
||||||
|
pts="$(awk '/[0-9.]*[GT]$/ {sub(/[GT]$/, ""); if ($2 > 8) {print $0 "G"} }' <<< "$PARTS")"
|
||||||
|
while read -r line; do
|
||||||
|
(( num++ ))
|
||||||
|
done <<< "$pts"
|
||||||
|
|
||||||
if [[ $AUTO_ROOT_PART && ! $LVM && ! $LUKS ]]; then
|
if [[ $AUTO_ROOT_PART && ! $LVM && ! $LUKS ]]; then
|
||||||
ROOT_PART="$AUTO_ROOT_PART"
|
ROOT_PART="$AUTO_ROOT_PART"
|
||||||
elif (( COUNT == 1 )); then
|
elif (( num == 1 )); then
|
||||||
ROOT_PART="$(awk 'NR==1 {print $1}' <<< "$PARTS")"
|
ROOT_PART="$(awk 'NR==1 {print $1}' <<< "$pts")"
|
||||||
else
|
else
|
||||||
dlg ROOT_PART menu "Mount Root" "\nSelect the root (/) partition, this is where $DIST will be installed." $PARTS
|
dlg ROOT_PART menu "Mount Root" "\nSelect the root (/) partition, this is where $DIST will be installed.\n\nDevices smaller than 8G will not be shown here." $pts
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ $ROOT_PART ]] || return 1
|
[[ $ROOT_PART ]] || return 1
|
||||||
@ -1278,11 +1266,10 @@ select_root_partition()
|
|||||||
select_extra_partitions()
|
select_extra_partitions()
|
||||||
{
|
{
|
||||||
local part
|
local part
|
||||||
|
|
||||||
while (( COUNT > 0 )); do
|
while (( COUNT > 0 )); do
|
||||||
part=''
|
part=''
|
||||||
dlg part menu 'Mount Boot' "$_expart" 'done' 'finish mounting step' $PARTS
|
dlg part menu 'Mount Boot' "$_expart" 'done' 'finish mounting step' $PARTS || break
|
||||||
if [[ $part == 'done' || -z $part ]]; then
|
if [[ $part == 'done' ]]; then
|
||||||
break
|
break
|
||||||
elif select_filesystem "$part" && select_mountpoint && part_mount "$part" "$EXMNT"; then
|
elif select_filesystem "$part" && select_mountpoint && part_mount "$part" "$EXMNT"; then
|
||||||
EXMNTS+="$part: $EXMNT "
|
EXMNTS+="$part: $EXMNT "
|
||||||
@ -1291,7 +1278,6 @@ select_extra_partitions()
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1579,8 +1565,10 @@ install_lightdm()
|
|||||||
{
|
{
|
||||||
rm -rf $SERVICE
|
rm -rf $SERVICE
|
||||||
rm -rf $MNT/home/$NEWUSER/.{xinitrc,profile,zprofile,bash_profile}
|
rm -rf $MNT/home/$NEWUSER/.{xinitrc,profile,zprofile,bash_profile}
|
||||||
chrun 'systemctl set-default graphical.target && systemctl enable lightdm.service' 2>$ERR
|
chrun 'systemctl set-default graphical.target' 2>$ERR
|
||||||
errshow 1 "systemctl set-default graphical.target && systemctl enable lightdm.service"
|
errshow 1 "systemctl set-default graphical.target"
|
||||||
|
chrun 'systemctl enable lightdm.service' 2>$ERR
|
||||||
|
errshow 1 "systemctl enable lightdm.service"
|
||||||
cat > $MNT/etc/lightdm/lightdm-gtk-greeter.conf << EOF
|
cat > $MNT/etc/lightdm/lightdm-gtk-greeter.conf << EOF
|
||||||
# LightDM GTK+ Configuration
|
# LightDM GTK+ Configuration
|
||||||
|
|
||||||
@ -1597,8 +1585,8 @@ EOF
|
|||||||
|
|
||||||
install_packages()
|
install_packages()
|
||||||
{
|
{
|
||||||
local inpkg="$PACKAGES $USER_PKGS"
|
|
||||||
local rmpkg=""
|
local rmpkg=""
|
||||||
|
local inpkg="$PACKAGES $USER_PKGS"
|
||||||
|
|
||||||
if pacman -Qsq 'archlabs-installer' >/dev/null 2>&1; then
|
if pacman -Qsq 'archlabs-installer' >/dev/null 2>&1; then
|
||||||
rmpkg+=" archlabs-installer"
|
rmpkg+=" archlabs-installer"
|
||||||
@ -1695,10 +1683,10 @@ install_mirrorlist()
|
|||||||
install_background()
|
install_background()
|
||||||
{
|
{
|
||||||
if [[ -d /run/archiso/sfs/airootfs/etc/skel ]] && grep -qw "$MNT" /proc/mounts && (grep -qw "$MNT/$BOOTDIR" /proc/mounts || [[ $SYS == 'BIOS' && -z $LUKS ]]); then
|
if [[ -d /run/archiso/sfs/airootfs/etc/skel ]] && grep -qw "$MNT" /proc/mounts && (grep -qw "$MNT/$BOOTDIR" /proc/mounts || [[ $SYS == 'BIOS' && -z $LUKS ]]); then
|
||||||
yesno "Background Install" "\nA portion of the install can be done in the background while you continue.\n\nUtilize background install?\n" || return 0
|
yesno "Background Install" "\nSome slower steps of the install can be done in the background before other configuration is needed, base system unpack, mirrorlist sort, updates, and base packages.\n\nThis will allow you to continue setting up the configuration and proceed at your own pace, while the installer is working.\n\nDo you want to use/start the background process?\n" || return 0
|
||||||
rsync -a /run/archiso/sfs/airootfs/ $MNT/ &
|
rsync -a /run/archiso/sfs/airootfs/ $MNT/ &
|
||||||
RSYNC_PID=$!
|
RSYNC_PID=$!
|
||||||
( install_mirrorlist "$MNT/etc/pacman.d/mirrorlist" && chrun "pacman -Syyu --noconfirm" && chrun "pacman -S $BASE_PKGS --needed --noconfirm" ) >/dev/null 2>&1 &
|
( install_mirrorlist "$MNT/etc/pacman.d/mirrorlist" && chrun "pacman -Syyu --noconfirm && pacman -S $BASE_PKGS --needed --noconfirm" ) >/dev/null 2>&1 &
|
||||||
MIRROR_PID=$!
|
MIRROR_PID=$!
|
||||||
trap "kill $RSYNC_PID 2>/dev/null; kill $MIRROR_PID 2>/dev/null" EXIT
|
trap "kill $RSYNC_PID 2>/dev/null; kill $MIRROR_PID 2>/dev/null" EXIT
|
||||||
fi
|
fi
|
||||||
@ -2544,7 +2532,7 @@ system_identify()
|
|||||||
|
|
||||||
modprobe -q efivarfs >/dev/null 2>&1
|
modprobe -q efivarfs >/dev/null 2>&1
|
||||||
|
|
||||||
_prep="\nWelcome to the installer primary menu.\nOnce a step is finished a step you will be returned here, if the step was successful (ie. no errors were encountered) the cursor will be advanced to the next step.\nIf a step is unsuccessful the cursor will be placed on the step required to advance (when possible).\nTo begin the install you should have:\n\n - A root (/) partition mounted."
|
_prep="\nOnce a step is finished a step you will be returned here, if the step was successful the cursor will be advanced to the next step.\nIf a step is unsuccessful the cursor will be placed on the step required to advance (when possible).\n\nTo begin the install you should have:\n\n - A root (/) partition mounted."
|
||||||
if [[ -d /sys/firmware/efi/efivars ]]; then
|
if [[ -d /sys/firmware/efi/efivars ]]; then
|
||||||
export SYS="UEFI"
|
export SYS="UEFI"
|
||||||
grep -q /sys/firmware/efi/efivars /proc/mounts || mount -t efivarfs efivarfs /sys/firmware/efi/efivars
|
grep -q /sys/firmware/efi/efivars /proc/mounts || mount -t efivarfs efivarfs /sys/firmware/efi/efivars
|
||||||
@ -2554,7 +2542,7 @@ system_identify()
|
|||||||
fi
|
fi
|
||||||
_prep+="\n\nOnce finished mounting, a portion of the install can be done in the background while you continue configuring the system:\n"
|
_prep+="\n\nOnce finished mounting, a portion of the install can be done in the background while you continue configuring the system:\n"
|
||||||
_prep+="\n - Choose the system bootloader.\n - Create a user and password."
|
_prep+="\n - Choose the system bootloader.\n - Create a user and password."
|
||||||
_prep+="\n - Basic system configuration, kernel, shell, login, packages, etc..\n\nLastly once you're happy with your choices and the required steps are complete, the main install can be started."
|
_prep+="\n - Basic system configuration, kernel, shell, login, packages, etc..\n\nOnce you're happy with the choices and the required steps are complete, the main install can be started."
|
||||||
}
|
}
|
||||||
|
|
||||||
check_background_install()
|
check_background_install()
|
||||||
|
Reference in New Issue
Block a user