mirror of
https://codeberg.org/privacy1st/arch
synced 2024-12-23 01:16:04 +01:00
installer: user can choose BTRFS subvolume layout (e.g. to support Timeshift)
This commit is contained in:
parent
d094f08f9d
commit
fdf3d5f622
@ -2,7 +2,7 @@
|
||||
_pkgname=installer
|
||||
_reponame=arch
|
||||
pkgname="de-p1st-$_pkgname"
|
||||
pkgver=0.1.17
|
||||
pkgver=0.1.18
|
||||
pkgrel=1
|
||||
pkgdesc="Bash script to install Arch Linux"
|
||||
arch=('any')
|
||||
|
@ -44,12 +44,7 @@ function main() {
|
||||
join_by ',' TMP1 FS_MOUNT_OPTIONS || return $?
|
||||
}
|
||||
|
||||
echo 'Mounting data partition with options: '"${FS_MOUNT_OPTIONS}"
|
||||
sudo mount -o "${FS_MOUNT_OPTIONS}" "${DATA_PART}" /mnt || return $?
|
||||
|
||||
echo 'Mounting boot partition ...'
|
||||
mkdir /mnt/boot || return $?
|
||||
sudo mount "${BOOT_PART}" /mnt/boot || return $?
|
||||
mount_partitions || return $?
|
||||
|
||||
# in: BOOT_FIRMWARE
|
||||
run_pacstrap || return $?
|
||||
@ -100,6 +95,7 @@ function get_user_input() {
|
||||
# @post
|
||||
# BOOT_FIRMWARE (uefi or bios)
|
||||
# FS (BTRFS, EXT4, F2FS)
|
||||
# FS_BTRFS_SUBVOL_LAYOUT (root_only, @root@home)
|
||||
# HOSTNAME
|
||||
# USERNAME, USER_PWD
|
||||
# LUKS_PWD
|
||||
@ -120,16 +116,23 @@ function get_user_input() {
|
||||
BOOT_FIRMWARE='bios'
|
||||
fi
|
||||
|
||||
else
|
||||
# If $BOOT_FIRMWARE is empty: Let user select BIOS type
|
||||
|
||||
TMP1=('uefi' 'Newer mainboards' 'bios' 'Legacy BIOS on older mainboards')
|
||||
else # If $BOOT_FIRMWARE is empty: Let user select BIOS type
|
||||
TMP1=('uefi' 'Newer mainboards' \
|
||||
'bios' 'Legacy BIOS on older mainboards')
|
||||
single_choice_if_empty BOOT_FIRMWARE 'Select your bios type' TMP1 || return $?
|
||||
fi
|
||||
|
||||
TMP1=('BTRFS' 'Allows snapshots and dynamic extension of the FS' 'EXT4' 'Default FS of many distributions' 'F2FS' 'Flash-Friendly-FS for SSD or NVMe')
|
||||
TMP1=('BTRFS' 'Allows snapshots and dynamic extension of the FS' \
|
||||
'EXT4' 'Default FS of many distributions' \
|
||||
'F2FS' 'Flash-Friendly-FS for SSD or NVMe')
|
||||
single_choice_if_empty FS 'Select filesystem to use' TMP1 || return $?
|
||||
|
||||
if [ "${FS}" = 'BTRFS' ]; then
|
||||
TMP1=('root_only' 'Just one subvolume for "/".' \
|
||||
'@root@home' 'Two subvolumes @ and @home. This configuration allows usage of "Timeshift".')
|
||||
single_choice_if_empty FS_BTRFS_SUBVOL_LAYOUT 'Select your preferred subvolume layout' TMP1 || return $?
|
||||
fi
|
||||
|
||||
ask_user_if_empty HOSTNAME 'Enter hostname:' || return $?
|
||||
ask_user_if_empty USERNAME 'Enter username:' || return $?
|
||||
|
||||
@ -180,7 +183,7 @@ function get_default_mount_options() {
|
||||
FS_DEFAULT_MOUNT_OPTIONS+=('compress_algorithm=lz4')
|
||||
;;
|
||||
*)
|
||||
echo 'Filesystem '"$FS"' not yet supported!'
|
||||
echo 'Filesystem '"${FS}"' not yet supported!'
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
@ -210,7 +213,7 @@ function get_additional_mount_options() {
|
||||
TMP1=('noatime' 'Don'\''t write file/folder access times' 'on')
|
||||
;;
|
||||
*)
|
||||
echo 'Filesystem '"$FS"' not yet supported!'
|
||||
echo 'Filesystem '"${FS}"' not yet supported!'
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
@ -218,6 +221,51 @@ function get_additional_mount_options() {
|
||||
multi_choice_if_empty FS_ADDITIONAL_MOUNT_OPTIONS 'Select mount options' TMP1 || return $?
|
||||
}
|
||||
|
||||
function mount_partitions() {
|
||||
# @pre
|
||||
# FS, FS_BTRFS_SUBVOL_LAYOUT, FS_MOUNT_OPTIONS, DATA_PART, BOOT_PART
|
||||
|
||||
if [ "${FS}" = 'BTRFS' ]; then
|
||||
case "${FS_BTRFS_SUBVOL_LAYOUT}" in
|
||||
'root_only')
|
||||
# Nothing special; same steps as for a regular FS
|
||||
echo 'Mounting data partition with options: '"${FS_MOUNT_OPTIONS}"
|
||||
sudo mount -o "${FS_MOUNT_OPTIONS}" "${DATA_PART}" /mnt || return $?
|
||||
;;
|
||||
'@root@home')
|
||||
# Timeshift BTRFS subvol layout:
|
||||
# https://github.com/teejee2008/timeshift#supported-system-configurations
|
||||
|
||||
# Mount top level subvolume
|
||||
sudo mount -o subvolid=5 "${DATA_PART}" /mnt || return $?
|
||||
# Create subvolumes @ and @home
|
||||
sudo btrfs subvolume create /mnt/@ || return $?
|
||||
sudo btrfs subvolume create /mnt/@home || return $?
|
||||
# List the created subvolumes
|
||||
sudo btrfs subvolume list /mnt || return $?
|
||||
# Umount the top level subvolume
|
||||
sudo umount -R /mnt || return $?
|
||||
|
||||
echo 'Mounting @ and @home subvolumes with options: '"${FS_MOUNT_OPTIONS}"
|
||||
sudo mount -o 'subvol=@'"${FS_MOUNT_OPTIONS}" "${DATA_PART}" /mnt || return $?
|
||||
sudo mkdir /mnt/home || return $?
|
||||
sudo mount -o 'subvol=@home'"${FS_MOUNT_OPTIONS}" "${DATA_PART}" /mnt/home || return $?
|
||||
;;
|
||||
*)
|
||||
echo 'BTRFS subvolume layout '"${FS_BTRFS_SUBVOL_LAYOUT}"' not supported!'
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
else
|
||||
echo 'Mounting data partition with options: '"${FS_MOUNT_OPTIONS}"
|
||||
sudo mount -o "${FS_MOUNT_OPTIONS}" "${DATA_PART}" /mnt || return $?
|
||||
fi
|
||||
|
||||
echo 'Mounting boot partition ...'
|
||||
sudo mkdir /mnt/boot || return $?
|
||||
sudo mount "${BOOT_PART}" /mnt/boot || return $?
|
||||
}
|
||||
|
||||
function run_pacstrap() {
|
||||
# @pre
|
||||
# BOOT_FIRMWARE
|
||||
@ -292,7 +340,7 @@ function run_genfstab() {
|
||||
true
|
||||
;;
|
||||
*)
|
||||
echo 'Filesystem '"$FS"' not yet supported!'
|
||||
echo 'Filesystem '"${FS}"' not yet supported!'
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
@ -3,33 +3,34 @@
|
||||
# FQDN=domain.name.of.this.host.de
|
||||
# STATIC_IP=123.123.123.123
|
||||
# IPV6_CAPABLE=1
|
||||
HOSTNAME=yodaTest
|
||||
USERNAME=yoda
|
||||
HOSTNAME='yodaTest'
|
||||
USERNAME='yoda'
|
||||
|
||||
# One should rather enter these interactively than saving in this cfg.
|
||||
USER_PWD=test
|
||||
LUKS_PWD=test
|
||||
USER_PWD='test'
|
||||
LUKS_PWD='test'
|
||||
|
||||
# If unset, then USER_PWD will be used for ROOT_PWD
|
||||
# ROOT_PWD=test
|
||||
|
||||
TARGET_BLOCK_DEVICE=/dev/sda
|
||||
BOOT_PART_SIZE=500 # MiB
|
||||
FS=BTRFS
|
||||
TARGET_BLOCK_DEVICE='/dev/sda'
|
||||
BOOT_PART_SIZE='500' # MiB
|
||||
FS='BTRFS'
|
||||
FS_BTRFS_SUBVOL_LAYOUT='@root@home' # Subvolume layout that is supported by Timeshift
|
||||
FS_ADDITIONAL_MOUNT_OPTIONS=('noatime')
|
||||
|
||||
# If not booted into the target system, these values should be set:
|
||||
# CPU_VENDOR: "autodetect", "amd", "intel" or "none"
|
||||
CPU_VENDOR=autodetect
|
||||
CPU_VENDOR='autodetect'
|
||||
# BOOT_FIRMWARE: "autodetect", "uefi" or "bios"
|
||||
BOOT_FIRMWARE=uefi
|
||||
BOOT_FIRMWARE='uefi'
|
||||
|
||||
# If set to "1", then the data, boot and luks partitions
|
||||
# will be left mounted/opened for manual inspection
|
||||
# after the installation
|
||||
LEAVE_MOUNTED=1
|
||||
LEAVE_MOUNTED='1'
|
||||
|
||||
PACSTRAP_INTERACTIVE=1
|
||||
PACSTRAP_INTERACTIVE='1'
|
||||
|
||||
############## ADDITIONAL_PKGS from here on ##############
|
||||
ADDITIONAL_PKGS=()
|
||||
@ -55,3 +56,7 @@ ADDITIONAL_PKGS+=('intellij-idea-ultimate-edition' 'intellij-idea-ultimate-editi
|
||||
ADDITIONAL_PKGS+=('evince')
|
||||
# Gallery / image viewer
|
||||
ADDITIONAL_PKGS+=('nomacs' 'qt5-imageformats')
|
||||
# LibreOffice with spell checking (de, us) and hyphenation rules (de, us)
|
||||
ADDITIONAL_PKGS+=('libreoffice-fresh')
|
||||
ADDITIONAL_PKGS+=('hunspell-de' 'hunspell-en_US')
|
||||
ADDITIONAL_PKGS+=('hyphen' 'hyphen-de' 'hyphen-en')
|
||||
|
Loading…
Reference in New Issue
Block a user