mirror of
https://gitlab.archlinux.org/tpowa/archboot.git
synced 2024-09-20 12:00:37 +02:00
functionalize more btrfs things
This commit is contained in:
parent
047e32f4da
commit
a12c81c3e5
1 changed files with 34 additions and 25 deletions
|
@ -1873,6 +1873,11 @@ partition() {
|
||||||
S_PART=1
|
S_PART=1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# scan and update btrfs devices
|
||||||
|
btrfs_scan() {
|
||||||
|
btrfs device scan >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
# mount btrfs for checks
|
# mount btrfs for checks
|
||||||
mount_btrfs() {
|
mount_btrfs() {
|
||||||
btrfs_scan
|
btrfs_scan
|
||||||
|
@ -1949,10 +1954,6 @@ select_btrfs_raid_devices () {
|
||||||
[ "$BTRFS_RAID_FINISH" = "DONE" ] && remove_btrfs_parts
|
[ "$BTRFS_RAID_FINISH" = "DONE" ] && remove_btrfs_parts
|
||||||
}
|
}
|
||||||
|
|
||||||
btrfs_scan() {
|
|
||||||
btrfs device scan >/dev/null 2>&1
|
|
||||||
}
|
|
||||||
|
|
||||||
# check btrfs subvolume
|
# check btrfs subvolume
|
||||||
check_btrfs_subvolume(){
|
check_btrfs_subvolume(){
|
||||||
mount_btrfs
|
mount_btrfs
|
||||||
|
@ -2037,6 +2038,31 @@ enter_mountpoint() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
btrfs_subvolume() {
|
||||||
|
if [ "$FSTYPE" = "btrfs" ]; then
|
||||||
|
# use device if no subvolume is present
|
||||||
|
# choose btrfs subvolume if present
|
||||||
|
# create subvolume if requested
|
||||||
|
choose_btrfs_subvolume || return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
check_mkfs_values() {
|
||||||
|
# Set values, to not confuse mkfs call!
|
||||||
|
[ "$FS_OPTIONS" = "" ] && FS_OPTIONS="NONE"
|
||||||
|
[ "$BTRFS_DEVICES" = "" ] && BTRFS_DEVICES="NONE"
|
||||||
|
[ "$BTRFS_LEVEL" = "" ] && BTRFS_LEVEL="NONE"
|
||||||
|
if [ "$LABEL_NAME" = "" -a -n "$(blkid -c=/dev/null -o value -s LABEL $PART)" ]; then
|
||||||
|
LABEL_NAME="$(blkid -c=/dev/null -o value -s LABEL $PART)"
|
||||||
|
else
|
||||||
|
LABEL_NAME="NONE"
|
||||||
|
fi
|
||||||
|
if [ "$FSTYPE" = "btrfs" ]; then
|
||||||
|
btrfs_compress || return 1
|
||||||
|
btrfs_ssd || return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
create_filesystem() {
|
create_filesystem() {
|
||||||
LABEL_NAME=""
|
LABEL_NAME=""
|
||||||
FS_OPTIONS=""
|
FS_OPTIONS=""
|
||||||
|
@ -2059,27 +2085,6 @@ create_filesystem() {
|
||||||
fi
|
fi
|
||||||
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
|
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)
|
FS_OPTIONS=$(cat $ANSWER)
|
||||||
else
|
|
||||||
### Put this to another function! It's needed in bootloaders later too!
|
|
||||||
if [ "$FSTYPE" = "btrfs" ]; then
|
|
||||||
# use device if no subvolume is present
|
|
||||||
# choose present btrfs subvolume
|
|
||||||
# create subvolume if requested
|
|
||||||
choose_btrfs_subvolume || return 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
# Set values, to not confuse mkfs call!
|
|
||||||
[ "$FS_OPTIONS" = "" ] && FS_OPTIONS="NONE"
|
|
||||||
[ "$BTRFS_DEVICES" = "" ] && BTRFS_DEVICES="NONE"
|
|
||||||
[ "$BTRFS_LEVEL" = "" ] && BTRFS_LEVEL="NONE"
|
|
||||||
if [ "$LABEL_NAME" = "" -a -n "$(blkid -c=/dev/null -o value -s LABEL $PART)" ]; then
|
|
||||||
LABEL_NAME="$(blkid -c=/dev/null -o value -s LABEL $PART)"
|
|
||||||
else
|
|
||||||
LABEL_NAME="NONE"
|
|
||||||
fi
|
|
||||||
if [ "$FSTYPE" = "btrfs" ]; then
|
|
||||||
btrfs_compress || return 1
|
|
||||||
btrfs_ssd || return 1
|
|
||||||
fi
|
fi
|
||||||
RUN_CREATE_FILESYSTEM="yes"
|
RUN_CREATE_FILESYSTEM="yes"
|
||||||
}
|
}
|
||||||
|
@ -2138,8 +2143,10 @@ mountpoints() {
|
||||||
if [ "$ASK_MOUNTPOINTS" = "1" ]; then
|
if [ "$ASK_MOUNTPOINTS" = "1" ]; then
|
||||||
select_filesystem && create_filesystem
|
select_filesystem && create_filesystem
|
||||||
else
|
else
|
||||||
|
btrfs_subvolume
|
||||||
RUN_CREATE_FILESYSTEM="yes"
|
RUN_CREATE_FILESYSTEM="yes"
|
||||||
fi
|
fi
|
||||||
|
check_mkfs_values
|
||||||
[ "$RUN_CREATE_FILESYSTEM" = "yes" ] && DO_ROOT=DONE
|
[ "$RUN_CREATE_FILESYSTEM" = "yes" ] && DO_ROOT=DONE
|
||||||
done
|
done
|
||||||
echo "$PART:$FSTYPE:/:$DOMKFS:$LABEL_NAME:$FS_OPTIONS:$BTRFS_DEVICES:$BTRFS_LEVEL:$BTRFS_SUBVOLUME:$BTRFS_COMPRESS:$BTRFS_SSD" >>/tmp/.parts
|
echo "$PART:$FSTYPE:/:$DOMKFS:$LABEL_NAME:$FS_OPTIONS:$BTRFS_DEVICES:$BTRFS_LEVEL:$BTRFS_SUBVOLUME:$BTRFS_COMPRESS:$BTRFS_SSD" >>/tmp/.parts
|
||||||
|
@ -2160,8 +2167,10 @@ mountpoints() {
|
||||||
enter_mountpoint && select_filesystem && create_filesystem
|
enter_mountpoint && select_filesystem && create_filesystem
|
||||||
else
|
else
|
||||||
enter_mountpoint
|
enter_mountpoint
|
||||||
|
btrfs_subvolume
|
||||||
RUN_CREATE_FILESYSTEM="yes"
|
RUN_CREATE_FILESYSTEM="yes"
|
||||||
fi
|
fi
|
||||||
|
check_mkfs_values
|
||||||
else
|
else
|
||||||
RUN_CREATE_FILESYSTEM="yes"
|
RUN_CREATE_FILESYSTEM="yes"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue