replace ACTIVATE with READY

This commit is contained in:
Tobias Powalowski 2023-01-09 15:35:17 +01:00
parent a5bcb3c226
commit f4d7a23022
7 changed files with 42 additions and 42 deletions

View file

@ -100,7 +100,7 @@ _auto_pacman()
# enable it on installed system too!
_auto_testing()
{
if [[ "${_DOTESTING}" == "yes" ]]; then
if [[ "${_DOTESTING}" == 1 ]]; then
_dialog --infobox "Enable [testing] repository on installed system ..." 3 70
sed -i -e '/^#\[testing\]/ { n ; s/^#// }' "${_DESTDIR}"/etc/pacman.conf
sed -i -e '/^#\[community-testing\]/ { n ; s/^#// }' "${_DESTDIR}"/etc/pacman.conf

View file

@ -285,7 +285,7 @@ _autoprepare() {
fi
## make and mount filesystems
for fsspec in ${_FSSPECS}; do
_DOMKFS="yes"
_DOMKFS=1
_PART="${_DEVICE}$(echo "${fsspec}" | tr -d ' ' | cut -f1 -d:)"
# Add check on nvme or mmc controller:
# NVME uses /dev/nvme0n1pX name scheme
@ -303,7 +303,7 @@ _autoprepare() {
_BTRFS_COMPRESS="compress=zstd"
[[ "${_MP}" == "/" ]] && _BTRFS_SUBVOLUME="root"
[[ "${_MP}" == "/home" ]] && _BTRFS_SUBVOLUME="home" && _DOMKFS="no"
_DOSUBVOLUME="yes"
_DOSUBVOLUME=1
else
_BTRFS_COMPRESS="NONE"
_BTRFS_SUBVOLUME="NONE"

View file

@ -244,7 +244,7 @@ _activate_dmraid()
# activate lvm2 devices
_activate_lvm2()
{
_ACTIVATE_LVM2=""
_LVM2_READY=""
if [[ -e /usr/bin/lvm ]]; then
_OLD_LVM2_GROUPS=${_LVM2_GROUPS}
_OLD_LVM2_VOLUMES=${_LVM2_VOLUMES}
@ -254,7 +254,7 @@ _activate_lvm2()
lvm vgchange --ignorelockingfailure --ignoremonitoring -ay >/dev/null 2>&1
_LVM2_GROUPS="$(vgs -o vg_name --noheading 2>/dev/null)"
_LVM2_VOLUMES="$(lvs -o vg_name,lv_name --noheading --separator - 2>/dev/null)"
[[ "${_OLD_LVM2_GROUPS}" == "${_LVM2_GROUPS}" && "${_OLD_LVM2_VOLUMES}" == "${_LVM2_VOLUMES}" ]] && _ACTIVATE_LVM2="no"
[[ "${_OLD_LVM2_GROUPS}" == "${_LVM2_GROUPS}" && "${_OLD_LVM2_VOLUMES}" == "${_LVM2_VOLUMES}" ]] && _LVM2_READY="1"
fi
}
@ -262,10 +262,10 @@ _activate_lvm2()
# activate md devices
_activate_raid()
{
_ACTIVATE_RAID=""
_RAID_READY=""
if [[ -e /usr/bin/mdadm ]]; then
_dialog --infobox "Activating RAID arrays..." 0 0
mdadm --assemble --scan >/dev/null 2>&1 || _ACTIVATE_RAID="no"
mdadm --assemble --scan >/dev/null 2>&1 || _RAID_READY="1"
fi
}
@ -273,7 +273,7 @@ _activate_raid()
# activate luks devices
_activate_luks()
{
_ACTIVATE_LUKS=""
_LUKS_READY=""
if [[ -e /usr/bin/cryptsetup ]]; then
_dialog --infobox "Scanning for luks encrypted devices..." 0 0
if ${_LSBLK} FSTYPE | grep -q "crypto_LUKS"; then
@ -283,13 +283,13 @@ _activate_luks()
_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}" == "" ]] && _ACTIVATE_LUKS="no"
[[ "${_RUN_LUKS}" == "" ]] && _LUKS_READY="1"
else
_ACTIVATE_LUKS="no"
_LUKS_READY="1"
fi
done
else
_ACTIVATE_LUKS="no"
_LUKS_READY="1"
fi
fi
}
@ -300,11 +300,11 @@ _activate_luks()
# run it more times if needed, it can be hidden by each other!
_activate_special_devices()
{
_ACTIVATE_RAID=""
_ACTIVATE_LUKS=""
_ACTIVATE_LVM2=""
_RAID_READY=""
_LUKS_READY=""
_LVM2_READY=""
_activate_dmraid
while ! [[ "${_ACTIVATE_LVM2}" == "no" && "${_ACTIVATE_RAID}" == "no" && "${_ACTIVATE_LUKS}" == "no" ]]; do
while [[ -n"${_LVM2_READY}" && -n "${_RAID_READY}" && -n "${_LUKS_READY}" ]]; do
_activate_raid
_activate_lvm2
_activate_luks

View file

@ -82,10 +82,10 @@ _check_btrfs_filesystem_creation() {
for i in $(grep "${_PART}[:#]" /tmp/.parts); do
if echo "${i}" | grep -q ":btrfs:"; then
_FSTYPE="btrfs"
_SKIP_FILESYSTEM="yes"
_SKIP_FILESYSTEM=1
# check on filesystem creation, skip subvolume asking then!
echo "${i}" | cut -d: -f 4 | grep -q yes && _DETECT_CREATE_FILESYSTEM="yes"
[[ "${_DETECT_CREATE_FILESYSTEM}" == "yes" ]] && _SKIP_ASK_SUBVOLUME="yes"
echo "${i}" | cut -d: -f 4 | grep -q yes && _DETECT_CREATE_FILESYSTEM=1
[[ "${_DETECT_CREATE_FILESYSTEM}" == 1 ]] && _SKIP_ASK_SUBVOLUME=1
fi
done
}
@ -172,11 +172,11 @@ _prepare_btrfs_subvolume() {
_DOSUBVOLUME="no"
_BTRFS_SUBVOLUME="NONE"
if [[ "${_SKIP_ASK_SUBVOLUME}" == "no" ]]; then
_dialog --defaultno --yesno "Would you like to create a new subvolume on ${_PART}?" 0 0 && _DOSUBVOLUME="yes"
_dialog --defaultno --yesno "Would you like to create a new subvolume on ${_PART}?" 0 0 && _DOSUBVOLUME=1
else
_DOSUBVOLUME="yes"
_DOSUBVOLUME=1
fi
if [[ "${_DOSUBVOLUME}" == "yes" ]]; then
if [[ "${_DOSUBVOLUME}" == 1 ]]; then
_BTRFS_SUBVOLUME="NONE"
while [[ "${_BTRFS_SUBVOLUME}" == "NONE" ]]; do
_dialog --inputbox "Enter the SUBVOLUME name for the device, keep it short\nand use no spaces or special\ncharacters." 10 65 2>"${_ANSWER}" || return 1
@ -190,7 +190,7 @@ _prepare_btrfs_subvolume() {
# check btrfs subvolume
_check_btrfs_subvolume(){
[[ "${_DOMKFS}" == "yes" && "${_FSTYPE}" == "btrfs" ]] && _DETECT_CREATE_FILESYSTEM="yes"
[[ "${_DOMKFS}" == 1 && "${_FSTYPE}" == "btrfs" ]] && _DETECT_CREATE_FILESYSTEM=1
if [[ "${_DETECT_CREATE_FILESYSTEM}" == "no" ]]; then
_mount_btrfs
for i in $(btrfs subvolume list "${_BTRFSMP}" | cut -d " " -f 7); do
@ -225,7 +225,7 @@ _choose_btrfs_subvolume () {
_SUBVOLUMES_DETECTED="no"
_SUBVOLUMES=$(find_btrfs_subvolume _)
# check if subvolumes are present
[[ -n "${_SUBVOLUMES}" ]] && _SUBVOLUMES_DETECTED="yes"
[[ -n "${_SUBVOLUMES}" ]] && _SUBVOLUMES_DETECTED=1
_subvolumes_in_use
for i in ${_SUBVOLUME_IN_USE}; do
#shellcheck disable=SC2001,SC2086
@ -236,7 +236,7 @@ _choose_btrfs_subvolume () {
_dialog --menu "Select the subvolume to mount:" 15 50 13 ${_SUBVOLUMES} 2>"${_ANSWER}" || return 1
_BTRFS_SUBVOLUME=$(cat "${_ANSWER}")
else
if [[ "${_SUBVOLUMES_DETECTED}" == "yes" ]]; then
if [[ "${_SUBVOLUMES_DETECTED}" == 1 ]]; then
_dialog --msgbox "ERROR: All subvolumes of the device are already in use. Switching to create a new one now." 8 65
_SKIP_ASK_SUBVOLUME=yes
_prepare_btrfs_subvolume || return 1
@ -261,7 +261,7 @@ _btrfs_subvolume() {
fi
_btrfs_compress
fi
_FILESYSTEM_FINISH="yes"
_FILESYSTEM_FINISH=1
}
# ask for btrfs compress option

View file

@ -92,8 +92,8 @@ _create_filesystem() {
_FS_OPTIONS=""
_BTRFS_DEVICES=""
_BTRFS_LEVEL=""
_dialog --yesno "Would you like to create a filesystem on ${_PART}?\n\n(This will overwrite existing data!)" 0 0 && _DOMKFS="yes"
if [[ "${_DOMKFS}" == "yes" ]]; then
_dialog --yesno "Would you like to create a filesystem on ${_PART}?\n\n(This will overwrite existing data!)" 0 0 && _DOMKFS=1
if [[ "${_DOMKFS}" == 1 ]]; then
while [[ "${_LABEL_NAME}" == "" ]]; do
_dialog --inputbox "Enter the LABEL name for the device, keep it short\n(not more than 12 characters) and use no spaces or special\ncharacters." 10 65 \
"$(${_LSBLK} LABEL "${_PART}")" 2>"${_ANSWER}" || return 1
@ -110,7 +110,7 @@ _create_filesystem() {
_dialog --inputbox "Enter additional options to the filesystem creation utility.\nUse this field only, if the defaults are not matching your needs,\nelse just leave it empty." 10 70 2>"${_ANSWER}" || return 1
_FS_OPTIONS=$(cat "${_ANSWER}")
fi
_FILESYSTEM_FINISH="yes"
_FILESYSTEM_FINISH=1
}
mountpoints() {
@ -139,12 +139,12 @@ mountpoints() {
if [[ "${_ASK_MOUNTPOINTS}" == 1 ]]; then
_create_filesystem
else
_FILESYSTEM_FINISH="yes"
_FILESYSTEM_FINISH=1
fi
else
_FILESYSTEM_FINISH="yes"
_FILESYSTEM_FINISH=1
fi
[[ "${_FILESYSTEM_FINISH}" == "yes" ]] && _DO_SWAP=DONE
[[ "${_FILESYSTEM_FINISH}" == 1 ]] && _DO_SWAP=DONE
done
_check_mkfs_values
if [[ "${_PART}" != "NONE" ]]; then
@ -168,7 +168,7 @@ mountpoints() {
else
_btrfs_subvolume
fi
[[ "${_FILESYSTEM_FINISH}" == "yes" ]] && _DO_ROOT=DONE
[[ "${_FILESYSTEM_FINISH}" == 1 ]] && _DO_ROOT=DONE
done
_find_btrfs_raid_DEVICEs
_btrfs_parts
@ -198,9 +198,9 @@ mountpoints() {
_btrfs_subvolume
fi
else
_FILESYSTEM_FINISH="yes"
_FILESYSTEM_FINISH=1
fi
[[ "${_FILESYSTEM_FINISH}" == "yes" ]] && _DO_ADDITIONAL="DONE"
[[ "${_FILESYSTEM_FINISH}" == 1 ]] && _DO_ADDITIONAL="DONE"
done
if [[ "${_PART}" != "DONE" ]]; then
_find_btrfs_raid_DEVICEs
@ -229,7 +229,7 @@ mountpoints() {
_BTRFS_SUBVOLUME=$(echo "${line}" | cut -d: -f 9)
_DOSUBVOLUME=$(echo "${line}" | cut -d: -f 10)
_BTRFS_COMPRESS=$(echo "${line}" | cut -d: -f 11)
if [[ "${_DOMKFS}" == "yes" ]]; then
if [[ "${_DOMKFS}" == 1 ]]; then
if [[ "${_FSTYPE}" == "swap" ]]; then
_dialog --infobox "Creating and activating \nswapspace on \n${_PART} ..." 0 0
else
@ -288,7 +288,7 @@ _mkfs() {
# we have two main cases: "swap" and everything else.
if [[ "${_FSTYPE}" == "swap" ]]; then
swapoff "${_DEVICE}" >/dev/null 2>&1
if [[ "${_DOMK}" == "yes" ]]; then
if [[ "${_DOMK}" == 1 ]]; then
mkswap -L "${_LABELNAME}" "${_DEVICE}" >"${_LOG}" 2>&1
#shellcheck disable=SC2181
if [[ $? != 0 ]]; then
@ -313,7 +313,7 @@ _mkfs() {
return 1
fi
# if we were tasked to create the filesystem, do so
if [[ "${_DOMK}" == "yes" ]]; then
if [[ "${_DOMK}" == 1 ]]; then
local ret
#shellcheck disable=SC2086
case ${_FSTYPE} in
@ -335,7 +335,7 @@ _mkfs() {
fi
sleep 2
fi
if [[ "${_FSTYPE}" == "btrfs" && -n "${_BTRFS_SUBVOLUME}" && "${_DOSUBVOLUME}" == "yes" ]]; then
if [[ "${_FSTYPE}" == "btrfs" && -n "${_BTRFS_SUBVOLUME}" && "${_DOSUBVOLUME}" == 1 ]]; then
_create_btrfs_subvolume
fi
_btrfs_scan
@ -365,7 +365,7 @@ _mkfs() {
return 1
fi
# btrfs needs balancing on fresh created raid, else weird things could happen
[[ "${_FSTYPE}" == "btrfs" && "${_DOMK}" == "yes" ]] && btrfs balance start --full-balance "${_DEST}""${_MOUNTPOINT}" >"${_LOG}" 2>&1
[[ "${_FSTYPE}" == "btrfs" && "${_DOMK}" == 1 ]] && btrfs balance start --full-balance "${_DEST}""${_MOUNTPOINT}" >"${_LOG}" 2>&1
# change permission of base directories to correct permission
# to avoid btrfs issues
if [[ "${_MOUNTPOINT}" == "/tmp" ]]; then

View file

@ -44,7 +44,7 @@ _do_wireless() {
"secret" 2>"${_ANSWER}" || return 1
_WLAN_SSID=$(cat "${_ANSWER}")
_WLAN_CONNECT="connect-hidden"
_WLAN_HIDDEN="yes"
_WLAN_HIDDEN=1
fi
# replace # with spaces again
#shellcheck disable=SC2001,SC2086

View file

@ -59,8 +59,8 @@ _select_mirror() {
# enable testing repository on network install
_dotesting() {
if ! grep -q "^\[testing\]" /etc/pacman.conf; then
_dialog --defaultno --yesno "Do you want to enable [testing]\nand [community-testing] repositories?\n\nOnly enable this if you need latest\navailable packages for testing purposes!" 9 50 && _DOTESTING="yes"
if [[ "${_DOTESTING}" == "yes" ]]; then
_dialog --defaultno --yesno "Do you want to enable [testing]\nand [community-testing] repositories?\n\nOnly enable this if you need latest\navailable packages for testing purposes!" 9 50 && _DOTESTING=1
if [[ "${_DOTESTING}" == 1 ]]; then
sed -i -e '/^#\[testing\]/ { n ; s/^#// }' /etc/pacman.conf
sed -i -e '/^#\[community-testing\]/ { n ; s/^#// }' /etc/pacman.conf
sed -i -e 's:^#\[testing\]:\[testing\]:g' -e 's:^#\[community-testing\]:\[community-testing\]:g' /etc/pacman.conf