mirror of
https://codeberg.org/privacy1st/arch
synced 2024-12-23 01:16:04 +01:00
installer script: work in progress (7)
This commit is contained in:
parent
0f26bfbe69
commit
cee4da2675
@ -160,8 +160,12 @@ function main() {
|
|||||||
get_default_mount_options || return $?
|
get_default_mount_options || return $?
|
||||||
choose_mount_options || return $?
|
choose_mount_options || return $?
|
||||||
|
|
||||||
partition "${TARGET_BLOCK_DEVICE}" "$BIOS_TYPE"
|
partition "${TARGET_BLOCK_DEVICE}" "$BIOS_TYPE" || return $?
|
||||||
|
format "$BIOS_TYPE" "${BOOT_PART}" "${LUKS_PART}" "${LUKS_PWD}" "${FS}" DATA_PART || return $?
|
||||||
|
|
||||||
# TODO: use FS_DEFAULT_MOUNT_OPTIONS and FS_MOUNT_OPTIONS in combination
|
# TODO: use FS_DEFAULT_MOUNT_OPTIONS and FS_MOUNT_OPTIONS in combination
|
||||||
|
mount "$DATA_PART" /mnt || return $?
|
||||||
|
mkdir /mnt/boot && mount "$BOOT_PART" /mnt/boot || return $?
|
||||||
}
|
}
|
||||||
|
|
||||||
main "$@"
|
main "$@"
|
||||||
|
@ -104,6 +104,60 @@ function partition() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
echo "boot partition: $BOOT_PART"
|
echo "boot partition: ${BOOT_PART}"
|
||||||
echo "luks partition: $LUKS_PART"
|
echo "luks partition: ${LUKS_PART}"
|
||||||
|
}
|
||||||
|
|
||||||
|
function format() {
|
||||||
|
# $1: uefi or bios
|
||||||
|
# $2: boot partition
|
||||||
|
# $3: luks partition
|
||||||
|
# $4: luks passphrase
|
||||||
|
# $5: FS for data partition (opened luks partition): BTRFS, EXT4 or F2FS
|
||||||
|
# $6: name of variable to store path to data partition (/dev/mapper/$(basename "$3"))
|
||||||
|
# return:
|
||||||
|
# -> boot partition formatted
|
||||||
|
# -> luks partition formatted and opened at /dev/mapper/$(basename "$3")
|
||||||
|
# -> variable with name $6 assigned to path to data partition
|
||||||
|
|
||||||
|
echo "Wiping old signatures from partitions ..."
|
||||||
|
wipefs "${2}" || return $?
|
||||||
|
wipefs "${3}" || return $?
|
||||||
|
|
||||||
|
echo "Formatting boot partition $2 ..."
|
||||||
|
mkfs.fat -F32 "$2" || return $?
|
||||||
|
|
||||||
|
echo "Creating encrypted luks partition $3 ..."
|
||||||
|
printf "%s" "$4" | cryptsetup luksFormat --type luks1 \
|
||||||
|
--cipher aes-xts-plain64 --key-size 512 --hash sha512 \
|
||||||
|
--iter-time 3500 --use-random "$3" || return $?
|
||||||
|
|
||||||
|
local luks_name
|
||||||
|
luks_name=$(basename "$3")
|
||||||
|
local -n data_part=$6 || return $?
|
||||||
|
data_part="/dev/mapper/${luks_name}"
|
||||||
|
|
||||||
|
# open luks partition
|
||||||
|
printf "%s" "$4" | cryptsetup luksOpen "$3" "${luks_name}" || return $?
|
||||||
|
|
||||||
|
echo "Formatting the data partition ${data_part} ..."
|
||||||
|
case "$5" in
|
||||||
|
BTRFS)
|
||||||
|
mkfs.btrfs "${data_part}" || return $?
|
||||||
|
;;
|
||||||
|
EXT4)
|
||||||
|
# archwiki -> Ext4#Enabling_metadata_checksums
|
||||||
|
mkfs.ext4 -O metadata_csum "${data_part}" || return $?
|
||||||
|
;;
|
||||||
|
F2FS)
|
||||||
|
# archwiki -> F2FS#Creating_a_F2FS_file_system
|
||||||
|
# - requires f2fs-tools
|
||||||
|
# - compression: "-O compression" and when mounting the filesystem, specify compress_algorithm=(lzo|lz4|zstd|lzo-rle)
|
||||||
|
mkfs.f2fs -O extra_attr,inode_checksum,sb_checksum,compression "${data_part}" || return $?
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Filesystem $5 is not yet supported!"
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user