fixes
This commit is contained in:
parent
b65d990cab
commit
eacb41b31b
134
step2/10-disk
134
step2/10-disk
|
@ -1,5 +1,131 @@
|
|||
if test -d /sys/firmware/efi; then
|
||||
source "${dir}/step2/disk/uefi"
|
||||
else
|
||||
source "${dir}/step2/disk/bios"
|
||||
if ! yesno "nun gehts los, sicher?" y; then
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
|
||||
diskid="${cfg[diskid]//-/_}"
|
||||
index=1
|
||||
|
||||
echo "Formatting disk"
|
||||
if test -d /sys/firmware/efi; then
|
||||
module start "disk" "Partition disk . UEFI"
|
||||
echo "g
|
||||
n
|
||||
1
|
||||
|
||||
+1G
|
||||
t
|
||||
1
|
||||
w
|
||||
q" | fdisk "${cfg[diskname]}" > /dev/null
|
||||
efipart="${cfg[diskname]}${index}"
|
||||
index=$(( index + 1 ))
|
||||
else
|
||||
module start "disk" "Partition disk . BIOS"
|
||||
echo "o
|
||||
w
|
||||
q" | fdisk -w always "${cfg[diskname]}" > /dev/null
|
||||
fi
|
||||
sleep 2
|
||||
|
||||
|
||||
echo "create bootpartition"
|
||||
target_boot="${cfg[diskname]}${index}"
|
||||
index=$(( index + 1 ))
|
||||
echo "n
|
||||
p
|
||||
1
|
||||
|
||||
+${cfg[bootsize]}G
|
||||
a
|
||||
w
|
||||
q" | fdisk "${cfg[diskname]}" > /dev/null
|
||||
sleep 2
|
||||
|
||||
if [[ "${cfg[rootfssize]}" == "rest" ]]; then
|
||||
target_partition_tmp="${cfg[diskname]}${index}"
|
||||
index=$(( index + 1 ))
|
||||
echo "create rootfs"
|
||||
echo "n
|
||||
p
|
||||
2
|
||||
|
||||
|
||||
w
|
||||
q" | fdisk "${cfg[diskname]}" > /dev/null
|
||||
elif [[ ! "${cfg[rootfssize]}" == "rest" ]]; then
|
||||
target_partition_tmp="${cfg[diskname]}${index}"
|
||||
echo "create rootfs with a specific size"
|
||||
echo "n
|
||||
p
|
||||
2
|
||||
|
||||
+${rootfssize}G
|
||||
w
|
||||
q" | fdisk "${cfg[diskname]}" > /dev/null
|
||||
fi
|
||||
sleep 2
|
||||
|
||||
target_partition="${target_partition_tmp}"
|
||||
if [[ ! "${cfg[fde_key_store]}" == "none" ]]; then
|
||||
echo -n "${cfg[diskpw]}" | cryptsetup luksFormat --type luks1 "${target_partition}" -d -
|
||||
sleep 2
|
||||
echo -n "${cfg[diskpw]}" | cryptsetup luksOpen "${target_partition}" "voidluks-${diskid}" -d -
|
||||
sleep 2
|
||||
#echo -n "oem" | cryptsetup luksFormat --type luks1 "${target_partition}" -d -
|
||||
#echo -n "oem" | cryptsetup luksOpen "${target_partition}" "voidluks-${diskid}" -d -
|
||||
target_partition="/dev/mapper/voidluks-${diskid}"
|
||||
fi
|
||||
|
||||
mkswap "${target_partition}"
|
||||
sleep 2
|
||||
vgcreate -q -f "voidvg.${diskid}" "${target_partition}" || exit 1
|
||||
sleep 2
|
||||
lvcreate -q -y --name swap -L "${cfg[swapsize]}"G "voidvg.${diskid}"
|
||||
sleep 2
|
||||
lvcreate -q -y --name root -l 100%FREE "voidvg.${diskid}"
|
||||
sleep 2
|
||||
mkfs.btrfs -q -f "/dev/mapper/voidvg.${diskid}-root"
|
||||
|
||||
mkswap "/dev/mapper/voidvg.${diskid}-swap"
|
||||
|
||||
mount "/dev/mapper/voidvg.${diskid}-root" "${dest}"
|
||||
btrfs subvol create "${dest}/rootfs"
|
||||
btrfs subvol create "${dest}/homefs"
|
||||
mkdir -p "${dest}/system/snapshots/update" "${dest}/system/snapshots/regular" "${dest}/system/backup"
|
||||
umount "${dest}"
|
||||
|
||||
mount "/dev/mapper/voidvg.${diskid}-root" "${dest}" -o subvol=rootfs
|
||||
for i in boot home dev proc sys tmp etc var/lib/backup/quelle/rootfs var/lib/backup/ziel var/db; do mkdir -p "${dest}/${i}"; done
|
||||
|
||||
mount "/dev/mapper/voidvg.${diskid}-root" "${dest}"/home -o subvol=homefs
|
||||
mkdir -p "${dest}/var/lib/backup/quelle/bootfs"
|
||||
|
||||
mkfs.btrfs -q -f "${target_boot}"
|
||||
mount "${target_boot}" "${dest}/boot"
|
||||
btrfs subvol create "${dest}/boot/bootfs"
|
||||
mkdir -p "${dest}/boot/system/snapshots/update" "${dest}/boot/system/snapshots/regular" "${dest}/boot/system/backup"
|
||||
umount "${dest}/boot"
|
||||
|
||||
if [[ "${cfg[fde_key_store]}" == "once" ]]; then
|
||||
mount "${target_boot}" "${dest}/boot" -o subvol=bootfs
|
||||
fi
|
||||
|
||||
if test -d /sys/firmware/efi; then
|
||||
mkdir -p "${dest}/boot/efi"
|
||||
mkfs.vfat -F32 "${efipart}"
|
||||
mount "${efipart}" "${dest}/boot/efi"
|
||||
fi
|
||||
|
||||
for dir in dev proc sys run; do mkdir -p "${dest}"/$dir ; mount --rbind /$dir "${dest}"/$dir ; mount --make-rslave "${dest}"/$dir ; done
|
||||
|
||||
setconf add rootuuid "$(blkid -o value -s UUID ${target_partition})"
|
||||
setconf add partuuid "$(blkid -o value -s UUID ${cfg[diskname]}${cfg[target_part]})"
|
||||
[[ "${cfg[fde_key_store]}" == "once" ]] && setconf "add" "bootuuid" "$(blkid -o value -s UUID ${target_boot})"
|
||||
setconf add swapuuid "$(blkid -o value -s UUID /dev/mapper/voidvg.${diskid}-swap)"
|
||||
|
||||
|
||||
mount -t tmpfs -o size=512m tmpfs "${dest}"/tmp
|
||||
|
||||
module end
|
||||
|
|
|
@ -2,19 +2,37 @@ if ! yesno "nun gehts los, sicher?" y; then
|
|||
exit
|
||||
fi
|
||||
|
||||
module start "disk" "Partition disk . BIOS"
|
||||
|
||||
|
||||
diskid="${cfg[diskid]//-/_}"
|
||||
if [[ -n "${cfg[wipe]}" ]]; then
|
||||
echo "Formatting disk"
|
||||
index=1
|
||||
|
||||
echo "Formatting disk"
|
||||
if test -d /sys/firmware/efi; then
|
||||
module start "disk" "Partition disk . UEFI"
|
||||
echo "g
|
||||
n
|
||||
1
|
||||
|
||||
+1G
|
||||
t
|
||||
1
|
||||
w
|
||||
q" | fdisk "${cfg[diskname]}" > /dev/null
|
||||
efipart="${cfg[diskname]}${index}"
|
||||
index=$(( index + 1 ))
|
||||
else
|
||||
module start "disk" "Partition disk . BIOS"
|
||||
echo "o
|
||||
w
|
||||
q" | fdisk -w always "${cfg[diskname]}" > /dev/null
|
||||
fi
|
||||
sleep 2
|
||||
|
||||
|
||||
echo "create bootpartition"
|
||||
target_boot="${cfg[diskname]}1"
|
||||
target_boot="${cfg[diskname]}${index}"
|
||||
index=$(( index + 1 ))
|
||||
echo "n
|
||||
p
|
||||
1
|
||||
|
@ -26,7 +44,8 @@ q" | fdisk "${cfg[diskname]}" > /dev/null
|
|||
sleep 2
|
||||
|
||||
if [[ "${cfg[rootfssize]}" == "rest" ]]; then
|
||||
target_partition_tmp="${cfg[diskname]}2"
|
||||
target_partition_tmp="${cfg[diskname]}${index}"
|
||||
index=$(( index + 1 ))
|
||||
echo "create rootfs"
|
||||
echo "n
|
||||
p
|
||||
|
@ -36,7 +55,7 @@ if [[ "${cfg[rootfssize]}" == "rest" ]]; then
|
|||
w
|
||||
q" | fdisk "${cfg[diskname]}" > /dev/null
|
||||
elif [[ ! "${cfg[rootfssize]}" == "rest" ]]; then
|
||||
target_partition_tmp="${cfg[diskname]}2"
|
||||
target_partition_tmp="${cfg[diskname]}${index}"
|
||||
echo "create rootfs with a specific size"
|
||||
echo "n
|
||||
p
|
||||
|
@ -93,6 +112,12 @@ if [[ "${cfg[fde_key_store]}" == "once" ]]; then
|
|||
mount "${target_boot}" "${dest}/boot" -o subvol=bootfs
|
||||
fi
|
||||
|
||||
if test -d /sys/firmware/efi; then
|
||||
mkdir -p "${dest}/boot/efi"
|
||||
mkfs.vfat -F32 "${efipart}"
|
||||
mount "${efipart}" "${dest}/boot/efi"
|
||||
fi
|
||||
|
||||
for dir in dev proc sys run; do mkdir -p "${dest}"/$dir ; mount --rbind /$dir "${dest}"/$dir ; mount --make-rslave "${dest}"/$dir ; done
|
||||
|
||||
setconf add rootuuid "$(blkid -o value -s UUID ${target_partition})"
|
||||
|
|
|
@ -5,22 +5,25 @@ fi
|
|||
module start "disk" "Partition disk . UEFI"
|
||||
|
||||
diskid="${cfg[diskid]//-/_}"
|
||||
if [[ -n "${cfg[wipe]}" ]]; then
|
||||
echo "Formatting disk"
|
||||
echo "g
|
||||
n
|
||||
1
|
||||
index=1
|
||||
|
||||
+1G
|
||||
t
|
||||
1
|
||||
w
|
||||
q" | fdisk "${cfg[diskname]}" > /dev/null
|
||||
fi
|
||||
efipart="${cfg[diskname]}1"
|
||||
echo "Formatting disk"
|
||||
echo "g
|
||||
n
|
||||
1
|
||||
|
||||
+1G
|
||||
t
|
||||
1
|
||||
w
|
||||
q" | fdisk "${cfg[diskname]}" > /dev/null
|
||||
efipart="${cfg[diskname]}${index}"
|
||||
index=$(( index + 1 ))
|
||||
sleep 2
|
||||
|
||||
echo "create bootpartition"
|
||||
target_boot="${cfg[diskname]}2"
|
||||
target_boot="${cfg[diskname]}${index}"
|
||||
index=$(( index + 1 ))
|
||||
echo "n
|
||||
2
|
||||
|
||||
|
@ -30,7 +33,7 @@ q" | fdisk "${cfg[diskname]}" > /dev/null
|
|||
sleep 2
|
||||
|
||||
if [[ "${cfg[rootfssize]}" == "rest" ]]; then
|
||||
target_partition_tmp="${cfg[diskname]}3"
|
||||
target_partition_tmp="${cfg[diskname]}${index}"
|
||||
echo "create rootfs"
|
||||
echo "n
|
||||
3
|
||||
|
@ -39,7 +42,7 @@ if [[ "${cfg[rootfssize]}" == "rest" ]]; then
|
|||
w
|
||||
q" | fdisk "${cfg[diskname]}" > /dev/null
|
||||
elif [[ ! "${cfg[rootfssize]}" == "rest" ]]; then
|
||||
target_partition_tmp="${cfg[diskname]}3"
|
||||
target_partition_tmp="${cfg[diskname]}${index}"
|
||||
echo "create rootfs with a specific size"
|
||||
echo "n
|
||||
p
|
||||
|
|
Loading…
Reference in New Issue