setup-ivi-fstab: use correct case
[platform/adaptation/setup-scripts.git] / setup-ivi-fstab
index a0c1153..a91c19c 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
 
@@ -92,14 +97,24 @@ proc    /proc     proc    defaults        0 0
 sysfs   /sys      sysfs   defaults        0 0"
 
 pnum=0
-br="
-"
 while [ "$pnum" -lt "$INSTALLERFW_PART_COUNT" ]; do
+       installerfw_verify_defined "INSTALLERFW_PART${pnum}_UUID"
+       installerfw_verify_defined "INSTALLERFW_PART${pnum}_MOUNTPOINT"
+       installerfw_verify_defined "INSTALLERFW_PART${pnum}_FSTYPE"
+
        eval uuid="\${INSTALLERFW_PART${pnum}_UUID:-}"
        eval mountpoint="\${INSTALLERFW_PART${pnum}_MOUNTPOINT:-}"
        eval fsopts="\${INSTALLERFW_PART${pnum}_FSOPTS:-defaults}"
        eval fstype="\${INSTALLERFW_PART${pnum}_FSTYPE:-}"
 
+       if [ "$fstype" = "vfat" ]; then
+               # FAT FS's short UUID has to be uppercase
+               uuid="$(printf "%s" "$uuid" | tr "[:lower:]" "[:upper:]")"
+       else
+               # Normal UUID has to be lowercase
+               uuid="$(printf "%s" "$uuid" | tr "[:upper:]" "[:lower:]")"
+       fi
+
        contents="${contents}${br}UUID=$uuid  $mountpoint  $fstype  $fsopts  0 0"
 
        pnum="$((pnum+1))"