mirror of
https://gitlab.archlinux.org/tpowa/archboot.git
synced 2024-09-20 03:50:37 +02:00
code cleanup
This commit is contained in:
parent
78eeb9c524
commit
f5bcdd262e
12 changed files with 74 additions and 74 deletions
|
@ -6,7 +6,7 @@
|
|||
# according to partitioning/formatting stage
|
||||
_auto_fstab(){
|
||||
# Modify fstab
|
||||
if [[ "${_S_MKFS}" == "1" || "${_S_MKFSAUTO}" == "1" ]]; then
|
||||
if [[ "${_S_MKFS}" == 1 || "${_S_MKFSAUTO}" == 1 ]]; then
|
||||
_dialog --infobox "Create new fstab on installed system ..." 3 70
|
||||
if [[ -f /tmp/.device-names ]]; then
|
||||
sort /tmp/.device-names >>"${_DESTDIR}"/etc/fstab
|
||||
|
@ -198,8 +198,8 @@ _auto_timesetting() {
|
|||
fi
|
||||
if [[ ! -f "${_DESTDIR}"/etc/adjtime ]]; then
|
||||
_dialog --infobox "Enable clock setting on installed system ..." 3 70
|
||||
echo "0.0 0 0.0" > "${_DESTDIR}"/etc/adjtime
|
||||
echo "0" >> "${_DESTDIR}"/etc/adjtime
|
||||
echo 0.0 0 0.0 > "${_DESTDIR}"/etc/adjtime
|
||||
echo 0 >> "${_DESTDIR}"/etc/adjtime
|
||||
[[ -s /tmp/.hardwareclock ]] && cat /tmp/.hardwareclock >>"${_DESTDIR}"/etc/adjtime
|
||||
sleep 1
|
||||
fi
|
||||
|
|
|
@ -44,7 +44,7 @@ _autoprepare() {
|
|||
if [[ -z "${_NAME_SCHEME_PARAMETER_RUN}" ]]; then
|
||||
_set_device_name_scheme || return 1
|
||||
fi
|
||||
if [[ "${_GUIDPARAMETER}" == "1" ]]; then
|
||||
if [[ "${_GUIDPARAMETER}" == 1 ]]; then
|
||||
_dialog --inputbox "Enter the mountpoint of your UEFI SYSTEM PARTITION (Default is /boot) : " 10 60 "/boot" 2>"${_ANSWER}" || return 1
|
||||
_UEFISYS_MP="$(cat "${_ANSWER}")"
|
||||
fi
|
||||
|
@ -63,15 +63,15 @@ _autoprepare() {
|
|||
command -v mkfs.nilfs2 > /dev/null 2>&1 && _FSOPTS="${_FSOPTS} nilfs2 Nilfs2"
|
||||
command -v mkfs.jfs > /dev/null 2>&1 && _FSOPTS="${_FSOPTS} jfs JFS"
|
||||
# create 1 MB bios_grub partition for grub BIOS GPT support
|
||||
if [[ "${_GUIDPARAMETER}" == "1" ]]; then
|
||||
if [[ "${_GUIDPARAMETER}" == 1 ]]; then
|
||||
_GUID_PART_SIZE="2"
|
||||
_GPT_BIOS_GRUB_PART_SIZE="${_GUID_PART_SIZE}"
|
||||
_PART_NUM="1"
|
||||
_GPT_BIOS_GRUB_PART_NUM="${_PART_NUM}"
|
||||
_DISK_SIZE="$((_DISK_SIZE-_GUID_PART_SIZE))"
|
||||
fi
|
||||
if [[ "${_GUIDPARAMETER}" == "1" ]]; then
|
||||
if [[ "${_UEFISYS_BOOTPART}" == "1" ]]; then
|
||||
if [[ "${_GUIDPARAMETER}" == 1 ]]; then
|
||||
if [[ "${_UEFISYS_BOOTPART}" == 1 ]]; then
|
||||
while [[ -z "${_UEFISYS_PART_SET}" ]]; do
|
||||
_dialog --inputbox "Enter the size (MB) of your /boot partition,\nMinimum value is 260.\n\nDisk space left: ${_DISK_SIZE} MB" 10 65 "512" 2>"${_ANSWER}" || return 1
|
||||
_UEFISYS_PART_SIZE="$(cat "${_ANSWER}")"
|
||||
|
@ -145,7 +145,7 @@ _autoprepare() {
|
|||
while [[ -z "${_SWAP_PART_SET}" ]]; do
|
||||
_dialog --inputbox "Enter the size (MB) of your swap partition,\nMinimum value is > 0.\n\nDisk space left: ${_DISK_SIZE} MB" 10 65 "${_SWAP_SIZE}" 2>"${_ANSWER}" || return 1
|
||||
_SWAP_PART_SIZE=$(cat "${_ANSWER}")
|
||||
if [[ -z "${_SWAP_PART_SIZE}" || "${_SWAP_PART_SIZE}" == "0" ]]; then
|
||||
if [[ -z "${_SWAP_PART_SIZE}" || "${_SWAP_PART_SIZE}" == 0 ]]; then
|
||||
_dialog --msgbox "ERROR: You have entered an invalid size, please enter again." 0 0
|
||||
else
|
||||
if [[ "${_SWAP_PART_SIZE}" -ge "${_DISK_SIZE}" ]]; then
|
||||
|
@ -171,7 +171,7 @@ _autoprepare() {
|
|||
while [[ -z "${_ROOT_PART_SET}" ]]; do
|
||||
_dialog --inputbox "Enter the size (MB) of your / partition\nMinimum value is 2000,\nthe /home partition will use the remaining space.\n\nDisk space left: ${_DISK_SIZE} MB" 10 65 "${_ROOT_SIZE}" 2>"${_ANSWER}" || return 1
|
||||
_ROOT_PART_SIZE=$(cat "${_ANSWER}")
|
||||
if [[ -z "${_ROOT_PART_SIZE}" || "${_ROOT_PART_SIZE}" == "0" || "${_ROOT_PART_SIZE}" -lt "2000" ]]; then
|
||||
if [[ -z "${_ROOT_PART_SIZE}" || "${_ROOT_PART_SIZE}" == 0 || "${_ROOT_PART_SIZE}" -lt "2000" ]]; then
|
||||
_dialog --msgbox "ERROR: You have entered an invalid size, please enter again." 0 0
|
||||
else
|
||||
if [[ "${_ROOT_PART_SIZE}" -ge "${_DISK_SIZE}" ]]; then
|
||||
|
@ -207,7 +207,7 @@ _autoprepare() {
|
|||
# disable swap and all mounted partitions, umount / last!
|
||||
_umountall
|
||||
# we assume a /dev/sdX,/dev/vdX or /dev/nvmeXnY format
|
||||
if [[ "${_GUIDPARAMETER}" == "1" ]]; then
|
||||
if [[ "${_GUIDPARAMETER}" == 1 ]]; then
|
||||
# GPT (GUID) is supported only by 'parted' or 'sgdisk'
|
||||
_printk off
|
||||
_dialog --infobox "Partitioning ${_DEVICE} ..." 0 0
|
||||
|
@ -221,7 +221,7 @@ _autoprepare() {
|
|||
# create actual partitions
|
||||
sgdisk --set-alignment="2048" --new="${_GPT_BIOS_GRUB_PART_NUM}":0:+"${_GPT_BIOS_GRUB_PART_SIZE}"M --typecode="${_GPT_BIOS_GRUB_PART_NUM}":EF02 --change-name="${_GPT_BIOS_GRUB_PART_NUM}":BIOS_GRUB "${_DEVICE}" > "${_LOG}"
|
||||
sgdisk --set-alignment="2048" --new="${_UEFISYS_PART_NUM}":0:+"${_UEFISYS_PART_SIZE}"M --typecode="${_UEFISYS_PART_NUM}":EF00 --change-name="${_UEFISYS_PART_NUM}":UEFI_SYSTEM "${_DEVICE}" > "${_LOG}"
|
||||
if [[ "${_UEFISYS_BOOTPART}" == "1" ]]; then
|
||||
if [[ "${_UEFISYS_BOOTPART}" == 1 ]]; then
|
||||
sgdisk --attributes="${_UEFISYS_PART_NUM}":set:2 "${_DEVICE}" > "${_LOG}"
|
||||
else
|
||||
sgdisk --set-alignment="2048" --new="${_BOOT_PART_NUM}":0:+"${_BOOT_PART_SIZE}"M --typecode="${_BOOT_PART_NUM}":8300 --attributes="${_BOOT_PART_NUM}":set:2 --change-name="${_BOOT_PART_NUM}":ARCHLINUX_BOOT "${_DEVICE}" > "${_LOG}"
|
||||
|
@ -274,8 +274,8 @@ _autoprepare() {
|
|||
_FSSPEC_SWAP_PART="${_SWAP_PART_NUM}:swap:swap::SWAP_ARCH"
|
||||
_FSSPEC_BOOT_PART="${_BOOT_PART_NUM}:/boot:ext2::BOOT_ARCH"
|
||||
_FSSPEC_UEFISYS_PART="${_UEFISYS_PART_NUM}:${_UEFISYS_MP}:vfat:-F32:EFISYS"
|
||||
if [[ "${_GUIDPARAMETER}" == "1" ]]; then
|
||||
if [[ "${_UEFISYS_BOOTPART}" == "1" ]]; then
|
||||
if [[ "${_GUIDPARAMETER}" == 1 ]]; then
|
||||
if [[ "${_UEFISYS_BOOTPART}" == 1 ]]; then
|
||||
_FSSPECS="${_FSSPEC_ROOT_PART} ${_FSSPEC_UEFISYS_PART} ${_FSSPEC_HOME_PART} ${_FSSPEC_SWAP_PART}"
|
||||
else
|
||||
_FSSPECS="${_FSSPEC_ROOT_PART} ${_FSSPEC_BOOT_PART} ${_FSSPEC_UEFISYS_PART} ${_FSSPEC_HOME_PART} ${_FSSPEC_SWAP_PART}"
|
||||
|
|
|
@ -18,9 +18,9 @@ _VC_NUM="$(basename ${_LOG} | sed -e 's#tty##g')"
|
|||
_VC="VC${_VC_NUM}"
|
||||
# install stages
|
||||
_S_NET="" # network setting
|
||||
_S_SRC=0 # choose mirror
|
||||
_S_MKFS=0 # formatting
|
||||
_S_MKFSAUTO=0 # auto fs part/formatting
|
||||
_S_SRC="" # choose mirror
|
||||
_S_MKFS="" # formatting
|
||||
_S_MKFSAUTO="" # auto fs part/formatting
|
||||
# menu item tracker- autoselect the next item
|
||||
_NEXTITEM=""
|
||||
# To allow choice in script set EDITOR=""
|
||||
|
@ -149,11 +149,11 @@ _set_clock() {
|
|||
}
|
||||
|
||||
_prepare_storagedrive() {
|
||||
_S_MKFSAUTO=0
|
||||
_S_MKFS=0
|
||||
_DONE=0
|
||||
_S_MKFSAUTO=""
|
||||
_S_MKFS=""
|
||||
_DONE=""
|
||||
_NEXTITEM=""
|
||||
while [[ "${_DONE}" = "0" ]]; do
|
||||
while [[ -z "${_DONE}" ]]; do
|
||||
if [[ -n "${_NEXTITEM}" ]]; then
|
||||
_DEFAULT="--default-item ${_NEXTITEM}"
|
||||
else
|
||||
|
|
|
@ -223,7 +223,7 @@ _findpartitions() {
|
|||
|
||||
# don't check on raid devices!
|
||||
_findbootloaderdisks() {
|
||||
if ! [[ "${_USE_DMRAID}" == "1" ]]; then
|
||||
if ! [[ "${_USE_DMRAID}" == 1 ]]; then
|
||||
_blockdevices "${1}"
|
||||
else
|
||||
_dmraid_devices "${1}"
|
||||
|
@ -282,7 +282,7 @@ _activate_luks()
|
|||
if ! ${_LSBLK} TYPE "${part}" | grep -q "crypt$"; then
|
||||
_RUN_LUKS=""
|
||||
_dialog --yesno "Setup detected luks encrypted device, do you want to activate ${part} ?" 0 0 && _RUN_LUKS="1"
|
||||
[[ "${_RUN_LUKS}" == "1" ]] && _enter_luks_name && _enter_luks_passphrase && _opening_luks
|
||||
[[ "${_RUN_LUKS}" == 1 ]] && _enter_luks_name && _enter_luks_passphrase && _opening_luks
|
||||
[[ "${_RUN_LUKS}" == "" ]] && _ACTIVATE_LUKS="no"
|
||||
else
|
||||
_ACTIVATE_LUKS="no"
|
||||
|
@ -318,7 +318,7 @@ _set_device_name_scheme() {
|
|||
_MENU_DESC_TEXT=""
|
||||
## util-linux root=PARTUUID=/root=PARTLABEL= support - https://git.kernel.org/?p=utils/util-linux/util-linux.git;a=commitdiff;h=fc387ee14c6b8672761ae5e67ff639b5cae8f27c;hp=21d1fa53f16560dacba33fffb14ffc05d275c926
|
||||
## mkinitcpio's init root=PARTUUID= support - https://projects.archlinux.org/mkinitcpio.git/tree/init_functions#n185
|
||||
if [[ "${_UEFI_BOOT}" == "1" ]]; then
|
||||
if [[ "${_UEFI_BOOT}" == 1 ]]; then
|
||||
_NAME_SCHEME_LEVELS="${_NAME_SCHEME_LEVELS} PARTUUID PARTUUID=<partuuid> PARTLABEL PARTLABEL=<partlabel>"
|
||||
_MENU_DESC_TEXT="\nPARTUUID and PARTLABEL are specific to GPT disks.\nIn GPT disks, PARTUUID is recommended.\nIn MBR/msdos disks,"
|
||||
fi
|
||||
|
@ -371,7 +371,7 @@ _stopmd()
|
|||
if grep -q ^md /proc/mdstat 2>/dev/null; then
|
||||
_DISABLEMD=""
|
||||
_dialog --defaultno --yesno "Setup detected already running raid devices, do you want to disable them completely?" 0 0 && _DISABLEMD="1"
|
||||
if [[ "${_DISABLEMD}" == "1" ]]; then
|
||||
if [[ "${_DISABLEMD}" == 1 ]]; then
|
||||
_umountall
|
||||
_dialog --infobox "Disabling all software raid devices..." 0 0
|
||||
# shellcheck disable=SC2013
|
||||
|
@ -392,7 +392,7 @@ _stopmd()
|
|||
_DISABLEMDSB=""
|
||||
if ${_LSBLK} FSTYPE | grep -q "linux_raid_member"; then
|
||||
_dialog --defaultno --yesno "Setup detected superblock of raid devices, do you want to clean the superblock of them?" 0 0 && _DISABLEMDSB="1"
|
||||
if [[ "${_DISABLEMDSB}" == "1" ]]; then
|
||||
if [[ "${_DISABLEMDSB}" == 1 ]]; then
|
||||
_umountall
|
||||
_dialog --infobox "Cleaning superblocks of all software raid devices..." 0 0
|
||||
for i in $(${_LSBLK} NAME,FSTYPE | grep "linux_raid_member$" | cut -d' ' -f 1); do
|
||||
|
@ -416,10 +416,10 @@ _stoplvm()
|
|||
! [[ "${_LV_VOLUMES}" == "" ]] && _DETECTED_LVM=1
|
||||
! [[ "${_LV_GROUPS}" == "" ]] && _DETECTED_LVM=1
|
||||
! [[ "${_LV_PHYSICAL}" == "" ]] && _DETECTED_LVM=1
|
||||
if [[ "${_DETECTED_LVM}" == "1" ]]; then
|
||||
if [[ "${_DETECTED_LVM}" == 1 ]]; then
|
||||
_dialog --defaultno --yesno "Setup detected lvm volumes, volume groups or physical devices, do you want to remove them completely?" 0 0 && _DISABLELVM="1"
|
||||
fi
|
||||
if [[ "${_DISABLELVM}" == "1" ]]; then
|
||||
if [[ "${_DISABLELVM}" == 1 ]]; then
|
||||
_umountall
|
||||
_dialog --infobox "Removing logical volumes ..." 0 0
|
||||
for i in ${_LV_VOLUMES}; do
|
||||
|
@ -445,10 +445,10 @@ _stopluks()
|
|||
# detect already running luks devices
|
||||
_LUKSDEVICE="$(${_LSBLK} NAME,TYPE | grep " crypt$" | cut -d' ' -f1)"
|
||||
[[ "${_LUKSDEVICE}" == "" ]] || _DETECTED_LUKS=1
|
||||
if [[ "${_DETECTED_LUKS}" == "1" ]]; then
|
||||
if [[ "${_DETECTED_LUKS}" == 1 ]]; then
|
||||
_dialog --defaultno --yesno "Setup detected running luks encrypted devices, do you want to remove them completely?" 0 0 && _DISABLELUKS="1"
|
||||
fi
|
||||
if [[ "${_DISABLELUKS}" == "1" ]]; then
|
||||
if [[ "${_DISABLELUKS}" == 1 ]]; then
|
||||
_umountall
|
||||
_dialog --infobox "Removing luks encrypted devices ..." 0 0
|
||||
for i in ${_LUKSDEVICE}; do
|
||||
|
@ -462,10 +462,10 @@ _stopluks()
|
|||
_DETECTED_LUKS=""
|
||||
# detect not running luks devices
|
||||
${_LSBLK} FSTYPE | grep -q "crypto_LUKS" && _DETECTED_LUKS=1
|
||||
if [[ "${_DETECTED_LUKS}" == "1" ]]; then
|
||||
if [[ "${_DETECTED_LUKS}" == 1 ]]; then
|
||||
_dialog --defaultno --yesno "Setup detected not running luks encrypted devices, do you want to remove them completely?" 0 0 && _DISABLELUKS="1"
|
||||
fi
|
||||
if [[ "${_DISABLELUKS}" == "1" ]]; then
|
||||
if [[ "${_DISABLELUKS}" == 1 ]]; then
|
||||
_dialog --infobox "Removing not running luks encrypted devices ..." 0 0
|
||||
for i in $(${_LSBLK} NAME,FSTYPE | grep "crypto_LUKS$" | cut -d' ' -f1); do
|
||||
# delete header from device
|
||||
|
@ -481,9 +481,9 @@ _dmraid_update()
|
|||
_printk off
|
||||
_dialog --infobox "Deactivating dmraid devices ..." 0 0
|
||||
dmraid -an >/dev/null 2>&1
|
||||
if [[ "${_DETECTED_LVM}" == "1" || "${_DETECTED_LUKS}" == "1" ]]; then
|
||||
if [[ "${_DETECTED_LVM}" == 1 || "${_DETECTED_LUKS}" == 1 ]]; then
|
||||
_dialog --defaultno --yesno "Setup detected running dmraid devices and/or running lvm2, luks encrypted devices. If you reduced/deleted partitions on your dmraid device a complete reset of devicemapper devices is needed. This will reset also your created lvm2 or encrypted devices. Are you sure you want to do this?" 0 0 && _RESETDM="1"
|
||||
if [[ "${_RESETDM}" == "1" ]]; then
|
||||
if [[ "${_RESETDM}" == 1 ]]; then
|
||||
_dialog --infobox "Resetting devicemapper devices ..." 0 0
|
||||
dmsetup remove_all >/dev/null 2>&1
|
||||
fi
|
||||
|
@ -619,7 +619,7 @@ _raid()
|
|||
_dialog --yesno "Would you like to create a degraded raid on ${_RAIDDEVICE}?" 0 0 && _DEGRADED="missing"
|
||||
echo "${_DEGRADED}" >>/tmp/.raid
|
||||
else
|
||||
if [[ "${_SPARE}" == "1" ]]; then
|
||||
if [[ "${_SPARE}" == 1 ]]; then
|
||||
echo "${_PART}" >>/tmp/.raid-spare
|
||||
else
|
||||
echo "${_PART}" >>/tmp/.raid
|
||||
|
@ -646,8 +646,8 @@ _createraid()
|
|||
_SPARE_DEVICES="$(wc -l < /tmp/.raid-spare)"
|
||||
# generate options for mdadm
|
||||
_RAIDOPTIONS="--force --run --level=${_LEVEL}"
|
||||
! [[ "${_RAID_DEVICES}" == "0" ]] && _RAIDOPTIONS="${_RAIDOPTIONS} --raid-devices=${_RAID_DEVICES}"
|
||||
! [[ "${_SPARE_DEVICES}" == "0" ]] && _RAIDOPTIONS="${_RAIDOPTIONS} --spare-devices=${_SPARE_DEVICES}"
|
||||
! [[ "${_RAID_DEVICES}" == 0 ]] && _RAIDOPTIONS="${_RAIDOPTIONS} --raid-devices=${_RAID_DEVICES}"
|
||||
! [[ "${_SPARE_DEVICES}" == 0 ]] && _RAIDOPTIONS="${_RAIDOPTIONS} --spare-devices=${_SPARE_DEVICES}"
|
||||
! [[ "${_PARITY}" == "" ]] && _RAIDOPTIONS="${_RAIDOPTIONS} --layout=${_PARITY}"
|
||||
_dialog --infobox "Creating ${_RAIDDEVICE}..." 0 0
|
||||
#shellcheck disable=SC2086
|
||||
|
@ -658,7 +658,7 @@ _createraid()
|
|||
_dialog --msgbox "Error creating ${_RAIDDEVICE} (see ${_LOG} for details)." 0 0
|
||||
return 1
|
||||
fi
|
||||
if [[ ${_RAID_PARTITION} == "1" ]]; then
|
||||
if [[ ${_RAID_PARTITION} == 1 ]]; then
|
||||
# switch for mbr usage
|
||||
_set_guid
|
||||
if [[ -z "${_GUIDPARAMETER}" ]]; then
|
||||
|
@ -899,11 +899,11 @@ _createlv()
|
|||
_LV_SIZE=$(cat "${_ANSWER}")
|
||||
if [[ -z "${_LV_SIZE}" ]]; then
|
||||
_dialog --yesno "Would you like to create Logical Volume with no free space left?" 0 0 && _LV_ALL="1"
|
||||
if ! [[ "${_LV_ALL}" == "1" ]]; then
|
||||
if ! [[ "${_LV_ALL}" == 1 ]]; then
|
||||
_LV_SIZE=0
|
||||
fi
|
||||
fi
|
||||
if [[ "${_LV_SIZE}" == "0" ]]; then
|
||||
if [[ "${_LV_SIZE}" == 0 ]]; then
|
||||
_dialog --msgbox "ERROR: You have entered a invalid size, please enter again." 0 0
|
||||
else
|
||||
if [[ "${_LV_SIZE}" -ge "$(vgs -o vg_free --noheading --units m | sed -e 's#m##g')" ]]; then
|
||||
|
@ -916,7 +916,7 @@ _createlv()
|
|||
#Contiguous doesn't work with +100%FREE
|
||||
_LV_CONTIGUOUS=""
|
||||
[[ -z "${_LV_ALL}" ]] && _dialog --defaultno --yesno "Would you like to create Logical Volume as a contiguous partition, that means that your space doesn't get partitioned over one or more disks nor over non-contiguous physical extents.\n(usefull for swap space etc.)?" 0 0 && _LV_CONTIGUOUS="1"
|
||||
if [[ "${_LV_CONTIGUOUS}" == "1" ]]; then
|
||||
if [[ "${_LV_CONTIGUOUS}" == 1 ]]; then
|
||||
_CONTIGUOUS=yes
|
||||
_LV_EXTRA="-C y"
|
||||
else
|
||||
|
@ -928,7 +928,7 @@ _createlv()
|
|||
_dialog --yesno "Would you like to create Logical Volume ${_LVDEVICE} like this?\nVolume Group:\n${_LV}\nVolume Size:\n${_LV_SIZE}\nContiguous Volume:\n${_CONTIGUOUS}" 0 0 && _LVFINISH="DONE"
|
||||
done
|
||||
_umountall
|
||||
if [[ "${_LV_ALL}" == "1" ]]; then
|
||||
if [[ "${_LV_ALL}" == 1 ]]; then
|
||||
#shellcheck disable=SC2086
|
||||
if lvcreate ${_LV_EXTRA} -l +100%FREE ${_LV} -n ${_LVDEVICE} >"${_LOG}" 2>&1; then
|
||||
_dialog --infobox "Creating Logical Volume ${_LVDEVICE} successful.\n\nContinuing in 3 seconds..." 5 50
|
||||
|
|
|
@ -661,7 +661,7 @@ EOF
|
|||
fi
|
||||
_LINUX_MOD_COMMAND=$(echo "${_LINUX_UNMOD_COMMAND}" | sed -e 's# # #g' | sed -e 's# # #g')
|
||||
## create default kernel entry
|
||||
_NUMBER="0"
|
||||
_NUMBER=0
|
||||
if [[ "${_RUNNING_ARCH}" == "aarch64" ]]; then
|
||||
cat << EOF >> "${_DESTDIR}/${_GRUB_PREFIX_DIR}/${_GRUB_CFG}"
|
||||
# (${_NUMBER}) Arch Linux
|
||||
|
@ -777,7 +777,7 @@ _do_grub_bios() {
|
|||
if [[ -z "${_FAIL_COMPLEX}" ]]; then
|
||||
# check if mapper is used
|
||||
if echo "${_BOOTDEV}" | grep -q /dev/mapper; then
|
||||
_RAID_ON_LVM="0"
|
||||
_RAID_ON_LVM=""
|
||||
#check if mapper contains a md device!
|
||||
for devpath in $(pvs -o pv_name --noheading); do
|
||||
if echo "${devpath}" | grep -v "/dev/md.p" | grep /dev/md; then
|
||||
|
@ -958,7 +958,7 @@ _install_bootloader() {
|
|||
if [[ "${_NAME_SCHEME_PARAMETER_RUN}" == "" ]]; then
|
||||
_set_device_name_scheme || return 1
|
||||
fi
|
||||
if [[ "${_S_SRC}" == "0" ]]; then
|
||||
if [[ -z "${_S_SRC}" ]]; then
|
||||
_select_source || return 1
|
||||
fi
|
||||
_prepare_pacman
|
||||
|
|
|
@ -248,7 +248,7 @@ _choose_btrfs_subvolume () {
|
|||
_btrfs_subvolume() {
|
||||
_FILESYSTEM_FINISH=""
|
||||
if [[ "${_FSTYPE}" == "btrfs" && "${_DOMKFS}" == "no" ]]; then
|
||||
if [[ "${_ASK_MOUNTPOINTS}" == "1" ]]; then
|
||||
if [[ "${_ASK_MOUNTPOINTS}" == 1 ]]; then
|
||||
# create subvolume if requested
|
||||
# choose btrfs subvolume if present
|
||||
_prepare_btrfs_subvolume || return 1
|
||||
|
|
|
@ -21,7 +21,7 @@ _set_mkinitcpio() {
|
|||
for i in $(grep ^HOOKS "${_DESTDIR}"/etc/mkinitcpio.conf | sed -e 's/"//g' -e 's/HOOKS=\(//g' -e 's/\)//g'); do
|
||||
[[ -e ${_DESTDIR}/usr/lib/initcpio/install/${i} ]] || _HOOK_ERROR=1
|
||||
done
|
||||
if [[ "${_HOOK_ERROR}" == "1" ]]; then
|
||||
if [[ "${_HOOK_ERROR}" == 1 ]]; then
|
||||
_dialog --msgbox "ERROR: Detected error in 'HOOKS=' line, please correct HOOKS= in /etc/mkinitcpio.conf!" 18 70
|
||||
else
|
||||
_run_mkinitcpio
|
||||
|
|
|
@ -36,7 +36,7 @@ _ssd_optimization() {
|
|||
# check all underlying devices on ssd
|
||||
for i in $(${_LSBLK} NAME,TYPE "${_DEVICE}" -s | grep "disk$" | cut -d' ' -f 1); do
|
||||
# check for ssd
|
||||
if [[ "$(cat /sys/block/"$(basename "${i}")"/queue/rotational)" == "0" ]]; then
|
||||
if [[ "$(cat /sys/block/"$(basename "${i}")"/queue/rotational)" == 0 ]]; then
|
||||
_SSD_MOUNT_OPTIONS="noatime"
|
||||
fi
|
||||
done
|
||||
|
@ -136,7 +136,7 @@ mountpoints() {
|
|||
_PART=$(cat "${_ANSWER}")
|
||||
if [[ "${_PART}" != "NONE" ]]; then
|
||||
_clear_fs_values
|
||||
if [[ "${_ASK_MOUNTPOINTS}" == "1" ]]; then
|
||||
if [[ "${_ASK_MOUNTPOINTS}" == 1 ]]; then
|
||||
_create_filesystem
|
||||
else
|
||||
_FILESYSTEM_FINISH="yes"
|
||||
|
@ -163,7 +163,7 @@ mountpoints() {
|
|||
# clear values first!
|
||||
_clear_fs_values
|
||||
_check_btrfs_filesystem_creation
|
||||
if [[ "${_ASK_MOUNTPOINTS}" == "1" && "${_SKIP_FILESYSTEM}" == "no" ]]; then
|
||||
if [[ "${_ASK_MOUNTPOINTS}" == 1 && "${_SKIP_FILESYSTEM}" == "no" ]]; then
|
||||
_select_filesystem && _create_filesystem && _btrfs_subvolume
|
||||
else
|
||||
_btrfs_subvolume
|
||||
|
@ -191,7 +191,7 @@ mountpoints() {
|
|||
_clear_fs_values
|
||||
_check_btrfs_filesystem_creation
|
||||
# Select a filesystem type
|
||||
if [[ "${_ASK_MOUNTPOINTS}" == "1" && "${_SKIP_FILESYSTEM}" == "no" ]]; then
|
||||
if [[ "${_ASK_MOUNTPOINTS}" == 1 && "${_SKIP_FILESYSTEM}" == "no" ]]; then
|
||||
_enter_mountpoint && _select_filesystem && _create_filesystem && _btrfs_subvolume
|
||||
else
|
||||
_enter_mountpoint
|
||||
|
@ -382,7 +382,7 @@ _mkfs() {
|
|||
#shellcheck disable=SC2155
|
||||
local _FSLABEL="$(_getfslabel "${_DEVICE}")"
|
||||
|
||||
if [[ "${_UEFI_BOOT}" == "1" ]]; then
|
||||
if [[ "${_UEFI_BOOT}" == 1 ]]; then
|
||||
#shellcheck disable=SC2155
|
||||
local _PARTUUID="$(_getpartuuid "${_DEVICE}")"
|
||||
#shellcheck disable=SC2155
|
||||
|
@ -403,7 +403,7 @@ _mkfs() {
|
|||
_DEVICE="LABEL=${_FSLABEL}"
|
||||
fi
|
||||
else
|
||||
if [[ "${_UEFI_BOOT}" == "1" ]]; then
|
||||
if [[ "${_UEFI_BOOT}" == 1 ]]; then
|
||||
if [[ "${_NAME_SCHEME_PARAMETER}" == "PARTUUID" ]]; then
|
||||
if [[ -n "${_PARTUUID}" ]]; then
|
||||
_DEVICE="PARTUUID=${_PARTUUID}"
|
||||
|
@ -424,16 +424,16 @@ _mkfs() {
|
|||
# _GUID_VALUE:
|
||||
# get real device name from lsblk first to get GUID_VALUE from blkid
|
||||
_GUID_VALUE="$(${_BLKID} -p -i -s _PART_ENTRY_TYPE -o value "$(${_LSBLK} NAME,UUID,LABEL,PARTLABEL,PARTUUID | grep "$(echo "${_DEVICE}" | cut -d"=" -f2)" | cut -d" " -f 1)")"
|
||||
if ! [[ "${_GUID_VALUE}" == "933ac7e1-2eb4-4f13-b844-0e14e2aef915" && "${_MOUNTPOINT}" == "/home" || "${_GUID_VALUE}" == "0657fd6d-a4ab-43c4-84e5-0933c84b4f4f" && "${_MOUNTPOINT}" == "swap" || "${_GUID_VALUE}" == "c12a7328-f81f-11d2-ba4b-00a0c93ec93b" && "${_MOUNTPOINT}" == "/boot" && "${_UEFI_BOOT}" == "1" || "${_MOUNTPOINT}" == "/" ]]; then
|
||||
if ! [[ "${_GUID_VALUE}" == "933ac7e1-2eb4-4f13-b844-0e14e2aef915" && "${_MOUNTPOINT}" == "/home" || "${_GUID_VALUE}" == "0657fd6d-a4ab-43c4-84e5-0933c84b4f4f" && "${_MOUNTPOINT}" == "swap" || "${_GUID_VALUE}" == "c12a7328-f81f-11d2-ba4b-00a0c93ec93b" && "${_MOUNTPOINT}" == "/boot" && "${_UEFI_BOOT}" == 1 || "${_MOUNTPOINT}" == "/" ]]; then
|
||||
if [[ "${_MOUNTOPTIONS}" == "" ]]; then
|
||||
echo -n "${_DEVICE} ${_MOUNTPOINT} ${_FSTYPE} defaults 0 " >>/tmp/.fstab
|
||||
else
|
||||
echo -n "${_DEVICE} ${_MOUNTPOINT} ${_FSTYPE} defaults,${_MOUNTOPTIONS} 0 " >>/tmp/.fstab
|
||||
fi
|
||||
if [[ "${_FSTYPE}" == "swap" || "${_FSTYPE}" == "btrfs" ]]; then
|
||||
echo "0" >>/tmp/.fstab
|
||||
echo 0 >>/tmp/.fstab
|
||||
else
|
||||
echo "1" >>/tmp/.fstab
|
||||
echo 1 >>/tmp/.fstab
|
||||
fi
|
||||
fi
|
||||
unset _MOUNTOPTIONS
|
||||
|
|
|
@ -65,7 +65,7 @@ _do_wireless() {
|
|||
else
|
||||
iwctl --passphrase="${_WLAN_KEY}" station "${_INTERFACE}" "${_WLAN_CONNECT}" "${_WLAN_SSID}" > /dev/null 2>&1 && _WLAN_AUTH="1"
|
||||
fi
|
||||
if [[ "${_WLAN_AUTH}" == "1" ]]; then
|
||||
if [[ -n "${_WLAN_AUTH}" ]]; then
|
||||
_dialog --infobox "Authentification successfull. Continuing in 3 seconds ..." 3 70
|
||||
sleep 3
|
||||
else
|
||||
|
@ -167,7 +167,7 @@ _donetwork() {
|
|||
fi
|
||||
echo "Using setup's network profile ${_NETWORK_PROFILE} now..." > "${_LOG}"
|
||||
systemctl restart systemd-networkd
|
||||
_NETWORK_COUNT="0"
|
||||
_NETWORK_COUNT=0
|
||||
_dialog --infobox "Waiting 30 seconds for network link to come up ..." 3 60
|
||||
# add sleep here dhcp can need some time to get link
|
||||
while ! ping -c1 www.google.com > "${_LOG}" 2>&1; do
|
||||
|
|
|
@ -98,7 +98,7 @@ _update_environment() {
|
|||
sleep 3
|
||||
else
|
||||
_dialog --defaultno --yesno "New online kernel version ${_ONLINE_KERNEL} available.\n\nDo you want to update the archboot environment to latest packages with caching packages for installation?\n\nATTENTION:\nThis will reboot the system using kexec!" 0 0 && _UPDATE_ENVIRONMENT="1"
|
||||
if [[ "${_UPDATE_ENVIRONMENT}" == "1" ]]; then
|
||||
if [[ "${_UPDATE_ENVIRONMENT}" == 1 ]]; then
|
||||
_dialog --infobox "Now setting up new archboot environment and dowloading latest packages.\n\nRunning at the moment: update-installer -latest-install\nCheck ${_VC} console (ALT-F${_VC_NUM}) for progress...\n\nGet a cup of coffee ...\nDepending on your system's setup, this needs about 5 minutes.\nPlease be patient." 0 0
|
||||
update-installer -latest-install > "${_LOG}" 2>&1
|
||||
fi
|
||||
|
@ -171,7 +171,7 @@ _run_pacman(){
|
|||
# performs package installation to the target system
|
||||
_install_packages() {
|
||||
_destdir_mounts || return 1
|
||||
if [[ "${_S_SRC}" == "0" ]]; then
|
||||
if [[ -z "${_S_SRC}" ]]; then
|
||||
_select_source || return 1
|
||||
fi
|
||||
_prepare_pacman || return 1
|
||||
|
|
|
@ -29,19 +29,19 @@ _check_gpt() {
|
|||
_GUID_DETECTED="1"
|
||||
fi
|
||||
fi
|
||||
if [[ "${_GUID_DETECTED}" == "1" ]]; then
|
||||
if [[ "${_GUID_DETECTED}" == 1 ]]; then
|
||||
### This check is not enabled in any function yet!
|
||||
if [[ "${_CHECK_UEFISYS_PART}" == "1" ]]; then
|
||||
if [[ "${_CHECK_UEFISYS_PART}" == 1 ]]; then
|
||||
_check_efisys_part
|
||||
fi
|
||||
if [[ "${_CHECK_BIOS_BOOT_GRUB}" == "1" ]]; then
|
||||
if [[ "${_CHECK_BIOS_BOOT_GRUB}" == 1 ]]; then
|
||||
if ! sgdisk -p "${_DISK}" | grep -q 'EF02'; then
|
||||
_dialog --msgbox "Setup detected no BIOS BOOT PARTITION in ${_DISK}. Please create a >=1 MB BIOS Boot partition for grub BIOS GPT support." 0 0
|
||||
_RUN_CFDISK="1"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [[ "${_RUN_CFDISK}" == "1" ]]; then
|
||||
if [[ "${_RUN_CFDISK}" == 1 ]]; then
|
||||
_dialog --msgbox "Now you'll be put into cfdisk where you can partition your storage drive. You should make a swap partition and as many data partitions as you will need." 7 60
|
||||
clear && cfdisk "${_DISK}"
|
||||
# reread partitiontable for kernel
|
||||
|
@ -88,7 +88,7 @@ _check_efisys_part() {
|
|||
fi
|
||||
umount "${_DESTDIR}/${_UEFISYS_MP}" &> /dev/null
|
||||
umount "${_UEFISYS_PART}" &> /dev/null
|
||||
if [[ "${_FORMAT_UEFISYS_FAT32}" == "1" ]]; then
|
||||
if [[ "${_FORMAT_UEFISYS_FAT32}" == 1 ]]; then
|
||||
mkfs.vfat -F32 -n "EFISYS" "${_UEFISYS_PART}"
|
||||
fi
|
||||
mkdir -p "${_DESTDIR}/${_UEFISYS_MP}"
|
||||
|
@ -138,7 +138,7 @@ _partition() {
|
|||
[[ "${_DISK}" == "DONE" ]] && break
|
||||
_MSDOS_DETECTED=""
|
||||
if ! [[ "${_DISK}" == "" ]]; then
|
||||
if [[ "${_GUIDPARAMETER}" == "1" ]]; then
|
||||
if [[ "${_GUIDPARAMETER}" == 1 ]]; then
|
||||
_CHECK_BIOS_BOOT_GRUB=""
|
||||
_CHECK_UEFISYS_PART=""
|
||||
_RUN_CFDISK="1"
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
# menu for raid, lvm and encrypt
|
||||
_create_special() {
|
||||
_NEXTITEM=""
|
||||
_SPECIALDONE=0
|
||||
while [[ "${_SPECIALDONE}" == "0" ]]; do
|
||||
_SPECIALDONE=""
|
||||
while [[ -z "${_SPECIALDONE}" ]]; do
|
||||
if [[ -n "${_NEXTITEM}" ]]; then
|
||||
_DEFAULT="--default-item ${_NEXTITEM}"
|
||||
else
|
||||
|
@ -29,7 +29,7 @@ _create_special() {
|
|||
_SPECIALDONE=1 ;;
|
||||
esac
|
||||
done
|
||||
if [[ "${_CANCEL}" == "1" ]]; then
|
||||
if [[ "${_CANCEL}" == 1 ]]; then
|
||||
_NEXTITEM="3"
|
||||
else
|
||||
_NEXTITEM="4"
|
||||
|
@ -39,8 +39,8 @@ _create_special() {
|
|||
# menu for md creation
|
||||
_createmd() {
|
||||
_NEXTITEM=""
|
||||
_MDDONE=0
|
||||
while [[ "${_MDDONE}" == "0" ]]; do
|
||||
_MDDONE=""
|
||||
while [[ -z "${_MDDONE}" ]]; do
|
||||
if [[ -n "${_NEXTITEM}" ]]; then
|
||||
_DEFAULT="--default-item ${_NEXTITEM}"
|
||||
else
|
||||
|
@ -76,8 +76,8 @@ _createmd() {
|
|||
# menu for lvm creation
|
||||
_createlvm() {
|
||||
_NEXTITEM=""
|
||||
_LVMDONE=0
|
||||
while [[ "${_LVMDONE}" == "0" ]]; do
|
||||
_LVMDONE=""
|
||||
while [[ -z "${_LVMDONE}" ]]; do
|
||||
if [[ -n "${_NEXTITEM}" ]]; then
|
||||
_DEFAULT="--default-item ${_NEXTITEM}"
|
||||
else
|
||||
|
@ -114,8 +114,8 @@ _createlvm() {
|
|||
# menu for luks creation
|
||||
_createluks() {
|
||||
_NEXTITEM=""
|
||||
_LUKSDONE=0
|
||||
while [[ "${_LUKSDONE}" == "0" ]]; do
|
||||
_LUKSDONE=""
|
||||
while [[ -z "${_LUKSDONE}" ]]; do
|
||||
if [[ -n "${_NEXTITEM}" ]]; then
|
||||
_DEFAULT="--default-item ${_NEXTITEM}"
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue