mirror of
https://github.com/suikan4github/kaiten-yaki.git
synced 2025-12-20 10:31:17 -03:00
Refactoed common function
These common function is renamed with _common explicitly.
This commit is contained in:
parent
ccc7d009f6
commit
54f80d7f80
5 changed files with 28 additions and 29 deletions
|
|
@ -3,7 +3,7 @@
|
||||||
# Confirmation and Passphrase setting
|
# Confirmation and Passphrase setting
|
||||||
# *******************************************************************************
|
# *******************************************************************************
|
||||||
|
|
||||||
function confirmation(){
|
function confirmation_common(){
|
||||||
|
|
||||||
# Consistency check for the OVERWRITEINSTALL and ERASEALL
|
# Consistency check for the OVERWRITEINSTALL and ERASEALL
|
||||||
if [ ${ERASEALL} -eq 1 -a ${OVERWRITEINSTALL} -eq 1 ] ; then
|
if [ ${ERASEALL} -eq 1 -a ${OVERWRITEINSTALL} -eq 1 ] ; then
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash -u
|
#!/bin/bash -u
|
||||||
|
|
||||||
function parainstall_msg() {
|
function para_install_msg_common() {
|
||||||
|
|
||||||
cat <<- HEREDOC
|
cat <<- HEREDOC
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
# Pre-install stage
|
# Pre-install stage
|
||||||
# *******************************************************************************
|
# *******************************************************************************
|
||||||
|
|
||||||
function pre_install() {
|
function pre_install_common() {
|
||||||
|
|
||||||
|
|
||||||
# ----- Erase entire disk, create partitions, format them and encrypt the LUKS partition -----
|
# ----- Erase entire disk, create partitions, format them and encrypt the LUKS partition -----
|
||||||
|
|
@ -5,9 +5,9 @@ function main() {
|
||||||
source config.sh
|
source config.sh
|
||||||
|
|
||||||
# Load functions
|
# Load functions
|
||||||
source lib/confirmation.sh
|
source lib/confirmation_common.sh
|
||||||
source lib/preinstall.sh
|
source lib/pre_install_common.sh
|
||||||
source lib/parainstall_msg.sh
|
source lib/para_install_msg_common.sh
|
||||||
|
|
||||||
|
|
||||||
# This is the mount point of the install target.
|
# This is the mount point of the install target.
|
||||||
|
|
@ -38,7 +38,7 @@ function main() {
|
||||||
# *******************************************************************************
|
# *******************************************************************************
|
||||||
|
|
||||||
# Common part of the parameter confirmation
|
# Common part of the parameter confirmation
|
||||||
if ! confirmation ; then
|
if ! confirmation_common ; then
|
||||||
return 1 # with error status
|
return 1 # with error status
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -47,7 +47,7 @@ function main() {
|
||||||
# *******************************************************************************
|
# *******************************************************************************
|
||||||
|
|
||||||
# Common part of the pre-install stage
|
# Common part of the pre-install stage
|
||||||
if ! pre_install ; then
|
if ! pre_install_common ; then
|
||||||
return 1 # with error status
|
return 1 # with error status
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -57,7 +57,7 @@ function main() {
|
||||||
# *******************************************************************************
|
# *******************************************************************************
|
||||||
|
|
||||||
# Show common message to let the operator focus on the critical part
|
# Show common message to let the operator focus on the critical part
|
||||||
parainstall_msg
|
para_install_msg_common
|
||||||
|
|
||||||
# Ubuntu dependent message
|
# Ubuntu dependent message
|
||||||
cat <<- HEREDOC
|
cat <<- HEREDOC
|
||||||
|
|
@ -80,10 +80,10 @@ function main() {
|
||||||
# Record the PID of the installer.
|
# Record the PID of the installer.
|
||||||
export INSTALLER_PID=$!
|
export INSTALLER_PID=$!
|
||||||
|
|
||||||
# Common part of the para-install.
|
|
||||||
# Record the install PID, modify the /etc/default/grub of the target,
|
# Record the install PID, modify the /etc/default/grub of the target,
|
||||||
# and then, wait for the end of sintaller.
|
# and then, wait for the end of the intaller.
|
||||||
if ! grub_check_and_modify_ubuntu ; then
|
if ! grub_check_and_modify ; then
|
||||||
return 1 # with error status
|
return 1 # with error status
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -92,7 +92,7 @@ function main() {
|
||||||
# *******************************************************************************
|
# *******************************************************************************
|
||||||
|
|
||||||
# Finalizing. Embedd encryption key into the ramfs image.
|
# Finalizing. Embedd encryption key into the ramfs image.
|
||||||
post_install_ubuntu
|
post_install
|
||||||
|
|
||||||
# Normal end
|
# Normal end
|
||||||
return 0
|
return 0
|
||||||
|
|
@ -102,7 +102,7 @@ function main() {
|
||||||
|
|
||||||
# *******************************************************************************
|
# *******************************************************************************
|
||||||
# Ubuntu dependent post-installation process
|
# Ubuntu dependent post-installation process
|
||||||
function post_install_ubuntu() {
|
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
|
||||||
echo "...Mounting /dev/mapper/${VGNAME}-${LVROOTNAME} on ${TARGETMOUNTPOINT}."
|
echo "...Mounting /dev/mapper/${VGNAME}-${LVROOTNAME} on ${TARGETMOUNTPOINT}."
|
||||||
|
|
@ -162,12 +162,12 @@ function post_install_ubuntu() {
|
||||||
|
|
||||||
retrun 0
|
retrun 0
|
||||||
|
|
||||||
} # End of post_install_ubuntu()
|
} # End of post_install()
|
||||||
|
|
||||||
|
|
||||||
# *******************************************************************************
|
# *******************************************************************************
|
||||||
# This function will be executed in the foreguround context, to watch the GUI installer.
|
# This function will be executed in the foreguround context, to watch the GUI installer.
|
||||||
function grub_check_and_modify_ubuntu() {
|
function grub_check_and_modify() {
|
||||||
|
|
||||||
# While the /etc/default/grub in the install target is NOT existing, keep sleeping.
|
# While the /etc/default/grub in the install target is NOT existing, keep sleeping.
|
||||||
# If installer terminated without file copy, this script also terminates.
|
# If installer terminated without file copy, this script also terminates.
|
||||||
|
|
@ -211,7 +211,7 @@ function grub_check_and_modify_ubuntu() {
|
||||||
# succesfull return
|
# succesfull return
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
} # grub_check_and_modify_ubuntu()
|
} # grub_check_and_modify()
|
||||||
|
|
||||||
# *******************************************************************************
|
# *******************************************************************************
|
||||||
# Execute
|
# Execute
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,9 @@ function main() {
|
||||||
source config.sh
|
source config.sh
|
||||||
|
|
||||||
# Load functions
|
# Load functions
|
||||||
source lib/confirmation.sh
|
source lib/confirmation_common.sh
|
||||||
source lib/preinstall.sh
|
source lib/pre_install_common.sh
|
||||||
source lib/parainstall_msg.sh
|
source lib/para_install_msg_common.sh
|
||||||
|
|
||||||
|
|
||||||
# This is the mount point of the install target.
|
# This is the mount point of the install target.
|
||||||
|
|
@ -38,7 +38,7 @@ function main() {
|
||||||
# *******************************************************************************
|
# *******************************************************************************
|
||||||
|
|
||||||
# Common part of the parameter confirmation
|
# Common part of the parameter confirmation
|
||||||
if ! confirmation ; then
|
if ! confirmation_common ; then
|
||||||
return 1 # with error status
|
return 1 # with error status
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -50,7 +50,7 @@ function main() {
|
||||||
xbps-install -y -Su xbps gptfdisk
|
xbps-install -y -Su xbps gptfdisk
|
||||||
|
|
||||||
# Common part of the pre-install stage
|
# Common part of the pre-install stage
|
||||||
if ! pre_install ; then
|
if ! pre_install_common ; then
|
||||||
return 1 # with error status
|
return 1 # with error status
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -66,7 +66,8 @@ function main() {
|
||||||
# *******************************************************************************
|
# *******************************************************************************
|
||||||
|
|
||||||
# Show common message to let the operator focus on the critical part
|
# Show common message to let the operator focus on the critical part
|
||||||
parainstall_msg
|
para_install_msg_common
|
||||||
|
|
||||||
# Void-Linux dependent message
|
# Void-Linux dependent message
|
||||||
cat <<- HEREDOC
|
cat <<- HEREDOC
|
||||||
|
|
||||||
|
|
@ -112,14 +113,12 @@ function main() {
|
||||||
return 1 # with error status
|
return 1 # with error status
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# At here, the installation was successful.
|
|
||||||
|
|
||||||
# *******************************************************************************
|
# *******************************************************************************
|
||||||
# Post-install stage
|
# Post-install stage
|
||||||
# *******************************************************************************
|
# *******************************************************************************
|
||||||
|
|
||||||
# Finalizing. Embedd encryption key into the ramfs image.
|
# Finalizing. Embedd encryption key into the ramfs image.
|
||||||
post_install_void
|
post_install
|
||||||
|
|
||||||
# Normal end
|
# Normal end
|
||||||
return 0
|
return 0
|
||||||
|
|
@ -129,7 +128,7 @@ function main() {
|
||||||
|
|
||||||
# *******************************************************************************
|
# *******************************************************************************
|
||||||
# Void Linux dependent post-installation process
|
# Void Linux dependent post-installation process
|
||||||
function post_install_void() {
|
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
|
||||||
echo "...Mounting /dev/mapper/${VGNAME}-${LVROOTNAME} on ${TARGETMOUNTPOINT}."
|
echo "...Mounting /dev/mapper/${VGNAME}-${LVROOTNAME} on ${TARGETMOUNTPOINT}."
|
||||||
|
|
@ -192,7 +191,7 @@ function post_install_void() {
|
||||||
|
|
||||||
retrun 0
|
retrun 0
|
||||||
|
|
||||||
} # End of post_install_void()
|
} # End of post_install()
|
||||||
|
|
||||||
|
|
||||||
# *******************************************************************************
|
# *******************************************************************************
|
||||||
|
|
@ -217,7 +216,7 @@ function grub_check_and_modify_void() {
|
||||||
# succesfull return
|
# succesfull return
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
} # gurb_check_and_modify_void()
|
} # grub_check_and_modify()
|
||||||
|
|
||||||
# *******************************************************************************
|
# *******************************************************************************
|
||||||
# Execute
|
# Execute
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue