new
This commit is contained in:
parent
a742eeab25
commit
bad76f2c36
11
etc/base
11
etc/base
|
@ -39,16 +39,15 @@ tmpfs /tmp tmpfs defaults,nosuid,nodev 0 0
|
||||||
/dev/mapper/vg_${TARGETNAME_UNDERSCORE}-root /var/lib/backup/quelle/rootfs btrfs defaults 0 0
|
/dev/mapper/vg_${TARGETNAME_UNDERSCORE}-root /var/lib/backup/quelle/rootfs btrfs defaults 0 0
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
||||||
if [ "$EFI" == "1" ]; then
|
if [ "$EFI" == "1" ]; then
|
||||||
uuid=$(blkid -o value -s UUID ${TARGET_PHY_ID}-part1)
|
uuid=$(blkid -o value -s UUID ${TARGET_PHY_ID}-part1)
|
||||||
echo "UUID=${uuid} /boot/efi vfat defaults 0 0" >> /etc/fstab
|
echo "UUID=${uuid} /boot/efi vfat defaults 0 0" >> /etc/fstab
|
||||||
echo "efivarfs /sys/firmware/efi/efivars efivarfs defaults,nosuid,nodev,noexec 0 0" >> /etc/fstab
|
echo "efivarfs /sys/firmware/efi/efivars efivarfs defaults,nosuid,nodev,noexec 0 0" >> /etc/fstab
|
||||||
else
|
fi
|
||||||
if [ "${ENCRYPTION_STYLE}" == "e" ]; then
|
|
||||||
uuid=$(blkid -o value -s UUID ${TARGET_PHY_ID}-part1)
|
if [ "${ENCRYPTION_STYLE}" == "e" ]; then
|
||||||
echo "UUID=${uuid} /boot btrfs defaults,subvol=bootfs 0 0" >> /etc/fstab
|
uuid=$(blkid -o value -s UUID "${BOOTDEV}")
|
||||||
fi
|
echo "UUID=${uuid} /boot btrfs defaults,subvol=bootfs 0 0" >> /etc/fstab
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$ENCRYPTION_STYLE" == "a" ] || [ "$ENCRYPTION_STYLE" == "d" ]; then
|
if [ "$ENCRYPTION_STYLE" == "a" ] || [ "$ENCRYPTION_STYLE" == "d" ]; then
|
||||||
|
|
36
main.sh
36
main.sh
|
@ -105,29 +105,43 @@ hibernation() {
|
||||||
do_partition() {
|
do_partition() {
|
||||||
header "do partition"
|
header "do partition"
|
||||||
start=1
|
start=1
|
||||||
|
end=1
|
||||||
TARGET_PART="1"
|
TARGET_PART="1"
|
||||||
if [ "$EFI" == "1" ]; then
|
if [ "$EFI" == "1" ]; then
|
||||||
parted "${TARGET_PHY_ID}" -s -- mklabel gpt
|
parted "${TARGET_PHY_ID}" -s -- mklabel gpt
|
||||||
sleep 2
|
sleep 2
|
||||||
size=512
|
size=512
|
||||||
parted "${TARGET_PHY_ID}" unit mib -s -- mkpart EFI fat32 "$start" "$(( start + size ))"
|
end=$(( start + size ))
|
||||||
|
parted "${TARGET_PHY_ID}" unit mib -s -- mkpart EFI fat32 "$start" "$end"
|
||||||
parted "${TARGET_PHY_ID}" unit mib -s -- set 1 esp on
|
parted "${TARGET_PHY_ID}" unit mib -s -- set 1 esp on
|
||||||
sleep 2
|
|
||||||
start="$(( start + size ))"
|
|
||||||
parted "${TARGET_PHY_ID}" unit mib -s -- mkpart root ext4 "$start" 100%
|
|
||||||
mkfs.vfat -I -F32 "${TARGET_PHY_ID}-part1"
|
|
||||||
TARGET_PART="2"
|
TARGET_PART="2"
|
||||||
dd if=/dev/random of="${TARGET_PHY_ID}-part2" bs=512 count=4
|
start="$(( end + 1 ))"
|
||||||
|
sleep 2
|
||||||
|
mkfs.vfat -I -F32 "${TARGET_PHY_ID}-part1"
|
||||||
|
if [ "${ENCRYPTION_STYLE}" == "e" ]; then
|
||||||
|
size=2048
|
||||||
|
end=$(( start + size ))
|
||||||
|
parted "${TARGET_PHY_ID}" unit mib -s -- mkpart boot ext4 "$start" "${end}"
|
||||||
|
TARGET_PART="3"
|
||||||
|
start="$(( end + 1 ))"
|
||||||
|
BOOTDEV="${TARGET_PHY_ID}-part2"
|
||||||
|
sleep 2
|
||||||
|
mkfs.btrfs -q -f "${TARGET_PHY_ID}-part2"
|
||||||
|
fi
|
||||||
|
parted "${TARGET_PHY_ID}" unit mib -s -- mkpart root ext4 "$start" 100%
|
||||||
|
dd if=/dev/random of="${TARGET_PHY_ID}-part${TARGET_PART}" bs=512 count=4
|
||||||
else
|
else
|
||||||
parted "${TARGET_PHY_ID}" -s -- mklabel msdos
|
parted "${TARGET_PHY_ID}" -s -- mklabel msdos
|
||||||
sleep 2
|
sleep 2
|
||||||
if [ "${ENCRYPTION_STYLE}" == "e" ]; then
|
if [ "${ENCRYPTION_STYLE}" == "e" ]; then
|
||||||
size=2048
|
size=2048
|
||||||
parted "${TARGET_PHY_ID}" unit mib -s -- mkpart primary ext4 "${start}" "$(( start + size ))"
|
end=$(( start + size ))
|
||||||
|
parted "${TARGET_PHY_ID}" unit mib -s -- mkpart primary ext4 "${start}" "${end}"
|
||||||
|
start="$(( end + 1 ))"
|
||||||
|
TARGET_PART="2"
|
||||||
|
BOOTDEV="${TARGET_PHY_ID}-part1"
|
||||||
sleep 2
|
sleep 2
|
||||||
mkfs.btrfs -q -f "${TARGET_PHY_ID}-part1"
|
mkfs.btrfs -q -f "${TARGET_PHY_ID}-part1"
|
||||||
start="$(( start + size + start ))"
|
|
||||||
TARGET_PART="2"
|
|
||||||
fi
|
fi
|
||||||
parted "${TARGET_PHY_ID}" unit mib -s -- mkpart primary ext4 "$start" -1s
|
parted "${TARGET_PHY_ID}" unit mib -s -- mkpart primary ext4 "$start" -1s
|
||||||
dd if=/dev/random of="${TARGET_PHY_ID}-part${TARGET_PART}" bs=512 count=4
|
dd if=/dev/random of="${TARGET_PHY_ID}-part${TARGET_PART}" bs=512 count=4
|
||||||
|
@ -156,6 +170,7 @@ do_partition() {
|
||||||
for i in boot home dev proc sys tmp etc var/lib/backup/quelle/rootfs var/lib/backup/ziel var/db; do
|
for i in boot home dev proc sys tmp etc var/lib/backup/quelle/rootfs var/lib/backup/ziel var/db; do
|
||||||
mkdir -p "${target}/${i}"
|
mkdir -p "${target}/${i}"
|
||||||
done
|
done
|
||||||
|
|
||||||
mount "/dev/mapper/vg_${TARGETNAME_UNDERSCORE}-root" "${target}/home" -o subvol=homefs
|
mount "/dev/mapper/vg_${TARGETNAME_UNDERSCORE}-root" "${target}/home" -o subvol=homefs
|
||||||
if [ "${EFI}" == "1" ]; then
|
if [ "${EFI}" == "1" ]; then
|
||||||
mkdir -p "${target}/boot/efi"
|
mkdir -p "${target}/boot/efi"
|
||||||
|
@ -163,7 +178,7 @@ do_partition() {
|
||||||
else
|
else
|
||||||
if [ "${ENCRYPTION_STYLE}" == "e" ]; then
|
if [ "${ENCRYPTION_STYLE}" == "e" ]; then
|
||||||
mkdir -p "${target}/boot" "${target}/var/lib/backup/quelle/bootfs"
|
mkdir -p "${target}/boot" "${target}/var/lib/backup/quelle/bootfs"
|
||||||
mount "${TARGET_PHY_ID}-part1" "${target}/boot"
|
mount "${BOOTDEV}" "${target}/boot"
|
||||||
mkdir -p "${target}/boot/system/snapshots/update" "${target}/boot/system/snapshots/regular" "${target}/boot/system/backup"
|
mkdir -p "${target}/boot/system/snapshots/update" "${target}/boot/system/snapshots/regular" "${target}/boot/system/backup"
|
||||||
btrfs subvol create "${target}/boot/bootfs"
|
btrfs subvol create "${target}/boot/bootfs"
|
||||||
umount "${target}/boot"
|
umount "${target}/boot"
|
||||||
|
@ -313,6 +328,7 @@ do_chroot() {
|
||||||
echo "ENC=${ENC}" >> "${vars}"
|
echo "ENC=${ENC}" >> "${vars}"
|
||||||
echo "HIBERNATE=${HIBERNATE}" >> "${vars}"
|
echo "HIBERNATE=${HIBERNATE}" >> "${vars}"
|
||||||
echo "DEBUG=${DEBUG}" >> "${vars}"
|
echo "DEBUG=${DEBUG}" >> "${vars}"
|
||||||
|
echo "BOOTDEV=${BOOTDEV}" >> "${vars}"
|
||||||
|
|
||||||
cat <<EOF > "${target}/tmp/vinstaller/main_chroot"
|
cat <<EOF > "${target}/tmp/vinstaller/main_chroot"
|
||||||
#!/usr/bin/bash
|
#!/usr/bin/bash
|
||||||
|
|
Loading…
Reference in New Issue
Block a user