add NO_LOG to every LSBLK call with device

This commit is contained in:
Tobias Powalowski 2023-07-06 16:04:43 +02:00
parent 65cf9be6ca
commit 9922c11d47
3 changed files with 9 additions and 9 deletions

View file

@ -34,7 +34,7 @@ _autoprepare() {
_BOOTDEV_SIZE="" _BOOTDEV_SIZE=""
_UEFISYSDEV_SIZE="" _UEFISYSDEV_SIZE=""
# get just the disk size in M/MiB 1024*1024 # get just the disk size in M/MiB 1024*1024
_DISK_SIZE="$(($(${_LSBLK} SIZE -d -b "${_DISK}")/1048576))" _DISK_SIZE="$(($(${_LSBLK} SIZE -d -b "${_DISK}" 2>"${_NO_LOG}")/1048576))"
if [[ -z "${_DISK_SIZE}" ]]; then if [[ -z "${_DISK_SIZE}" ]]; then
_dialog --msgbox "ERROR: Setup cannot detect size of your device, please use normal installation routine for partitioning and mounting devices." 0 0 _dialog --msgbox "ERROR: Setup cannot detect size of your device, please use normal installation routine for partitioning and mounting devices." 0 0
return 1 return 1

View file

@ -130,14 +130,14 @@ _abort_uboot(){
} }
_abort_nilfs_bootpart() { _abort_nilfs_bootpart() {
if ${_LSBLK} FSTYPE "${_BOOTDEV}" | grep -q "nilfs2"; then if ${_LSBLK} FSTYPE "${_BOOTDEV}" 2>"${_NO_LOG}" | grep -q "nilfs2"; then
_dialog --msgbox "Error:\nYour selected bootloader cannot boot from nilfs2 partition with /boot on it." 0 0 _dialog --msgbox "Error:\nYour selected bootloader cannot boot from nilfs2 partition with /boot on it." 0 0
return 1 return 1
fi fi
} }
_abort_f2fs_bootpart() { _abort_f2fs_bootpart() {
if ${_LSBLK} FSTYPE "${_BOOTDEV}" | grep -q "f2fs"; then if ${_LSBLK} FSTYPE "${_BOOTDEV}" 2>"${_NO_LOG}" | grep -q "f2fs"; then
_dialog --msgbox "Error:\nYour selected bootloader cannot boot from f2fs partition with /boot on it." 0 0 _dialog --msgbox "Error:\nYour selected bootloader cannot boot from f2fs partition with /boot on it." 0 0
return 1 return 1
fi fi
@ -175,7 +175,7 @@ _do_uefi_efibootmgr() {
for _bootnum in $(efibootmgr | grep '^Boot[0-9]' | grep -F -i "${_BOOTMGR_LABEL}" | cut -b5-8) ; do for _bootnum in $(efibootmgr | grep '^Boot[0-9]' | grep -F -i "${_BOOTMGR_LABEL}" | cut -b5-8) ; do
efibootmgr --quiet -b "${_bootnum}" -B >> "${_LOG}" efibootmgr --quiet -b "${_bootnum}" -B >> "${_LOG}"
done done
_BOOTMGRDEV=$(${_LSBLK} PKNAME "${_UEFISYSDEV}") _BOOTMGRDEV=$(${_LSBLK} PKNAME "${_UEFISYSDEV}" 2>"${_NO_LOG}")
_BOOTMGRNUM=$(echo "${_UEFISYSDEV}" | sed -e "s#${_BOOTMGRDEV}##g" | sed -e 's#p##g') _BOOTMGRNUM=$(echo "${_UEFISYSDEV}" | sed -e "s#${_BOOTMGRDEV}##g" | sed -e 's#p##g')
efibootmgr --quiet --create --disk "${_BOOTMGRDEV}" --part "${_BOOTMGRNUM}" --loader "${_BOOTMGR_LOADER_PATH}" --label "${_BOOTMGR_LABEL}" >> "${_LOG}" efibootmgr --quiet --create --disk "${_BOOTMGRDEV}" --part "${_BOOTMGRNUM}" --loader "${_BOOTMGR_LOADER_PATH}" --label "${_BOOTMGR_LABEL}" >> "${_LOG}"
} }

View file

@ -35,7 +35,7 @@ _ssd_optimization() {
_SSD_MOUNT_OPTIONS="" _SSD_MOUNT_OPTIONS=""
if echo "${_FSTYPE}" | grep -Eq 'ext4|jfs|btrfs|xfs|nilfs2|f2fs'; then if echo "${_FSTYPE}" | grep -Eq 'ext4|jfs|btrfs|xfs|nilfs2|f2fs'; then
# check all underlying devices on ssd # check all underlying devices on ssd
for i in $(${_LSBLK} NAME,TYPE "${_DEV}" -s | grep "disk$" | cut -d' ' -f 1); do for i in $(${_LSBLK} NAME,TYPE "${_DEV}" -s 2>"${_NO_LOG}" | grep "disk$" | cut -d' ' -f 1); do
# check for ssd # 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" _SSD_MOUNT_OPTIONS="noatime"
@ -109,7 +109,7 @@ _check_mkfs_values() {
[[ -z "${_BTRFS_DEVS}" ]] && _BTRFS_DEVS="NONE" [[ -z "${_BTRFS_DEVS}" ]] && _BTRFS_DEVS="NONE"
[[ -z "${_BTRFS_LEVEL}" ]] && _BTRFS_LEVEL="NONE" [[ -z "${_BTRFS_LEVEL}" ]] && _BTRFS_LEVEL="NONE"
[[ -z "${_BTRFS_SUBVOLUME}" ]] && _BTRFS_SUBVOLUME="NONE" [[ -z "${_BTRFS_SUBVOLUME}" ]] && _BTRFS_SUBVOLUME="NONE"
[[ -z "${_LABEL_NAME}" && -n "$(${_LSBLK} LABEL "${_DEV}")" ]] && _LABEL_NAME="$(${_LSBLK} LABEL "${_DEV}")" [[ -z "${_LABEL_NAME}" && -n "$(${_LSBLK} LABEL "${_DEV}")" ]] && _LABEL_NAME="$(${_LSBLK} LABEL "${_DEV}" 2>"${_NO_LOG}")"
[[ -z "${_LABEL_NAME}" ]] && _LABEL_NAME="NONE" [[ -z "${_LABEL_NAME}" ]] && _LABEL_NAME="NONE"
} }
@ -124,7 +124,7 @@ _create_filesystem() {
[[ "${_FSTYPE}" == "swap" || "${_FSTYPE}" == "vfat" ]] || _select_filesystem || return 1 [[ "${_FSTYPE}" == "swap" || "${_FSTYPE}" == "vfat" ]] || _select_filesystem || return 1
while [[ -z "${_LABEL_NAME}" ]]; do while [[ -z "${_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 \ _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 "${_DEV}")" 2>"${_ANSWER}" || return 1 "$(${_LSBLK} LABEL "${_DEV}" 2>"${_NO_LOG}")" 2>"${_ANSWER}" || return 1
_LABEL_NAME=$(cat "${_ANSWER}") _LABEL_NAME=$(cat "${_ANSWER}")
if grep ":${_LABEL_NAME}$" /tmp/.parts; then if grep ":${_LABEL_NAME}$" /tmp/.parts; then
_dialog --msgbox "ERROR: You have defined 2 identical LABEL names! Please enter another name." 8 65 _dialog --msgbox "ERROR: You have defined 2 identical LABEL names! Please enter another name." 8 65
@ -185,7 +185,7 @@ _mountpoints() {
# clear values first! # clear values first!
_clear_fs_values _clear_fs_values
_check_btrfs_filesystem_creation _check_btrfs_filesystem_creation
[[ ! "${_DEV}" == "NONE" ]] && _FSTYPE="$(${_LSBLK} FSTYPE "${_DEV}")" [[ ! "${_DEV}" == "NONE" ]] && _FSTYPE="$(${_LSBLK} FSTYPE "${_DEV}" 2>"${_NO_LOG}")"
if [[ -z "${_SWAP_DONE}" && "${_FSTYPE}" == "swap" ]] || [[ "${_DEV}" == "NONE" ]]; then if [[ -z "${_SWAP_DONE}" && "${_FSTYPE}" == "swap" ]] || [[ "${_DEV}" == "NONE" ]]; then
_SKIP_FILESYSTEM=1 _SKIP_FILESYSTEM=1
fi fi
@ -272,7 +272,7 @@ _mountpoints() {
_check_mkfs_values _check_mkfs_values
echo "${_DEV}:${_FSTYPE}:${_MP}:${_DOMKFS}:${_LABEL_NAME}:${_FS_OPTIONS}:${_BTRFS_DEVS}:${_BTRFS_LEVEL}:${_BTRFS_SUBVOLUME}:${_BTRFS_COMPRESS}" >>/tmp/.parts echo "${_DEV}:${_FSTYPE}:${_MP}:${_DOMKFS}:${_LABEL_NAME}:${_FS_OPTIONS}:${_BTRFS_DEVS}:${_BTRFS_LEVEL}:${_BTRFS_SUBVOLUME}:${_BTRFS_COMPRESS}" >>/tmp/.parts
# always remove swap paetition and root device # always remove swap paetition and root device
[[ ! "${_FSTYPE}" == "btrfs" || -z "${_UEFISYSDEV_DONE}" ]] && _DEVS="${_DEVS//$(${_LSBLK} NAME,SIZE -d "${_DEV}")/}" [[ ! "${_FSTYPE}" == "btrfs" || -z "${_UEFISYSDEV_DONE}" ]] && _DEVS="${_DEVS//$(${_LSBLK} NAME,SIZE -d "${_DEV}" 2>"${_NO_LOG}")/}"
fi fi
fi fi
done done