mirror of
https://github.com/suikan4github/kaiten-yaki.git
synced 2025-12-20 10:31:17 -03:00
all existence check is by -e
This commit is contained in:
parent
8d6363ba62
commit
f5d39aa867
2 changed files with 5 additions and 5 deletions
|
|
@ -91,7 +91,7 @@ fi # if erase all
|
||||||
|
|
||||||
# ----- Open the LUKS partition -----
|
# ----- Open the LUKS partition -----
|
||||||
# Open the crypt partition.
|
# Open the crypt partition.
|
||||||
printf %s "${PASSPHRASE}" | cryptsetup open -d - "${DEV}${CRYPTPARTITION}" ${CRYPTPARTNAME}
|
printf %s "${PASSPHRASE}" | cryptsetup open -e - "${DEV}${CRYPTPARTITION}" ${CRYPTPARTNAME}
|
||||||
|
|
||||||
# Check whether successful open. If mapped, it is successful.
|
# Check whether successful open. If mapped, it is successful.
|
||||||
if [ ! -e /dev/mapper/${CRYPTPARTNAME} ] ; then
|
if [ ! -e /dev/mapper/${CRYPTPARTNAME} ] ; then
|
||||||
|
|
@ -106,20 +106,20 @@ fi # if crypt volume is unable to open
|
||||||
|
|
||||||
# ----- Configure the LVM in LUKS volume -----
|
# ----- Configure the LVM in LUKS volume -----
|
||||||
# Create a Physical Volume and Volume Group, if first time
|
# Create a Physical Volume and Volume Group, if first time
|
||||||
if [ ! -d /dev/${VGNAME} ]; then
|
if [ ! -e /dev/${VGNAME} ]; then
|
||||||
pvcreate /dev/mapper/${CRYPTPARTNAME}
|
pvcreate /dev/mapper/${CRYPTPARTNAME}
|
||||||
vgcreate ${VGNAME} /dev/mapper/${CRYPTPARTNAME}
|
vgcreate ${VGNAME} /dev/mapper/${CRYPTPARTNAME}
|
||||||
fi # if /dev/volume-groupt not exist
|
fi # if /dev/volume-groupt not 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
|
||||||
if [ -d /dev/mapper/${VGNAME}-${LVSWAPNAME} ] ; then
|
if [ -e /dev/mapper/${VGNAME}-${LVSWAPNAME} ] ; then
|
||||||
echo "Swap volume already exist. Skipped to create" 1>&2
|
echo "Swap volume already exist. Skipped to create" 1>&2
|
||||||
else
|
else
|
||||||
lvcreate -L ${LVSWAPSIZE} -n ${LVSWAPNAME} ${VGNAME}
|
lvcreate -L ${LVSWAPSIZE} -n ${LVSWAPNAME} ${VGNAME}
|
||||||
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.
|
||||||
if [ -d /dev/mapper/${VGNAME}-${LVROOTNAME} ] ; then
|
if [ -e /dev/mapper/${VGNAME}-${LVROOTNAME} ] ; then
|
||||||
cat <<HEREDOC 1>&2
|
cat <<HEREDOC 1>&2
|
||||||
***** ERROR : Logical volume ${VGNAME}-${LVROOTNAME} already exists. *****
|
***** ERROR : Logical volume ${VGNAME}-${LVROOTNAME} already exists. *****
|
||||||
Check LVROOTNAME environment variable in config.txt.
|
Check LVROOTNAME environment variable in config.txt.
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ chmod u=rx,go-rwx /etc/luks
|
||||||
chmod u=r,go-rwx /etc/luks/boot_os.keyfile
|
chmod u=r,go-rwx /etc/luks/boot_os.keyfile
|
||||||
|
|
||||||
# Add a key to the key file. Use the passphrase in the environment variable.
|
# Add a key to the key file. Use the passphrase in the environment variable.
|
||||||
printf %s "${PASSPHRASE}" | cryptsetup luksAddKey -d - "${DEV}${CRYPTPARTITION}" /etc/luks/boot_os.keyfile
|
printf %s "${PASSPHRASE}" | cryptsetup luksAddKey -e - "${DEV}${CRYPTPARTITION}" /etc/luks/boot_os.keyfile
|
||||||
|
|
||||||
# Add the LUKS volume information to /etc/crypttab to decrypt by kernel.
|
# Add the LUKS volume information to /etc/crypttab to decrypt by kernel.
|
||||||
echo "${CRYPTPARTNAME} UUID=$(blkid -s UUID -o value ${DEV}${CRYPTPARTITION}) /etc/luks/boot_os.keyfile luks,discard" >> /etc/crypttab
|
echo "${CRYPTPARTNAME} UUID=$(blkid -s UUID -o value ${DEV}${CRYPTPARTITION}) /etc/luks/boot_os.keyfile luks,discard" >> /etc/crypttab
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue