mirror of
https://github.com/suikan4github/kaiten-yaki.git
synced 2025-12-20 02:21:17 -03:00
Add volume protection logic
In cae of the unexpected quit of GUI/TUI installer, The target volume was deleted always. Changed it to delete only when
This commit is contained in:
parent
fb3720787c
commit
b9e490e5f3
4 changed files with 28 additions and 27 deletions
|
|
@ -7,7 +7,7 @@ function confirmation_common(){
|
|||
|
||||
# Consistency check for the OVERWRITEINSTALL and ERASEALL
|
||||
if [ ${ERASEALL} -eq 1 -a ${OVERWRITEINSTALL} -eq 1 ] ; then
|
||||
cat <<- HEREDOC 1>&2
|
||||
cat <<- HEREDOC
|
||||
***** ERROR : Confliction between ERASEALL and OVERWRITEINSTALL *****
|
||||
...ERASEALL = ${ERASEALL}
|
||||
...OVERWRITEINSTALL = ${OVERWRITEINSTALL}
|
||||
|
|
@ -20,7 +20,7 @@ function confirmation_common(){
|
|||
|
||||
# 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
|
||||
cat <<- HEREDOC
|
||||
***** ERROR : VGNAME is "${VGNAME}" *****
|
||||
..."-" is not allowed in the volume name.
|
||||
...Check configuration in your config.sh
|
||||
|
|
@ -32,7 +32,7 @@ function confirmation_common(){
|
|||
|
||||
# Sanity check for root volume name
|
||||
if echo ${LVROOTNAME} | grep "-" -i > /dev/null ; then # "-" is found in the volume name.
|
||||
cat <<- HEREDOC 1>&2
|
||||
cat <<- HEREDOC
|
||||
***** ERROR : LVROOTNAME is "${LVROOTNAME}" *****
|
||||
..."-" is not allowed in the volume name.
|
||||
...Check configuration in your config.sh
|
||||
|
|
@ -44,7 +44,7 @@ function confirmation_common(){
|
|||
|
||||
# Sanity check for swap volume name
|
||||
if echo ${LVSWAPNAME} | grep "-" -i > /dev/null ; then # "-" is found in the volume name.
|
||||
cat <<- HEREDOC 1>&2
|
||||
cat <<- HEREDOC
|
||||
***** ERROR : LVSWAPNAME is "${LVSWAPNAME}" *****
|
||||
..."-" is not allowed in the volume name.
|
||||
...Check configuration in your config.sh
|
||||
|
|
@ -63,7 +63,7 @@ function confirmation_common(){
|
|||
HEREDOC
|
||||
read YESNO
|
||||
if [ ${YESNO} != "Y" -a ${YESNO} != "y" ] ; then
|
||||
cat <<- HEREDOC 1>&2
|
||||
cat <<- HEREDOC
|
||||
|
||||
...Installation process terminated..
|
||||
HEREDOC
|
||||
|
|
@ -75,7 +75,7 @@ function confirmation_common(){
|
|||
echo "Are you sure you want to erase entire ${DEV}? [Y/N]"
|
||||
read YESNO
|
||||
if [ ${YESNO} != "Y" -a ${YESNO} != "y" ] ; then
|
||||
cat <<-HEREDOC 1>&2
|
||||
cat <<-HEREDOC
|
||||
...Check your config.sh. The variable ERASEALL is ${ERASEALL}.
|
||||
|
||||
...Installation process terminated..
|
||||
|
|
@ -96,7 +96,7 @@ function confirmation_common(){
|
|||
|
||||
# Validate whether both are indentical or not
|
||||
if [ ${PASSPHRASE} != ${PASSPHRASE_C} ] ; then
|
||||
cat <<-HEREDOC 1>&2
|
||||
cat <<-HEREDOC
|
||||
***** ERROR : Passphrase doesn't match *****
|
||||
|
||||
...Installation process terminated..
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ function pre_install_common() {
|
|||
|
||||
# Check whether successful open. If mapped, it is successful.
|
||||
if [ ! -e /dev/mapper/${CRYPTPARTNAME} ] ; then
|
||||
cat <<- HEREDOC 1>&2
|
||||
cat <<- HEREDOC
|
||||
***** ERROR : Cannot open LUKS volume "${CRYPTPARTNAME}" on ${DEV}${CRYPTPARTITION}. *****
|
||||
...Check passphrase and your config.txt
|
||||
|
||||
|
|
@ -83,7 +83,7 @@ function pre_install_common() {
|
|||
if [ ${OVERWRITEINSTALL} -eq 1 ] ; then # exist and overwrite install
|
||||
echo "...Logical volume "${VGNAME}-${LVROOTNAME}" already exists. OK."
|
||||
else # exist and not overwriteinstall
|
||||
cat <<- HEREDOC 1>&2
|
||||
cat <<- HEREDOC
|
||||
***** ERROR : Logical volume "${VGNAME}-${LVROOTNAME}" already exists. *****
|
||||
...Check LVROOTNAME environment variable in your config.txt.
|
||||
HEREDOC
|
||||
|
|
@ -91,7 +91,7 @@ function pre_install_common() {
|
|||
vgchange -a n ${VGNAME}
|
||||
echo "...Closing LUKS volume \"${CRYPTPARTNAME}\"."
|
||||
cryptsetup close ${CRYPTPARTNAME}
|
||||
cat <<- HEREDOC 1>&2
|
||||
cat <<- HEREDOC
|
||||
|
||||
...Installation process terminated..
|
||||
HEREDOC
|
||||
|
|
@ -99,7 +99,7 @@ function pre_install_common() {
|
|||
fi
|
||||
else # not exsit
|
||||
if [ ${OVERWRITEINSTALL} -eq 1 ] ; then
|
||||
cat <<- HEREDOC 1>&2
|
||||
cat <<- HEREDOC
|
||||
***** ERROR : Logical volume "${VGNAME}-${LVROOTNAME}" doesn't exist while overwrite install. *****
|
||||
...Check consistency of your config.txt.
|
||||
HEREDOC
|
||||
|
|
@ -107,7 +107,7 @@ function pre_install_common() {
|
|||
vgchange -a n ${VGNAME}
|
||||
echo "...Closing LUKS volume \"${CRYPTPARTNAME}\"."
|
||||
cryptsetup close ${CRYPTPARTNAME}
|
||||
cat <<- HEREDOC 1>&2
|
||||
cat <<- HEREDOC
|
||||
|
||||
...Installation process terminated..
|
||||
HEREDOC
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ function main() {
|
|||
HEREDOC
|
||||
read YESNO
|
||||
if [ ${YESNO} != "Y" -a ${YESNO} != "y" ] ; then
|
||||
cat <<- HEREDOC 1>&2
|
||||
cat <<- HEREDOC
|
||||
|
||||
...Installation process terminated..
|
||||
HEREDOC
|
||||
|
|
@ -177,16 +177,16 @@ function grub_check_and_modify() {
|
|||
|
||||
# Check if installer still exist
|
||||
if ! ps $INSTALLER_PID > /dev/null ; then # If not exists
|
||||
cat <<-HEREDOC 1>&2
|
||||
***** ERROR : The GUI/TUI installer terminated unexpectedly. *****
|
||||
...Deleting the new logical volume "${VGNAME}-${LVROOTNAME}".
|
||||
HEREDOC
|
||||
lvremove -f /dev/mapper/${VGNAME}-${LVROOTNAME}
|
||||
echo "***** ERROR : The GUI/TUI installer terminated unexpectedly. *****"
|
||||
if [ ${OVERWRITEINSTALL} -eq 0 ] ; then # If not over install, volume is new. So delete it
|
||||
echo "...Deleting the new logical volume \"${VGNAME}-${LVROOTNAME}\"."
|
||||
lvremove -f /dev/mapper/${VGNAME}-${LVROOTNAME}
|
||||
fi
|
||||
echo "...Deactivating all logical volumes in volume group \"${VGNAME}\"."
|
||||
vgchange -a n ${VGNAME}
|
||||
echo "...Closing LUKS volume \"${CRYPTPARTNAME}\"."
|
||||
cryptsetup close ${CRYPTPARTNAME}
|
||||
cat <<-HEREDOC 1>&2
|
||||
cat <<-HEREDOC
|
||||
|
||||
...The new logical volume has been deleted. You can retry Kaiten-yaki again.
|
||||
...Installation process terminated.
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ function main() {
|
|||
HEREDOC
|
||||
read YESNO
|
||||
if [ ${YESNO} != "Y" -a ${YESNO} != "y" ] ; then
|
||||
cat <<- HEREDOC 1>&2
|
||||
cat <<- HEREDOC
|
||||
|
||||
...Installation process terminated..
|
||||
HEREDOC
|
||||
|
|
@ -96,16 +96,17 @@ function main() {
|
|||
# Check if background checker still exist
|
||||
if ps $grub_check_and_modify_id > /dev/null ; then # If exists
|
||||
# If exist, the grub was not modifyed -> void-installer termianted unexpectedly
|
||||
cat <<-HEREDOC 1>&2
|
||||
***** ERROR : The GUI/TUI installer terminated unexpectedly. *****
|
||||
...Deleting the new logical volume "${VGNAME}-${LVROOTNAME}".
|
||||
HEREDOC
|
||||
lvremove -f /dev/mapper/${VGNAME}-${LVROOTNAME}
|
||||
|
||||
echo "***** ERROR : The GUI/TUI installer terminated unexpectedly. *****"
|
||||
if [ ${OVERWRITEINSTALL} -eq 0 ] ; then # If not over install, volume is new. So delete it
|
||||
echo "...Deleting the new logical volume \"${VGNAME}-${LVROOTNAME}\"."
|
||||
lvremove -f /dev/mapper/${VGNAME}-${LVROOTNAME}
|
||||
fi
|
||||
echo "...Deactivating all logical volumes in volume group \"${VGNAME}\"."
|
||||
vgchange -a n ${VGNAME}
|
||||
echo "...Closing LUKS volume \"${CRYPTPARTNAME}\"."
|
||||
cryptsetup close ${CRYPTPARTNAME}
|
||||
cat <<-HEREDOC 1>&2
|
||||
cat <<-HEREDOC
|
||||
|
||||
...The new logical volume has been deleted. You can retry Kaiten-yaki again.
|
||||
...Installation process terminated.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue