mirror of
https://github.com/suikan4github/kaiten-yaki.git
synced 2025-12-20 02:21:17 -03:00
Add appropriate indent to the heredocument of chroot
This commit is contained in:
parent
73f346f275
commit
1c707ff903
2 changed files with 53 additions and 53 deletions
|
|
@ -116,38 +116,38 @@ function post_install_local() {
|
||||||
echo "...Chroot to ${TARGETMOUNTPOINT}."
|
echo "...Chroot to ${TARGETMOUNTPOINT}."
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
cat <<- HEREDOC | chroot ${TARGETMOUNTPOINT} /bin/bash
|
cat <<- HEREDOC | chroot ${TARGETMOUNTPOINT} /bin/bash
|
||||||
# Mount the rest of partitions by target /etc/fstab
|
# Mount the rest of partitions by target /etc/fstab
|
||||||
mount -a
|
mount -a
|
||||||
|
|
||||||
# Set up the kernel hook of encryption
|
# Set up the kernel hook of encryption
|
||||||
echo "...Installing cryptsetup-initramfs package."
|
echo "...Installing cryptsetup-initramfs package."
|
||||||
apt -qq install -y cryptsetup-initramfs
|
apt -qq install -y cryptsetup-initramfs
|
||||||
|
|
||||||
# Prepare a key file to embed in to the ramfs.
|
# Prepare a key file to embed in to the ramfs.
|
||||||
echo "...Prepairing key file."
|
echo "...Prepairing key file."
|
||||||
mkdir /etc/luks
|
mkdir /etc/luks
|
||||||
dd if=/dev/urandom of=/etc/luks/boot_os.keyfile bs=4096 count=1 status=none
|
dd if=/dev/urandom of=/etc/luks/boot_os.keyfile bs=4096 count=1 status=none
|
||||||
chmod u=rx,go-rwx /etc/luks
|
chmod u=rx,go-rwx /etc/luks
|
||||||
chmod u=r,go-rwx /etc/luks/boot_os.keyfile
|
chmod u=r,go-rwx /etc/luks/boot_os.keyfile
|
||||||
|
|
||||||
# Add a key to the key file. Use the passphrase in the environment variable.
|
# Add a key to the key file. Use the passphrase in the environment variable.
|
||||||
echo "...Adding a key to the key file."
|
echo "...Adding a key to the key file."
|
||||||
printf %s "${PASSPHRASE}" | cryptsetup luksAddKey -d - "${DEV}${CRYPTPARTITION}" /etc/luks/boot_os.keyfile
|
printf %s "${PASSPHRASE}" | cryptsetup luksAddKey -d - "${DEV}${CRYPTPARTITION}" /etc/luks/boot_os.keyfile
|
||||||
|
|
||||||
# Add the LUKS volume information to /etc/crypttab to decrypt by kernel.
|
# Add the LUKS volume information to /etc/crypttab to decrypt by kernel.
|
||||||
echo "...Adding LUKS volume info to /etc/crypttab."
|
echo "...Adding LUKS volume info to /etc/crypttab."
|
||||||
echo "${CRYPTPARTNAME} UUID=$(blkid -s UUID -o value ${DEV}${CRYPTPARTITION}) /etc/luks/boot_os.keyfile luks,discard" >> /etc/crypttab
|
echo "${CRYPTPARTNAME} UUID=$(blkid -s UUID -o value ${DEV}${CRYPTPARTITION}) /etc/luks/boot_os.keyfile luks,discard" >> /etc/crypttab
|
||||||
|
|
||||||
# Putting key file into the ramfs initial image
|
# Putting key file into the ramfs initial image
|
||||||
echo "...Registering key file to the ramfs"
|
echo "...Registering key file to the ramfs"
|
||||||
echo "KEYFILE_PATTERN=/etc/luks/*.keyfile" >> /etc/cryptsetup-initramfs/conf-hook
|
echo "KEYFILE_PATTERN=/etc/luks/*.keyfile" >> /etc/cryptsetup-initramfs/conf-hook
|
||||||
echo "UMASK=0077" >> /etc/initramfs-tools/initramfs.conf
|
echo "UMASK=0077" >> /etc/initramfs-tools/initramfs.conf
|
||||||
|
|
||||||
# Finally, update the ramfs initial image with the key file.
|
# Finally, update the ramfs initial image with the key file.
|
||||||
echo "...Upadting initramfs."
|
echo "...Upadting initramfs."
|
||||||
update-initramfs -uk all
|
update-initramfs -uk all
|
||||||
|
|
||||||
# Leave chroot
|
# Leave chroot
|
||||||
HEREDOC
|
HEREDOC
|
||||||
|
|
||||||
# Unmount all
|
# Unmount all
|
||||||
|
|
|
||||||
|
|
@ -140,41 +140,41 @@ function post_install_local() {
|
||||||
echo "...Chroot to ${TARGETMOUNTPOINT}."
|
echo "...Chroot to ${TARGETMOUNTPOINT}."
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
cat <<- HEREDOC | chroot ${TARGETMOUNTPOINT} /bin/bash
|
cat <<- HEREDOC | chroot ${TARGETMOUNTPOINT} /bin/bash
|
||||||
# Mount the rest of partitions by target /etc/fstab
|
# Mount the rest of partitions by target /etc/fstab
|
||||||
mount -a
|
mount -a
|
||||||
|
|
||||||
# Set up the kernel hook of encryption
|
# Set up the kernel hook of encryption
|
||||||
echo "...Installing cryptsetup-initramfs package."
|
echo "...Installing cryptsetup-initramfs package."
|
||||||
xbps-install -y lvm2 cryptsetup
|
xbps-install -y lvm2 cryptsetup
|
||||||
|
|
||||||
# Prepare a key file to embed in to the ramfs.
|
# Prepare a key file to embed in to the ramfs.
|
||||||
echo "...Prepairing key file."
|
echo "...Prepairing key file."
|
||||||
mkdir /etc/luks
|
mkdir /etc/luks
|
||||||
dd if=/dev/urandom of=/etc/luks/boot_os.keyfile bs=4096 count=1 status=none
|
dd if=/dev/urandom of=/etc/luks/boot_os.keyfile bs=4096 count=1 status=none
|
||||||
chmod u=rx,go-rwx /etc/luks
|
chmod u=rx,go-rwx /etc/luks
|
||||||
chmod u=r,go-rwx /etc/luks/boot_os.keyfile
|
chmod u=r,go-rwx /etc/luks/boot_os.keyfile
|
||||||
|
|
||||||
# Add a key to the key file. Use the passphrase in the environment variable.
|
# Add a key to the key file. Use the passphrase in the environment variable.
|
||||||
echo "...Adding a key to the key file."
|
echo "...Adding a key to the key file."
|
||||||
printf %s "${PASSPHRASE}" | cryptsetup luksAddKey -d - "${DEV}${CRYPTPARTITION}" /etc/luks/boot_os.keyfile
|
printf %s "${PASSPHRASE}" | cryptsetup luksAddKey -d - "${DEV}${CRYPTPARTITION}" /etc/luks/boot_os.keyfile
|
||||||
|
|
||||||
# Add the LUKS volume information to /etc/crypttab to decrypt by kernel.
|
# Add the LUKS volume information to /etc/crypttab to decrypt by kernel.
|
||||||
echo "...Adding LUKS volume info to /etc/crypttab."
|
echo "...Adding LUKS volume info to /etc/crypttab."
|
||||||
echo "${CRYPTPARTNAME} UUID=$(blkid -s UUID -o value ${DEV}${CRYPTPARTITION}) /etc/luks/boot_os.keyfile luks,discard" >> /etc/crypttab
|
echo "${CRYPTPARTNAME} UUID=$(blkid -s UUID -o value ${DEV}${CRYPTPARTITION}) /etc/luks/boot_os.keyfile luks,discard" >> /etc/crypttab
|
||||||
|
|
||||||
# Putting key file into the ramfs initial image
|
# Putting key file into the ramfs initial image
|
||||||
echo "...Registering key file to the ramfs"
|
echo "...Registering key file to the ramfs"
|
||||||
echo 'install_items+=" /etc/luks/boot_os.keyfile /etc/crypttab " ' > /etc/dracut.conf.d/10-crypt.conf
|
echo 'install_items+=" /etc/luks/boot_os.keyfile /etc/crypttab " ' > /etc/dracut.conf.d/10-crypt.conf
|
||||||
|
|
||||||
# Finally, update the ramfs initial image with the key file.
|
# Finally, update the ramfs initial image with the key file.
|
||||||
echo "...Upadting initramfs."
|
echo "...Upadting initramfs."
|
||||||
xbps-reconfigure -fa
|
xbps-reconfigure -fa
|
||||||
echo "...grub-mkconfig."
|
echo "...grub-mkconfig."
|
||||||
grub-mkconfig -o /boot/grub/grub.cfg
|
grub-mkconfig -o /boot/grub/grub.cfg
|
||||||
echo "...update-grub."
|
echo "...update-grub."
|
||||||
update-grub
|
update-grub
|
||||||
|
|
||||||
# Leave chroot
|
# Leave chroot
|
||||||
HEREDOC
|
HEREDOC
|
||||||
|
|
||||||
# Unmount all
|
# Unmount all
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue