#! /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"

err=0
if [ -x /usr/bin/sdbootutil ] ; then
  ( set -x ; sdbootutil set-default "$1" ) || err=1
elif [ -x /usr/bin/bootctl ] ; then
  ( set -x ; bootctl set-default "$1" ) || err=1
else
  echo "sdbootutil or bootctl: command not found"
  err=1
fi

exit $err
