Adriana Kobylak | adb57d9 | 2017-04-28 16:05:39 -0500 | [diff] [blame] | 1 | [Unit] |
Adriana Kobylak | f256ae5 | 2017-05-01 12:23:17 -0500 | [diff] [blame^] | 2 | Description=Mount UBIFS volume pnor-prsv and pnor-rw-%I |
Adriana Kobylak | adb57d9 | 2017-04-28 16:05:39 -0500 | [diff] [blame] | 3 | Requires=obmc-flash-bios-ubiattach.service |
| 4 | After=obmc-flash-bios-ubiattach.service |
| 5 | |
| 6 | [Service] |
| 7 | Type=oneshot |
Adriana Kobylak | f256ae5 | 2017-05-01 12:23:17 -0500 | [diff] [blame^] | 8 | RemainAfterExit=no |
| 9 | ExecStart=/bin/sh -c 'rw=pnor-rw-%i; \ |
| 10 | if [ ! -d "/media/$rw" ]; then \ |
| 11 | mkdir /media/$rw; fi; \ |
| 12 | if [ ! -d "/media/pnor-prsv" ]; then \ |
| 13 | mkdir /media/pnor-prsv; fi; \ |
| 14 | rw_ubi=`ubinfo -d 0 -a | grep $rw`; \ |
| 15 | if [ -z "$rw_ubi" ]; then \ |
| 16 | {sbindir}/ubimkvol /dev/ubi0 -N $rw -s 1MiB; fi; \ |
| 17 | prsv_ubi=`ubinfo -d 0 -a | grep pnor-prsv`; \ |
| 18 | if [ -z "$prsv_ubi" ]; then \ |
| 19 | {sbindir}/ubimkvol /dev/ubi0 -N pnor-prsv -s 1MiB; fi; \ |
| 20 | if ! grep -q $rw /proc/mounts; then \ |
| 21 | mount -t ubifs ubi0:$rw /media/$rw; fi; \ |
| 22 | if ! grep -q pnor-prsv /proc/mounts; then \ |
| 23 | mount -t ubifs ubi0:pnor-prsv /media/pnor-prsv; fi;' |