mikshaw
Group: Members
Posts: 4856
Joined: July 2004 |
|
Posted: Sep. 04 2005,14:33 |
|
minimally tested FINAL EDIT: This first test was a failure, since i had some misconceptions of the DSL init process. Don't listen to anything I say in this first post.
The topic of a post-install script in myDSL extensions comes up once in a while....we were talking about it last night on irc, and I thought i'd give it a go. This first idea does not require a remaster, but instead uses a myDSL extension to add the post-install capability. It is simply an extension containing an edited version of /etc/init.d/mydsl-install, and named something like "0-POSTINSTALL.tar.gz" so it will be the first extension loaded in an auto-load situation (and will not bother running mkwriteable if you don't have a need for it).
The mockup post-install code, added to /etc/init.d/mydsl-install AFTER the "case $APP" and BEFORE "umount":
Code Sample | mydslPOSTINST="/tmp/mydsl.postInstall/postinst.sh" if [ -x "$mydslPOSTINST" ]; then sh $mydslPOSTINST && chmod -x $mydslPOSTINST fi |
I had originally hoped to use the APP variable in the script, but it wouldn't have worked if the package was ever renamed. The "chmod" isn't necessary, but as an afterthought it might be useful for something.
It requires adding a script named /tmp/mydsl.postInstall/postinst.sh to any package using post install behavior. This script needs to be executable. It DOES NOT work with uci extensions. I don't think i want to bother incorporating post-install into mounted apps.
EDIT: After some minor tests it seems to work fine, both at boottime and with user-initiated install.
Test archive here: link to crappy script removed. Better version available farther along in this thread
Archive contains 3 myDSL packages: The post-install (edited mydsl-install script), one *.tar.gz test and one *.dsl test. Don't test on anything but a non-persistent liveCD or frugal, just to be safe.
EDIT2: I just remembered that mydsl-install is run as root, which would mean that the post-install script is currently also run as root. Just something to keep in mind.
EDIT3: My bad...it doesn't work at boot time, since dsl-config doesn't run mydsl-load...it extracts the contents of the archives with tar directly.
-------------- http://www.tldp.org/LDP/intro-linux/html/index.html
|