3 # Copyright 2013 Intel Corporation
4 # Author: Artem Bityutskiy
10 srcdir="$(readlink -ev -- ${0%/*})"
11 PATH="/usr/share/setup-ivi:$srcdir:$PATH"
13 . setup-ivi-sh-functions
14 . installerfw-sh-functions
16 # This is a small trick which I use to make sure my scripts are portable -
17 # check if 'dash' is present, and if yes - use it.
18 if can_switch_to_dash; then
19 exec dash -euf "$srcdir/$PROG" "$@"
26 Usage: $PROG [options]
28 Create the default Tizen IVI /etc/fstab file.
31 -f, --force re-write /etc/fstab if it exists
32 -v, --verbose be verbose
33 --version show the program version and exit
34 -h, --help show this text and exit
40 IFS= printf "%s\n\n" "$PROG: error: $*" >&2
46 tmp=`getopt -n $PROG -o f,v,h --long force,verbose,version,help -- "$@"` ||
47 show_usage_fail "cannot parse command-line options"
70 *) show_usage_fail "unrecognized option \"$1\""
76 installerfw_available || installerfw_restore_env
78 fstab="$(installerfw_mnt_prefix "/etc/fstab")"
80 if [ -s "$fstab" ] && [ -z "$force" ]; then
81 fatal "\"$fstab\" already exists, use -f to re-write it"
84 installerfw_verify_defined "INSTALLERFW_PART_COUNT"
86 contents="# Generated by $PROG
87 devpts /dev/pts devpts gid=5,mode=620 0 0
88 tmpfs /dev/shm tmpfs defaults 0 0
89 proc /proc proc defaults 0 0
90 sysfs /sys sysfs defaults 0 0"
95 while [ "$pnum" -lt "$INSTALLERFW_PART_COUNT" ]; do
96 eval uuid="\${INSTALLERFW_PART${pnum}_UUID:-}"
97 eval mountpoint="\${INSTALLERFW_PART${pnum}_MOUNTPOINT:-}"
98 eval fsopts="\${INSTALLERFW_PART${pnum}_FSOPTS:-defaults}"
99 eval fstype="\${INSTALLERFW_PART${pnum}_FSTYPE:-}"
101 contents="${contents}${br}UUID=$uuid $mountpoint $fstype $fsopts 0 0"
106 verbose "writing the followint to \"$fstab\": $contents"
108 printf "%s" "$contents" > "$fstab"