Refactored

Distribution check is now common function
This commit is contained in:
Suikan 2021-07-03 09:47:42 +09:00
parent 8ab8143838
commit 2d2d200fef
3 changed files with 49 additions and 42 deletions

View file

@ -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