Tiny Core Linux

Tiny Core Extensions => TCE Q&A Forum => Topic started by: gregg_a_g on August 15, 2012, 09:31:53 AM

Title: Overwrite previous link
Post by: gregg_a_g on August 15, 2012, 09:31:53 AM
I created a new extension for my Brother MFC8840D multifunction scanner/printer.  Inside the extension there were several "links" that pointed to /usr/lib which I revised to point to /usr/local/lib before I created the extension.  Also, there is a scanner configuration (brother.conf) that goes in the /usr/local/etc/sane.d directory.  All of this seemed to work okay, but the one think that didn't work was linking my new "dll.conf" file.  Since the "sane-backend" extension already creates a dll.conf link in /usr/local/etc/sane.d, I guess you can't make a new link pointing to a different file (my extension with an updated dll.conf that includes the brother.conf).  For now I just "sudo rm dll.conf" and then create a new dll.conf with just "brother" on one line.  I guess I could also link to the file in my extension.  Is there a way to automate this, or a preferred method for "updating" links for extensions that have overlaps/conflicts? 
Title: Re: Overwrite previous link
Post by: Juanito on August 15, 2012, 10:16:14 AM
The "tc way" for configuration files under /usr/local/etc is to have a extension start up script test for their existance and if required copy a default from somewhere like /usr/local/share.

This also has the advantage that the file can be overwritten.

This being said, I'm certainly guilty of forgetting to do this..
Title: Re: Overwrite previous link
Post by: gregg_a_g on August 15, 2012, 10:22:08 AM
Juanito, thanks for the quick reply.  So does the "tc way" include a way to insert a startup script?  In other words, if I create
a new extension, say "gg1" with associated file structure, is there a way to include a "startup script" in the file structure (maybe just below "gg1" with a special name) such that the script will run when the extension is loaded?  Or do I just need to add a command in /opt/bootlocal.sh ?
Title: Re: Overwrite previous link
Post by: gerald_clark on August 15, 2012, 10:34:46 AM
Please read the wiki article:
http://wiki.tinycorelinux.net/wiki:creating_extensions

It covers startup scripts.
Title: Re: Overwrite previous link
Post by: gregg_a_g on August 15, 2012, 10:55:26 AM
I was a little confused by the details, but think I get it now.  The file in usr/local/tce.installed/ext-name will be executed when the extension is first loaded (and this is where the dll.conf would get copied - from /usr/local/share or somewhere, to /usr/local/etc and effectively replace the link with a real file).

Thanks!  TinyCore keeps getting better (and making more sense).  I am also very excited to see ARM work beginning!  Lots of very inexpensive device showing up!