[pacman-dev] [PATCH 1/4] Use sysconfdir instead of hardcoded /etc

Dan McGee dpmcgee at gmail.com
Mon Oct 11 16:00:01 EDT 2010


On Mon, Oct 11, 2010 at 2:57 PM, Nezmer <git at nezmer.info> wrote:
> On Mon, Oct 11, 2010 at 02:52:01PM -0500, Dan McGee wrote:
>> On Mon, Oct 11, 2010 at 2:16 PM, Nezmer <git at nezmer.info> wrote:
>> >  "/etc" was hardcoded in some scripts and manpages. Change this to
>> >  respect sysconfdir
>> >
>> > Signed-off-by: Nezmer <git at nezmer.info>
>> > ---
>> >  contrib/Makefile.am       |   10 ++++++++++
>> >  contrib/bacman            |   12 ++++++------
>> >  contrib/pacscripts        |    2 +-
>> >  contrib/pactree           |    6 +++---
>> >  contrib/wget-xdelta.sh    |    4 ++--
>> >  contrib/zsh_completion    |    6 +++---
>> >  doc/Makefile.am           |    8 ++++++++
>> >  doc/makepkg.8.txt         |    2 +-
>> >  doc/pacman.conf.5.txt     |    4 ++--
>> >  scripts/rankmirrors.sh.in |    2 +-
>> >  10 files changed, 37 insertions(+), 19 deletions(-)
>> >
>> > diff --git a/contrib/Makefile.am b/contrib/Makefile.am
>> > index c6243b1..cb2ffc7 100644
>> > --- a/contrib/Makefile.am
>> > +++ b/contrib/Makefile.am
>> > @@ -12,4 +12,14 @@ EXTRA_DIST = \
>> >        zsh_completion \
>> >        README
>> >
>> > +edit = sed -e 's|@sysconfdir[@]|$(sysconfdir)|g'
>> > +
>> > +# Use sysconfdir
>> > +$(EXTRA_DIST): Makefile
>> > +       cp -a $@ $@.tmp # To reserve permissions in tmp files
>> > +       $(edit) $@ >$@.tmp || true
>> > +       mv $@.tmp $@
>> > +
>> > +all-am: $(EXTRA_DIST)
>> > +
>>
>> Unfortunately, none of this works quite as expected unless I am
>> missing something.
>> 1) You will immediately mark files as dirty to git and
>> 2) there is no more @sysconfdir@ once this runs once, making it not
>> all that useful.
>>
>> The first step to these patches will be to do to contrib/ what was
>> done to scripts/ way back when, and move them to extensions such as
>> .sh.in and then have the final result in a bare .sh file.
>>
>> -Dan
>>
>
> I know.
>
> I wasn't sure you would accept renaming all files.

It's the only way I will take it. :)

The patch can be made a lot more compact if you use the '-M -B -C' set
of options to diff/log/format-patch.

-Dan


More information about the pacman-dev mailing list