#!/bin/sh loggerName=detectParSystem.sh MNTDIR=/mnt/rfs DIAG_FILE=/var/run/diag/parsystem ubidev=ubi3 rfs1ubi=5 rfs2ubi=6 rfs1ubimtd="ubi.mtd=5" rfs2ubimtd="ubi.mtd=6" f_exit(){ umount $MNTDIR /usr/bin/ubidetach /dev/ubi_ctrl -m $OtherUbi >/dev/null 2>&1 exit 1 } mkdir $MNTDIR >/dev/null 2>&1 # ermitteln der aktiven Partition ActiveMtd=`cat /proc/cmdline | awk '{print $3}'` /usr/bin/logger -s -t $loggerName "aktive Partion <$ActiveMtd>" if [ $ActiveMtd = $rfs1ubimtd ]; then OtherUbi=$rfs2ubi /usr/bin/ubiattach /dev/ubi_ctrl -m $OtherUbi -d 3 >/dev/null 2>&1 if [ "$?" -ne "0" ]; then logger -s -t $loggerName "Error: /usr/bin/ubiattach /dev/ubi_ctrl -m $OtherUbi" f_exit fi mount -r -o sync -t ubifs $ubidev:rootfs $MNTDIR >/dev/null 2>&1 if [ "$?" -ne "0" ]; then logger -s -t $loggerName "Error: mount -t ubifs $ubidev:rootfs $MNTDIR" f_exit fi else OtherUbi=$rfs1ubi /usr/bin/ubiattach /dev/ubi_ctrl -m $OtherUbi -d 3 >/dev/null 2>&1 if [ "$?" -ne "0" ]; then logger -s -t $loggerName "Error: /usr/bin/ubiattach /dev/ubi_ctrl -m $OtherUbi" f_exit fi mount -r -o sync -t ubifs $ubidev:rootfs $MNTDIR >/dev/null 2>&1 if [ "$?" -ne "0" ]; then logger -s -t $loggerName "Error: mount -t ubifs $ubidev:rootfs $MNTDIR" f_exit fi fi # Parallele FW Version eintragen cat $MNTDIR/etc/version > $DIAG_FILE if [ "$?" -ne "0" ]; then logger -s -t $loggerName "Error: cat $MNTDIR/etc/version" f_exit fi # aushaengen umount $MNTDIR /usr/bin/ubidetach /dev/ubi_ctrl -m $OtherUbi >/dev/null 2>&1 exit 0