mirror of
https://github.com/suikan4github/kaiten-yaki.git
synced 2025-12-20 10:31:17 -03:00
Merge branch 'feature/7' into develop
This commit is contained in:
commit
60a519f9ba
3 changed files with 30 additions and 2 deletions
|
|
@ -7,6 +7,7 @@ Record of the modification in project development.
|
||||||
### Changed
|
### Changed
|
||||||
- [Issue 5 : OVERWRITEINSTALL confirmation is missing](https://github.com/suikan4github/kaiten-yaki/issues/5)
|
- [Issue 5 : OVERWRITEINSTALL confirmation is missing](https://github.com/suikan4github/kaiten-yaki/issues/5)
|
||||||
- [Issue 6 : Remove loglevel dependency from the void-kaiten-yaki.sh ](https://github.com/suikan4github/kaiten-yaki/6)
|
- [Issue 6 : Remove loglevel dependency from the void-kaiten-yaki.sh ](https://github.com/suikan4github/kaiten-yaki/6)
|
||||||
|
- [Issue 7 : Add the return status validation ](https://github.com/suikan4github/kaiten-yaki/7)
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
### Removed
|
### Removed
|
||||||
|
|
|
||||||
|
|
@ -138,27 +138,33 @@ function pre_install() {
|
||||||
# Zap existing partition table and create new GPT
|
# Zap existing partition table and create new GPT
|
||||||
echo "...Initializing \"${DEV}\" with GPT."
|
echo "...Initializing \"${DEV}\" with GPT."
|
||||||
sgdisk --zap-all "${DEV}"
|
sgdisk --zap-all "${DEV}"
|
||||||
|
if is_error ; then return 1 ; fi; # If error, terminate
|
||||||
# Create EFI partition and format it
|
# Create EFI partition and format it
|
||||||
echo "...Creating an EFI partition on \"${DEV}\"."
|
echo "...Creating an EFI partition on \"${DEV}\"."
|
||||||
# shellcheck disable=SC2140
|
# shellcheck disable=SC2140
|
||||||
sgdisk --new="${EFIPARTITION}":0:+"${EFISIZE}" --change-name="${EFIPARTITION}":"EFI System" --typecode="${EFIPARTITION}":ef00 "${DEV}"
|
sgdisk --new="${EFIPARTITION}":0:+"${EFISIZE}" --change-name="${EFIPARTITION}":"EFI System" --typecode="${EFIPARTITION}":ef00 "${DEV}"
|
||||||
|
if is_error ; then return 1 ; fi; # If error, terminate
|
||||||
echo "...Formatting the EFI parttion."
|
echo "...Formatting the EFI parttion."
|
||||||
mkfs.vfat -F 32 -n EFI-SP "${DEV}${EFIPARTITION}"
|
mkfs.vfat -F 32 -n EFI-SP "${DEV}${EFIPARTITION}"
|
||||||
|
if is_error ; then return 1 ; fi; # If error, terminate
|
||||||
# Create Linux partition
|
# Create Linux partition
|
||||||
echo "...Creating a Linux partition on ${DEV}."
|
echo "...Creating a Linux partition on ${DEV}."
|
||||||
# shellcheck disable=SC2140
|
# shellcheck disable=SC2140
|
||||||
sgdisk --new="${CRYPTPARTITION}":0:0 --change-name="${CRYPTPARTITION}":"Linux LUKS" --typecode="${CRYPTPARTITION}":8309 "${DEV}"
|
sgdisk --new="${CRYPTPARTITION}":0:0 --change-name="${CRYPTPARTITION}":"Linux LUKS" --typecode="${CRYPTPARTITION}":8309 "${DEV}"
|
||||||
|
if is_error ; then return 1 ; fi; # If error, terminate
|
||||||
# Then print them
|
# Then print them
|
||||||
sgdisk --print "${DEV}"
|
sgdisk --print "${DEV}"
|
||||||
else # BIOS
|
else # BIOS
|
||||||
# Zap existing partition table
|
# Zap existing partition table
|
||||||
echo "...Erasing partition table of \"${DEV}\"."
|
echo "...Erasing partition table of \"${DEV}\"."
|
||||||
dd if=/dev/zero of="${DEV}" bs=512 count=1
|
dd if=/dev/zero of="${DEV}" bs=512 count=1
|
||||||
|
if is_error ; then return 1 ; fi; # If error, terminate
|
||||||
# Create MBR and allocate max storage for Linux partition
|
# Create MBR and allocate max storage for Linux partition
|
||||||
echo "...Creating a Linux partition on ${DEV} with MBR."
|
echo "...Creating a Linux partition on ${DEV} with MBR."
|
||||||
sfdisk "${DEV}" <<- HEREDOC
|
sfdisk "${DEV}" <<- HEREDOC
|
||||||
2M,,L
|
2M,,L
|
||||||
HEREDOC
|
HEREDOC
|
||||||
|
if is_error ; then return 1 ; fi; # If error, terminate
|
||||||
fi # if EFI firmware
|
fi # if EFI firmware
|
||||||
|
|
||||||
# Encrypt the partition to install Linux
|
# Encrypt the partition to install Linux
|
||||||
|
|
@ -194,8 +200,10 @@ function pre_install() {
|
||||||
else
|
else
|
||||||
echo "...Initializing a physical volume on \"${CRYPTPARTNAME}\""
|
echo "...Initializing a physical volume on \"${CRYPTPARTNAME}\""
|
||||||
pvcreate /dev/mapper/"${CRYPTPARTNAME}"
|
pvcreate /dev/mapper/"${CRYPTPARTNAME}"
|
||||||
|
if [ $? -ne 0 ] ; then deactivate_and_close; return 1 ; fi;
|
||||||
echo "...And then creating Volume group \"${VGNAME}\"."
|
echo "...And then creating Volume group \"${VGNAME}\"."
|
||||||
vgcreate "${VGNAME}" /dev/mapper/"${CRYPTPARTNAME}"
|
vgcreate "${VGNAME}" /dev/mapper/"${CRYPTPARTNAME}"
|
||||||
|
if [ $? -ne 0 ] ; then deactivate_and_close; return 1 ; fi;
|
||||||
fi # if /dev/volume-groupt exist
|
fi # if /dev/volume-groupt exist
|
||||||
|
|
||||||
# Create a SWAP Logical Volume on VG, if it doesn't exist
|
# Create a SWAP Logical Volume on VG, if it doesn't exist
|
||||||
|
|
@ -204,6 +212,7 @@ function pre_install() {
|
||||||
else
|
else
|
||||||
echo "...Creating logical volume \"${LVSWAPNAME}\" on \"${VGNAME}\"."
|
echo "...Creating logical volume \"${LVSWAPNAME}\" on \"${VGNAME}\"."
|
||||||
lvcreate -L "${LVSWAPSIZE}" -n "${LVSWAPNAME}" "${VGNAME}"
|
lvcreate -L "${LVSWAPSIZE}" -n "${LVSWAPNAME}" "${VGNAME}"
|
||||||
|
if [ $? -ne 0 ] ; then deactivate_and_close; return 1 ; fi;
|
||||||
fi # if /dev/mapper/swap volume already exit.
|
fi # if /dev/mapper/swap volume already exit.
|
||||||
|
|
||||||
# Create a ROOT Logical Volume on VG.
|
# Create a ROOT Logical Volume on VG.
|
||||||
|
|
@ -231,6 +240,7 @@ function pre_install() {
|
||||||
else # not exist and not overwrite install
|
else # not exist and not overwrite install
|
||||||
echo "...Creating logical volume \"${LVROOTNAME}\" on \"${VGNAME}\"."
|
echo "...Creating logical volume \"${LVROOTNAME}\" on \"${VGNAME}\"."
|
||||||
lvcreate -l "${LVROOTSIZE}" -n "${LVROOTNAME}" "${VGNAME}"
|
lvcreate -l "${LVROOTSIZE}" -n "${LVROOTNAME}" "${VGNAME}"
|
||||||
|
if [ $? -ne 0 ] ; then deactivate_and_close; return 1 ; fi;
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -332,3 +342,20 @@ function distribution_check(){
|
||||||
# no error
|
# no error
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# *******************************************************************************
|
||||||
|
# Error report and return revsers status.
|
||||||
|
# *******************************************************************************
|
||||||
|
function is_error() {
|
||||||
|
if [ $? -eq 0 ] ; then # Is previous job OK?
|
||||||
|
return 1 # If OK, return error ( because it was not error )
|
||||||
|
else
|
||||||
|
cat <<- HEREDOC
|
||||||
|
**** ERROR ! ****
|
||||||
|
|
||||||
|
Installation process terminated.
|
||||||
|
HEREDOC
|
||||||
|
return 0 # If error, return OK ( because it was error )
|
||||||
|
fi;
|
||||||
|
}
|
||||||
|
|
@ -56,8 +56,8 @@ function main() {
|
||||||
# Common part of the pre-install stage
|
# Common part of the pre-install stage
|
||||||
if ! pre_install ; then
|
if ! pre_install ; then
|
||||||
# If error, restore the modification.
|
# If error, restore the modification.
|
||||||
echo "...restoring modified /etc/default/grub."
|
echo "...restoring /etc/default/grub, if needed"
|
||||||
sed -i -e "s#loglevel=4 ${GRUB_ADDITIONAL_PARAMETERS}#loglevel=4#" /etc/default/grub
|
sed -i -e "s#${GRUB_ADDITIONAL_PARAMETERS}##" /etc/default/grub
|
||||||
return 1 # with error status
|
return 1 # with error status
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue