View previous topic :: View next topic |
Author |
Message |
javeree Guru
Joined: 29 Jan 2006 Posts: 453
|
Posted: Thu Mar 28, 2013 11:28 am Post subject: |
|
|
sure, no problem with that. However I think you should remove the lines
Code: | echo "patching the executable to allow files in subdirectories (e.g. /etc/portage/make.conf.d)"
sed -i 's:^dconfpath=.*:dconfpath="${dpath}/$(basename ${conf})":' update-conf.d
|
and directly put that in the code.
I'm also considering adding the following features:
1. update-conf.d -a
execute update-conf for each file in /etc/update-conf.d.conf
2. update-conf.d -1 some-config-file
run the script for the mentioned configfile, even if it is not mentioned in /etc/update-conf.d
3. update-conf.d -2 some-config-file
the same as update-conf.d -1 some-config-file, but add the configfile to /etc/update-conf.d |
|
Back to top |
|
|
Atha Apprentice
Joined: 22 Sep 2004 Posts: 229
|
Posted: Thu Mar 28, 2013 12:05 pm Post subject: |
|
|
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.
[EDIT #2]
Code: | print_usage () {
echo "Usage: ${scriptname} [-12ahlsuv] <conf>" >&2
echo "" >&2
echo "Options:" >&2
echo " -1 run-once (ignores list of valid <conf> entries)" >&2
echo " -2 (same as -1 -s)" >&2
echo " process and add <conf> to list of valid entries" >&2
echo " -a process all valid <conf> entries from the stored list" >&2
echo " -h show this page (usage, help)" >&2
echo " -l show list of valid <conf> entries" >&2
echo " -s set <conf> as valid entry" >&2
echo " -u unset <conf> as valid entry" >&2
echo " -v be verbose (default: not verbose)" >&2
echo "" >&2
echo "Argument:" >&2
echo " <conf> is a .d'ed config in ${root}" >&2
echo "" >&2
echo "The list of valid <conf> entries is stored in ${scriptconf}." >&2
} |
But it’s getting very very complicated to implement all this. At least for me…
I’d also suggest to keep a simple version around, in case someone wants to keep a minimal version…
[EDIT #3]
BTW, when I use the ebuild from GitHub (which is basically your ebuild) and do a ebuild update-conf.d-9999.ebuild digest on it, it get an error:
Code: | !!! app-admin/update-conf.d-9999 does not follow correct package syntax. |
What is wrong? |
|
Back to top |
|
|
javeree Guru
Joined: 29 Jan 2006 Posts: 453
|
Posted: Fri Mar 29, 2013 8:13 pm Post subject: |
|
|
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. |
|
Back to top |
|
|
javeree Guru
Joined: 29 Jan 2006 Posts: 453
|
Posted: Fri Mar 29, 2013 8:13 pm Post subject: |
|
|
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. |
|
Back to top |
|
|
Atha Apprentice
Joined: 22 Sep 2004 Posts: 229
|
Posted: Mon Apr 08, 2013 7:06 pm Post subject: Developement update |
|
|
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 this to install it:
Code: | git clone git://github.com/Atha/update-conf.d.git
cd update-conf.d
make select-complex
make clean
make build install |
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. |
|
Back to top |
|
|
Atha Apprentice
Joined: 22 Sep 2004 Posts: 229
|
Posted: Tue Apr 09, 2013 9:43 pm Post subject: Finished! |
|
|
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 |
|
Back to top |
|
|
Atha Apprentice
Joined: 22 Sep 2004 Posts: 229
|
Posted: Sun Sep 15, 2013 10:42 pm Post subject: final release (for now) |
|
|
I've finally found some time to go over the docs, the makefile and the ebuild. It should all be working properly now.
I've also put some effort into making a man page for the complex script.
I hope you all enjoy this release!
Cheers and thanks for all your help with it,
Atha. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|