Inspection of "pidin" shows that the script launcher process (proc_scriptlauncher) identifies correctly the mount path to the SD card in which the encoded copie_scr.sh script resides, for example:
Code:
323657 24584 /bin/proc_scriptlauncher -i 30 -p /dev/shmem/copie_scr.sh ... 966717 323657 ksh /dev/shmem/copie_scr.sh /mnt/sdcard10t12
and
Code:
323657 24584 /bin/proc_scriptlauncher -i 30 -p /dev/shmem/copie_scr.sh ... 1212477 323657 ksh /dev/shmem/copie_scr.sh /mnt/sdcard20t12
In the former case, the SD script is run from slot SD 1; in the latter, slot SD 2.
Thus, shell argument 1 to the encoded copie_scr.sh script contains the correct mount path to the SD card. Using this information about the calling process, we can include it in a new (encoded) copie_scr.sh script:
Code:
#!/bin/ksh # 20220102 drger; MMI3G SD shell script launcher export SDPATH=$1 export PATH=${SDPATH}/bin:$PATH export SDLIB=${SDPATH}/lib export SDVAR=${SDPATH}/var export SWTRAIN="`cat /dev/shmem/sw_trainname.txt`" mount -u $SDPATH cd $SDPATH exec ksh ./run.sh $SDPATH
Here, new exported environment variable SDPATH contains the value passed from the script launcher process as argument number 1 ($1). And while we're at it, we can prepend our SD card bin directory to the PATH, and add a new SWTRAIN environment variable using the contents of /dev/shmem/sw_trainname.txt (this is the MMI firmware version name) (along with a couple environment variables I use routinely in my MMI SD scripts: SDLIB and SDVAR).
Finally, the new encoded copie_scr.sh script launches our plain-text "run.sh" shell script with argument $SDPATH for completeness.
A ZIP archive of this new and improved copie_scr.sh SD card script launcher (and its source text) can be found HERE.
The size of this encoded copie_scr.sh file is 268 bytes and the md5sum is a18e6f7ebedc97b28f99cacb2ff87d4b. --g
Bookmarks