mirror of
https://github.com/suikan4github/kaiten-yaki.git
synced 2025-12-20 10:31:17 -03:00
Merge branch 'feature/35' into develop
For issue #33 ( not 35! ) Support "M/G/T" as size prefix
This commit is contained in:
commit
d324960448
3 changed files with 45 additions and 13 deletions
|
|
@ -4,6 +4,7 @@ Record of the modification in project development.
|
|||
## [Unreleased] - yyyy-mm-dd
|
||||
### Added
|
||||
- [Issue 31 : Add extra partition functionality.](https://github.com/suikan4github/kaiten-yaki/issues/31)
|
||||
- [Issue 35 : Support "M/G/T" as size prefix.](https://github.com/suikan4github/kaiten-yaki/issues/35)
|
||||
|
||||
### Changed
|
||||
### Deprecated
|
||||
|
|
|
|||
|
|
@ -32,27 +32,35 @@ export LVEXT1SUFFIX="_home"
|
|||
export USELVEXT2=0
|
||||
export LVEXT2SUFFIX="_var"
|
||||
|
||||
# Logical volume size of the Linux installation.
|
||||
# 30% mean, new logical volume will use 30% of the free space
|
||||
# in the LVM volume group. For example, assume the free space is 100GB,
|
||||
# and LVROOTSIZE is 30%FREE. Script will create 30GB logical volume.
|
||||
|
||||
# Volume size parameters.
|
||||
# Note that the order of the volume creation is :
|
||||
# 1. EFI if needed
|
||||
# 2. SWAP
|
||||
# 3. LVROOT
|
||||
# 4. LVEXT1 if needed
|
||||
# 5. LVEXT2 if needed
|
||||
export LVROOTSIZE="10%FREE"
|
||||
|
||||
# Logical volume size of the optional volumes.
|
||||
export LVEXT1SIZE="90%FREE"
|
||||
export LVEXT2SIZE="100%FREE"
|
||||
|
||||
# Set the size of EFI partition and swap partition.
|
||||
# The unit is Byte. You can use M,G... notation.
|
||||
# You CANNOT use the % notation.
|
||||
export EFISIZE="200M"
|
||||
|
||||
# Logical volume size of the swap volumes.
|
||||
export LVSWAPSIZE="8G"
|
||||
|
||||
# Logical volume size of the Linux installation.
|
||||
# There are four posibble way to specify the volume.
|
||||
# nnnM, nnnG, nnnT : Absolute size speicification. nnnMbyte, nnnGByte, nnnT byte.
|
||||
# mm%VG : Use mm% of the entire volume group.
|
||||
# mm%FREE : Use mm% of the avairable storage are in the volume group.
|
||||
export LVROOTSIZE="10G"
|
||||
|
||||
# Logical volume size of the optional volumes.
|
||||
export LVEXT1SIZE="30G"
|
||||
export LVEXT2SIZE="10G"
|
||||
|
||||
|
||||
# Usually, these names can be left untouched.
|
||||
# If you change, keep them consistent through all installation in your system.
|
||||
export CRYPTPARTNAME="luks_volume"
|
||||
|
|
|
|||
|
|
@ -141,6 +141,25 @@ function confirmation(){
|
|||
return 1 # with error status
|
||||
fi # passphrase validation
|
||||
|
||||
|
||||
# Add -l or -L parameter to the size. The lvcreate command have two size parameter.
|
||||
# -l ###%[FREE|VG|PVS|ORIGIN] : Size by relative value.
|
||||
# -L ###[M|G|T|m|g|t] : Size by absolute value.
|
||||
# Too preven the duplicated match, awk exists the process after it match the /%/ pattern.
|
||||
# If Unit is not specified, installation will fail.
|
||||
|
||||
LVSWAPSIZE=$(echo "${LVSWAPSIZE}" | awk '/%/{print "-l", $0; exit} /M|G|T|m|g|t/{print "-L", $0}')
|
||||
export LVSWAPSIZE
|
||||
|
||||
LVROOTSIZE=$(echo "${LVROOTSIZE}" | awk '/%/{print "-l", $0; exit} /M|G|T|m|g|t/{print "-L", $0}')
|
||||
export LVROOTSIZE
|
||||
|
||||
LVEXT1SIZE=$(echo "${LVEXT1SIZE}" | awk '/%/{print "-l", $0; exit} /M|G|T|m|g|t/{print "-L", $0}')
|
||||
export LVEXT1SIZE
|
||||
|
||||
LVEXT2SIZE=$(echo "${LVEXT2SIZE}" | awk '/%/{print "-l", $0; exit} /M|G|T|m|g|t/{print "-L", $0}')
|
||||
export LVEXT2SIZE
|
||||
|
||||
# succesfull return
|
||||
return 0
|
||||
}
|
||||
|
|
@ -239,7 +258,8 @@ function pre_install() {
|
|||
echo "...Swap volume already exist. Skipped to create. No problem."
|
||||
else
|
||||
echo "...Creating logical volume \"${LVSWAPNAME}\" on \"${VGNAME}\"."
|
||||
lvcreate -L "${LVSWAPSIZE}" -n "${LVSWAPNAME}" "${VGNAME}"
|
||||
# Too use the bash IFS, first parameter is not quoted.
|
||||
lvcreate ${LVSWAPSIZE} -n "${LVSWAPNAME}" "${VGNAME}"
|
||||
if [ $? -ne 0 ] ; then deactivate_and_close; return 1 ; fi;
|
||||
fi # if /dev/mapper/swap volume already exit.
|
||||
|
||||
|
|
@ -272,7 +292,8 @@ function pre_install() {
|
|||
return 1 # with error status
|
||||
else # not exist and not overwrite install
|
||||
echo "...Creating logical volume \"${LVROOTNAME}\" on \"${VGNAME}\"."
|
||||
lvcreate -l "${LVROOTSIZE}" -n "${LVROOTNAME}" "${VGNAME}"
|
||||
# Too use the bash IFS, first parameter is not quoted.
|
||||
lvcreate ${LVROOTSIZE} -n "${LVROOTNAME}" "${VGNAME}"
|
||||
if [ $? -ne 0 ] ; then deactivate_and_close; return 1 ; fi;
|
||||
IS_ROOT_CREATED=1
|
||||
|
||||
|
|
@ -474,7 +495,8 @@ function create_ext_lv() {
|
|||
echo "...Logical volume \"${VGNAME}-${LVROOTNAME}${LVEXT1SUFFIX}\" already exists. OK."
|
||||
else
|
||||
echo "...Creating logical volume \"${LVROOTNAME}${LVEXT1SUFFIX}\" on \"${VGNAME}\"."
|
||||
lvcreate -l "${LVEXT1SIZE}" -n "${LVROOTNAME}${LVEXT1SUFFIX}" "${VGNAME}"
|
||||
# Too use the bash IFS, first parameter is not quoted.
|
||||
lvcreate ${LVEXT1SIZE} -n "${LVROOTNAME}${LVEXT1SUFFIX}" "${VGNAME}"
|
||||
if [ $? -ne 0 ] ; then # if fail
|
||||
echo "***** ERROR : failed to create "${VGNAME}-${LVROOTNAME}${LVEXT1SUFFIX}" . *****"
|
||||
return 1 ;
|
||||
|
|
@ -489,7 +511,8 @@ function create_ext_lv() {
|
|||
echo "...Logical volume \"${VGNAME}-${LVROOTNAME}${LVEXT2SUFFIX}\" already exists. OK."
|
||||
else
|
||||
echo "...Creating logical volume \"${LVROOTNAME}${LVEXT2SUFFIX}\" on \"${VGNAME}\"."
|
||||
lvcreate -l "${LVEXT2SIZE}" -n "${LVROOTNAME}${LVEXT2SUFFIX}" "${VGNAME}"
|
||||
# Too use the bash IFS, first parameter is not quoted.
|
||||
lvcreate ${LVEXT2SIZE} -n "${LVROOTNAME}${LVEXT2SUFFIX}" "${VGNAME}"
|
||||
if [ $? -ne 0 ] ; then # if fail
|
||||
echo "***** ERROR : failed to create "${VGNAME}-${LVROOTNAME}${LVEXT1SUFFIX}" . *****"
|
||||
return 1 ;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue