1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
#! /bin/bash
set -e
# Create syslinux configuration or list syslinux configuration files (x86)
# If called with two arguments (source and destination dir), the script will
# create a syslinux configuration; if called with only one argument, it will
# list the files for the created configuration.
# The variables TYPE and INCLUDE_GTK - which determine the contents
# of the created syslinux configuration - should be set in the environment.
# See also the x86_syslinux target in build/config/x86.cfg and the
# documentation for the SYSLINUX_CFG option in build/README.
SRC="$1"
DST="$2"
[ -d "$SRC" ] || exit 1
if [ -z "$DST" ]; then
# Only list config files
cd "$SRC"
find . -type f | sed "s:\./::"
exit 0
elif [ ! -d "$DST" ]; then
exit 1
fi
# Create config for default desktop environment
create_standard_config() {
cp "$SRC"/syslinux.cfg "$SRC"/menu.cfg "$SRC"/stdmenu.cfg \
"$SRC"/prompt.cfg "$SRC"/exithelp.cfg "$DST"/
cp "$SRC"/{,ad,rq}txt.cfg "$DST"/
if [ -n "$INCLUDE_GTK" ]; then
cp "$SRC"/{ad,rq,}gtk.cfg "$DST"/
cp "$SRC"/spkgtk.cfg "$DST"/
else
cp "$SRC"/spk.cfg "$DST"/
fi
}
case $TYPE in
template)
cp -r "$SRC"/*.cfg "$DST"/
if [ -z "$INCLUDE_GTK" ]; then
rm -f "$DST"/*gtk.cfg
rm -f "$DST"/*spkgtk.cfg
else
rm -f "$DST"/*spk.cfg
fi
exit 0
;;
prompt)
cp "$SRC"/prompt.cfg "$DST"/syslinux.cfg
cp "$SRC"/menu.cfg "$DST"/
cp "$SRC"/{,ad,rq}txt.cfg "$DST"/
cp "$SRC"/spk.cfg "$DST"/
;;
standard)
create_standard_config
;;
*)
exit 1
;;
esac
sed -i "s/desktop=%desktop% //" "$DST"/*.cfg
|