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
|
|
@ -42,7 +42,7 @@ export LVEXT2SUFFIX="_var"
|
||||||
# 5. LVEXT2 if needed
|
# 5. LVEXT2 if needed
|
||||||
|
|
||||||
# Set the size of EFI partition and swap partition.
|
# Set the size of EFI partition and swap partition.
|
||||||
# The unit is Byte. You can use M,G... notation.
|
# The unit is Byte. You can use M,G[Kaiten-Yaki] notation.
|
||||||
# You CANNOT use the % notation.
|
# You CANNOT use the % notation.
|
||||||
export EFISIZE="200M"
|
export EFISIZE="200M"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ function chrooted_job() {
|
||||||
mount -a
|
mount -a
|
||||||
|
|
||||||
# Prepare the crypto tool in the install target
|
# 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
|
apt -qq install -y cryptsetup-initramfs
|
||||||
|
|
||||||
# Prepare a new key file to embed in to the ramfs.
|
# 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.
|
# The new key is 4096byte length binary value.
|
||||||
# Because this key is sotred as "cleartext", in the target file sysmte,
|
# Because this key is sotred as "cleartext", in the target file sysmte,
|
||||||
# only root is allowed to access this key file.
|
# only root is allowed to access this key file.
|
||||||
echo "...Prepairing key file."
|
echo "[Kaiten-Yaki] 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 the new key to the LUKS 2nd key slot. The passphrase is required to modify the LUKS keyslot.
|
# 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
|
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"
|
# 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
|
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.
|
# Add key file to the list of the intems in initramfs.
|
||||||
# See https://cryptsetup-team.pages.debian.net/cryptsetup/README.initramfs.html for detail
|
# 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 "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 "[Kaiten-Yaki] Upadting initramfs."
|
||||||
update-initramfs -uk all
|
update-initramfs -uk all
|
||||||
|
|
||||||
# Leave chroot
|
# Leave chroot
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ function chrooted_job() {
|
||||||
mount -a
|
mount -a
|
||||||
|
|
||||||
# Prepare the crypto tool in the install target
|
# 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
|
xbps-install -y lvm2 cryptsetup
|
||||||
|
|
||||||
# Prepare a new key file to embed in to the ramfs.
|
# 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.
|
# The new key is 4096byte length binary value.
|
||||||
# Because this key is sotred as "cleartext", in the target file sysmte,
|
# Because this key is sotred as "cleartext", in the target file sysmte,
|
||||||
# only root is allowed to access this key file.
|
# only root is allowed to access this key file.
|
||||||
echo "...Prepairing key file."
|
echo "[Kaiten-Yaki] 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 the new key to the LUKS 2nd key slot. The passphrase is required to modify the LUKS keyslot.
|
# 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
|
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"
|
# 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
|
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.
|
# 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.
|
# 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
|
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 "[Kaiten-Yaki] Upadting initramfs."
|
||||||
xbps-reconfigure -fa
|
xbps-reconfigure -fa
|
||||||
echo "...grub-mkconfig."
|
echo "[Kaiten-Yaki] grub-mkconfig."
|
||||||
grub-mkconfig -o /boot/grub/grub.cfg
|
grub-mkconfig -o /boot/grub/grub.cfg
|
||||||
|
|
||||||
# Leave chroot
|
# Leave chroot
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,11 @@ function confirmation(){
|
||||||
if [ "${ERASEALL}" -ne 0 ] && [ "${OVERWRITEINSTALL}" -ne 0 ] ; then
|
if [ "${ERASEALL}" -ne 0 ] && [ "${OVERWRITEINSTALL}" -ne 0 ] ; then
|
||||||
cat <<- HEREDOC
|
cat <<- HEREDOC
|
||||||
***** ERROR : Confliction between ERASEALL and OVERWRITEINSTALL *****
|
***** ERROR : Confliction between ERASEALL and OVERWRITEINSTALL *****
|
||||||
...ERASEALL = ${ERASEALL}
|
[Kaiten-Yaki] ERASEALL = ${ERASEALL}
|
||||||
...OVERWRITEINSTALL = ${OVERWRITEINSTALL}
|
[Kaiten-Yaki] OVERWRITEINSTALL = ${OVERWRITEINSTALL}
|
||||||
...Check configuration in your config.sh
|
[Kaiten-Yaki] Check configuration in your config.sh
|
||||||
|
|
||||||
...Installation process terminated..
|
[Kaiten-Yaki] Installation process terminated..
|
||||||
HEREDOC
|
HEREDOC
|
||||||
return 1 # with error status
|
return 1 # with error status
|
||||||
fi
|
fi
|
||||||
|
|
@ -22,10 +22,10 @@ function confirmation(){
|
||||||
if echo "${VGNAME}" | grep "-" -i > /dev/null ; then # "-" is found in the volume group name.
|
if echo "${VGNAME}" | grep "-" -i > /dev/null ; then # "-" is found in the volume group name.
|
||||||
cat <<- HEREDOC
|
cat <<- HEREDOC
|
||||||
***** ERROR : VGNAME is "${VGNAME}" *****
|
***** ERROR : VGNAME is "${VGNAME}" *****
|
||||||
..."-" is not allowed in the volume name.
|
[Kaiten-Yaki] "-" is not allowed in the volume name.
|
||||||
...Check configuration in your config.sh
|
[Kaiten-Yaki] Check configuration in your config.sh
|
||||||
|
|
||||||
...Installation process terminated..
|
[Kaiten-Yaki] Installation process terminated..
|
||||||
HEREDOC
|
HEREDOC
|
||||||
return 1 # with error status
|
return 1 # with error status
|
||||||
fi # "-" is found in the volume group name.
|
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.
|
if echo "${LVROOTNAME}" | grep "-" -i > /dev/null ; then # "-" is found in the volume name.
|
||||||
cat <<- HEREDOC
|
cat <<- HEREDOC
|
||||||
***** ERROR : LVROOTNAME is "${LVROOTNAME}" *****
|
***** ERROR : LVROOTNAME is "${LVROOTNAME}" *****
|
||||||
..."-" is not allowed in the volume name.
|
[Kaiten-Yaki] "-" is not allowed in the volume name.
|
||||||
...Check configuration in your config.sh
|
[Kaiten-Yaki] Check configuration in your config.sh
|
||||||
|
|
||||||
...Installation process terminated..
|
[Kaiten-Yaki] Installation process terminated..
|
||||||
HEREDOC
|
HEREDOC
|
||||||
return 1 # with error status
|
return 1 # with error status
|
||||||
fi # "-" is found in the volume name.
|
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.
|
if echo "${LVEXT1SUFFIX}" | grep "-" -i > /dev/null ; then # "-" is found in the volume name.
|
||||||
cat <<- HEREDOC
|
cat <<- HEREDOC
|
||||||
***** ERROR : LVEXT1SUFFIX is "${LVEXT1SUFFIX}" *****
|
***** ERROR : LVEXT1SUFFIX is "${LVEXT1SUFFIX}" *****
|
||||||
..."-" is not allowed in the volume name.
|
[Kaiten-Yaki] "-" is not allowed in the volume name.
|
||||||
...Check configuration in your config.sh
|
[Kaiten-Yaki] Check configuration in your config.sh
|
||||||
|
|
||||||
...Installation process terminated..
|
[Kaiten-Yaki] Installation process terminated..
|
||||||
HEREDOC
|
HEREDOC
|
||||||
return 1 # with error status
|
return 1 # with error status
|
||||||
fi # "-" is found in the volume suffix.
|
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.
|
if echo "${LVEXT2SUFFIX}" | grep "-" -i > /dev/null ; then # "-" is found in the volume name.
|
||||||
cat <<- HEREDOC
|
cat <<- HEREDOC
|
||||||
***** ERROR : LVEXT2SUFFIX is "${LVEXT2SUFFIX}" *****
|
***** ERROR : LVEXT2SUFFIX is "${LVEXT2SUFFIX}" *****
|
||||||
..."-" is not allowed in the volume name.
|
[Kaiten-Yaki] "-" is not allowed in the volume name.
|
||||||
...Check configuration in your config.sh
|
[Kaiten-Yaki] Check configuration in your config.sh
|
||||||
|
|
||||||
...Installation process terminated..
|
[Kaiten-Yaki] Installation process terminated..
|
||||||
HEREDOC
|
HEREDOC
|
||||||
return 1 # with error status
|
return 1 # with error status
|
||||||
fi # "-" is found in the volume suffix.
|
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.
|
if echo "${LVSWAPNAME}" | grep "-" -i > /dev/null ; then # "-" is found in the volume name.
|
||||||
cat <<- HEREDOC
|
cat <<- HEREDOC
|
||||||
***** ERROR : LVSWAPNAME is "${LVSWAPNAME}" *****
|
***** ERROR : LVSWAPNAME is "${LVSWAPNAME}" *****
|
||||||
..."-" is not allowed in the volume name.
|
[Kaiten-Yaki] "-" is not allowed in the volume name.
|
||||||
...Check configuration in your config.sh
|
[Kaiten-Yaki] Check configuration in your config.sh
|
||||||
|
|
||||||
...Installation process terminated..
|
[Kaiten-Yaki] Installation process terminated..
|
||||||
HEREDOC
|
HEREDOC
|
||||||
return 1 # with error status
|
return 1 # with error status
|
||||||
fi # "-" is found in the volume name.
|
fi # "-" is found in the volume name.
|
||||||
|
|
@ -113,22 +113,22 @@ function confirmation(){
|
||||||
HEREDOC
|
HEREDOC
|
||||||
|
|
||||||
if [ "${ERASEALL}" -ne 0 ] ; then
|
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
|
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
|
else
|
||||||
echo "Going to create a new logical volume \"${VGNAME}-${LVROOTNAME}\"."
|
echo "[Kaiten-Yaki] Going to create a new logical volume \"${VGNAME}-${LVROOTNAME}\"."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# ----- Set Passphrase -----
|
# ----- Set Passphrase -----
|
||||||
# Input passphrase
|
# Input passphrase
|
||||||
echo ""
|
echo ""
|
||||||
echo "Type passphrase for the disk encryption."
|
echo "[Kaiten-Yaki] Type passphrase for the disk encryption."
|
||||||
read -sr PASSPHRASE
|
read -sr PASSPHRASE
|
||||||
export PASSPHRASE
|
export PASSPHRASE
|
||||||
|
|
||||||
echo "Type passphrase again, to confirm."
|
echo "[Kaiten-Yaki] Type passphrase again, to confirm."
|
||||||
read -sr PASSPHRASE_C
|
read -sr PASSPHRASE_C
|
||||||
|
|
||||||
# Validate whether both are indentical or not
|
# Validate whether both are indentical or not
|
||||||
|
|
@ -136,7 +136,7 @@ function confirmation(){
|
||||||
cat <<-HEREDOC
|
cat <<-HEREDOC
|
||||||
***** ERROR : Passphrase doesn't match *****
|
***** ERROR : Passphrase doesn't match *****
|
||||||
|
|
||||||
...Installation process terminated..
|
[Kaiten-Yaki] Installation process terminated..
|
||||||
HEREDOC
|
HEREDOC
|
||||||
return 1 # with error status
|
return 1 # with error status
|
||||||
else
|
else
|
||||||
|
|
@ -186,19 +186,19 @@ function pre_install() {
|
||||||
# Assign specified space and rest of disk to the EFI and LUKS partition, respectively.
|
# Assign specified space and rest of disk to the EFI and LUKS partition, respectively.
|
||||||
if [ "${ISEFI}" -ne 0 ] ; then # EFI
|
if [ "${ISEFI}" -ne 0 ] ; then # EFI
|
||||||
# Zap existing partition table and create new GPT
|
# Zap existing partition table and create new GPT
|
||||||
echo "...Initializing \"${DEV}\" with GPT."
|
echo "[Kaiten-Yaki] Initializing \"${DEV}\" with GPT."
|
||||||
sgdisk --zap-all "${DEV}"
|
sgdisk --zap-all "${DEV}"
|
||||||
if is_error ; then return 1 ; fi; # If error, terminate
|
if is_error ; then return 1 ; fi; # If error, terminate
|
||||||
# Create EFI partition and format it
|
# 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
|
# shellcheck disable=SC2140
|
||||||
sgdisk --new="${EFIPARTITION}":0:+"${EFISIZE}" --change-name="${EFIPARTITION}":"EFI System" --typecode="${EFIPARTITION}":ef00 "${DEV}"
|
sgdisk --new="${EFIPARTITION}":0:+"${EFISIZE}" --change-name="${EFIPARTITION}":"EFI System" --typecode="${EFIPARTITION}":ef00 "${DEV}"
|
||||||
if is_error ; then return 1 ; fi; # If error, terminate
|
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}"
|
mkfs.vfat -F 32 -n EFI-SP "${DEV}${EFIPARTITION}"
|
||||||
if is_error ; then return 1 ; fi; # If error, terminate
|
if is_error ; then return 1 ; fi; # If error, terminate
|
||||||
# Create Linux partition
|
# Create Linux partition
|
||||||
echo "...Creating a Linux partition on ${DEV}."
|
echo "[Kaiten-Yaki] Creating a Linux partition on ${DEV}."
|
||||||
# shellcheck disable=SC2140
|
# shellcheck disable=SC2140
|
||||||
sgdisk --new="${CRYPTPARTITION}":0:0 --change-name="${CRYPTPARTITION}":"Linux LUKS" --typecode="${CRYPTPARTITION}":8309 "${DEV}"
|
sgdisk --new="${CRYPTPARTITION}":0:0 --change-name="${CRYPTPARTITION}":"Linux LUKS" --typecode="${CRYPTPARTITION}":8309 "${DEV}"
|
||||||
if is_error ; then return 1 ; fi; # If error, terminate
|
if is_error ; then return 1 ; fi; # If error, terminate
|
||||||
|
|
@ -206,11 +206,11 @@ function pre_install() {
|
||||||
sgdisk --print "${DEV}"
|
sgdisk --print "${DEV}"
|
||||||
else # BIOS
|
else # BIOS
|
||||||
# Zap existing partition table
|
# 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
|
dd if=/dev/zero of="${DEV}" bs=512 count=1
|
||||||
if is_error ; then return 1 ; fi; # If error, terminate
|
if is_error ; then return 1 ; fi; # If error, terminate
|
||||||
# Create MBR and allocate max storage for Linux partition
|
# 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
|
sfdisk "${DEV}" <<- HEREDOC
|
||||||
2M,,L
|
2M,,L
|
||||||
HEREDOC
|
HEREDOC
|
||||||
|
|
@ -218,23 +218,23 @@ function pre_install() {
|
||||||
fi # if EFI firmware
|
fi # if EFI firmware
|
||||||
|
|
||||||
# Encrypt the partition to install Linux
|
# 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}"
|
printf %s "${PASSPHRASE}" | cryptsetup luksFormat --iter-time "${ITERTIME}" --type=luks1 --key-file - --batch-mode "${DEV}${CRYPTPARTITION}"
|
||||||
|
|
||||||
fi # if erase all
|
fi # if erase all
|
||||||
|
|
||||||
# ----- Open the LUKS partition -----
|
# ----- Open the LUKS partition -----
|
||||||
# Open the crypt 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}"
|
printf %s "${PASSPHRASE}" | cryptsetup open -d - "${DEV}${CRYPTPARTITION}" "${CRYPTPARTNAME}"
|
||||||
|
|
||||||
# Check whether successful open. If mapped, it is successful.
|
# Check whether successful open. If mapped, it is successful.
|
||||||
if [ ! -e /dev/mapper/"${CRYPTPARTNAME}" ] ; then
|
if [ ! -e /dev/mapper/"${CRYPTPARTNAME}" ] ; then
|
||||||
cat <<- HEREDOC
|
cat <<- HEREDOC
|
||||||
***** ERROR : Cannot open LUKS volume "${CRYPTPARTNAME}" on "${DEV}${CRYPTPARTITION}". *****
|
***** 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
|
HEREDOC
|
||||||
return 1 # with error status
|
return 1 # with error status
|
||||||
fi # if crypt volume is unable to open
|
fi # if crypt volume is unable to open
|
||||||
|
|
@ -242,25 +242,25 @@ function pre_install() {
|
||||||
# ----- Configure the LVM in LUKS volume -----
|
# ----- Configure the LVM in LUKS volume -----
|
||||||
# Check volume group ${VGNAME} exist or not
|
# Check volume group ${VGNAME} exist or not
|
||||||
if vgdisplay -s "${VGNAME}" &> /dev/null ; then # if exist
|
if vgdisplay -s "${VGNAME}" &> /dev/null ; then # if exist
|
||||||
echo "...Volume group \"${VGNAME}\" already exist. Skipped to create. No problem."
|
echo "[Kaiten-Yaki] Volume group \"${VGNAME}\" already exist. Skipped to create. No problem."
|
||||||
echo "...Activating all logical volumes in volume group \"${VGNAME}\"."
|
echo "[Kaiten-Yaki] Activating all logical volumes in volume group \"${VGNAME}\"."
|
||||||
vgchange -ay
|
vgchange -ay
|
||||||
echo "...Scanning all logical volumes."
|
echo "[Kaiten-Yaki] Scanning all logical volumes."
|
||||||
lvscan
|
lvscan
|
||||||
else
|
else
|
||||||
echo "...Initializing a physical volume on \"${CRYPTPARTNAME}\""
|
echo "[Kaiten-Yaki] Initializing a physical volume on \"${CRYPTPARTNAME}\""
|
||||||
pvcreate /dev/mapper/"${CRYPTPARTNAME}"
|
pvcreate /dev/mapper/"${CRYPTPARTNAME}"
|
||||||
if [ $? -ne 0 ] ; then deactivate_and_close; return 1 ; fi;
|
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}"
|
vgcreate "${VGNAME}" /dev/mapper/"${CRYPTPARTNAME}"
|
||||||
if [ $? -ne 0 ] ; then deactivate_and_close; return 1 ; fi;
|
if [ $? -ne 0 ] ; then deactivate_and_close; return 1 ; fi;
|
||||||
fi # if /dev/volume-groupt exist
|
fi # if /dev/volume-groupt exist
|
||||||
|
|
||||||
# Create a SWAP Logical Volume on VG, if it doesn't exist
|
# Create a SWAP Logical Volume on VG, if it doesn't exist
|
||||||
if [ -e /dev/mapper/"${VGNAME}"-"${LVSWAPNAME}" ] ; then
|
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
|
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.
|
# Too use the bash IFS, first parameter is not quoted.
|
||||||
lvcreate ${LVSWAPSIZE} -n "${LVSWAPNAME}" "${VGNAME}"
|
lvcreate ${LVSWAPSIZE} -n "${LVSWAPNAME}" "${VGNAME}"
|
||||||
if [ $? -ne 0 ] ; then deactivate_and_close; return 1 ; fi;
|
if [ $? -ne 0 ] ; then deactivate_and_close; return 1 ; fi;
|
||||||
|
|
@ -269,7 +269,7 @@ function pre_install() {
|
||||||
# Create a ROOT Logical Volume on VG.
|
# Create a ROOT Logical Volume on VG.
|
||||||
if [ -e /dev/mapper/"${VGNAME}"-"${LVROOTNAME}" ] ; then # exist
|
if [ -e /dev/mapper/"${VGNAME}"-"${LVROOTNAME}" ] ; then # exist
|
||||||
if [ "${OVERWRITEINSTALL}" -ne 0 ] ; then # exist and overwrite install
|
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 extended volumes if needed
|
||||||
create_ext_lv
|
create_ext_lv
|
||||||
|
|
@ -278,7 +278,7 @@ function pre_install() {
|
||||||
else # exist and not overwriteinstall
|
else # exist and not overwriteinstall
|
||||||
cat <<- HEREDOC
|
cat <<- HEREDOC
|
||||||
***** ERROR : Logical volume "${VGNAME}-${LVROOTNAME}" already exists. *****
|
***** 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
|
HEREDOC
|
||||||
# Deactivate all lg and close the LUKS volume
|
# Deactivate all lg and close the LUKS volume
|
||||||
deactivate_and_close
|
deactivate_and_close
|
||||||
|
|
@ -288,13 +288,13 @@ function pre_install() {
|
||||||
if [ "${OVERWRITEINSTALL}" -ne 0 ] ; then # not exist and overwrite install
|
if [ "${OVERWRITEINSTALL}" -ne 0 ] ; then # not exist and overwrite install
|
||||||
cat <<- HEREDOC
|
cat <<- HEREDOC
|
||||||
***** ERROR : Logical volume "${VGNAME}-${LVROOTNAME}" doesn't exist while overwrite install. *****
|
***** 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
|
HEREDOC
|
||||||
# Deactivate all lg and close the LUKS volume
|
# Deactivate all lg and close the LUKS volume
|
||||||
deactivate_and_close
|
deactivate_and_close
|
||||||
return 1 # with error status
|
return 1 # with error status
|
||||||
else # not exist and not overwrite install
|
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.
|
# Too use the bash IFS, first parameter is not quoted.
|
||||||
lvcreate ${LVROOTSIZE} -n "${LVROOTNAME}" "${VGNAME}"
|
lvcreate ${LVROOTSIZE} -n "${LVROOTNAME}" "${VGNAME}"
|
||||||
if [ $? -ne 0 ] ; then deactivate_and_close; return 1 ; fi;
|
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} is defined by the caller of this function for BTRFS formated volume.
|
||||||
# ${BTRFSOPTION} have to be NOT quoted. Otherwise, mount will receive an empty
|
# ${BTRFSOPTION} have to be NOT quoted. Otherwise, mount will receive an empty
|
||||||
# string as first option, when the veraible is 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}"
|
mount ${BTRFSOPTION} /dev/mapper/"${VGNAME}"-"${LVROOTNAME}" "${TARGETMOUNTPOINT}"
|
||||||
|
|
||||||
# And mount other directories
|
# 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
|
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.
|
# 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"
|
mkdir "${TARGETMOUNTPOINT}/tmp/kaiten-yaki"
|
||||||
cp -r ./* -t "${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 here-document is script executed under chroot. At here we call
|
||||||
# the distribution dependent script "lib/chrooted_job_${DISTRIBUTIONSIGNATURE}.sh",
|
# the distribution dependent script "lib/chrooted_job_${DISTRIBUTIONSIGNATURE}.sh",
|
||||||
# which was copied to /temp at previous code.
|
# 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
|
# shellcheck disable=SC2086
|
||||||
cat <<- HEREDOC | chroot "${TARGETMOUNTPOINT}" /bin/bash
|
cat <<- HEREDOC | chroot "${TARGETMOUNTPOINT}" /bin/bash
|
||||||
cd /tmp/kaiten-yaki
|
cd /tmp/kaiten-yaki
|
||||||
|
|
@ -392,23 +392,23 @@ function post_install() {
|
||||||
HEREDOC
|
HEREDOC
|
||||||
|
|
||||||
# Unmount all. -l ( lazy ) option is added to supress the busy error.
|
# Unmount all. -l ( lazy ) option is added to supress the busy error.
|
||||||
echo "...Unmounting all."
|
echo "[Kaiten-Yaki] Unmounting all."
|
||||||
umount -R -l "${TARGETMOUNTPOINT}"
|
umount -R -l "${TARGETMOUNTPOINT}"
|
||||||
|
|
||||||
echo "...Post install process finished."
|
echo "[Kaiten-Yaki] Post install process finished."
|
||||||
|
|
||||||
# Free LUKS volume as swap volume.
|
# 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
|
swapoff -a
|
||||||
|
|
||||||
# Close LUKS
|
# 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}"
|
vgchange -a n "${VGNAME}"
|
||||||
echo "...Closing LUKS volume \"${CRYPTPARTNAME}\"."
|
echo "[Kaiten-Yaki] Closing LUKS volume \"${CRYPTPARTNAME}\"."
|
||||||
cryptsetup close "${CRYPTPARTNAME}"
|
cryptsetup close "${CRYPTPARTNAME}"
|
||||||
|
|
||||||
# Deleting the passphrase information.
|
# Deleting the passphrase information.
|
||||||
echo "...Deleting passphrase information."
|
echo "[Kaiten-Yaki] Deleting passphrase information."
|
||||||
PASSPHRASE=""
|
PASSPHRASE=""
|
||||||
export PASSPHRASE
|
export PASSPHRASE
|
||||||
|
|
||||||
|
|
@ -416,7 +416,7 @@ function post_install() {
|
||||||
cat <<- HEREDOC
|
cat <<- HEREDOC
|
||||||
****************** Install process finished ******************
|
****************** Install process finished ******************
|
||||||
|
|
||||||
...Ready to reboot.
|
[Kaiten-Yaki] Ready to reboot.
|
||||||
HEREDOC
|
HEREDOC
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
@ -433,32 +433,32 @@ function deactivate_and_close(){
|
||||||
|
|
||||||
if [ "${IS_ROOT_CREATED}" -ne 0 ] ; then # if extra volume 1 created
|
if [ "${IS_ROOT_CREATED}" -ne 0 ] ; then # if extra volume 1 created
|
||||||
# Remove newly created root volume
|
# 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}"
|
lvremove -f /dev/mapper/"${VGNAME}"-"${LVROOTNAME}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ "${IS_LVEXT1_CREATED}" -ne 0 ] ; then # if extra volume 1 created
|
if [ "${IS_LVEXT1_CREATED}" -ne 0 ] ; then # if extra volume 1 created
|
||||||
# Remove newly created extra volume 1
|
# 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}"
|
lvremove -f /dev/mapper/"${VGNAME}"-"${LVROOTNAME}${LVEXT1SUFFIX}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${IS_LVEXT2_CREATED}" -ne 0 ] ; then # if extra volume 2 created
|
if [ "${IS_LVEXT2_CREATED}" -ne 0 ] ; then # if extra volume 2 created
|
||||||
# Remove newly created extra volume 2
|
# 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}"
|
lvremove -f /dev/mapper/"${VGNAME}"-"${LVROOTNAME}${LVEXT2SUFFIX}"
|
||||||
fi
|
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}"
|
vgchange -a n "${VGNAME}"
|
||||||
echo "...Closing LUKS volume \"${CRYPTPARTNAME}\"."
|
echo "[Kaiten-Yaki] Closing LUKS volume \"${CRYPTPARTNAME}\"."
|
||||||
cryptsetup close "${CRYPTPARTNAME}"
|
cryptsetup close "${CRYPTPARTNAME}"
|
||||||
cat <<- HEREDOC
|
cat <<- HEREDOC
|
||||||
|
|
||||||
...Installation process terminated..
|
[Kaiten-Yaki] Installation process terminated..
|
||||||
HEREDOC
|
HEREDOC
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -469,11 +469,11 @@ function deactivate_and_close(){
|
||||||
function on_unexpected_installer_quit(){
|
function on_unexpected_installer_quit(){
|
||||||
echo "***** ERROR : The GUI/TUI installer terminated unexpectedly. *****"
|
echo "***** ERROR : The GUI/TUI installer terminated unexpectedly. *****"
|
||||||
if [ "${OVERWRITEINSTALL}" -ne 0 ] ; then # If overwrite install, keep the volume
|
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
|
fi
|
||||||
# Deactivate all lg and close the LUKS volume
|
# Deactivate all lg and close the LUKS volume
|
||||||
deactivate_and_close
|
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
|
if [ "${YESNO}" != "Y" ] && [ "${YESNO}" != "y" ] ; then
|
||||||
cat <<- HEREDOC
|
cat <<- HEREDOC
|
||||||
|
|
||||||
...Installation process terminated..
|
[Kaiten-Yaki] Installation process terminated..
|
||||||
HEREDOC
|
HEREDOC
|
||||||
return 1 # with error status
|
return 1 # with error status
|
||||||
fi # if YES
|
fi # if YES
|
||||||
|
|
@ -512,9 +512,9 @@ function distribution_check(){
|
||||||
function create_ext_lv() {
|
function create_ext_lv() {
|
||||||
if [ "${USELVEXT1}" -ne 0 ] ; then # if using extra volume 1
|
if [ "${USELVEXT1}" -ne 0 ] ; then # if using extra volume 1
|
||||||
if [ -e /dev/mapper/"${VGNAME}-${LVROOTNAME}${LVEXT1SUFFIX}" ] ; then # if extra volume 1 exist
|
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
|
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.
|
# Too use the bash IFS, first parameter is not quoted.
|
||||||
lvcreate ${LVEXT1SIZE} -n "${LVROOTNAME}${LVEXT1SUFFIX}" "${VGNAME}"
|
lvcreate ${LVEXT1SIZE} -n "${LVROOTNAME}${LVEXT1SUFFIX}" "${VGNAME}"
|
||||||
if [ $? -ne 0 ] ; then # if fail
|
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 [ "${USELVEXT2}" -ne 0 ] ; then # if using extra volume 2
|
||||||
if [ -e /dev/mapper/"${VGNAME}-${LVROOTNAME}${LVEXT2SUFFIX}" ] ; then # if extra volume 2 exist
|
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
|
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.
|
# Too use the bash IFS, first parameter is not quoted.
|
||||||
lvcreate ${LVEXT2SIZE} -n "${LVROOTNAME}${LVEXT2SUFFIX}" "${VGNAME}"
|
lvcreate ${LVEXT2SIZE} -n "${LVROOTNAME}${LVEXT2SUFFIX}" "${VGNAME}"
|
||||||
if [ $? -ne 0 ] ; then # if fail
|
if [ $? -ne 0 ] ; then # if fail
|
||||||
|
|
|
||||||
|
|
@ -81,13 +81,13 @@ function para_install_local() {
|
||||||
# Distrobution dependent message
|
# Distrobution dependent message
|
||||||
cat <<- HEREDOC
|
cat <<- HEREDOC
|
||||||
|
|
||||||
************************ CAUTION! CAUTION! CAUTION! ****************************
|
**************** CAUTION! CAUTION! CAUTION! ********************
|
||||||
|
[Kaiten-Yaki]
|
||||||
Make sure to click "Continue Testing", at the end of the Ubiquity installer.
|
[Kaiten-Yaki] Make sure to click "Continue Testing", at the end of
|
||||||
Just exit the installer without rebooting. Other wise, your system
|
[Kaiten-Yaki] the Ubiquity installer. Just exit the installer without
|
||||||
is unable to boot.
|
[Kaiten-Yaki] rebooting. Otherwise, your system becomes unable to boot.
|
||||||
|
[Kaiten-Yaki]
|
||||||
Type return key to start Ubiquity.
|
[Kaiten-Yaki] Type return key to start Ubiquity.
|
||||||
HEREDOC
|
HEREDOC
|
||||||
|
|
||||||
# waiting for a console input
|
# waiting for a console input
|
||||||
|
|
@ -134,12 +134,12 @@ function grub_check_and_modify_local() {
|
||||||
|
|
||||||
# Make target GRUB aware to the crypt partition
|
# Make target GRUB aware to the crypt partition
|
||||||
# This must do it after start of the file copy by installer, but before the end of the file copy.
|
# This must do it after start of the file copy by installer, but before the end of the file copy.
|
||||||
echo "...Adding GRUB_ENABLE_CRYPTODISK entry to ${TARGETMOUNTPOINT}/etc/default/grub "
|
echo "[Kaiten-Yaki] Adding GRUB_ENABLE_CRYPTODISK entry to ${TARGETMOUNTPOINT}/etc/default/grub "
|
||||||
echo "GRUB_ENABLE_CRYPTODISK=y" >> ${TARGETMOUNTPOINT}/etc/default/grub
|
echo "GRUB_ENABLE_CRYPTODISK=y" >> ${TARGETMOUNTPOINT}/etc/default/grub
|
||||||
|
|
||||||
# And then, wait for the end of installer process
|
# And then, wait for the end of installer process
|
||||||
echo "...Waiting for the end of GUI/TUI installer."
|
echo "[Kaiten-Yaki] Waiting for the end of GUI/TUI installer."
|
||||||
echo "...Again, DO NOT reboot/restart here. Just exit the GUI/TUI installer."
|
echo "[Kaiten-Yaki] Again, DO NOT reboot/restart here. Just exit the GUI/TUI installer."
|
||||||
wait $INSTALLER_PID
|
wait $INSTALLER_PID
|
||||||
|
|
||||||
# succesfull return
|
# succesfull return
|
||||||
|
|
|
||||||
|
|
@ -45,17 +45,17 @@ function main() {
|
||||||
export GRUB_ADDITIONAL_PARAMETERS="rd.auto=1 cryptdevice=${DEV}${CRYPTPARTITION}:${CRYPTPARTNAME} root=/dev/mapper/${VGNAME}-${LVROOTNAME}"
|
export GRUB_ADDITIONAL_PARAMETERS="rd.auto=1 cryptdevice=${DEV}${CRYPTPARTITION}:${CRYPTPARTNAME} root=/dev/mapper/${VGNAME}-${LVROOTNAME}"
|
||||||
if grep "$GRUB_ADDITIONAL_PARAMETERS" /etc/default/grub ; then # Is additonal parameter already added?
|
if grep "$GRUB_ADDITIONAL_PARAMETERS" /etc/default/grub ; then # Is additonal parameter already added?
|
||||||
# Yes
|
# Yes
|
||||||
echo ".../etc/default/grub already modified. OK, skipping to modiy."
|
echo "[Kaiten-Yaki] /etc/default/grub already modified. OK, skipping to modiy."
|
||||||
else
|
else
|
||||||
# Not yet. Let's add.
|
# Not yet. Let's add.
|
||||||
echo "...Modify /etc/default/grub."
|
echo "[Kaiten-Yaki] Modify /etc/default/grub."
|
||||||
sed -i -e "/GRUB_CMDLINE_LINUX_DEFAULT/{s#\"# ${GRUB_ADDITIONAL_PARAMETERS}\"#2}" /etc/default/grub
|
sed -i -e "/GRUB_CMDLINE_LINUX_DEFAULT/{s#\"# ${GRUB_ADDITIONAL_PARAMETERS}\"#2}" /etc/default/grub
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Common part of the pre-install stage
|
# Common part of the pre-install stage
|
||||||
if ! pre_install ; then
|
if ! pre_install ; then
|
||||||
# If error, restore the modification.
|
# If error, restore the modification.
|
||||||
echo "...restoring /etc/default/grub, if needed"
|
echo "[Kaiten-Yaki] restoring /etc/default/grub, if needed"
|
||||||
sed -i -e "s#${GRUB_ADDITIONAL_PARAMETERS}##" /etc/default/grub
|
sed -i -e "s#${GRUB_ADDITIONAL_PARAMETERS}##" /etc/default/grub
|
||||||
return 1 # with error status
|
return 1 # with error status
|
||||||
fi
|
fi
|
||||||
|
|
@ -96,13 +96,13 @@ function para_install_local() {
|
||||||
# Distrobution dependent message
|
# Distrobution dependent message
|
||||||
cat <<- HEREDOC
|
cat <<- HEREDOC
|
||||||
|
|
||||||
************************ CAUTION! CAUTION! CAUTION! ****************************
|
******************** CAUTION! CAUTION! CAUTION! ************************
|
||||||
|
[Kaiten-Yaki]
|
||||||
Make sure to click "NO", if the void-installer ask you to reboot.
|
[Kaiten-Yaki] Make sure to click "NO", if the void-installer ask you to
|
||||||
Just exit the installer without rebooting. Other wise, your system
|
[Kaiten-Yaki] reboot.Just exit the installer without rebooting. Otherwise,
|
||||||
is unable to boot.
|
[Kaiten-Yaki] your system becomes unable to boot.
|
||||||
|
[Kaiten-Yaki]
|
||||||
Type return key to start void-installer.
|
[Kaiten-Yaki] Type return key to start void-installer.
|
||||||
HEREDOC
|
HEREDOC
|
||||||
|
|
||||||
# waiting for a console input
|
# waiting for a console input
|
||||||
|
|
@ -123,7 +123,7 @@ function para_install_local() {
|
||||||
# If exist, the grub was not modifyed -> void-installer termianted unexpectedly
|
# If exist, the grub was not modifyed -> void-installer termianted unexpectedly
|
||||||
# Delete the nwe volume if overwrite install, and close all
|
# Delete the nwe volume if overwrite install, and close all
|
||||||
on_unexpected_installer_quit
|
on_unexpected_installer_quit
|
||||||
echo "...restoring modified /etc/default/grub."
|
echo "[Kaiten-Yaki] restoring modified /etc/default/grub."
|
||||||
sed -i "s#loglevel=4 ${GRUB_ADDITIONAL_PARAMETERS}#loglevel=4#" /etc/default/grub
|
sed -i "s#loglevel=4 ${GRUB_ADDITIONAL_PARAMETERS}#loglevel=4#" /etc/default/grub
|
||||||
return 1 # with error status
|
return 1 # with error status
|
||||||
fi
|
fi
|
||||||
|
|
@ -149,7 +149,7 @@ function grub_check_and_modify_local() {
|
||||||
|
|
||||||
# Make target GRUB aware to the crypt partition
|
# Make target GRUB aware to the crypt partition
|
||||||
# This must do it after start of the file copy by installer, but before the end of the file copy.
|
# This must do it after start of the file copy by installer, but before the end of the file copy.
|
||||||
echo "...Adding GRUB_ENABLE_CRYPTODISK entry to ${TARGETMOUNTPOINT}/etc/default/grub "
|
echo "[Kaiten-Yaki] Adding GRUB_ENABLE_CRYPTODISK entry to ${TARGETMOUNTPOINT}/etc/default/grub "
|
||||||
echo "GRUB_ENABLE_CRYPTODISK=y" >> ${TARGETMOUNTPOINT}/etc/default/grub
|
echo "GRUB_ENABLE_CRYPTODISK=y" >> ${TARGETMOUNTPOINT}/etc/default/grub
|
||||||
|
|
||||||
# succesfull return
|
# succesfull return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue