diff --git a/script/config.sh b/script/config.sh index 096c64b..a4b0e8e 100644 --- a/script/config.sh +++ b/script/config.sh @@ -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" diff --git a/script/lib/common.sh b/script/lib/common.sh index c2a26e0..91a8d3f 100644 --- a/script/lib/common.sh +++ b/script/lib/common.sh @@ -141,6 +141,24 @@ 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 ###[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 return 0 } @@ -239,7 +257,7 @@ 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}" + 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 +290,7 @@ 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}" + lvcreate "${LVROOTSIZE}" -n "${LVROOTNAME}" "${VGNAME}" if [ $? -ne 0 ] ; then deactivate_and_close; return 1 ; fi; IS_ROOT_CREATED=1 @@ -474,7 +492,7 @@ 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}" + lvcreate "${LVEXT1SIZE}" -n "${LVROOTNAME}${LVEXT1SUFFIX}" "${VGNAME}" if [ $? -ne 0 ] ; then # if fail echo "***** ERROR : failed to create "${VGNAME}-${LVROOTNAME}${LVEXT1SUFFIX}" . *****" return 1 ; @@ -489,7 +507,7 @@ 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}" + lvcreate "${LVEXT2SIZE}" -n "${LVROOTNAME}${LVEXT2SUFFIX}" "${VGNAME}" if [ $? -ne 0 ] ; then # if fail echo "***** ERROR : failed to create "${VGNAME}-${LVROOTNAME}${LVEXT1SUFFIX}" . *****" return 1 ;