mirror of
https://github.com/nchevsky/systemrescue-zfs.git
synced 2026-03-06 13:03:56 +01:00
Added support for booting from luks encrpyted devices in findroot
This commit is contained in:
parent
f6fa1db397
commit
88a82c0662
|
|
@ -4,7 +4,7 @@ SystemRescueCd ChangeLog
|
|||
-------------------------------------------------------------------------------
|
||||
6.1.4 (YYYY-MM-DD):
|
||||
-------------------------------------------------------------------------------
|
||||
* Added an option in the boot menu to start from a Linux OS installed on the disk
|
||||
* Added an entry in the boot menu to start from a Linux OS installed on the disk
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
6.1.3 (2020-04-18):
|
||||
|
|
|
|||
|
|
@ -1,14 +1,42 @@
|
|||
run_hook() {
|
||||
grep -q 'findroot' /proc/cmdline || return
|
||||
|
||||
# Initialisation
|
||||
local newroot="/new_root"
|
||||
local rootdev=""
|
||||
modprobe -a -q dm-crypt >/dev/null 2>&1
|
||||
echo "Searching for block devices ..."
|
||||
sleep 2
|
||||
|
||||
# Prepare access to luks encrypted block devices
|
||||
local cryptdev="$(blkid -t TYPE='crypto_LUKS' -o device)"
|
||||
for curdev in ${cryptdev}
|
||||
do
|
||||
if cryptsetup isLuks ${curdev} >/dev/null 2>&1
|
||||
then
|
||||
echo "A passphrase is required to access device ${curdev}:"
|
||||
local cryptname="${curdev##*/}"
|
||||
local cryptargs=""
|
||||
while ! eval cryptsetup open --type luks ${curdev} ${cryptname} ${cryptargs}
|
||||
do
|
||||
sleep 2;
|
||||
done
|
||||
if [ ! -e "/dev/mapper/${cryptname}" ]
|
||||
then
|
||||
err "Password succeeded but ${cryptname} creation failed, aborting..."
|
||||
launch_interactive_shell --exec
|
||||
fi
|
||||
echo "Have successfully prepared access to encrypted device ${curdev}"
|
||||
fi
|
||||
done
|
||||
|
||||
# Show list of accessible block devices
|
||||
echo "====================================================================="
|
||||
/usr/bin/lsblk --list --paths --output=name,fssize,fstype,label,uuid
|
||||
/usr/bin/lsblk --list --paths --output=name,fssize,fstype,label
|
||||
echo "====================================================================="
|
||||
sleep 5
|
||||
|
||||
# Attempt to find a filesystem which contains /sbin/init
|
||||
local devlist=$(/usr/bin/lsblk --list --noheadings --paths --output=name)
|
||||
for curdev in ${devlist}
|
||||
do
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ LABEL sysresccd_findroot
|
|||
TEXT HELP
|
||||
Boot from a Linux operating system installed on the disk
|
||||
ENDTEXT
|
||||
MENU LABEL Automatically detect any installed Linux system on disk and start it
|
||||
MENU LABEL Boot from a Linux operating system installed on the disk
|
||||
LINUX boot/%ISO_ARCH%/vmlinuz
|
||||
INITRD boot/intel_ucode.img,boot/amd_ucode.img,boot/%ISO_ARCH%/sysresccd.img
|
||||
APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% findroot
|
||||
|
|
|
|||
Loading…
Reference in a new issue