Sorry if a repost
Hi,

Whith the release of dachstein CD (I didn't tried it yet), I think it's time
to explain what
I am coding now. ( It's not yet ready for a release but you can get the
ideas.
I might be usefull to store config files on a floppy

Introduction:
I consider myself as a 'semi-idiot' creating EigerStein/Dachstein for a
dozen of "super-idiots"
All of them have the same kind of Internet connexion (ADSL with pppoe).
Some of them wanted to have secure tunnels between 2 leaf so I had the
requirement to change
the internal network addressing quite easily

Goal:
- How to keep the configurations files separate from the rest of the
packages
- How to manage the modifications made to configuration file so that I can
remember what I did
  some months before.
- How to ease some manipulations of the config files

Acknowoledgments
I stole a lot of ideas from Oxygen, EigerStein, Dachstien, fli4l.... And
added a few of mine ;-)
I want to thanks the LRP/LEAF gurus for building such a great thing...)
the leaf project is really a gold mine for the one who wants to learn shell
programming

Design
The Main idea is to keep copies of modified configuration files in the
/myconfig directory
copy them in the right place early in the boot process.
the template of config files contains tags that can be replaced by the
actual values stored
in a file on the boot device (out of the .lrp easier to edit whithout
booting the floppy)

Description
I've built a package called MYCONFIG.LRP that contains
-- a directory called
     /myconfig
        /bin              : some scripts
        /templates    : templates of config files stored in subdirectories
bu package name
                             (see templates.conf)
        /sbin            : some scripts copied to /usr/local/sbin ( tools)
        /config         : folder containing the copy of the config directory
stored on the boot
                             filesystem out of the packages
                             myconfig.txt contains variables definitions
       /scripts         : scripts that are called by the unconfigured.sh to
setup things that cannot
                             be done with the templates ( creating the
dnscache file /etc/dnscache/root/ip/internal net

-- a script in /sbin/unconfigured.sh

Files:
  /myconfig/templates.conf
    This file describes the templates. it has the following format
Package   template  destination  owner group perm

   package: package owning this config file
   template: name of template in the /myconfig/templates/$package directory
   destination: full path name where the file must be put
   owner group perm ( if present, chown chgrp chmod are done on the dest
file

 /sbin/unconfigured.sh
  this script (if present, of course ) is called by the boot process after
  packages extractions and before the /etc/init.d
  it calls /myconfig/bin/setup.sh ( todo: change this filename)

 /myconfig/bin/setup.sh
  this scripts does the following
 - temporarly mount /proc because it will be mounted later during the boot
 - mount boot device
 - install all package stored in /boot/addons ( to overcome the command line
lenght limit)
 - look in /boot/config for the first file named *.cfg  (eg.  a.cfg )
 - if found copy it as /myconfig/config/myconfig.txt
 - copy all files from /boot/config/a/*.* to /myconfig/templates/config
    that way I can store out of the packages all configuration data
      - variables from myconfig.txt
      - other templates (ssh key files...)
 - call /myconfig/bin/processtemplate
 - call all scripts in /myconfig/scripts
 - unmount /proc and boot device
/myconfig/bin/processtemplate
   this script converts the myconfig.txt file into a sed script
   in: var=val
   out: s/##var##/val/g
   for all templates in /myconfig/templates.conf
     execute the sed script write the output at destination pathname
     set owner group and permissions
   next


Conclusions.
It's working but not yet finished.
I wanted to store all my modifications in a new package so that a can simply
overwrite  a  .LRP with a new one without losing my changes.

How to use.
- basically instead of modifiying a config file from the menus, you copy the
file in
the /myconfig/template/xx.in
- edit it to use the ##tagname## if it's defined in the myconfig.txt
- or simply edit it
- backup myconfig.lrp.

if you want to upgrade a package, you can replace the old one with a new
downloaded one
and review the config file to compare it with your template.

TODO:
better comment_stripping ( remove LF if file editied in dos/win)
..bug fixes
documentation

URL:
http://users.skynet.be/Etienne.Charlier/myconfig.lrp


If this can give some ideas to the true gurus, .....
It's just a draft, I'm coding/testing before writing docs...


_______________________________________________
Leaf-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/leaf-devel

Reply via email to