Author Topic: Overwrite previous link  (Read 2300 times)

Offline gregg_a_g

  • Newbie
  • *
  • Posts: 28
Overwrite previous link
« on: August 15, 2012, 06: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? 

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14630
Re: Overwrite previous link
« Reply #1 on: August 15, 2012, 07: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..

Offline gregg_a_g

  • Newbie
  • *
  • Posts: 28
Re: Overwrite previous link
« Reply #2 on: August 15, 2012, 07: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 ?

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: Overwrite previous link
« Reply #3 on: August 15, 2012, 07:34:46 AM »
Please read the wiki article:
http://wiki.tinycorelinux.net/wiki:creating_extensions

It covers startup scripts.

Offline gregg_a_g

  • Newbie
  • *
  • Posts: 28
Re: Overwrite previous link
« Reply #4 on: August 15, 2012, 07: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!