mirror of
https://github.com/suikan4github/kaiten-yaki.git
synced 2025-12-20 10:31:17 -03:00
Refactored
Distribution check is now common function
This commit is contained in:
parent
8ab8143838
commit
2d2d200fef
3 changed files with 49 additions and 42 deletions
|
|
@ -276,7 +276,6 @@ function deactivate_and_close(){
|
|||
# *******************************************************************************
|
||||
# Delete the nwe volume if overwrite install, and close all
|
||||
# *******************************************************************************
|
||||
|
||||
function on_unexpected_installer_quit(){
|
||||
echo "***** ERROR : The GUI/TUI installer terminated unexpectedly. *****"
|
||||
if [ "${OVERWRITEINSTALL}" -eq 0 ] ; then # If not over install, volume is new. So delete it
|
||||
|
|
@ -287,3 +286,31 @@ function on_unexpected_installer_quit(){
|
|||
deactivate_and_close
|
||||
echo "...The new logical volume has been deleted. You can retry Kaiten-yaki again."
|
||||
}
|
||||
|
||||
|
||||
# *******************************************************************************
|
||||
# Check whether given signaure is in the system information
|
||||
# *******************************************************************************
|
||||
function distribution_check(){
|
||||
if ! uname -a | grep "${DISTRIBUTIONSIGNATURE}" -i > /dev/null ; then # Signature is not found in the OS name.
|
||||
echo "*******************************************************************************"
|
||||
uname -a
|
||||
cat <<- HEREDOC
|
||||
*******************************************************************************
|
||||
This system seems to be not $DISTRIBUTIONNAME, while this script is dediated to the $DISTRIBUTIONNAME.
|
||||
Are you sure you want to run this script? [Y/N]
|
||||
HEREDOC
|
||||
read -r YESNO
|
||||
if [ "${YESNO}" != "Y" ] && [ "${YESNO}" != "y" ] ; then
|
||||
cat <<- HEREDOC
|
||||
|
||||
...Installation process terminated..
|
||||
HEREDOC
|
||||
return 1 # with error status
|
||||
fi # if YES
|
||||
|
||||
fi # Distribution check
|
||||
|
||||
# no error
|
||||
return 0
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
# Load configuration parameter
|
||||
source ./config.sh
|
||||
|
||||
# Load functions
|
||||
# Load common functions
|
||||
source ./lib.sh
|
||||
|
||||
function main() {
|
||||
|
|
@ -12,30 +12,20 @@ function main() {
|
|||
# This is the mount point of the install target.
|
||||
export TARGETMOUNTPOINT="/target"
|
||||
|
||||
# Distribution check
|
||||
if ! uname -a | grep ubuntu -i > /dev/null ; then # "Ubuntu" is not found in the OS name.
|
||||
echo "*******************************************************************************"
|
||||
uname -a
|
||||
cat <<- HEREDOC
|
||||
*******************************************************************************
|
||||
This system seems to be not Ubuntu, while this script is dediated to the Ubuntu.
|
||||
Are you sure you want to run this script? [Y/N]
|
||||
HEREDOC
|
||||
read -r YESNO
|
||||
if [ "${YESNO}" != "Y" ] && [ "${YESNO}" != "y" ] ; then
|
||||
cat <<- HEREDOC
|
||||
|
||||
...Installation process terminated..
|
||||
HEREDOC
|
||||
return 1 # with error status
|
||||
fi # if YES
|
||||
|
||||
fi # Distribution check
|
||||
|
||||
# *******************************************************************************
|
||||
# Confirmation before installation
|
||||
# *******************************************************************************
|
||||
|
||||
# parameters for distribution check
|
||||
export DISTRIBUTIONSIGNATURE="ubuntu"
|
||||
export DISTRIBUTIONNAME="Ubuntu"
|
||||
|
||||
# Check whetehr given signature exist or not
|
||||
if ! distribution_check ; then
|
||||
return 1 # with error status
|
||||
fi
|
||||
|
||||
# Common part of the parameter confirmation
|
||||
if ! confirmation ; then
|
||||
return 1 # with error status
|
||||
|
|
|
|||
|
|
@ -4,38 +4,28 @@
|
|||
# Load configuration parameter
|
||||
source ./config.sh
|
||||
|
||||
# Load functions
|
||||
# Load common functions
|
||||
source ./lib.sh
|
||||
|
||||
function main() {
|
||||
|
||||
# This is the mount point of the install target.
|
||||
export TARGETMOUNTPOINT="/mnt/target"
|
||||
|
||||
# Distribution check
|
||||
if ! uname -a | grep void -i > /dev/null ; then # "Void" is not found in the OS name.
|
||||
echo "*******************************************************************************"
|
||||
uname -a
|
||||
cat <<- HEREDOC
|
||||
*******************************************************************************
|
||||
This system seems to be not Void Linux, while this script is dediated to the Void Linux.
|
||||
Are you sure you want to run this script? [Y/N]
|
||||
HEREDOC
|
||||
read -r YESNO
|
||||
if [ "${YESNO}" != "Y" ] && [ "${YESNO}" != "y" ] ; then
|
||||
cat <<- HEREDOC
|
||||
|
||||
...Installation process terminated..
|
||||
HEREDOC
|
||||
return 1 # with error status
|
||||
fi # if YES
|
||||
|
||||
fi # Distribution check
|
||||
|
||||
|
||||
# *******************************************************************************
|
||||
# Confirmation before installation
|
||||
# *******************************************************************************
|
||||
|
||||
# parameters for distribution check
|
||||
export DISTRIBUTIONSIGNATURE="void"
|
||||
export DISTRIBUTIONNAME="Void Linux"
|
||||
|
||||
# Check whetehr given signature exist or not
|
||||
if ! distribution_check ; then
|
||||
return 1 # with error status
|
||||
fi
|
||||
|
||||
# Common part of the parameter confirmation
|
||||
if ! confirmation ; then
|
||||
return 1 # with error status
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue