Update common.sh

This commit is contained in:
tromcho 2023-02-21 14:01:52 +07:00 committed by GitHub
parent 6b5d7e4b10
commit 731242bfb2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -82,7 +82,7 @@ function confirmation(){
return 1 # with error status return 1 # with error status
fi # "-" is found in the volume name. fi # "-" is found in the volume name.
# For surre ask the your config.sh is edited # Make sure config.sh is edited
cat <<- HEREDOC cat <<- HEREDOC
LUKS volume partition : ${DEV}${CRYPTPARTITION} LUKS volume partition : ${DEV}${CRYPTPARTITION}
@ -149,7 +149,7 @@ function confirmation(){
# -l ###%[FREE|VG|PVS|ORIGIN] : Size by relative value. # -l ###%[FREE|VG|PVS|ORIGIN] : Size by relative value.
# -L ###[M|G|T|m|g|t] : Size by absolute value. # -L ###[M|G|T|m|g|t] : Size by absolute value.
# Too preven the duplicated match, awk exists the process after it match the /%/ pattern. # Too preven the duplicated match, awk exists the process after it match the /%/ pattern.
# If Unit is not specified, installation will fail. # If the unit is not specified, installation will fail.
LVSWAPSIZE=$(echo "${LVSWAPSIZE}" | awk '/%/{print "-l", $0; exit} /M|G|T|m|g|t/{print "-L", $0}') LVSWAPSIZE=$(echo "${LVSWAPSIZE}" | awk '/%/{print "-l", $0; exit} /M|G|T|m|g|t/{print "-L", $0}')
export LVSWAPSIZE export LVSWAPSIZE
@ -228,7 +228,7 @@ function pre_install() {
echo "[Kaiten-Yaki] 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 it successfully opens. 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}". *****
@ -240,7 +240,7 @@ function pre_install() {
fi # if crypt volume is unable to open fi # if crypt volume is unable to open
# ----- Configure the LVM in LUKS volume ----- # ----- Configure the LVM in LUKS volume -----
# Check volume group ${VGNAME} exist or not # Check if 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 "[Kaiten-Yaki] Volume group \"${VGNAME}\" already exist. Skipped to create. No problem." echo "[Kaiten-Yaki] Volume group \"${VGNAME}\" already exist. Skipped to create. No problem."
echo "[Kaiten-Yaki] Activating all logical volumes in volume group \"${VGNAME}\"." echo "[Kaiten-Yaki] Activating all logical volumes in volume group \"${VGNAME}\"."
@ -360,17 +360,17 @@ function para_install_msg() {
# ******************************************************************************* # *******************************************************************************
# Common post-install stage # Common post-install stage
# ******************************************************************************* # *******************************************************************************
# In side this script, the chrooted job is parameterrized as by evn variable TARGETCHROOTEDJOB # Inside this script, the chrooted job is parameterized as by evn variable TARGETCHROOTEDJOB
function post_install() { function post_install() {
## Mount the target file system ## Mount the target file system
# ${TARGETMOUNTPOINT} is created by the GUI/TUI installer # ${TARGETMOUNTPOINT} is created by the GUI/TUI installer.
# ${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 "[Kaiten-Yaki] 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 "[Kaiten-Yaki] 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
@ -401,7 +401,7 @@ function post_install() {
echo "[Kaiten-Yaki] 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 "[Kaiten-Yaki] 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 "[Kaiten-Yaki] Closing LUKS volume \"${CRYPTPARTNAME}\"." echo "[Kaiten-Yaki] Closing LUKS volume \"${CRYPTPARTNAME}\"."
@ -412,7 +412,7 @@ function post_install() {
PASSPHRASE="" PASSPHRASE=""
export PASSPHRASE export PASSPHRASE
# Finishing message # Finishing message.
cat <<- HEREDOC cat <<- HEREDOC
****************** Install process finished ****************** ****************** Install process finished ******************
@ -464,7 +464,7 @@ function deactivate_and_close(){
} }
# ******************************************************************************* # *******************************************************************************
# Delete the nwe volume if overwrite install, and close all # Delete the new volume if overwrite install, and close all
# ******************************************************************************* # *******************************************************************************
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. *****"
@ -478,7 +478,7 @@ function on_unexpected_installer_quit(){
# ******************************************************************************* # *******************************************************************************
# Check whether given signaure is in the system information # Check whether given signature is in the system information
# ******************************************************************************* # *******************************************************************************
function distribution_check(){ function distribution_check(){
if ! uname -a | grep "${DISTRIBUTIONSIGNATURE}" -i > /dev/null ; then # Signature is not found in the OS name. if ! uname -a | grep "${DISTRIBUTIONSIGNATURE}" -i > /dev/null ; then # Signature is not found in the OS name.
@ -537,7 +537,7 @@ function create_ext_lv() {
echo "***** ERROR : failed to create "${VGNAME}-${LVROOTNAME}${LVEXT1SUFFIX}" . *****" echo "***** ERROR : failed to create "${VGNAME}-${LVROOTNAME}${LVEXT1SUFFIX}" . *****"
return 1 ; return 1 ;
else # if success else # if success
IS_LVEXT2_CREATED=1 # Mark this volume is created IS_LVEXT2_CREATED=1 # Mark this volume as created
fi; fi;
fi fi
fi fi