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
|
|
@ -79,24 +79,45 @@ 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
|
||||
cat <<- HEREDOC 1>&2
|
||||
***** ERROR : Logical volume "${VGNAME}-${LVROOTNAME}" already exists. *****
|
||||
...Check LVROOTNAME environment variable in 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
|
||||
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.
|
||||
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
|
||||
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
|
||||
fi
|
||||
|
||||
...Installation process terminated..
|
||||
HEREDOC
|
||||
return 1 # with error status
|
||||
else
|
||||
echo "...Create logical volume \"${LVROOTNAME}\" on \"${VGNAME}\"."
|
||||
lvcreate -l ${LVROOTSIZE} -n ${LVROOTNAME} ${VGNAME}
|
||||
fi # if the root volun already exist
|
||||
|
||||
# successful return
|
||||
return 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue