Silent-Hunter
Hardcore Member
- Joined
- May 29, 2010
- Messages
- 3,485
How do I make a PND copy files from within itself to its appdata folder?
The PND I have made needs the right nub to have the scroll function, so I created PND_pre_script.sh and PND_post_script.sh but they don't work when packaged into the PND, they have to be in the appdata folder. So I want to make the PND copy them there on first run. I've tried to find how to do this, but no luck.
EDIT:
I figured out how to do it, but it doesn't work the first time the PND runs, the scripts are moved, but they don't run properly until I quit and restart the PND.
Here's the run.sh from the PND:
#!/bin/sh
[ ! -d 'PND_pre_script.sh' ] && cp -Rpn pre_script.sh PND_pre_script.sh
[ ! -d 'PND_post_script.sh' ] && cp -Rpn post_script.sh PND_post_script.sh
./svgviewer
And here is the contents of the .out:
=======================================================================================
PND : /media/2/build/out.pnd
PND_FSTYPE : Squashfs
APPDATADIR : /media/2/pandora/appdata/svgviewer
APPDD_FSTYPE : ext3
PND_CPUSPEED : <unset>
EXENAME : run.sh
ARGUMENTS : <unset>
=======================================================================================
[ START ]--- Mount the PND ----------
Mounting : mount -t squashfs -o ro "/dev/loop2" "/mnt/utmp/svgviewer"
Mounting the Union FS : mount -t aufs -o exec,dirs="/media/2/pandora/appdata/svgviewer=rw+nolwh":"/mnt/pnd/svgviewer=rr" none "/mnt/utmp/svgviewer"
[SUCCESS]--- Mount the PND ----------
[ START ]--- Starting the application (run.sh ) ----------
[SUCCESS]--- Starting the application (run.sh ) ----------
[ START ]--- Starting user configured post-script ----------
cat: /tmp/nub0mode_before: No such file or directory
cat: /tmp/nub1mode_before: No such file or directory
usage:
/usr/pandora/scripts/op_nubchange.sh <left_nub_mode> <right_nub_mode>
rm: cannot remove `/tmp/nub0mode_before': No such file or directory
rm: cannot remove `/tmp/nub1mode_before': No such file or directory
[ FAILED]--- Starting user configured post-script ----------
[ START ]--- Restoring the frame buffer status ----------
[SUCCESS]--- Restoring the frame buffer status ----------
[ START ]--- uMount the PND ----------
[ START ]--- Waiting the Union to be available ----------
[SUCCESS]--- Waiting the Union to be available ----------
auplink
link.c:223: AUFS_CTL_PLINK_MAINT: Inappropriate ioctl for device
rmdir: failed to remove `/mnt/utmp/svgviewer': Device or resource busy
[ START ]--- Waiting the PND mount dir to be free ----------
[SUCCESS]--- Waiting the PND mount dir to be free ----------
cleanup done
[SUCCESS]--- uMount the PND ----------
=======================================================================================
Return code is : 6
It appears as though it can't see the PND_pre_script.sh, even though I know it copied it because I checked that it's there, and it works on subsequent runs.
The PND I have made needs the right nub to have the scroll function, so I created PND_pre_script.sh and PND_post_script.sh but they don't work when packaged into the PND, they have to be in the appdata folder. So I want to make the PND copy them there on first run. I've tried to find how to do this, but no luck.
EDIT:
I figured out how to do it, but it doesn't work the first time the PND runs, the scripts are moved, but they don't run properly until I quit and restart the PND.
Here's the run.sh from the PND:
#!/bin/sh
[ ! -d 'PND_pre_script.sh' ] && cp -Rpn pre_script.sh PND_pre_script.sh
[ ! -d 'PND_post_script.sh' ] && cp -Rpn post_script.sh PND_post_script.sh
./svgviewer
And here is the contents of the .out:
=======================================================================================
PND : /media/2/build/out.pnd
PND_FSTYPE : Squashfs
APPDATADIR : /media/2/pandora/appdata/svgviewer
APPDD_FSTYPE : ext3
PND_CPUSPEED : <unset>
EXENAME : run.sh
ARGUMENTS : <unset>
=======================================================================================
[ START ]--- Mount the PND ----------
Mounting : mount -t squashfs -o ro "/dev/loop2" "/mnt/utmp/svgviewer"
Mounting the Union FS : mount -t aufs -o exec,dirs="/media/2/pandora/appdata/svgviewer=rw+nolwh":"/mnt/pnd/svgviewer=rr" none "/mnt/utmp/svgviewer"
[SUCCESS]--- Mount the PND ----------
[ START ]--- Starting the application (run.sh ) ----------
[SUCCESS]--- Starting the application (run.sh ) ----------
[ START ]--- Starting user configured post-script ----------
cat: /tmp/nub0mode_before: No such file or directory
cat: /tmp/nub1mode_before: No such file or directory
usage:
/usr/pandora/scripts/op_nubchange.sh <left_nub_mode> <right_nub_mode>
rm: cannot remove `/tmp/nub0mode_before': No such file or directory
rm: cannot remove `/tmp/nub1mode_before': No such file or directory
[ FAILED]--- Starting user configured post-script ----------
[ START ]--- Restoring the frame buffer status ----------
[SUCCESS]--- Restoring the frame buffer status ----------
[ START ]--- uMount the PND ----------
[ START ]--- Waiting the Union to be available ----------
[SUCCESS]--- Waiting the Union to be available ----------
auplink
rmdir: failed to remove `/mnt/utmp/svgviewer': Device or resource busy
[ START ]--- Waiting the PND mount dir to be free ----------
[SUCCESS]--- Waiting the PND mount dir to be free ----------
cleanup done
[SUCCESS]--- uMount the PND ----------
=======================================================================================
Return code is : 6
It appears as though it can't see the PND_pre_script.sh, even though I know it copied it because I checked that it's there, and it works on subsequent runs.
Last edited by a moderator: