VER="1.0"
srcdir="$(readlink -ev -- ${0%/*})"
-. "$srcdir/setup-ivi-sh-functions"
+if [ -f "$srcdir/setup-ivi-sh-functions" ]; then
+ . "$srcdir/setup-ivi-sh-functions"
+else
+ . /usr/share/setup-ivi/setup-ivi-sh-functions
+fi
# This is a small trick which I use to make sure my scripts are portable -
# check if 'dash' is present, and if yes - use it.
if can_switch_to_dash; then
- exec dash -euf "$srcdir/$PROG" "$@"
+ exec dash -euf -- "$srcdir/$PROG" "$@"
exit $?
fi
{
verbose "creating the default configuration file \"$conf_file\""
- mkdir -p $verbose "$conf_dir" >&2
+ mkdir -p $verbose -- "$conf_dir" >&2
cat > "$conf_file" <<-EOF
# Generated by $PROG
timeout 0
fatal "cannot fetch kernel version from \"$kernel\""
# Create the new entry
- mkdir -p $verbose "$entries_dir" >&2
+ mkdir -p $verbose -- "$entries_dir" >&2
cat > "$entry_path" <<-EOF
# Generated by $PROG
title $title
if [ -n "$verbose" ]; then
verbose "contents of \"$entry_path\":"
- cat "$entry_path" >&2
+ cat -- "$entry_path" >&2
fi
}
"(use -f to ignore this error)"
fi
- rm -rf $verbose "$entry_path" >&2
+ rm -rf $verbose -- "$entry_path" >&2
verbose "removed $entry_path"
}
if [ -f "$entry" ]; then
local regexp="$(get_regexp "efi")"
- local result="$(LC_ALL=C sed -n -e "s/$regexp/\2/p" "$entry")"
+ local result="$(LC_ALL=C sed -n -e "s/$regexp/\2/p" -- \
+ "$entry")"
if [ -z "$result" ]; then
regexp="$(get_regexp "linux")"
- result="$(LC_ALL=C sed -n -e "s/$regexp/\2/p" "$entry")"
+ result="$(LC_ALL=C sed -n -e "s/$regexp/\2/p" -- \
+ "$entry")"
[ -n "$result" ] || return 0
fi
# Find the current default entry
local regexp="$(get_regexp "default")"
- local default_entry="$(LC_ALL=C sed -n -e "s/$regexp/\2/p" "$conf_file")"
+ local default_entry="$(LC_ALL=C sed -n -e "s/$regexp/\2/p" -- \
+ "$conf_file")"
if [ -z "$entry" ]; then
printf "%s\n" "entry: $default_entry"
# Escape special sed characters in "$entry" and replace the old default
# entry with the new one
local entry_esc="$(esc_sed_replacement "$entry")"
- LC_ALL=C sed -i -e "s/$regexp/\1$entry_esc\3/" "$conf_file"
+ LC_ALL=C sed -i -e "s/$regexp/\1$entry_esc\3/" -- "$conf_file"
verbose "set the default boot kernel to \"$entry"\"
}