#!/bin/bash . $include_modpatch #add Tam section to rc.S if ! `cat "$1"/etc/init.d/rc.S | grep -q 'mkdir -p /data/tam'` ; then echo2 " -- add Tam section from original rc.S" sed -i -e 's|^.*export CONFIG_ENVIRONMENT_PATH=/proc/sys/urlader.*$| \ modprobe vfat\ modprobe nls_cp437\ modprobe nls_iso8859-1\ modprobe fat\ xx=`grep \"jffs2\" /proc/mtd`\ jffs2_pat=""\ jffs2_size=0\ jffs2_found=0\ echo "[jffs2] xx=$xx"\ for i in $xx ; do\ echo "[jffs2] i=$i"\ case $i in\ *:)\ jffs2_pat=${i##mtd}\ jffs2_pat=${jffs2_pat%%:}\ echo "[jffs2] jffs2_pat=$jffs2_pat"\ ;;\ 00*)\ if [ $jffs2_found -eq 0 ] ; then\ jffs2_size=$((0x$i / (2**16)))\ echo "[jffs2] jffs2_size=$jffs2_size"\ fi\ jffs2_found=1\ ;;\ esac\ done\ if [ $jffs2_size -gt 0 ]; then\ echo "[jffs2] load jffs2 module" ; \ if modprobe jffs2; then\ echo "[jffs2] mount jffs "; \ mount -t jffs2 /dev/mtdblock${jffs2_pat} /data\ jffs2_ok=$?\ if [ $jffs2_ok -ne 0 ]; then\ /bin/reinit_jffs2 -c /dev/mtdblock${jffs2_pat} -a -o /var/tmp/jffs2.image ;\ cp /var/tmp/jffs2.image /dev/mtdblock${jffs2_pat}\ echo "copying image..."\ rm /var/tmp/jffs2.image\ echo "done."\ mount -t jffs2 /dev/mtdblock${jffs2_pat} /data\ jffs2_ok=$?\ fi\ if [ $jffs2_ok -eq 0 ]; then\ echo "[jffs2] write env variable jffs2_size to $jffs2_size" ;\ echo "jffs2_size $jffs2_size" >/proc/sys/urlader/environment\ fi\ fi\ fi\ # TAM\ if [ -d /usr/share/tam/msg/tcom/${Language} ] ; then\ ln -s /usr/share/tam/msg/tcom/${Language} /var/tam/message\ else\ ln -s /usr/share/tam/msg/default/${Language} /var/tam/message\ fi\ echo "TAM: create JFFS2 directory /data/tam"\ mkdir -p /data/tam\ if [ -d /data/tam ] ; then\ if [ ! -f /data/tam/config ] ; then\ if [ -f /etc/default.${CONFIG_PRODUKT}/tcom/config.tam ] ; then\ echo "TAM Defaults: cp /etc/default.${CONFIG_PRODUKT}/tcom/config.tam /data/tam/config"\ cp /etc/default.${CONFIG_PRODUKT}/tcom/config.tam /data/tam/config\ else\ echo "TAM Defaults: /etc/default.${CONFIG_PRODUKT}/tcom/config.tam not found!"\ fi\ fi\ else\ echo "TAM Defaults: User Directory /data/tam not found!"\ fi\ # PTEST\ export CONFIG_ENVIRONMENT_PATH=/proc/sys/urlader|' "${1}/etc/init.d/rc.S" fi