mirror of
https://github.com/suikan4github/kaiten-yaki.git
synced 2025-12-20 02:21:17 -03:00
Modify to accespt the absolute volume size.
This commit is contained in:
parent
b8db4d4977
commit
f0f081ad34
2 changed files with 39 additions and 13 deletions
|
|
@ -32,27 +32,35 @@ export LVEXT1SUFFIX="_home"
|
||||||
export USELVEXT2=0
|
export USELVEXT2=0
|
||||||
export LVEXT2SUFFIX="_var"
|
export LVEXT2SUFFIX="_var"
|
||||||
|
|
||||||
# Logical volume size of the Linux installation.
|
|
||||||
# 30% mean, new logical volume will use 30% of the free space
|
# Volume size parameters.
|
||||||
# in the LVM volume group. For example, assume the free space is 100GB,
|
|
||||||
# and LVROOTSIZE is 30%FREE. Script will create 30GB logical volume.
|
|
||||||
# Note that the order of the volume creation is :
|
# Note that the order of the volume creation is :
|
||||||
# 1. EFI if needed
|
# 1. EFI if needed
|
||||||
# 2. SWAP
|
# 2. SWAP
|
||||||
# 3. LVROOT
|
# 3. LVROOT
|
||||||
# 4. LVEXT1 if needed
|
# 4. LVEXT1 if needed
|
||||||
# 5. LVEXT2 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.
|
# Set the size of EFI partition and swap partition.
|
||||||
# The unit is Byte. You can use M,G... notation.
|
# The unit is Byte. You can use M,G... notation.
|
||||||
|
# You CANNOT use the % notation.
|
||||||
export EFISIZE="200M"
|
export EFISIZE="200M"
|
||||||
|
|
||||||
|
# Logical volume size of the swap volumes.
|
||||||
export LVSWAPSIZE="8G"
|
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.
|
# Usually, these names can be left untouched.
|
||||||
# If you change, keep them consistent through all installation in your system.
|
# If you change, keep them consistent through all installation in your system.
|
||||||
export CRYPTPARTNAME="luks_volume"
|
export CRYPTPARTNAME="luks_volume"
|
||||||
|
|
|
||||||
|
|
@ -141,6 +141,24 @@ function confirmation(){
|
||||||
return 1 # with error status
|
return 1 # with error status
|
||||||
fi # passphrase validation
|
fi # passphrase validation
|
||||||
|
|
||||||
|
|
||||||
|
# Add -l or -L parameter to the size. The lvcreate command have two size parameter.
|
||||||
|
# -L ###[M|G|T|m|g|t] : Size by absolute value.
|
||||||
|
# -l ###%[FREE|VG|PVS|ORIGIN] : Size by relative value.
|
||||||
|
# If Unit is not specified, installation will fail.
|
||||||
|
|
||||||
|
LVSWAPSIZE=$(echo "${LVSWAPSIZE}" | awk '/M|G|T|m|g|t/{print "-L", $0} /%/ {print "-l", $0}')
|
||||||
|
export LVSWAPSIZE
|
||||||
|
|
||||||
|
LVROOTSIZE=$(echo "${LVROOTSIZE}" | awk '/M|G|T|m|g|t/{print "-L", $0} /%/ {print "-l", $0}')
|
||||||
|
export LVROOTSIZE
|
||||||
|
|
||||||
|
LVEXT1SIZE=$(echo "${LVEXT1SIZE}" | awk '/M|G|T|m|g|t/{print "-L", $0} /%/ {print "-l", $0}')
|
||||||
|
export LVEXT1SIZE
|
||||||
|
|
||||||
|
LVEXT2SIZE=$(echo "${LVEXT2SIZE}" | awk '/M|G|T|m|g|t/{print "-L", $0} /%/ {print "-l", $0}')
|
||||||
|
export LVEXT2SIZE
|
||||||
|
|
||||||
# succesfull return
|
# succesfull return
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
@ -239,7 +257,7 @@ function pre_install() {
|
||||||
echo "...Swap volume already exist. Skipped to create. No problem."
|
echo "...Swap volume already exist. Skipped to create. No problem."
|
||||||
else
|
else
|
||||||
echo "...Creating logical volume \"${LVSWAPNAME}\" on \"${VGNAME}\"."
|
echo "...Creating logical volume \"${LVSWAPNAME}\" on \"${VGNAME}\"."
|
||||||
lvcreate -L "${LVSWAPSIZE}" -n "${LVSWAPNAME}" "${VGNAME}"
|
lvcreate "${LVSWAPSIZE}" -n "${LVSWAPNAME}" "${VGNAME}"
|
||||||
if [ $? -ne 0 ] ; then deactivate_and_close; return 1 ; fi;
|
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.
|
||||||
|
|
||||||
|
|
@ -272,7 +290,7 @@ function pre_install() {
|
||||||
return 1 # with error status
|
return 1 # with error status
|
||||||
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 "${LVROOTSIZE}" -n "${LVROOTNAME}" "${VGNAME}"
|
||||||
if [ $? -ne 0 ] ; then deactivate_and_close; return 1 ; fi;
|
if [ $? -ne 0 ] ; then deactivate_and_close; return 1 ; fi;
|
||||||
IS_ROOT_CREATED=1
|
IS_ROOT_CREATED=1
|
||||||
|
|
||||||
|
|
@ -474,7 +492,7 @@ function create_ext_lv() {
|
||||||
echo "...Logical volume \"${VGNAME}-${LVROOTNAME}${LVEXT1SUFFIX}\" already exists. OK."
|
echo "...Logical volume \"${VGNAME}-${LVROOTNAME}${LVEXT1SUFFIX}\" already exists. OK."
|
||||||
else
|
else
|
||||||
echo "...Creating logical volume \"${LVROOTNAME}${LVEXT1SUFFIX}\" on \"${VGNAME}\"."
|
echo "...Creating logical volume \"${LVROOTNAME}${LVEXT1SUFFIX}\" on \"${VGNAME}\"."
|
||||||
lvcreate -l "${LVEXT1SIZE}" -n "${LVROOTNAME}${LVEXT1SUFFIX}" "${VGNAME}"
|
lvcreate "${LVEXT1SIZE}" -n "${LVROOTNAME}${LVEXT1SUFFIX}" "${VGNAME}"
|
||||||
if [ $? -ne 0 ] ; then # if fail
|
if [ $? -ne 0 ] ; then # if fail
|
||||||
echo "***** ERROR : failed to create "${VGNAME}-${LVROOTNAME}${LVEXT1SUFFIX}" . *****"
|
echo "***** ERROR : failed to create "${VGNAME}-${LVROOTNAME}${LVEXT1SUFFIX}" . *****"
|
||||||
return 1 ;
|
return 1 ;
|
||||||
|
|
@ -489,7 +507,7 @@ function create_ext_lv() {
|
||||||
echo "...Logical volume \"${VGNAME}-${LVROOTNAME}${LVEXT2SUFFIX}\" already exists. OK."
|
echo "...Logical volume \"${VGNAME}-${LVROOTNAME}${LVEXT2SUFFIX}\" already exists. OK."
|
||||||
else
|
else
|
||||||
echo "...Creating logical volume \"${LVROOTNAME}${LVEXT2SUFFIX}\" on \"${VGNAME}\"."
|
echo "...Creating logical volume \"${LVROOTNAME}${LVEXT2SUFFIX}\" on \"${VGNAME}\"."
|
||||||
lvcreate -l "${LVEXT2SIZE}" -n "${LVROOTNAME}${LVEXT2SUFFIX}" "${VGNAME}"
|
lvcreate "${LVEXT2SIZE}" -n "${LVROOTNAME}${LVEXT2SUFFIX}" "${VGNAME}"
|
||||||
if [ $? -ne 0 ] ; then # if fail
|
if [ $? -ne 0 ] ; then # if fail
|
||||||
echo "***** ERROR : failed to create "${VGNAME}-${LVROOTNAME}${LVEXT1SUFFIX}" . *****"
|
echo "***** ERROR : failed to create "${VGNAME}-${LVROOTNAME}${LVEXT1SUFFIX}" . *****"
|
||||||
return 1 ;
|
return 1 ;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue