mirror of
https://github.com/suikan4github/kaiten-yaki.git
synced 2025-12-20 02:21:17 -03:00
Added overwrite install
This commit is contained in:
parent
5cbe95252c
commit
791ffa6112
3 changed files with 58 additions and 20 deletions
|
|
@ -5,12 +5,25 @@
|
|||
|
||||
function confirmation(){
|
||||
|
||||
# Consistency check for the OVERWRITEINSTALL and ERASEALL
|
||||
if [ ${ERASEALL} -eq 1 -a ${OVERWRITEINSTALL} -eq 1 ] ; then
|
||||
cat <<- HEREDOC 1>&2
|
||||
***** ERROR : Confliction between ERASEALL and OVERWRITEINATALL *****
|
||||
...ERASEALL = ${ERASEALL}
|
||||
...OVERWRITEINSTALL = ${OVERWRITEINSTALL}
|
||||
...Check configuration in config.txt
|
||||
|
||||
...Installation process terminated..
|
||||
HEREDOC
|
||||
|
||||
fi
|
||||
|
||||
# Sanity check for volume group name
|
||||
if echo ${VGNAME} | grep "-" -i > /dev/null ; then # "-" is found in the volume group name.
|
||||
cat <<- HEREDOC 1>&2
|
||||
***** ERROR : VGNAME is "${VGNAME}" *****
|
||||
..."-" is not allowed in the volume name.
|
||||
...Check passphrase and config.txt
|
||||
...Check configuration in config.txt
|
||||
|
||||
...Installation process terminated..
|
||||
HEREDOC
|
||||
|
|
@ -22,7 +35,7 @@ function confirmation(){
|
|||
cat <<- HEREDOC 1>&2
|
||||
***** ERROR : LVROOTNAME is "${LVROOTNAME}" *****
|
||||
..."-" is not allowed in the volume name.
|
||||
...Check passphrase and config.txt
|
||||
...Check configuration in config.txt
|
||||
|
||||
...Installation process terminated..
|
||||
HEREDOC
|
||||
|
|
@ -34,7 +47,7 @@ function confirmation(){
|
|||
cat <<- HEREDOC 1>&2
|
||||
***** ERROR : LVSWAPNAME is "${LVSWAPNAME}" *****
|
||||
..."-" is not allowed in the volume name.
|
||||
...Check passphrase and config.txt
|
||||
...Check configuration in config.txt
|
||||
|
||||
...Installation process terminated..
|
||||
HEREDOC
|
||||
|
|
|
|||
|
|
@ -79,7 +79,10 @@ function pre_install() {
|
|||
fi # if /dev/mapper/swap volume already exit.
|
||||
|
||||
# Create a ROOT Logical Volume on VG.
|
||||
if [ -e /dev/mapper/${VGNAME}-${LVROOTNAME} ] ; then
|
||||
if [ -e /dev/mapper/${VGNAME}-${LVROOTNAME} ] ; then # exist
|
||||
if [ ${OVERWRITEINATALL} -eq 1 ] ; then # exist and overwrite install
|
||||
echo "...Logical volume "${VGNAME}-${LVROOTNAME}" already exists. OK."
|
||||
else # exist and not overwriteinstall
|
||||
cat <<- HEREDOC 1>&2
|
||||
***** ERROR : Logical volume "${VGNAME}-${LVROOTNAME}" already exists. *****
|
||||
...Check LVROOTNAME environment variable in config.txt.
|
||||
|
|
@ -93,10 +96,28 @@ function pre_install() {
|
|||
...Installation process terminated..
|
||||
HEREDOC
|
||||
return 1 # with error status
|
||||
else
|
||||
fi
|
||||
else # not exsit
|
||||
if [ ${OVERWRITEINATALL} -eq 1 ] ; then
|
||||
cat <<- HEREDOC 1>&2
|
||||
***** ERROR : Logical volume "${VGNAME}-${LVROOTNAME}" doesn't exist while overwrite install. *****
|
||||
...Check consistency of config.txt.
|
||||
HEREDOC
|
||||
echo "...Deactivate all logical volumes in volume group \"${VGNAME}\"."
|
||||
vgchange -a n ${VGNAME}
|
||||
echo "...Close LUKS volume \"${CRYPTPARTNAME}\"."
|
||||
cryptsetup close ${CRYPTPARTNAME}
|
||||
cat <<- HEREDOC 1>&2
|
||||
|
||||
...Installation process terminated..
|
||||
HEREDOC
|
||||
return 1 # with error status
|
||||
else # not exist and not overwrite install
|
||||
echo "...Create logical volume \"${LVROOTNAME}\" on \"${VGNAME}\"."
|
||||
lvcreate -l ${LVROOTSIZE} -n ${LVROOTNAME} ${VGNAME}
|
||||
fi # if the root volun already exist
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# successful return
|
||||
return 0
|
||||
|
|
|
|||
|
|
@ -26,6 +26,10 @@ export CRYPTPARTNAME="luks_volume"
|
|||
export VGNAME="vg1"
|
||||
export LVSWAPNAME="swap"
|
||||
|
||||
# Do not touch this parameter, unless you understand precisely what you are doing.
|
||||
# 1 : Overwrite the existing logical volume as root vlume. 0 : Create new logical volume as root volume.
|
||||
export OVERWRITEINSTALL=0
|
||||
|
||||
# Void Linux only. Ignored in Ubuntu.
|
||||
# The font size of the void-installer
|
||||
export XTERMFONTSIZE=11
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue