#! /usr/bin/sh

# Settings from /etc/sysconfig/filename are available as environment vars
# with the name 'SYS__FILENAME__KEY' (filename converted to upper case).
#
# Not all files are parsed, current list is:
#   bootloader, language
#

# include common functions
. "$PBL_INCLUDE/library"

lib_get_cmdline_bls
append=\"$(lib_shellquote "$cmdline")\"

err=0
if [ -x /usr/bin/bootctl ] ; then
  default_kernel=$(bootctl status | grep linux: | cut -d ':' -f 2 | tr -ds ' ' '/')
  default_initrd=$(bootctl status | grep initrd: | cut -d ':' -f 2 | tr -ds ' ' '/')
else
  lib_get_default_kernel_initrd
fi

echo "kernel=$default_kernel" > "$PBL_RESULT"
echo "initrd=$default_initrd" >> "$PBL_RESULT"
echo -n "append=$append" >> "$PBL_RESULT"

exit $err
