Add 'COPYING' file with the GPLv2 licens
[platform/adaptation/setup-scripts.git] / setup-ivi-boot
index 13f2406..ba167fc 100755 (executable)
@@ -10,13 +10,18 @@ VER="1.0"
 srcdir="$(readlink -ev -- ${0%/*})"
 PATH="/usr/share/setup-ivi:$srcdir:$PATH"
 
-. "$srcdir/setup-ivi-sh-functions"
-. "$srcdir/installerfw-sh-functions"
+if [ -f "$srcdir/setup-ivi-sh-functions" ]; then
+       . "$srcdir/setup-ivi-sh-functions"
+       . "$srcdir/installerfw-sh-functions"
+else
+       .  /usr/share/setup-ivi/setup-ivi-sh-functions
+       .  /usr/share/setup-ivi/installerfw-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
 
@@ -34,7 +39,7 @@ install_gummiboot()
        fi
 
        # Install gummiboot
-       mkdir -p $verbose "$installdir" >&2
+       mkdir -p $verbose -- "$installdir" >&2
        [ -f "$gummiboot_path/gummibootia32.efi" ] && \
                cp $verbose "$gummiboot_path/gummibootia32.efi" \
                            "$installdir/bootia32.efi" >&2
@@ -68,7 +73,7 @@ install_extlinux()
                      "variable is not defined"
 
        # Install extlinux
-       mkdir -p $verbose "$installdir" >&2
+       mkdir -p $verbose -- "$installdir" >&2
        "$extlinux" --device "$boot_devnode" -i "$installdir" || \
                fatal "cannot install extlinux to \"$installdir\"" \
                      "(requires extlinux version 5 or greater)"
@@ -143,9 +148,7 @@ done
 bootdir="$(installerfw_mnt_prefix "/boot")"
 
 if installerfw_available; then
-       if ! [ -s "$(installerfw_get_env_file_name)" ]; then
-               installerfw_save_env
-       fi
+       installerfw_save_env
 else
        installerfw_restore_env
 fi
@@ -160,7 +163,7 @@ else
 fi
 
 # Create bootloader entries for each kernel
-kernels="$(ls -1 "$bootdir" | LC_ALL=C grep "^vmlinuz-" | sort -r)"
+kernels="$(ls -1 "$bootdir" | LC_ALL=C grep -- "^vmlinuz-" | sort -r)"
 
 [ -n "$kernels" ] || \
        fatal "no kernels (vmlinuz-*) found in \"$bootdir\""