Sounds good. I will add your patch to my github repository. If you want, I can give you direct access to the repository as well.

[EDIT #1]
I’m working on adding some command line arguments as you mentioned. I hope this all will be POSIX compliant in the end (I’m using the getopts function). Anyway, I hope you haven’t finished this already.

On [EDIT 1]: getopts is indeed what I also use in my scripts. However, I think that in order to be Posix compliant one needs to use getopt instead.

On [EDIT 2]: looks good, but I would then leave out -2, as it is just -1 -s. It feels morenlike the mantra: "Do one thing, but do it well"
On [EDIT 3]: you renamed my ebuild to update-conf.d-9999 . I was not sure if a dot in an atom name was valid, So I named it update-conf-9999. Therefore, I use the line

Code:

EGIT_REPO_URI="git://github.com/Atha/${PN}.d"

. With your ebuild name, you'd have to remove the .d to find the valid git URI

I doubt if I'll get enough time in the next fortnight to try the ebuild, but will let you know if I do. It's nice that you want to give me github access, but I'm not familiar with it. Still, I might give it a try if I first read up a bit on it. As soon as I'm ready to check this out again, I'll send you my private email.

On [EDIT 1]: getopts is indeed what I also use in my scripts. However, I think that in order to be Posix compliant one needs to use getopt instead.

On [EDIT 2]: looks good, but I would then leave out -2, as it is just -1 -s. It feels morenlike the mantra: "Do one thing, but do it well"
On [EDIT 3]: you renamed my ebuild to update-conf.d-9999 . I was not sure if a dot in an atom name was valid, So I named it update-conf-9999. Therefore, I use the line

Code:

EGIT_REPO_URI="git://github.com/Atha/${PN}.d"

. With your ebuild name, you'd have to remove the .d to find the valid git URI

I doubt if I'll get enough time in the next fortnight to try the ebuild, but will let you know if I do. It's nice that you want to give me github access, but I'm not familiar with it. Still, I might give it a try if I first read up a bit on it. As soon as I'm ready to check this out again, I'll send you my private email.

Script development goes well. I still have a few issues, but overall all works as expected. I have to fix some small issues still, but I will upload to git as soon as it’s done.

I’m still not sure whether I should update the existing script or instead publish it as a new advanced version and thus give the user the choice if (s)he wants to use the small script or the advanced (and most likely not POSIX compliant) script. I’ll get to a decission upon completion of my script…

[EDIT #1]
Done. You can get the new version via the GitHub repository.

BEWARE! This script has NOT been thoroughly tested, althou I did run it on my system without errors and it worked as expected.

USE CAUTION! Only use this if you know what you’re doing! This script may delete important files, so make backups!
You have been warned.

So, these are the new command line options (use update-conf.d -h):

Code:

update-conf.d COMPLEX version 2013-04-09

Usage: update-conf.d [-12achlnsuv] [<conf>...]

Options:
-1 run-once (ignores list of valid <conf> entries)
-2 (same as -1 -s)
process and add <conf> to list of valid entries
-a process all valid <conf> entries from the stored list (implies -c)
the <conf>-argument is not required or ignored when present
with -a, options -s and -u are ignored
-c continue on error
-h show this short help page
-l show list of valid <conf> entries
-n test, do nothing (implies -v)
-s set <conf> as valid entry
cannot be used together with -u
-u unset <conf> as valid entry
cannot be used together with -s
-v be verbose (default: not verbose)

Arguments:
<conf> is a .d'ed config in /etc

The list of valid <conf> entries is stored in /etc/update-conf.d.conf.

Feedback is welcomed!

I did NOT check for POSIX compliance yet. (Note: getopts is said to be POSIX compliant.)
Atha.

[EDIT #2]
The set (-s) and unset (-u) options, which should add or remove <conf> entry to/from the /etc/update-cond.d.conf file, are not implemented yet. Suggestions are welcomed!
Atha.

[EDIT #3]
I just updated the scripts on GitHub. The changes are:

The scripts are now called SIMPLE and COMPLEX.

You can select them using make (make select-simple and make select-complex). In order to be able to get the selected version built, run make clean, otherwise make build and make install will use the previously built version (which may not be the one you just selected).

Only one version can be installed, as both will be named update-conf.d.

The logic for set and unset is finished, but as of now the functions are still stubs.

I'm still searching for a good way to manage (set/unset) entries in the update-conf.d.conf file…
Atha.

I've found what I needed at stackoverflow. I am using grep -v (inverted grep) for the unset function because it seems to be the fastest way to do it, with the only downside that a .bak file of /etc/update-conf.d.conf needs to be created. On the other hand, this possibly prevents data loss if anything should go wrong.

Please test, and give feedback! But be adviced to make backups! A prefixed environment is recommended for testing. (ALTERNATIVLEY simply set root="/etc" to something like root="/tmp/etc" inside the script you use for testing… don't forget to populate that testing directory!)

[EDIT] Issues:

One issue already is apparent: mv prints out errors if a file doesn't exist already: using update-conf.d -s test, and a (prefixed) /tmp/etc/test.d present, complains because /tmp/etc/test cannot be moved (mv) to /tmp/etc/test.bak. This only happens once.

I'm pretty sure it only works with paths, that do not contain spaces!

[UPDATE] @Issues:

I've just tested it: it actually works with paths, that contain spaces.

Last edited by Atha on Sun Sep 15, 2013 10:47 pm; edited 2 times in total