mirror of
https://github.com/suikan4github/kaiten-yaki.git
synced 2025-12-20 02:21:17 -03:00
Add "[Kaiten-Yaki]" to the message header
This commit is contained in:
parent
555bf5a38e
commit
73b3329cd7
6 changed files with 106 additions and 106 deletions
|
|
@ -6,7 +6,7 @@ function chrooted_job() {
|
|||
mount -a
|
||||
|
||||
# Prepare the crypto tool in the install target
|
||||
echo "...Installing cryptsetup-initramfs package."
|
||||
echo "[Kaiten-Yaki] Installing cryptsetup-initramfs package."
|
||||
apt -qq install -y cryptsetup-initramfs
|
||||
|
||||
# Prepare a new key file to embed in to the ramfs.
|
||||
|
|
@ -14,28 +14,28 @@ function chrooted_job() {
|
|||
# The new key is 4096byte length binary value.
|
||||
# Because this key is sotred as "cleartext", in the target file sysmte,
|
||||
# only root is allowed to access this key file.
|
||||
echo "...Prepairing key file."
|
||||
echo "[Kaiten-Yaki] Prepairing key file."
|
||||
mkdir /etc/luks
|
||||
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=r,go-rwx /etc/luks/boot_os.keyfile
|
||||
|
||||
# Add the new key to the LUKS 2nd key slot. The passphrase is required to modify the LUKS keyslot.
|
||||
echo "...Adding a key to the key file."
|
||||
echo "[Kaiten-Yaki] Adding a key to the key file."
|
||||
printf %s "${PASSPHRASE}" | cryptsetup luksAddKey --iter-time "${ITERTIME}" -d - "${DEV}${CRYPTPARTITION}" /etc/luks/boot_os.keyfile
|
||||
|
||||
# Register the LUKS voluem to /etc/crypttab to tell "This volume is encrypted"
|
||||
echo "...Adding LUKS volume info to /etc/crypttab."
|
||||
echo "[Kaiten-Yaki] 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
|
||||
|
||||
# Add key file to the list of the intems in initramfs.
|
||||
# See https://cryptsetup-team.pages.debian.net/cryptsetup/README.initramfs.html for detail
|
||||
echo "...Directing to include keyfile into the initramfs"
|
||||
echo "[Kaiten-Yaki] Directing to include keyfile into the initramfs"
|
||||
echo "KEYFILE_PATTERN=/etc/luks/*.keyfile" >> /etc/cryptsetup-initramfs/conf-hook
|
||||
echo "UMASK=0077" >> /etc/initramfs-tools/initramfs.conf
|
||||
|
||||
# Finally, update the ramfs initial image with the key file.
|
||||
echo "...Upadting initramfs."
|
||||
echo "[Kaiten-Yaki] Upadting initramfs."
|
||||
update-initramfs -uk all
|
||||
|
||||
# Leave chroot
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ function chrooted_job() {
|
|||
mount -a
|
||||
|
||||
# Prepare the crypto tool in the install target
|
||||
echo "...Installing cryptsetup-initramfs package."
|
||||
echo "[Kaiten-Yaki] Installing cryptsetup-initramfs package."
|
||||
xbps-install -y lvm2 cryptsetup
|
||||
|
||||
# Prepare a new key file to embed in to the ramfs.
|
||||
|
|
@ -14,29 +14,29 @@ function chrooted_job() {
|
|||
# The new key is 4096byte length binary value.
|
||||
# Because this key is sotred as "cleartext", in the target file sysmte,
|
||||
# only root is allowed to access this key file.
|
||||
echo "...Prepairing key file."
|
||||
echo "[Kaiten-Yaki] Prepairing key file."
|
||||
mkdir /etc/luks
|
||||
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=r,go-rwx /etc/luks/boot_os.keyfile
|
||||
|
||||
# Add the new key to the LUKS 2nd key slot. The passphrase is required to modify the LUKS keyslot.
|
||||
echo "...Adding a key to the key file."
|
||||
echo "[Kaiten-Yaki] Adding a key to the key file."
|
||||
printf %s "${PASSPHRASE}" | cryptsetup luksAddKey --iter-time "${ITERTIME}" -d - "${DEV}${CRYPTPARTITION}" /etc/luks/boot_os.keyfile
|
||||
|
||||
# Register the LUKS voluem to /etc/crypttab to tell "This volume is encrypted"
|
||||
echo "...Adding LUKS volume info to /etc/crypttab."
|
||||
echo "[Kaiten-Yaki] 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
|
||||
|
||||
# Add key file to the list of the intems in initramfs.
|
||||
# See https://man7.org/linux/man-pages/man5/dracut.conf.5.html for details.
|
||||
echo "...Directing to include keyfile into the initramfs"
|
||||
echo "[Kaiten-Yaki] Directing to include keyfile into the initramfs"
|
||||
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.
|
||||
echo "...Upadting initramfs."
|
||||
echo "[Kaiten-Yaki] Upadting initramfs."
|
||||
xbps-reconfigure -fa
|
||||
echo "...grub-mkconfig."
|
||||
echo "[Kaiten-Yaki] grub-mkconfig."
|
||||
grub-mkconfig -o /boot/grub/grub.cfg
|
||||
|
||||
# Leave chroot
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@ function confirmation(){
|
|||
if [ "${ERASEALL}" -ne 0 ] && [ "${OVERWRITEINSTALL}" -ne 0 ] ; then
|
||||
cat <<- HEREDOC
|
||||
***** ERROR : Confliction between ERASEALL and OVERWRITEINSTALL *****
|
||||
...ERASEALL = ${ERASEALL}
|
||||
...OVERWRITEINSTALL = ${OVERWRITEINSTALL}
|
||||
...Check configuration in your config.sh
|
||||
[Kaiten-Yaki] ERASEALL = ${ERASEALL}
|
||||
[Kaiten-Yaki] OVERWRITEINSTALL = ${OVERWRITEINSTALL}
|
||||
[Kaiten-Yaki] Check configuration in your config.sh
|
||||
|
||||
...Installation process terminated..
|
||||
[Kaiten-Yaki] Installation process terminated..
|
||||
HEREDOC
|
||||
return 1 # with error status
|
||||
fi
|
||||
|
|
@ -22,10 +22,10 @@ function confirmation(){
|
|||
if echo "${VGNAME}" | grep "-" -i > /dev/null ; then # "-" is found in the volume group name.
|
||||
cat <<- HEREDOC
|
||||
***** ERROR : VGNAME is "${VGNAME}" *****
|
||||
..."-" is not allowed in the volume name.
|
||||
...Check configuration in your config.sh
|
||||
[Kaiten-Yaki] "-" is not allowed in the volume name.
|
||||
[Kaiten-Yaki] Check configuration in your config.sh
|
||||
|
||||
...Installation process terminated..
|
||||
[Kaiten-Yaki] Installation process terminated..
|
||||
HEREDOC
|
||||
return 1 # with error status
|
||||
fi # "-" is found in the volume group name.
|
||||
|
|
@ -34,10 +34,10 @@ function confirmation(){
|
|||
if echo "${LVROOTNAME}" | grep "-" -i > /dev/null ; then # "-" is found in the volume name.
|
||||
cat <<- HEREDOC
|
||||
***** ERROR : LVROOTNAME is "${LVROOTNAME}" *****
|
||||
..."-" is not allowed in the volume name.
|
||||
...Check configuration in your config.sh
|
||||
[Kaiten-Yaki] "-" is not allowed in the volume name.
|
||||
[Kaiten-Yaki] Check configuration in your config.sh
|
||||
|
||||
...Installation process terminated..
|
||||
[Kaiten-Yaki] Installation process terminated..
|
||||
HEREDOC
|
||||
return 1 # with error status
|
||||
fi # "-" is found in the volume name.
|
||||
|
|
@ -47,10 +47,10 @@ function confirmation(){
|
|||
if echo "${LVEXT1SUFFIX}" | grep "-" -i > /dev/null ; then # "-" is found in the volume name.
|
||||
cat <<- HEREDOC
|
||||
***** ERROR : LVEXT1SUFFIX is "${LVEXT1SUFFIX}" *****
|
||||
..."-" is not allowed in the volume name.
|
||||
...Check configuration in your config.sh
|
||||
[Kaiten-Yaki] "-" is not allowed in the volume name.
|
||||
[Kaiten-Yaki] Check configuration in your config.sh
|
||||
|
||||
...Installation process terminated..
|
||||
[Kaiten-Yaki] Installation process terminated..
|
||||
HEREDOC
|
||||
return 1 # with error status
|
||||
fi # "-" is found in the volume suffix.
|
||||
|
|
@ -61,10 +61,10 @@ function confirmation(){
|
|||
if echo "${LVEXT2SUFFIX}" | grep "-" -i > /dev/null ; then # "-" is found in the volume name.
|
||||
cat <<- HEREDOC
|
||||
***** ERROR : LVEXT2SUFFIX is "${LVEXT2SUFFIX}" *****
|
||||
..."-" is not allowed in the volume name.
|
||||
...Check configuration in your config.sh
|
||||
[Kaiten-Yaki] "-" is not allowed in the volume name.
|
||||
[Kaiten-Yaki] Check configuration in your config.sh
|
||||
|
||||
...Installation process terminated..
|
||||
[Kaiten-Yaki] Installation process terminated..
|
||||
HEREDOC
|
||||
return 1 # with error status
|
||||
fi # "-" is found in the volume suffix.
|
||||
|
|
@ -74,10 +74,10 @@ function confirmation(){
|
|||
if echo "${LVSWAPNAME}" | grep "-" -i > /dev/null ; then # "-" is found in the volume name.
|
||||
cat <<- HEREDOC
|
||||
***** ERROR : LVSWAPNAME is "${LVSWAPNAME}" *****
|
||||
..."-" is not allowed in the volume name.
|
||||
...Check configuration in your config.sh
|
||||
[Kaiten-Yaki] "-" is not allowed in the volume name.
|
||||
[Kaiten-Yaki] Check configuration in your config.sh
|
||||
|
||||
...Installation process terminated..
|
||||
[Kaiten-Yaki] Installation process terminated..
|
||||
HEREDOC
|
||||
return 1 # with error status
|
||||
fi # "-" is found in the volume name.
|
||||
|
|
@ -113,22 +113,22 @@ function confirmation(){
|
|||
HEREDOC
|
||||
|
||||
if [ "${ERASEALL}" -ne 0 ] ; then
|
||||
echo "Going to erase entire disk ${DEV}."
|
||||
echo "[Kaiten-Yaki] Going to erase entire disk ${DEV}."
|
||||
elif [ "${OVERWRITEINSTALL}" -ne 0 ] ; then
|
||||
echo "Going to overwrite the logical volume \"${VGNAME}-${LVROOTNAME}\"."
|
||||
echo "[Kaiten-Yaki] Going to overwrite the logical volume \"${VGNAME}-${LVROOTNAME}\"."
|
||||
else
|
||||
echo "Going to create a new logical volume \"${VGNAME}-${LVROOTNAME}\"."
|
||||
echo "[Kaiten-Yaki] Going to create a new logical volume \"${VGNAME}-${LVROOTNAME}\"."
|
||||
fi
|
||||
|
||||
|
||||
# ----- Set Passphrase -----
|
||||
# Input passphrase
|
||||
echo ""
|
||||
echo "Type passphrase for the disk encryption."
|
||||
echo "[Kaiten-Yaki] Type passphrase for the disk encryption."
|
||||
read -sr PASSPHRASE
|
||||
export PASSPHRASE
|
||||
|
||||
echo "Type passphrase again, to confirm."
|
||||
echo "[Kaiten-Yaki] Type passphrase again, to confirm."
|
||||
read -sr PASSPHRASE_C
|
||||
|
||||
# Validate whether both are indentical or not
|
||||
|
|
@ -136,7 +136,7 @@ function confirmation(){
|
|||
cat <<-HEREDOC
|
||||
***** ERROR : Passphrase doesn't match *****
|
||||
|
||||
...Installation process terminated..
|
||||
[Kaiten-Yaki] Installation process terminated..
|
||||
HEREDOC
|
||||
return 1 # with error status
|
||||
else
|
||||
|
|
@ -186,19 +186,19 @@ function pre_install() {
|
|||
# Assign specified space and rest of disk to the EFI and LUKS partition, respectively.
|
||||
if [ "${ISEFI}" -ne 0 ] ; then # EFI
|
||||
# Zap existing partition table and create new GPT
|
||||
echo "...Initializing \"${DEV}\" with GPT."
|
||||
echo "[Kaiten-Yaki] Initializing \"${DEV}\" with GPT."
|
||||
sgdisk --zap-all "${DEV}"
|
||||
if is_error ; then return 1 ; fi; # If error, terminate
|
||||
# Create EFI partition and format it
|
||||
echo "...Creating an EFI partition on \"${DEV}\"."
|
||||
echo "[Kaiten-Yaki] Creating an EFI partition on \"${DEV}\"."
|
||||
# shellcheck disable=SC2140
|
||||
sgdisk --new="${EFIPARTITION}":0:+"${EFISIZE}" --change-name="${EFIPARTITION}":"EFI System" --typecode="${EFIPARTITION}":ef00 "${DEV}"
|
||||
if is_error ; then return 1 ; fi; # If error, terminate
|
||||
echo "...Formatting the EFI parttion."
|
||||
echo "[Kaiten-Yaki] Formatting the EFI parttion."
|
||||
mkfs.vfat -F 32 -n EFI-SP "${DEV}${EFIPARTITION}"
|
||||
if is_error ; then return 1 ; fi; # If error, terminate
|
||||
# Create Linux partition
|
||||
echo "...Creating a Linux partition on ${DEV}."
|
||||
echo "[Kaiten-Yaki] Creating a Linux partition on ${DEV}."
|
||||
# shellcheck disable=SC2140
|
||||
sgdisk --new="${CRYPTPARTITION}":0:0 --change-name="${CRYPTPARTITION}":"Linux LUKS" --typecode="${CRYPTPARTITION}":8309 "${DEV}"
|
||||
if is_error ; then return 1 ; fi; # If error, terminate
|
||||
|
|
@ -206,11 +206,11 @@ function pre_install() {
|
|||
sgdisk --print "${DEV}"
|
||||
else # BIOS
|
||||
# Zap existing partition table
|
||||
echo "...Erasing partition table of \"${DEV}\"."
|
||||
echo "[Kaiten-Yaki] Erasing partition table of \"${DEV}\"."
|
||||
dd if=/dev/zero of="${DEV}" bs=512 count=1
|
||||
if is_error ; then return 1 ; fi; # If error, terminate
|
||||
# Create MBR and allocate max storage for Linux partition
|
||||
echo "...Creating a Linux partition on ${DEV} with MBR."
|
||||
echo "[Kaiten-Yaki] Creating a Linux partition on ${DEV} with MBR."
|
||||
sfdisk "${DEV}" <<- HEREDOC
|
||||
2M,,L
|
||||
HEREDOC
|
||||
|
|
@ -218,23 +218,23 @@ function pre_install() {
|
|||
fi # if EFI firmware
|
||||
|
||||
# Encrypt the partition to install Linux
|
||||
echo "...Initializing \"${DEV}${CRYPTPARTITION}\" as crypt partition"
|
||||
echo "[Kaiten-Yaki] Initializing \"${DEV}${CRYPTPARTITION}\" as crypt partition"
|
||||
printf %s "${PASSPHRASE}" | cryptsetup luksFormat --iter-time "${ITERTIME}" --type=luks1 --key-file - --batch-mode "${DEV}${CRYPTPARTITION}"
|
||||
|
||||
fi # if erase all
|
||||
|
||||
# ----- Open the LUKS partition -----
|
||||
# Open the crypt partition.
|
||||
echo "...Opening a crypt partition \"${DEV}${CRYPTPARTITION}\" as \"${CRYPTPARTNAME}\""
|
||||
echo "[Kaiten-Yaki] Opening a crypt partition \"${DEV}${CRYPTPARTITION}\" as \"${CRYPTPARTNAME}\""
|
||||
printf %s "${PASSPHRASE}" | cryptsetup open -d - "${DEV}${CRYPTPARTITION}" "${CRYPTPARTNAME}"
|
||||
|
||||
# Check whether successful open. If mapped, it is successful.
|
||||
if [ ! -e /dev/mapper/"${CRYPTPARTNAME}" ] ; then
|
||||
cat <<- HEREDOC
|
||||
***** ERROR : Cannot open LUKS volume "${CRYPTPARTNAME}" on "${DEV}${CRYPTPARTITION}". *****
|
||||
...Check passphrase and your config.txt
|
||||
[Kaiten-Yaki] Check passphrase and your config.txt
|
||||
|
||||
...Installation process terminated..
|
||||
[Kaiten-Yaki] Installation process terminated..
|
||||
HEREDOC
|
||||
return 1 # with error status
|
||||
fi # if crypt volume is unable to open
|
||||
|
|
@ -242,25 +242,25 @@ function pre_install() {
|
|||
# ----- Configure the LVM in LUKS volume -----
|
||||
# Check volume group ${VGNAME} exist or not
|
||||
if vgdisplay -s "${VGNAME}" &> /dev/null ; then # if exist
|
||||
echo "...Volume group \"${VGNAME}\" already exist. Skipped to create. No problem."
|
||||
echo "...Activating all logical volumes in volume group \"${VGNAME}\"."
|
||||
echo "[Kaiten-Yaki] Volume group \"${VGNAME}\" already exist. Skipped to create. No problem."
|
||||
echo "[Kaiten-Yaki] Activating all logical volumes in volume group \"${VGNAME}\"."
|
||||
vgchange -ay
|
||||
echo "...Scanning all logical volumes."
|
||||
echo "[Kaiten-Yaki] Scanning all logical volumes."
|
||||
lvscan
|
||||
else
|
||||
echo "...Initializing a physical volume on \"${CRYPTPARTNAME}\""
|
||||
echo "[Kaiten-Yaki] Initializing a physical volume on \"${CRYPTPARTNAME}\""
|
||||
pvcreate /dev/mapper/"${CRYPTPARTNAME}"
|
||||
if [ $? -ne 0 ] ; then deactivate_and_close; return 1 ; fi;
|
||||
echo "...And then creating Volume group \"${VGNAME}\"."
|
||||
echo "[Kaiten-Yaki] And then creating Volume group \"${VGNAME}\"."
|
||||
vgcreate "${VGNAME}" /dev/mapper/"${CRYPTPARTNAME}"
|
||||
if [ $? -ne 0 ] ; then deactivate_and_close; return 1 ; fi;
|
||||
fi # if /dev/volume-groupt exist
|
||||
|
||||
# Create a SWAP Logical Volume on VG, if it doesn't exist
|
||||
if [ -e /dev/mapper/"${VGNAME}"-"${LVSWAPNAME}" ] ; then
|
||||
echo "...Swap volume already exist. Skipped to create. No problem."
|
||||
echo "[Kaiten-Yaki] Swap volume already exist. Skipped to create. No problem."
|
||||
else
|
||||
echo "...Creating logical volume \"${LVSWAPNAME}\" on \"${VGNAME}\"."
|
||||
echo "[Kaiten-Yaki] Creating logical volume \"${LVSWAPNAME}\" on \"${VGNAME}\"."
|
||||
# Too use the bash IFS, first parameter is not quoted.
|
||||
lvcreate ${LVSWAPSIZE} -n "${LVSWAPNAME}" "${VGNAME}"
|
||||
if [ $? -ne 0 ] ; then deactivate_and_close; return 1 ; fi;
|
||||
|
|
@ -269,7 +269,7 @@ function pre_install() {
|
|||
# Create a ROOT Logical Volume on VG.
|
||||
if [ -e /dev/mapper/"${VGNAME}"-"${LVROOTNAME}" ] ; then # exist
|
||||
if [ "${OVERWRITEINSTALL}" -ne 0 ] ; then # exist and overwrite install
|
||||
echo "...Logical volume \"${VGNAME}-${LVROOTNAME}\" already exists. OK."
|
||||
echo "[Kaiten-Yaki] Logical volume \"${VGNAME}-${LVROOTNAME}\" already exists. OK."
|
||||
|
||||
# Create extended volumes if needed
|
||||
create_ext_lv
|
||||
|
|
@ -278,7 +278,7 @@ function pre_install() {
|
|||
else # exist and not overwriteinstall
|
||||
cat <<- HEREDOC
|
||||
***** ERROR : Logical volume "${VGNAME}-${LVROOTNAME}" already exists. *****
|
||||
...Check LVROOTNAME environment variable in your config.txt.
|
||||
[Kaiten-Yaki] Check LVROOTNAME environment variable in your config.txt.
|
||||
HEREDOC
|
||||
# Deactivate all lg and close the LUKS volume
|
||||
deactivate_and_close
|
||||
|
|
@ -288,13 +288,13 @@ function pre_install() {
|
|||
if [ "${OVERWRITEINSTALL}" -ne 0 ] ; then # not exist and overwrite install
|
||||
cat <<- HEREDOC
|
||||
***** ERROR : Logical volume "${VGNAME}-${LVROOTNAME}" doesn't exist while overwrite install. *****
|
||||
...Check consistency of your config.txt.
|
||||
[Kaiten-Yaki] Check consistency of your config.txt.
|
||||
HEREDOC
|
||||
# Deactivate all lg and close the LUKS volume
|
||||
deactivate_and_close
|
||||
return 1 # with error status
|
||||
else # not exist and not overwrite install
|
||||
echo "...Creating logical volume \"${LVROOTNAME}\" on \"${VGNAME}\"."
|
||||
echo "[Kaiten-Yaki] Creating logical volume \"${LVROOTNAME}\" on \"${VGNAME}\"."
|
||||
# Too use the bash IFS, first parameter is not quoted.
|
||||
lvcreate ${LVROOTSIZE} -n "${LVROOTNAME}" "${VGNAME}"
|
||||
if [ $? -ne 0 ] ; then deactivate_and_close; return 1 ; fi;
|
||||
|
|
@ -367,15 +367,15 @@ function post_install() {
|
|||
# ${BTRFSOPTION} is defined by the caller of this function for BTRFS formated volume.
|
||||
# ${BTRFSOPTION} have to be NOT quoted. Otherwise, mount will receive an empty
|
||||
# string as first option, when the veraible is empty.
|
||||
echo "...Mounting /dev/mapper/${VGNAME}-${LVROOTNAME} on ${TARGETMOUNTPOINT}."
|
||||
echo "[Kaiten-Yaki] Mounting /dev/mapper/${VGNAME}-${LVROOTNAME} on ${TARGETMOUNTPOINT}."
|
||||
mount ${BTRFSOPTION} /dev/mapper/"${VGNAME}"-"${LVROOTNAME}" "${TARGETMOUNTPOINT}"
|
||||
|
||||
# And mount other directories
|
||||
echo "...Mounting all other dirs."
|
||||
echo "[Kaiten-Yaki] Mounting all other dirs."
|
||||
for n in proc sys dev tmp etc/resolv.conf; do mount --rbind "/$n" "${TARGETMOUNTPOINT}/$n"; done
|
||||
|
||||
# Copy all scripts to the target /tmp for using in chroot session.
|
||||
echo "...Copying files in current dir to ${TARGETMOUNTPOINT}/tmp."
|
||||
echo "[Kaiten-Yaki] Copying files in current dir to ${TARGETMOUNTPOINT}/tmp."
|
||||
mkdir "${TARGETMOUNTPOINT}/tmp/kaiten-yaki"
|
||||
cp -r ./* -t "${TARGETMOUNTPOINT}/tmp/kaiten-yaki"
|
||||
|
||||
|
|
@ -383,7 +383,7 @@ function post_install() {
|
|||
# The here-document is script executed under chroot. At here we call
|
||||
# the distribution dependent script "lib/chrooted_job_${DISTRIBUTIONSIGNATURE}.sh",
|
||||
# which was copied to /temp at previous code.
|
||||
echo "...Chroot to ${TARGETMOUNTPOINT}. and execute chrooted_job_${DISTRIBUTIONSIGNATURE}.sh"
|
||||
echo "[Kaiten-Yaki] Chroot to ${TARGETMOUNTPOINT}. and execute chrooted_job_${DISTRIBUTIONSIGNATURE}.sh"
|
||||
# shellcheck disable=SC2086
|
||||
cat <<- HEREDOC | chroot "${TARGETMOUNTPOINT}" /bin/bash
|
||||
cd /tmp/kaiten-yaki
|
||||
|
|
@ -392,23 +392,23 @@ function post_install() {
|
|||
HEREDOC
|
||||
|
||||
# Unmount all. -l ( lazy ) option is added to supress the busy error.
|
||||
echo "...Unmounting all."
|
||||
echo "[Kaiten-Yaki] Unmounting all."
|
||||
umount -R -l "${TARGETMOUNTPOINT}"
|
||||
|
||||
echo "...Post install process finished."
|
||||
echo "[Kaiten-Yaki] Post install process finished."
|
||||
|
||||
# Free LUKS volume as swap volume.
|
||||
echo "...Disabling swap to release the LUKS volume."
|
||||
echo "[Kaiten-Yaki] Disabling swap to release the LUKS volume."
|
||||
swapoff -a
|
||||
|
||||
# Close LUKS
|
||||
echo "...Deactivating all logical volumes in volume group \"${VGNAME}\"."
|
||||
echo "[Kaiten-Yaki] Deactivating all logical volumes in volume group \"${VGNAME}\"."
|
||||
vgchange -a n "${VGNAME}"
|
||||
echo "...Closing LUKS volume \"${CRYPTPARTNAME}\"."
|
||||
echo "[Kaiten-Yaki] Closing LUKS volume \"${CRYPTPARTNAME}\"."
|
||||
cryptsetup close "${CRYPTPARTNAME}"
|
||||
|
||||
# Deleting the passphrase information.
|
||||
echo "...Deleting passphrase information."
|
||||
echo "[Kaiten-Yaki] Deleting passphrase information."
|
||||
PASSPHRASE=""
|
||||
export PASSPHRASE
|
||||
|
||||
|
|
@ -416,7 +416,7 @@ function post_install() {
|
|||
cat <<- HEREDOC
|
||||
****************** Install process finished ******************
|
||||
|
||||
...Ready to reboot.
|
||||
[Kaiten-Yaki] Ready to reboot.
|
||||
HEREDOC
|
||||
|
||||
return 0
|
||||
|
|
@ -433,32 +433,32 @@ function deactivate_and_close(){
|
|||
|
||||
if [ "${IS_ROOT_CREATED}" -ne 0 ] ; then # if extra volume 1 created
|
||||
# Remove newly created root volume
|
||||
echo "...Deleting the new logical volume \"${VGNAME}-${LVROOTNAME}\"."
|
||||
echo "[Kaiten-Yaki] Deleting the new logical volume \"${VGNAME}-${LVROOTNAME}\"."
|
||||
lvremove -f /dev/mapper/"${VGNAME}"-"${LVROOTNAME}"
|
||||
fi
|
||||
|
||||
|
||||
if [ "${IS_LVEXT1_CREATED}" -ne 0 ] ; then # if extra volume 1 created
|
||||
# Remove newly created extra volume 1
|
||||
echo "...Deleting the new logical volume \"${VGNAME}-${LVROOTNAME}${LVEXT1SUFFIX}\"."
|
||||
echo "[Kaiten-Yaki] Deleting the new logical volume \"${VGNAME}-${LVROOTNAME}${LVEXT1SUFFIX}\"."
|
||||
lvremove -f /dev/mapper/"${VGNAME}"-"${LVROOTNAME}${LVEXT1SUFFIX}"
|
||||
fi
|
||||
|
||||
if [ "${IS_LVEXT2_CREATED}" -ne 0 ] ; then # if extra volume 2 created
|
||||
# Remove newly created extra volume 2
|
||||
echo "...Deleting the new logical volume \"${VGNAME}-${LVROOTNAME}${LVEXT2SUFFIX}\"."
|
||||
echo "[Kaiten-Yaki] Deleting the new logical volume \"${VGNAME}-${LVROOTNAME}${LVEXT2SUFFIX}\"."
|
||||
lvremove -f /dev/mapper/"${VGNAME}"-"${LVROOTNAME}${LVEXT2SUFFIX}"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
echo "...Deactivating all logical volumes in volume group \"${VGNAME}\"."
|
||||
echo "[Kaiten-Yaki] Deactivating all logical volumes in volume group \"${VGNAME}\"."
|
||||
vgchange -a n "${VGNAME}"
|
||||
echo "...Closing LUKS volume \"${CRYPTPARTNAME}\"."
|
||||
echo "[Kaiten-Yaki] Closing LUKS volume \"${CRYPTPARTNAME}\"."
|
||||
cryptsetup close "${CRYPTPARTNAME}"
|
||||
cat <<- HEREDOC
|
||||
|
||||
...Installation process terminated..
|
||||
[Kaiten-Yaki] Installation process terminated..
|
||||
HEREDOC
|
||||
|
||||
}
|
||||
|
|
@ -469,11 +469,11 @@ function deactivate_and_close(){
|
|||
function on_unexpected_installer_quit(){
|
||||
echo "***** ERROR : The GUI/TUI installer terminated unexpectedly. *****"
|
||||
if [ "${OVERWRITEINSTALL}" -ne 0 ] ; then # If overwrite install, keep the volume
|
||||
echo "...Keep logical volume \"${VGNAME}-${LVROOTNAME}\" untouched."
|
||||
echo "[Kaiten-Yaki] Keep logical volume \"${VGNAME}-${LVROOTNAME}\" untouched."
|
||||
fi
|
||||
# Deactivate all lg and close the LUKS volume
|
||||
deactivate_and_close
|
||||
echo "...You can retry Kaiten-yaki again."
|
||||
echo "[Kaiten-Yaki] You can retry Kaiten-yaki again."
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -493,7 +493,7 @@ function distribution_check(){
|
|||
if [ "${YESNO}" != "Y" ] && [ "${YESNO}" != "y" ] ; then
|
||||
cat <<- HEREDOC
|
||||
|
||||
...Installation process terminated..
|
||||
[Kaiten-Yaki] Installation process terminated..
|
||||
HEREDOC
|
||||
return 1 # with error status
|
||||
fi # if YES
|
||||
|
|
@ -512,9 +512,9 @@ function distribution_check(){
|
|||
function create_ext_lv() {
|
||||
if [ "${USELVEXT1}" -ne 0 ] ; then # if using extra volume 1
|
||||
if [ -e /dev/mapper/"${VGNAME}-${LVROOTNAME}${LVEXT1SUFFIX}" ] ; then # if extra volume 1 exist
|
||||
echo "...Logical volume \"${VGNAME}-${LVROOTNAME}${LVEXT1SUFFIX}\" already exists. OK."
|
||||
echo "[Kaiten-Yaki] Logical volume \"${VGNAME}-${LVROOTNAME}${LVEXT1SUFFIX}\" already exists. OK."
|
||||
else
|
||||
echo "...Creating logical volume \"${LVROOTNAME}${LVEXT1SUFFIX}\" on \"${VGNAME}\"."
|
||||
echo "[Kaiten-Yaki] Creating logical volume \"${LVROOTNAME}${LVEXT1SUFFIX}\" on \"${VGNAME}\"."
|
||||
# Too use the bash IFS, first parameter is not quoted.
|
||||
lvcreate ${LVEXT1SIZE} -n "${LVROOTNAME}${LVEXT1SUFFIX}" "${VGNAME}"
|
||||
if [ $? -ne 0 ] ; then # if fail
|
||||
|
|
@ -528,9 +528,9 @@ function create_ext_lv() {
|
|||
|
||||
if [ "${USELVEXT2}" -ne 0 ] ; then # if using extra volume 2
|
||||
if [ -e /dev/mapper/"${VGNAME}-${LVROOTNAME}${LVEXT2SUFFIX}" ] ; then # if extra volume 2 exist
|
||||
echo "...Logical volume \"${VGNAME}-${LVROOTNAME}${LVEXT2SUFFIX}\" already exists. OK."
|
||||
echo "[Kaiten-Yaki] Logical volume \"${VGNAME}-${LVROOTNAME}${LVEXT2SUFFIX}\" already exists. OK."
|
||||
else
|
||||
echo "...Creating logical volume \"${LVROOTNAME}${LVEXT2SUFFIX}\" on \"${VGNAME}\"."
|
||||
echo "[Kaiten-Yaki] Creating logical volume \"${LVROOTNAME}${LVEXT2SUFFIX}\" on \"${VGNAME}\"."
|
||||
# Too use the bash IFS, first parameter is not quoted.
|
||||
lvcreate ${LVEXT2SIZE} -n "${LVROOTNAME}${LVEXT2SUFFIX}" "${VGNAME}"
|
||||
if [ $? -ne 0 ] ; then # if fail
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue