Merge branch 'master' into 'maintainance'

# Conflicts:
#   PKGBUILD
merge-requests/266/head
168912916 859421311 3 years ago
commit 9b92c01169

@ -72,7 +72,7 @@ rm_pgs(){
chroot_interactive() { chroot_interactive() {
DIALOG " $_EnterChroot " --infobox "$_ChrootReturn" 0 0 DIALOG " $_EnterChroot " --infobox "$_ChrootReturn" 0 0
echo "" echo ""
echo "" echo ""
arch_chroot bash arch_chroot bash
@ -131,7 +131,7 @@ install_vanilla_de_wm() {
*) loopmenu=0 *) loopmenu=0
return 0 return 0
;; ;;
esac esac
done done
} }
@ -235,7 +235,7 @@ install_de_wm() {
# If at least one package, install. # If at least one package, install.
if [[ $(cat ${PACKAGES}) != "" ]]; then if [[ $(cat ${PACKAGES}) != "" ]]; then
clear clear
if $hostcache; then if $hostcache; then
basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR
else else
@ -302,7 +302,7 @@ enable_dm() {
check_for_error "add default xdm" "$?" check_for_error "add default xdm" "$?"
DM=$(cat ${PACKAGES}) DM=$(cat ${PACKAGES})
DM_ENABLED=1 DM_ENABLED=1
else else
# enable display manager for systemd # enable display manager for systemd
arch_chroot "systemctl enable $(cat ${PACKAGES})" 2>$ERR arch_chroot "systemctl enable $(cat ${PACKAGES})" 2>$ERR
check_for_error "enable $(cat ${PACKAGES})" "$?" check_for_error "enable $(cat ${PACKAGES})" "$?"
@ -315,7 +315,7 @@ install_network_menu() {
declare -i loopmenu=1 declare -i loopmenu=1
while ((loopmenu)); do while ((loopmenu)); do
local PARENT="$FUNCNAME" local PARENT="$FUNCNAME"
submenu 5 submenu 5
DIALOG " $_InstNMMenuTitle " --default-item ${HIGHLIGHT_SUB} --menu "\n$_InstNMMenuBody\n " 0 0 5 \ DIALOG " $_InstNMMenuTitle " --default-item ${HIGHLIGHT_SUB} --menu "\n$_InstNMMenuBody\n " 0 0 5 \
"1" "$_SeeWirelessDev" \ "1" "$_SeeWirelessDev" \
@ -437,7 +437,7 @@ enable_nm() {
if [[ -e /mnt/.openrc ]]; then if [[ -e /mnt/.openrc ]]; then
arch_chroot "rc-update add $(cat ${PACKAGES}) default" 2>$ERR arch_chroot "rc-update add $(cat ${PACKAGES}) default" 2>$ERR
check_for_error "add default $(cat ${PACKAGES})." $? check_for_error "add default $(cat ${PACKAGES})." $?
else else
arch_chroot "systemctl enable $(cat ${PACKAGES})" 2>$ERR arch_chroot "systemctl enable $(cat ${PACKAGES})" 2>$ERR
check_for_error "enable $(cat ${PACKAGES})." $? check_for_error "enable $(cat ${PACKAGES})." $?
fi fi
@ -663,7 +663,7 @@ TTYPath=/dev/tty12" >> /mnt/etc/systemd/jounald.conf
sed -i '/MaxLevelConsole/ s/#//' /mnt/etc/systemd/journald.conf sed -i '/MaxLevelConsole/ s/#//' /mnt/etc/systemd/journald.conf
} }
enable_hibernation() { enable_hibernation() {
if DIALOG " Hibernation setup " --yesno "\nAre you sure you want to enable hibernation automatically? \n " 0 0; then if DIALOG " Hibernation setup " --yesno "\nAre you sure you want to enable hibernation automatically? \n " 0 0; then
if ! [[ -e /mnt/etc/fstab ]]; then if ! [[ -e /mnt/etc/fstab ]]; then
generate_fstab generate_fstab
@ -688,12 +688,12 @@ enable_autologin() {
autologin_user=$(echo /mnt/home/* | cut -d/ -f4 | fzf --reverse --prompt="user> " --header="Choose the user to automatically log in") autologin_user=$(echo /mnt/home/* | cut -d/ -f4 | fzf --reverse --prompt="user> " --header="Choose the user to automatically log in")
fi fi
#enable autologin #enable autologin
case "$(echo $dm)" in case "$(echo $dm)" in
gdm) sed -i "s/^AutomaticLogin=*/AutomaticLogin=$autologin_user/g" /mnt/etc/gdm/custom.conf gdm) sed -i "s/^AutomaticLogin=*/AutomaticLogin=$autologin_user/g" /mnt/etc/gdm/custom.conf
sed -i 's/^AutomaticLoginEnable=*/AutomaticLoginEnable=true/g' /mnt/etc/gdm/custom.conf sed -i 's/^AutomaticLoginEnable=*/AutomaticLoginEnable=true/g' /mnt/etc/gdm/custom.conf
sed -i 's/^TimedLoginEnable=*/TimedLoginEnable=true/g' /mnt/etc/gdm/custom.conf sed -i 's/^TimedLoginEnable=*/TimedLoginEnable=true/g' /mnt/etc/gdm/custom.conf
sed -i 's/^TimedLogin=*/TimedLoginEnable=$autologin_user/g' /mnt/etc/gdm/custom.conf sed -i 's/^TimedLogin=*/TimedLoginEnable=$autologin_user/g' /mnt/etc/gdm/custom.conf
sed -i 's/^TimedLoginDelay=*/TimedLoginDelay=0/g' /mnt/etc/gdm/custom.conf sed -i 's/^TimedLoginDelay=*/TimedLoginDelay=0/g' /mnt/etc/gdm/custom.conf
;; ;;
lightdm) sed -i "s/^#autologin-user=/autologin-user=$autologin_user/" /mnt/etc/lightdm/lightdm.conf lightdm) sed -i "s/^#autologin-user=/autologin-user=$autologin_user/" /mnt/etc/lightdm/lightdm.conf
sed -i 's/^#autologin-user-timeout=0/autologin-user-timeout=0/' /mnt/etc/lightdm/lightdm.conf sed -i 's/^#autologin-user-timeout=0/autologin-user-timeout=0/' /mnt/etc/lightdm/lightdm.conf
@ -716,12 +716,12 @@ fi
set_schedulers() { set_schedulers() {
[[ -e /mnt/etc/udev/rules.d/60-ioscheduler.rules ]] || \ [[ -e /mnt/etc/udev/rules.d/60-ioscheduler.rules ]] || \
echo '# set scheduler for non-rotating disks echo '# set scheduler for NVMe
# noop and deadline are recommended for non-rotating disks ACTION=="add|change", KERNEL=="nvme[0-9]n[0-9]", ATTR{queue/scheduler}="none"
# for rotational disks, cfq gives better performance and bfq-sq more responsive desktop environment # set scheduler for SSD and eMMC
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="deadline" ACTION=="add|change", KERNEL=="sd[a-z]|mmcblk[0-9]*", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="mq-deadline"
# set scheduler for rotating disks # set scheduler for rotating disks
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="1", ATTR{queue/scheduler}="bfq-sq"' > /mnt/etc/udev/rules.d/60-ioscheduler.rules ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="1", ATTR{queue/scheduler}="bfq"' > /mnt/etc/udev/rules.d/60-ioscheduler.rules
nano /mnt/etc/udev/rules.d/60-ioscheduler.rules nano /mnt/etc/udev/rules.d/60-ioscheduler.rules
} }

@ -96,11 +96,11 @@ auto_partition() {
check_for_error "${DEVICE} is $part_table" check_for_error "${DEVICE} is $part_table"
# Create partition table if one does not already exist # Create partition table if one does not already exist
if [[ $SYSTEM == "BIOS" ]] && [[ $part_table != "msdos" ]] ; then if [[ $SYSTEM == "BIOS" ]] && [[ $part_table != "msdos" ]] ; then
parted -s ${DEVICE} mklabel msdos 2>$ERR parted -s ${DEVICE} mklabel msdos 2>$ERR
check_for_error "${DEVICE} mklabel msdos" $? check_for_error "${DEVICE} mklabel msdos" $?
fi fi
if [[ $SYSTEM == "UEFI" ]] && [[ $part_table != "gpt" ]] ; then if [[ $SYSTEM == "UEFI" ]] && [[ $part_table != "gpt" ]] ; then
parted -s ${DEVICE} mklabel gpt 2>$ERR parted -s ${DEVICE} mklabel gpt 2>$ERR
check_for_error "${DEVICE} mklabel gpt" $? check_for_error "${DEVICE} mklabel gpt" $?
fi fi
@ -124,7 +124,7 @@ auto_partition() {
DIALOG "" --textbox /tmp/.devlist 0 0 DIALOG "" --textbox /tmp/.devlist 0 0
fi fi
} }
# Finds all available partitions according to type(s) specified and generates a list # Finds all available partitions according to type(s) specified and generates a list
# of them. This also includes partitions on different devices. # of them. This also includes partitions on different devices.
find_partitions() { find_partitions() {
@ -145,7 +145,7 @@ find_partitions() {
do do
partition_list="${partition_list} /dev/md/${i}" partition_list="${partition_list} /dev/md/${i}"
done done
for i in ${partition_list}; do for i in ${partition_list}; do
PARTITIONS="${PARTITIONS} ${i}" PARTITIONS="${PARTITIONS} ${i}"
NUMBER_PARTITIONS=$(( NUMBER_PARTITIONS + 1 )) NUMBER_PARTITIONS=$(( NUMBER_PARTITIONS + 1 ))
@ -160,7 +160,7 @@ find_partitions() {
(( $i % 2 == 0 )) || continue (( $i % 2 == 0 )) || continue
local j=$((i+1)) local j=$((i+1))
check_for_error "${parts[i]} ${parts[j]}" check_for_error "${parts[i]} ${parts[j]}"
done done
#for test delete /dev:sda8 #for test delete /dev:sda8
#delete_partition_in_list "/dev/sda8" #delete_partition_in_list "/dev/sda8"
@ -187,7 +187,7 @@ find_partitions() {
create_partitions create_partitions
fi fi
;; ;;
esac esac
} }
## List partitions to be hidden from the mounting menu ## List partitions to be hidden from the mounting menu
@ -254,15 +254,17 @@ select_filesystem() {
DIALOG " $_FSTitle " --menu "\n$_FSBody\n " 0 0 10 \ DIALOG " $_FSTitle " --menu "\n$_FSBody\n " 0 0 10 \
"$_FSSkip" "-" \ "$_FSSkip" "-" \
"btrfs" "mkfs.btrfs -f" \ "btrfs" "mkfs.btrfs -f" \
"ext2" "mkfs.ext2 -q" \
"ext3" "mkfs.ext3 -q" \ "ext3" "mkfs.ext3 -q" \
"ext4" "mkfs.ext4 -q" \ "ext4" "mkfs.ext4 -q" \
"f2fs" "mkfs.f2fs -q" \
"jfs" "mkfs.jfs -q" \ "jfs" "mkfs.jfs -q" \
"nilfs2" "mkfs.nilfs2 -fq" \ "nilfs2" "mkfs.nilfs2 -fq" \
"ntfs" "mkfs.ntfs -q" \ "ntfs" "mkfs.ntfs -q" \
"reiserfs" "mkfs.reiserfs -q" \ "reiserfs" "mkfs.reiserfs -q" \
"vfat" "mkfs.vfat -F32" \ "vfat" "mkfs.vfat -F32" \
"xfs" "mkfs.xfs -f" 2>${ANSWER} || return 1 "xfs" "mkfs.xfs -f" 2>${ANSWER} || return 1
case $(cat ${ANSWER}) in case $(cat ${ANSWER}) in
"$_FSSkip") FILESYSTEM="$_FSSkip" "$_FSSkip") FILESYSTEM="$_FSSkip"
;; ;;
@ -332,21 +334,21 @@ mount_opts() {
echo ${FS_OPTS} > /tmp/.fs_options echo ${FS_OPTS} > /tmp/.fs_options
format_name=$(echo ${PARTITION} | rev | cut -d/ -f1 | rev) format_name=$(echo ${PARTITION} | rev | cut -d/ -f1 | rev)
format_device=$(lsblk -i | tac | sed -r 's/^[^[:alnum:]]+//' | sed -n -e "/$format_name/,/disk/p" | awk '/disk/ {print $1}') format_device=$(lsblk -i | tac | sed -r 's/^[^[:alnum:]]+//' | sed -n -e "/$format_name/,/disk/p" | awk '/disk/ {print $1}')
if [[ "$(cat /sys/block/${format_device}/queue/rotational)" == 1 ]]; then if [[ "$(cat /sys/block/${format_device}/queue/rotational)" == 1 ]]; then
sed -i 's/autodefrag - off/autodefrag - on/' /tmp/.fs_options sed -i 's/autodefrag - off/autodefrag - on/' /tmp/.fs_options
sed -i 's/compress=zlip - off/compress=zlip - on/' /tmp/.fs_options sed -i 's/compress=zlip - off/compress=zlip - on/' /tmp/.fs_options
sed -i 's/nossd - off/nossd - on/' /tmp/.fs_options sed -i 's/nossd - off/nossd - on/' /tmp/.fs_options
else else
sed -i 's/compress=lzo - off/compress=lzo - on/' /tmp/.fs_options sed -i 's/compress=lzo - off/compress=lzo - on/' /tmp/.fs_options
sed -i 's/ space_cache - off/ space_cache - on/' /tmp/.fs_options sed -i 's/ space_cache - off/ space_cache - on/' /tmp/.fs_options
sed -i 's/commit=120 - off/commit=120 - on/' /tmp/.fs_options sed -i 's/commit=120 - off/commit=120 - on/' /tmp/.fs_options
sed -i 's/ ssd - off/ ssd - on/' /tmp/.fs_options sed -i 's/ ssd - off/ ssd - on/' /tmp/.fs_options
fi fi
sed -i 's/noatime - off/noatime - on/' /tmp/.fs_options sed -i 's/noatime - off/noatime - on/' /tmp/.fs_options
FS_OPTS=$(cat /tmp/.fs_options) FS_OPTS=$(cat /tmp/.fs_options)
DIALOG " $(echo $FILESYSTEM | sed "s/.*\.//g;s/-.*//g") " --checklist "\n$_btrfsMntBody\n " 0 0 \ DIALOG " $(echo $FILESYSTEM | sed "s/.*\.//g;s/-.*//g") " --checklist "\n$_btrfsMntBody\n " 0 0 \
@ -521,10 +523,10 @@ raid_level_menu() {
case $(cat ${ANSWER}) in case $(cat ${ANSWER}) in
"0") raid_array_menu 0 "0") raid_array_menu 0
;; ;;
"1") raid_array_menu 1 "1") raid_array_menu 1
;; ;;
"5") raid_array_menu 5 "5") raid_array_menu 5
;; ;;
"6") raid_array_menu 6 "6") raid_array_menu 6
;; ;;
"10") raid_array_menu 10 "10") raid_array_menu 10
@ -544,8 +546,8 @@ raid_create() {
RAID_DEVICE_NAME=${3} RAID_DEVICE_NAME=${3}
# creates the array # creates the array
mdadm --create --level=${RAID_LEVEL} --metadata=1.2 --raid-devices=${RAID_DEVICE_NUMBER} /dev/md/${RAID_DEVICE_NAME} ${RAID_DEVICES} mdadm --create --level=${RAID_LEVEL} --metadata=1.2 --raid-devices=${RAID_DEVICE_NUMBER} /dev/md/${RAID_DEVICE_NAME} ${RAID_DEVICES}
# array is disassembled and reassembled to prevent the array from being named /dev/md/md127 # array is disassembled and reassembled to prevent the array from being named /dev/md/md127
# the check of /etc/mdadm.conf is preformed to prevent the user from adding duplicate entries # the check of /etc/mdadm.conf is preformed to prevent the user from adding duplicate entries
if [[ $(cat /etc/mdadm.conf | grep "/dev/md/${RAID_DEVICE_NAME}" | wc -l) == 0 ]]; then if [[ $(cat /etc/mdadm.conf | grep "/dev/md/${RAID_DEVICE_NAME}" | wc -l) == 0 ]]; then
@ -553,7 +555,7 @@ raid_create() {
mdadm --stop /dev/md/${RAID_DEVICE_NAME} mdadm --stop /dev/md/${RAID_DEVICE_NAME}
mdadm --assemble --scan mdadm --assemble --scan
fi fi
DIALOG "$__ArrayCreatedTitle" --msgbox "\n$_ArrayCreatedDescription\n\nmdadm --create --level=${RAID_LEVEL} --metadata=1.2 --raid-devices=${RAID_DEVICE_NUMBER} /dev/md/${RAID_DEVICE_NAME} ${RAID_DEVICES}\n" 0 0 DIALOG "$__ArrayCreatedTitle" --msgbox "\n$_ArrayCreatedDescription\n\nmdadm --create --level=${RAID_LEVEL} --metadata=1.2 --raid-devices=${RAID_DEVICE_NUMBER} /dev/md/${RAID_DEVICE_NAME} ${RAID_DEVICES}\n" 0 0
} }
@ -563,11 +565,11 @@ raid_get_array_name() {
DIALOG "$_DeviceNameTitle" --inputbox "\n$_DeviceNameDescription\n\n$_DeviceNamePrefixWarning\n" 0 0 2>${ANSWER} DIALOG "$_DeviceNameTitle" --inputbox "\n$_DeviceNameDescription\n\n$_DeviceNamePrefixWarning\n" 0 0 2>${ANSWER}
raid_device_name=$(cat ${ANSWER}) raid_device_name=$(cat ${ANSWER})
if [[ ${raid_device_name} != "" ]]; then if [[ ${raid_device_name} != "" ]]; then
raid_create "${1}" ${2} ${raid_device_name} raid_create "${1}" ${2} ${raid_device_name}
fi fi
} }
raid_array_menu() { raid_array_menu() {
@ -576,21 +578,21 @@ raid_array_menu() {
INCLUDE_PART='part\|crypt' INCLUDE_PART='part\|crypt'
umount_partitions umount_partitions
find_partitions find_partitions
# Amend partition(s) found for use in check list # Amend partition(s) found for use in check list
PARTITIONS=$(echo $PARTITIONS | sed 's/M\|G\|T/& off/g') PARTITIONS=$(echo $PARTITIONS | sed 's/M\|G\|T/& off/g')
RAID_LEVEL=${1} RAID_LEVEL=${1}
# select partitions for the array # select partitions for the array
echo "" > $ANSWER echo "" > $ANSWER
while [[ $(cat ${ANSWER}) == "" ]]; do while [[ $(cat ${ANSWER}) == "" ]]; do
DIALOG "$_PartitionSelectTitle" --checklist "\n$__PartitionSelectDescription\n\n$_UseSpaceBar\n " 0 0 12 ${PARTITIONS} 2> ${ANSWER} DIALOG "$_PartitionSelectTitle" --checklist "\n$__PartitionSelectDescription\n\n$_UseSpaceBar\n " 0 0 12 ${PARTITIONS} 2> ${ANSWER}
done done
ANSWERS=$(cat ${ANSWER}) ANSWERS=$(cat ${ANSWER})
raid_get_array_name "${ANSWERS[@]}" ${RAID_LEVEL} raid_get_array_name "${ANSWERS[@]}" ${RAID_LEVEL}
} }
luks_menu() { luks_menu() {
@ -627,7 +629,7 @@ luks_open() {
find_partitions find_partitions
# Filter out partitions that don't contain crypt device # Filter out partitions that don't contain crypt device
list_non_crypt > /tmp/.ignore_part list_non_crypt > /tmp/.ignore_part
for part in $(cat /tmp/.ignore_part); do for part in $(cat /tmp/.ignore_part); do
delete_partition_in_list $part delete_partition_in_list $part
done done
@ -874,7 +876,7 @@ lvm_create() {
# Now the final LV. Size is automatic. # Now the final LV. Size is automatic.
DIALOG " $_LvmCreateVG (LV:$NUMBER_LOGICAL_VOLUMES) " --inputbox "\n$_LvmLvNameBody1 $_LvmLvNameBody2 (${LVM_VG_MB}MB).\n " 0 0 "lvol" 2>${ANSWER} || return 0 DIALOG " $_LvmCreateVG (LV:$NUMBER_LOGICAL_VOLUMES) " --inputbox "\n$_LvmLvNameBody1 $_LvmLvNameBody2 (${LVM_VG_MB}MB).\n " 0 0 "lvol" 2>${ANSWER} || return 0
LVM_LV_NAME=$(cat ${ANSWER}) LVM_LV_NAME=$(cat ${ANSWER})
# Loop if preceeded with a "/", if nothing is entered, if there is a space, or if that name already exists. # Loop if preceeded with a "/", if nothing is entered, if there is a space, or if that name already exists.
while [[ ${LVM_LV_NAME:0:1} == "/" ]] || [[ ${#LVM_LV_NAME} -eq 0 ]] || [[ ${LVM_LV_NAME} =~ \ |\' ]] || [[ $(lsblk | grep ${LVM_LV_NAME}) != "" ]]; do while [[ ${LVM_LV_NAME:0:1} == "/" ]] || [[ ${#LVM_LV_NAME} -eq 0 ]] || [[ ${LVM_LV_NAME} =~ \ |\' ]] || [[ $(lsblk | grep ${LVM_LV_NAME}) != "" ]]; do
DIALOG " $_ErrTitle " --msgbox "\n$_LvmLvNameErrBody\n " 0 0 DIALOG " $_ErrTitle " --msgbox "\n$_LvmLvNameErrBody\n " 0 0
@ -1109,8 +1111,8 @@ zfs_auto() {
fi fi
# next create the datasets including their parents # next create the datasets including their parents
zfs_create_dataset "${ZFS_ZPOOL_NAME}/data" "none" zfs_create_dataset "${ZFS_ZPOOL_NAME}/data" "none"
zfs_create_dataset "${ZFS_ZPOOL_NAME}/ROOT" "none" zfs_create_dataset "${ZFS_ZPOOL_NAME}/ROOT" "none"
zfs_create_dataset "${ZFS_ZPOOL_NAME}/ROOT/manjaro" "none" zfs_create_dataset "${ZFS_ZPOOL_NAME}/ROOT/manjaro" "none"
zfs_create_dataset "${ZFS_ZPOOL_NAME}/ROOT/manjaro/root" "/" zfs_create_dataset "${ZFS_ZPOOL_NAME}/ROOT/manjaro/root" "/"
zfs_create_dataset "${ZFS_ZPOOL_NAME}/data/home" "/home" zfs_create_dataset "${ZFS_ZPOOL_NAME}/data/home" "/home"
@ -1119,7 +1121,7 @@ zfs_auto() {
# set the rootfs # set the rootfs
zpool set bootfs=${ZFS_ZPOOL_NAME}/ROOT/manjaro/root ${ZFS_ZPOOL_NAME} 2>$ERR zpool set bootfs=${ZFS_ZPOOL_NAME}/ROOT/manjaro/root ${ZFS_ZPOOL_NAME} 2>$ERR
check_for_error "Setting zfs bootfs" check_for_error "Setting zfs bootfs"
# provide confirmation to the user # provide confirmation to the user
DIALOG " $_zfsZpoolCTitle " --infobox "\n$_zfsAutoComplete\n " 0 0 DIALOG " $_zfsZpoolCTitle " --infobox "\n$_zfsAutoComplete\n " 0 0
sleep 3 sleep 3
@ -1146,7 +1148,7 @@ zfs_import_pool() {
# return a list of imported zpools # return a list of imported zpools
zfs_list_pools() { zfs_list_pools() {
zpool list -H 2>/dev/null | awk '{print $1}' zpool list -H 2>/dev/null | awk '{print $1}'
} }
zfs_new_ds() { zfs_new_ds() {
@ -1239,7 +1241,7 @@ zfs_destroy_dataset() {
sleep 3 sleep 3
return 0 return 0
fi fi
# better confirm this one # better confirm this one
DIALOG --defaultno --yesno "$_zfsDestroyMenuConfirm1 ${zdataset} $_zfsDestroyMenuConfirm2" 0 0 DIALOG --defaultno --yesno "$_zfsDestroyMenuConfirm1 ${zdataset} $_zfsDestroyMenuConfirm2" 0 0
if [ $? ]; then if [ $? ]; then
@ -1267,7 +1269,7 @@ zfs_set_property () {
sleep 3 sleep 3
return 0 return 0
fi fi
# get property/value input # get property/value input
local -i loopmenu=1 local -i loopmenu=1
zfsmenubody=$_zfsSetMenuBody zfsmenubody=$_zfsSetMenuBody
@ -1436,7 +1438,7 @@ mount_partitions() {
ROOT_PART=${PARTITION} ROOT_PART=${PARTITION}
echo ${ROOT_PART} > /tmp/.root_partitioni echo ${ROOT_PART} > /tmp/.root_partitioni
echo ${ROOT_PART} > /tmp/.root_partition echo ${ROOT_PART} > /tmp/.root_partition
# Reset the mountpoint variable, in case this is the second time through this menu and old state is still around # Reset the mountpoint variable, in case this is the second time through this menu and old state is still around
MOUNT="" MOUNT=""
@ -1459,7 +1461,7 @@ mount_partitions() {
# No subvolumes present. Make some new ones # No subvolumes present. Make some new ones
DIALOG " Your root volume is formatted in btrfs " --yesno "\nWould you like to create subvolumes in it? \n " 0 0 && btrfs_subvolumes DIALOG " Your root volume is formatted in btrfs " --yesno "\nWould you like to create subvolumes in it? \n " 0 0 && btrfs_subvolumes
fi fi
fi fi
fi fi
# We need to remove legacy zfs partitions before make_swap since they can't hold swap # We need to remove legacy zfs partitions before make_swap since they can't hold swap
@ -1538,8 +1540,8 @@ get_cryptroot() {
# Mountpoint is not directly on LUKS device, so we need to get the crypt device above the mountpoint # Mountpoint is not directly on LUKS device, so we need to get the crypt device above the mountpoint
LUKS_ROOT_NAME="$(lsblk -i | tac | sed -r 's/^[^[:alnum:]]+//' | sed -n -e "/\/mnt$/,/crypt/p" | awk '/crypt/ {print $1}')" LUKS_ROOT_NAME="$(lsblk -i | tac | sed -r 's/^[^[:alnum:]]+//' | sed -n -e "/\/mnt$/,/crypt/p" | awk '/crypt/ {print $1}')"
fi fi
# Check if LUKS on LVM # Check if LUKS on LVM
if [[ $(lsblk -lno NAME,FSTYPE,TYPE,MOUNTPOINT | grep "lvm" | grep "/mnt$" | grep -i "crypto_luks" | uniq | awk '{print "/dev/mapper/"$1}') != "" ]]; then if [[ $(lsblk -lno NAME,FSTYPE,TYPE,MOUNTPOINT | grep "lvm" | grep "/mnt$" | grep -i "crypto_luks" | uniq | awk '{print "/dev/mapper/"$1}') != "" ]]; then
cryptparts=$(lsblk -lno NAME,FSTYPE,TYPE,MOUNTPOINT | grep "lvm" | grep "/mnt$" | grep -i "crypto_luks" | uniq | awk '{print "/dev/mapper/"$1}') cryptparts=$(lsblk -lno NAME,FSTYPE,TYPE,MOUNTPOINT | grep "lvm" | grep "/mnt$" | grep -i "crypto_luks" | uniq | awk '{print "/dev/mapper/"$1}')
for i in ${cryptparts}; do for i in ${cryptparts}; do
@ -1571,14 +1573,14 @@ get_cryptroot() {
done done
fi fi
echo "$LUKS_DEV" > /tmp/.luks_dev echo "$LUKS_DEV" > /tmp/.luks_dev
fi fi
} }
get_cryptboot(){ get_cryptboot(){
# If /boot is encrypted # If /boot is encrypted
if $(lsblk | sed -r 's/^[^[:alnum:]]+//' | awk '/\/mnt\/boot$/ {print $6}' | grep -q crypt) || $(lsblk -i | tac | sed -r 's/^[^[:alnum:]]+//' | sed -n -e "/\/mnt\/boot$/,/part/p" | awk '{print $6}' | grep -q crypt); then if $(lsblk | sed -r 's/^[^[:alnum:]]+//' | awk '/\/mnt\/boot$/ {print $6}' | grep -q crypt) || $(lsblk -i | tac | sed -r 's/^[^[:alnum:]]+//' | sed -n -e "/\/mnt\/boot$/,/part/p" | awk '{print $6}' | grep -q crypt); then
LUKS=1 LUKS=1
boot_name=$(mount | awk '/\/mnt\/boot / {print $1}' | sed s~/dev/mapper/~~g | sed s~/dev/~~g) boot_name=$(mount | awk '/\/mnt\/boot / {print $1}' | sed s~/dev/mapper/~~g | sed s~/dev/~~g)
#Get the name of the Luks device #Get the name of the Luks device
@ -1608,7 +1610,7 @@ get_cryptboot(){
} }
btrfs_subvolumes() { btrfs_subvolumes() {
#1) save mount options and name of the root partition #1) save mount options and name of the root partition
mount | grep "on /mnt " | grep -Po '(?<=\().*(?=\))' > /tmp/.root_mount_options mount | grep "on /mnt " | grep -Po '(?<=\().*(?=\))' > /tmp/.root_mount_options
#lsblk -lno MOUNTPOINT,NAME | awk '/^\/mnt / {print $2}' > /tmp/.root_partition #lsblk -lno MOUNTPOINT,NAME | awk '/^\/mnt / {print $2}' > /tmp/.root_partition
#2) choose automatic or manual mode #2) choose automatic or manual mode
@ -1627,7 +1629,7 @@ btrfs_subvolumes() {
cd cd
# Mount subvolumes # Mount subvolumes
umount /mnt umount /mnt
# Mount the first subvolume as / # Mount the first subvolume as /
mount -o $(cat ${MOUNT_OPTS}),subvol="$(awk '{print $1}' /tmp/.subvols)" "$(cat /tmp/.root_partition)" /mnt mount -o $(cat ${MOUNT_OPTS}),subvol="$(awk '{print $1}' /tmp/.subvols)" "$(cat /tmp/.root_partition)" /mnt
# Remove the first subvolume from the subvolume list # Remove the first subvolume from the subvolume list
sed -i -r 's/(\s+)?\S+//1' /tmp/.subvols sed -i -r 's/(\s+)?\S+//1' /tmp/.subvols
@ -1662,7 +1664,7 @@ btrfs_subvolumes() {
mount_existing_subvols() { mount_existing_subvols() {
# Set mount options # Set mount options
format_name=$(echo ${PARTITION} | rev | cut -d/ -f1 | rev) format_name=$(echo ${PARTITION} | rev | cut -d/ -f1 | rev)
format_device=$(lsblk -i | tac | sed -r 's/^[^[:alnum:]]+//' | sed -n -e "/$format_name/,/disk/p" | awk '/disk/ {print $1}') format_device=$(lsblk -i | tac | sed -r 's/^[^[:alnum:]]+//' | sed -n -e "/$format_name/,/disk/p" | awk '/disk/ {print $1}')
if [[ "$(cat /sys/block/${format_device}/queue/rotational)" == 1 ]]; then if [[ "$(cat /sys/block/${format_device}/queue/rotational)" == 1 ]]; then
fs_opts="autodefrag,compress=zlib,noatime,nossd,commit=120" fs_opts="autodefrag,compress=zlib,noatime,nossd,commit=120"
else else

Loading…
Cancel
Save