mirror of
https://gitlab.archlinux.org/tpowa/archboot.git
synced 2024-09-20 03:50:37 +02:00
more cryptsetup cleanup
This commit is contained in:
parent
bdd432cd36
commit
ef04233088
1 changed files with 12 additions and 30 deletions
|
@ -1478,7 +1478,7 @@ _enter_luks_passphrase () {
|
||||||
while [[ "${LUKSPASSPHRASE}" = "" ]]; do
|
while [[ "${LUKSPASSPHRASE}" = "" ]]; do
|
||||||
DIALOG --insecure --passwordbox "Enter passphrase for luks encrypted device ${PART}:" 0 0 2>${ANSWER} || return 1
|
DIALOG --insecure --passwordbox "Enter passphrase for luks encrypted device ${PART}:" 0 0 2>${ANSWER} || return 1
|
||||||
LUKSPASS=$(cat ${ANSWER})
|
LUKSPASS=$(cat ${ANSWER})
|
||||||
DIALOG --insecure --passwordbox "Retype passphrasefor luks encrypted device ${PART}:" 0 0 2>${ANSWER} || return 1
|
DIALOG --insecure --passwordbox "Retype passphrase for luks encrypted device ${PART}:" 0 0 2>${ANSWER} || return 1
|
||||||
LUKSPASS2=$(cat ${ANSWER})
|
LUKSPASS2=$(cat ${ANSWER})
|
||||||
if [[ "${LUKSPASS}" = "${LUKSPASS2}" ]]; then
|
if [[ "${LUKSPASS}" = "${LUKSPASS2}" ]]; then
|
||||||
LUKSPASSPHRASE=${LUKSPASS}
|
LUKSPASSPHRASE=${LUKSPASS}
|
||||||
|
@ -1493,7 +1493,14 @@ _enter_luks_passphrase () {
|
||||||
# opening luks
|
# opening luks
|
||||||
_opening_luks() {
|
_opening_luks() {
|
||||||
DIALOG --infobox "Opening encrypted ${PART}..." 0 0
|
DIALOG --infobox "Opening encrypted ${PART}..." 0 0
|
||||||
cryptsetup luksOpen ${PART} ${LUKSDEVICE} >${LOG} <${LUKSPASSPHRASE}
|
luksOpen_success="0"
|
||||||
|
while [[ "${luksOpen_success}" = "0" ]]; do
|
||||||
|
cryptsetup luksOpen ${PART} ${LUKSDEVICE} >${LOG} <${LUKSPASSPHRASE} && luksOpen_success=1
|
||||||
|
if [[ "${luksOpen_success}" = "0" ]]; then
|
||||||
|
DIALOG --msgbox "Error: Passphrases didn't match, please enter again." 0 0
|
||||||
|
_enter_luks_passphrase || return 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
LUKSPASSPHRASE="$(cat ${LUKSPASSPHRASE})"
|
LUKSPASSPHRASE="$(cat ${LUKSPASSPHRASE})"
|
||||||
DIALOG --yesno "Would you like to safe the passphrase of luks device to /etc/crypttab?\nName:${LUKSDEVICE}" 0 0 || LUKSPASSPHRASE="none"
|
DIALOG --yesno "Would you like to safe the passphrase of luks device to /etc/crypttab?\nName:${LUKSDEVICE}" 0 0 || LUKSPASSPHRASE="none"
|
||||||
echo ${LUKSDEVICE} ${PART} ${LUKSPASSPHRASE} >> /tmp/.crypttab
|
echo ${LUKSDEVICE} ${PART} ${LUKSPASSPHRASE} >> /tmp/.crypttab
|
||||||
|
@ -2536,23 +2543,10 @@ _mkfs() {
|
||||||
chmod 755 ${_dest}${_mountpoint}
|
chmod 755 ${_dest}${_mountpoint}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
local _uuid="$(getuuid ${_device})"
|
|
||||||
local _label="$(getlabel ${_device})"
|
|
||||||
# correct /tmp/.crypttab
|
|
||||||
_cryptdevice=${_device}
|
|
||||||
if [[ "${NAME_SCHEME_PARAMETER}" = "UUID" ]]; then
|
|
||||||
if [[ -n "${_uuid}" ]]; then
|
|
||||||
_cryptdevice="/dev/disk/by-uuid/${_uuid}"
|
|
||||||
fi
|
|
||||||
elif [[ "${NAME_SCHEME_PARAMETER}" = "LABEL" ]]; then
|
|
||||||
if [[ -n "${_label}" ]]; then
|
|
||||||
_cryptdevice="/dev/disk/by-label/${_label}"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
sed -i -e "s# ${_device} # ${_cryptdevice} #g" /tmp/.crypttab
|
|
||||||
# add to .device-names for config files
|
# add to .device-names for config files
|
||||||
echo "# DEVICE DETAILS: ${_device} UUID=${_uuid} LABEL=${_label}" >> /tmp/.device-names
|
echo "# DEVICE DETAILS: ${_device} UUID=${_uuid} LABEL=${_label}" >> /tmp/.device-names
|
||||||
echo "# DEVICE DETAILS: ${_device} /dev/disk/by-uuid/${_uuid} /dev/disk/by-label/${_label}" >> /tmp/.device-names
|
local _uuid="$(getuuid ${_device})"
|
||||||
|
local _label="$(getlabel ${_device})"
|
||||||
# add to temp fstab
|
# add to temp fstab
|
||||||
if [[ "${NAME_SCHEME_PARAMETER}" = "UUID" ]]; then
|
if [[ "${NAME_SCHEME_PARAMETER}" = "UUID" ]]; then
|
||||||
if [[ -n "${_uuid}" ]]; then
|
if [[ -n "${_uuid}" ]]; then
|
||||||
|
@ -4444,19 +4438,7 @@ auto_luks()
|
||||||
# remove root device from crypttab
|
# remove root device from crypttab
|
||||||
if [[ -e /tmp/.crypttab && "$(grep -v '^#' ${DESTDIR}/etc/crypttab)" = "" ]]; then
|
if [[ -e /tmp/.crypttab && "$(grep -v '^#' ${DESTDIR}/etc/crypttab)" = "" ]]; then
|
||||||
# add to temp crypttab
|
# add to temp crypttab
|
||||||
local _uuid="$(getuuid ${PART_ROOT})"
|
sed -i -e "/ $(basename ${PART_ROOT}) /d" /tmp/.crypttab
|
||||||
local _label="$(getlabel ${PART_ROOT})"
|
|
||||||
if [[ "${NAME_SCHEME_PARAMETER}" = "UUID" ]]; then
|
|
||||||
if [[ -n "${_uuid}" ]]; then
|
|
||||||
PART_ROOT="/dev/disk/by-uuid/${_uuid}"
|
|
||||||
fi
|
|
||||||
elif [[ "${NAME_SCHEME_PARAMETER}" = "LABEL" ]]; then
|
|
||||||
if [[ -n "${_label}" ]]; then
|
|
||||||
PART_ROOT="/dev/disk/by-label/${_label}"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
sed -i -e "/ ${PART_ROOT} /d" /tmp/.crypttab
|
|
||||||
cat /tmp/.device-names >> ${DESTDIR}/etc/crypttab
|
|
||||||
cat /tmp/.crypttab >> ${DESTDIR}/etc/crypttab
|
cat /tmp/.crypttab >> ${DESTDIR}/etc/crypttab
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue