updated lvm and luks
This commit is contained in:
parent
31870e51d9
commit
be5764c87a
|
|
@ -39,19 +39,35 @@ do_btrfs() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
do_format() {
|
||||||
|
mkfs."$FS" "$1" \
|
||||||
|
"$([[ $FS == xfs || $FS == btrfs || $FS == reiserfs ]] && echo "-f")" \
|
||||||
|
"$([[ $FS == vfat ]] && echo "-F32")" \
|
||||||
|
"$([[ $TRIM -eq 1 && $FS == ext4 ]] && echo "-E discard -F")"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
do_lvm() {
|
do_lvm() {
|
||||||
while [[ "$i" -le "$LVM_PART_NUM" ]]; do
|
while [[ "$i" -le "$LVM_PART_NUM" ]]; do
|
||||||
if [[ "$i" -eq "$LVM_PART_NUM" ]]; then
|
if [[ "$i" -eq "$LVM_PART_NUM" ]]; then
|
||||||
lvcreate -l 100%FREE "$LVM_VG" -n "${LVM_NAMES[$i]}"
|
lvcreate -l 100%FREE "$LVM_VG" -n "${LVM_NAMES[$i]}"
|
||||||
do_format "${LVM_NAMES[$i]}"
|
do_format /dev/"$LVM_VG"/"${LVM_NAMES[$i]}"
|
||||||
else
|
else
|
||||||
lvcreate -L "${LVM_SIZES[$i]}" "$LVM_VG" -n "${LVM_NAMES[$i]}"
|
lvcreate -L "${LVM_SIZES[$i]}" "$LVM_VG" -n "${LVM_NAMES[$i]}"
|
||||||
do_format "${LVM_NAMES[$i]}"
|
do_format /dev/"$LVM_VG"/"${LVM_NAMES[$i]}"
|
||||||
fi
|
fi
|
||||||
i=$((i + 1))
|
i=$((i + 1))
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lvm_mount() {
|
||||||
|
mount /dev/"$LVM_VG"/"${LVM_NAMES[1]}" "$MOUNTPOINT"/
|
||||||
|
for x in "${LVM_NAMES[@]:1}"; do
|
||||||
|
mkdir "$MOUNTPOINT"/"$x"
|
||||||
|
mount /dev/"$LVM_VG"/"$x" "$MOUNTPOINT"/"$x"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
do_partition() {
|
do_partition() {
|
||||||
sgdisk -Z "$DISK" # zap all on disk
|
sgdisk -Z "$DISK" # zap all on disk
|
||||||
sgdisk -a 2048 -o "$DISK" # new gpt disk 2048 alignment
|
sgdisk -a 2048 -o "$DISK" # new gpt disk 2048 alignment
|
||||||
|
|
@ -63,17 +79,7 @@ do_partition() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
do_format() {
|
|
||||||
if [[ $FS =~ "btrfs" ]]; then
|
|
||||||
do_btrfs "$ROOT" "$1"
|
|
||||||
else
|
|
||||||
mkfs."$FS" "$1" \
|
|
||||||
"$([[ $FS == xfs || $FS == reiserfs ]] && echo "-f")" \
|
|
||||||
"$([[ $FS == vfat ]] && echo "-F32")" \
|
|
||||||
"$([[ $TRIM -eq 1 && ${filesystem} == ext4 ]] && echo "-E discard -F")"
|
|
||||||
fi
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
# format a partition from given list of filesystems
|
# format a partition from given list of filesystems
|
||||||
|
|
||||||
|
|
@ -100,13 +106,14 @@ fi
|
||||||
if [[ "$LAYOUT" -eq 1 ]]; then
|
if [[ "$LAYOUT" -eq 1 ]]; then
|
||||||
do_partition
|
do_partition
|
||||||
make_boot "$BOOT" "$PART2"
|
make_boot "$BOOT" "$PART2"
|
||||||
do_format
|
do_btrfs "$ROOT" "$PART3"
|
||||||
|
|
||||||
elif [[ "$LVM" -eq 1 ]]; then
|
elif [[ "$LVM" -eq 1 ]]; then
|
||||||
do_partition
|
do_partition
|
||||||
pvcreate "$PART3"
|
pvcreate "$PART3"
|
||||||
vgcreate "$LVM_VG" "$PART3"
|
vgcreate "$LVM_VG" "$PART3"
|
||||||
do_lvm
|
do_lvm
|
||||||
|
lvm_mount
|
||||||
|
|
||||||
elif [[ "$LUKS" -eq 1 ]]; then
|
elif [[ "$LUKS" -eq 1 ]]; then
|
||||||
do_partition
|
do_partition
|
||||||
|
|
@ -117,7 +124,7 @@ elif [[ "$LUKS" -eq 1 ]]; then
|
||||||
pvcreate "$LUKS_PATH"
|
pvcreate "$LUKS_PATH"
|
||||||
vgcreate "$LVM_VG" "$LUKS_PATH"
|
vgcreate "$LVM_VG" "$LUKS_PATH"
|
||||||
do_lvm
|
do_lvm
|
||||||
|
lvm_mount
|
||||||
else
|
else
|
||||||
modprobe dm-mod
|
modprobe dm-mod
|
||||||
vgscan &>/dev/null
|
vgscan &>/dev/null
|
||||||
|
|
|
||||||
57
startup.sh
57
startup.sh
|
|
@ -80,8 +80,8 @@ efi_check() {
|
||||||
set_btrfs() {
|
set_btrfs() {
|
||||||
# Used -a to get more than one argument
|
# Used -a to get more than one argument
|
||||||
echo "Please enter your btrfs subvolumes separated by space"
|
echo "Please enter your btrfs subvolumes separated by space"
|
||||||
echo "usualy they start with @ like @home, @temp etc."
|
echo "usualy they start with @."
|
||||||
echo "Defaults are @home, @var, @tmp, @.snapshots"
|
echo "[like @home, default are @home, @var, @tmp, @.snapshots]"
|
||||||
echo " "
|
echo " "
|
||||||
read -r -p "press enter to use default: " -a ARR
|
read -r -p "press enter to use default: " -a ARR
|
||||||
if [[ -z "${ARR[*]}" ]]; then
|
if [[ -z "${ARR[*]}" ]]; then
|
||||||
|
|
@ -107,18 +107,27 @@ set_btrfs() {
|
||||||
|
|
||||||
# If lvm is selected
|
# If lvm is selected
|
||||||
set_lvm() {
|
set_lvm() {
|
||||||
read -r -p "Name your lvm volume group [like MyVolGroup]: " _VG
|
read -r -p "Name your lvm volume group [like MyVolGroup, default is MyVolGroup]: " _VG
|
||||||
read -r -p "Enter number of partitions [like 2]: " _PART_NUM
|
if [[ -z "$_VG" ]]; then
|
||||||
i=1
|
_VG="MyVolGroup"
|
||||||
_LVM_NAMES=()
|
fi
|
||||||
_LVM_SIZES=()
|
read -r -p "Enter number of partitions [like 2, default is 1]: " _PART_NUM
|
||||||
|
echo "Please make sure 1st partition is considered as root partition"
|
||||||
|
echo "And will be mounted at /mnt/ and other partitions will be mounted"
|
||||||
|
echo "at /mnt/partition_name by making a mkdir /mnt/partition_name"
|
||||||
if [[ -z "$PART_NUM" ]]; then
|
if [[ -z "$PART_NUM" ]]; then
|
||||||
PART_NUM=1
|
PART_NUM=1
|
||||||
fi
|
fi
|
||||||
|
i=1
|
||||||
|
_LVM_NAMES=()
|
||||||
|
_LVM_SIZES=()
|
||||||
while [[ $i -le "$_PART_NUM" ]]; do
|
while [[ $i -le "$_PART_NUM" ]]; do
|
||||||
read -r -p "Enter $iª partition name [like home]: " _LVM_NAME
|
read -r -p "Enter $i partition name [like root, default is root]: " _LVM_NAME
|
||||||
|
if [[ -z "$_LVM_NAME" ]]; then
|
||||||
|
_LVM_NAME="root"
|
||||||
|
fi
|
||||||
_LVM_NAMES+=("$_LVM_NAME")
|
_LVM_NAMES+=("$_LVM_NAME")
|
||||||
read -r -p "Enter $iª partition size [like 25G, 200M]: " _LVM_SIZE
|
read -r -p "Enter $i partition size [like 25G, 200M]: " _LVM_SIZE
|
||||||
_LVM_SIZES+=("$_LVM_SIZE")
|
_LVM_SIZES+=("$_LVM_SIZE")
|
||||||
i=$((i + 1))
|
i=$((i + 1))
|
||||||
done
|
done
|
||||||
|
|
@ -314,8 +323,11 @@ set_timezone() {
|
||||||
_TIMEZONE="$(curl --fail https://ipapi.co/timezone)"
|
_TIMEZONE="$(curl --fail https://ipapi.co/timezone)"
|
||||||
_ZONE=($(timedatectl list-timezones | sed 's/\/.*$//' | uniq))
|
_ZONE=($(timedatectl list-timezones | sed 's/\/.*$//' | uniq))
|
||||||
echo -ne "System detected your timezone to be '$_TIMEZONE'"
|
echo -ne "System detected your timezone to be '$_TIMEZONE'"
|
||||||
echo -ne "\n"
|
echo " "
|
||||||
read -r -p "Is this correct? [yes/no]: " ANSWER
|
read -r -p "Is this correct? [like yes/no, default is yes]: " ANSWER
|
||||||
|
if [[ -z "$ANSWER" ]]; then
|
||||||
|
ANSWER="yes"
|
||||||
|
fi
|
||||||
case "$ANSWER" in
|
case "$ANSWER" in
|
||||||
y | Y | yes | Yes | YES)
|
y | Y | yes | Yes | YES)
|
||||||
set_option TIMEZONE "$_TIMEZONE"
|
set_option TIMEZONE "$_TIMEZONE"
|
||||||
|
|
@ -364,7 +376,7 @@ set_keymap() {
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
invalid_option
|
invalid_option
|
||||||
set_keymap
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
@ -372,7 +384,10 @@ set_keymap() {
|
||||||
# Confirm if ssd is present
|
# Confirm if ssd is present
|
||||||
ssd_drive() {
|
ssd_drive() {
|
||||||
title "SSD Drive Confirmation"
|
title "SSD Drive Confirmation"
|
||||||
read -r -p "Is this system using an SSD? [yes/no]: " _SSD
|
read -r -p "Is this system using an SSD? [like yes/no, default is no]: " _SSD
|
||||||
|
if [[ -z "$_SSD" ]]; then
|
||||||
|
_SSD="no"
|
||||||
|
fi
|
||||||
case "$_SSD" in
|
case "$_SSD" in
|
||||||
y | Y | yes | Yes | YES)
|
y | Y | yes | Yes | YES)
|
||||||
set_option "SSD" 1
|
set_option "SSD" 1
|
||||||
|
|
@ -410,10 +425,16 @@ disk_selection() {
|
||||||
|
|
||||||
user_info() {
|
user_info() {
|
||||||
title "Add Your Information"
|
title "Add Your Information"
|
||||||
read -r -p "Please enter your username: " USERNAME
|
read -r -p "Please enter your username [default is archtitus]: " USERNAME
|
||||||
|
if [[ -z "$USERNAME" ]]; then
|
||||||
|
USERNAME="archtitus"
|
||||||
|
fi
|
||||||
set_option "USERNAME" "${USERNAME,,}" # convert to lower case as in issue #109
|
set_option "USERNAME" "${USERNAME,,}" # convert to lower case as in issue #109
|
||||||
set_password "PASSWORD"
|
set_password "PASSWORD"
|
||||||
read -r -p "Please enter your hostname: " HOSTNAME
|
read -r -p "Please enter your hostname [default is ArchLinux]: " HOSTNAME
|
||||||
|
if [[ -z "$HOSTNAME" ]]; then
|
||||||
|
HOSTNAME="ArchLinux"
|
||||||
|
fi
|
||||||
set_option "HOSTNAME" "$HOSTNAME"
|
set_option "HOSTNAME" "$HOSTNAME"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -512,9 +533,9 @@ make_choice() {
|
||||||
PS3="$PROMPT"
|
PS3="$PROMPT"
|
||||||
|
|
||||||
echo "Default installation comprises of the settings and the packages used"
|
echo "Default installation comprises of the settings and the packages used"
|
||||||
echo "by Chris Titus himself. More specifically, it uses 3 partitions, GPT"
|
echo "by Chris Titus himself. More specifically, it uses btrfs as file systems,"
|
||||||
echo "btrfs as file systems, KDE Plasma as desktop environment and sddm as "
|
echo "KDE Plasma as desktop environment and sddm as window manager and package"
|
||||||
echo "window manager and package list is in 'pkg-files/pacman-pkgs.txt'."
|
echo "list is in 'pkg-files/pacman-pkgs.txt'."
|
||||||
echo "While custom install allows you to choose your choices i.e. LVM, LUKS,"
|
echo "While custom install allows you to choose your choices i.e. LVM, LUKS,"
|
||||||
echo "DE, WM, file systems and etc."
|
echo "DE, WM, file systems and etc."
|
||||||
echo " "
|
echo " "
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue