Make Pineloader to be able to handle initrd and cmdline variables

Signed-off-by: Danct12 <danct12@disroot.org>
This commit is contained in:
Danct12 2020-05-19 10:07:12 +07:00
parent 4c25519623
commit e376e0f3da
2 changed files with 11 additions and 5 deletions

View File

@ -63,4 +63,6 @@ setup_telnetd
/pineloader
# Don't kernel panic just in case if the pineloader script crashes
echo "ERROR: Pineloader script finished, this is not supposed to happen!"
echo "Please telnet to $IP and diagnose the issue."
loop_forever

View File

@ -99,15 +99,19 @@ done
i=$(select_opt "${choices[@]}")
key="${choices[$i]}"
value="${config[$key]}"
value="${config[$key]}" && $value
if [ -z "$value" ]; then
echo "ERROR: The selected boot variables are blank, please debug the issue by telnet to:"
echo "$IP"
if [ -z "$value" ] || [ -z "$KERNEL" ]; then
echo "ERROR: The selected boot variables are blank, please check for syntax, double quote in your config file."
else
# Building up the kexec command line
KEXEC_CMD=("kexec" "-l" "$KERNEL")
[[ "$INITRD" ]] && KEXEC_CMD+=("--initrd" "$INITRD")
[[ "$CMDLINE" ]] && KEXEC_CMD+=("--command-line" "$CMDLINE")
mount -o ro $BOOTPART /mnt
echo "Loading kernel and ramdisk to memory..."
kexec -l --initrd="$INITRD" --command-line="$CMDLINE" $KERNEL
"${KEXEC_CMD[@]}"
echo "Starting kernel..."
kexec -e
fi