blob: a2147ea7584ea293ca91d0c559953a3d5be7d532 [file] [log] [blame]
Adriana Kobylakadb57d92017-04-28 16:05:39 -05001[Unit]
Adriana Kobylakf256ae52017-05-01 12:23:17 -05002Description=Mount UBIFS volume pnor-prsv and pnor-rw-%I
Adriana Kobylakadb57d92017-04-28 16:05:39 -05003Requires=obmc-flash-bios-ubiattach.service
4After=obmc-flash-bios-ubiattach.service
5
6[Service]
7Type=oneshot
Adriana Kobylakf256ae52017-05-01 12:23:17 -05008RemainAfterExit=no
9ExecStart=/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;'