On Fri, Jan 01, 2010 at 07:05:04PM +1300, martin f krafft wrote: > Package: switchconf > Version: 0.0.7-1 > Severity: wishlist > > It would be great if switchconf could run per-location scripts, e.g. > using run-parts on /etc/switchconf/scripts/$LOCATION/* > > Ideally, it should pass the old and new location names as $1 and $2, > or in the environment.
In my use cases I have find other ways for running code for different "LOCATION". To be more generic let's call it conf as a short for configuration. I use switchconf for changing things that don't depend on location. Usually you need to run things before and after the change. Instead of creating a new directory to store scripts. Why not recycle before.d and after.d? During the switch, file /var/lib/misc/switchconf.lastcfg have the name of the old conf. If I start calling the scripts with the new conf. You have all the information you may need: - $1=NextConf - `cat /var/lib/misc/switchconf.lastcfg`=OldConf. This way the only change is on the loop that call the scripts # executing each scripts before for r in `find ${conf_top_dirs}/${exec_dir_before} -type f -perm +1 | sort`; do echo -n "Executing $r .. "; echo "------------- Executing $r -----------------" >> ${logfile} ${r} ${conf} 2>&1 >> ${logfile} ^^^^^^^^^ echo "done."; done Jose Calhariz -- -- O olho do homem serve de fotografia ao invisível, como o ouvido serve de eco ao silêncio. -- Machado de Assis (Esaú e Jacó) -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org