Fabio M. Di Nitto wrote:
...
>> > Handling of prefix can be better I agree, but turning them into
>> > sbin_PROGRAM doesn't work either.
>> >
>> > Clearly I am open to any better solution than the one I have in place...
>>
>> Sure.
>> There's already so much default-munging going on in configure.ac,
>> why not add a tiny bit more.
>>
>> This incremental patch does what you seem to want:
>>
>> In case we're using the default (/usr) prefix
>> and the default exec_prefix, and set sbindir to /sbin:
>>
>> diff --git a/configure.ac b/configure.ac
>> index a568463..ca0301e 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -38,6 +38,7 @@ fi
>>
>> case $exec_prefix in
>> NONE) exec_prefix=$prefix;;
>> + test "$prefix:$sbindir" = '/usr:${exec_prefix}/sbin' &&
>> sbindir=/sbin
>> prefix) exec_prefix=$prefix;;
>> esac
>
> hmmmm... wouldn't that move all sbin_PROGRAMS to /sbin (assuming we are
> doing default build)? If so that's still not ideal because except those
> 3 binaries, all the others can go (and should go) in /usr/sbin as they
> are not vital for the FS operations.
Good catch. I see, now.
The following incremental patch finally seems to do the right thing:
- with --prefix=P where P!=/usr: no change
- with no --prefix option, or with --prefix=/usr, install those three
subdirs' tools into /sbin rather than into /usr/sbin.
diff --git a/gfs2/fsck/Makefile.am b/gfs2/fsck/Makefile.am
index 1667df3..ac89524 100644
--- a/gfs2/fsck/Makefile.am
+++ b/gfs2/fsck/Makefile.am
@@ -1,5 +1,10 @@
MAINTAINERCLEANFILES = Makefile.in
+# install into /sbin, not /usr/sbin
+sbindir := $(shell test '$(exec_prefix):$(sbindir)' = /usr:/usr/sbin \
+ && echo /sbin \
+ || echo '$(exec_prefix)/sbin')
+
sbin_PROGRAMS = fsck.gfs2
noinst_HEADERS = eattr.h fs_bits.h fsck.h fs_recovery.h hash.h \
diff --git a/gfs2/mkfs/Makefile.am b/gfs2/mkfs/Makefile.am
index ba4f851..75466fa 100644
--- a/gfs2/mkfs/Makefile.am
+++ b/gfs2/mkfs/Makefile.am
@@ -1,5 +1,10 @@
MAINTAINERCLEANFILES = Makefile.in
+# install into /sbin, not /usr/sbin
+sbindir := $(shell test '$(exec_prefix):$(sbindir)' = /usr:/usr/sbin \
+ && echo /sbin \
+ || echo '$(exec_prefix)/sbin')
+
sbin_PROGRAMS = mkfs.gfs2
noinst_HEADERS = gfs2_mkfs.h
diff --git a/gfs2/mount/Makefile.am b/gfs2/mount/Makefile.am
index a82970e..0303b24 100644
--- a/gfs2/mount/Makefile.am
+++ b/gfs2/mount/Makefile.am
@@ -1,5 +1,10 @@
MAINTAINERCLEANFILES = Makefile.in
+# install into /sbin, not /usr/sbin
+sbindir := $(shell test '$(exec_prefix):$(sbindir)' = /usr:/usr/sbin \
+ && echo /sbin \
+ || echo '$(exec_prefix)/sbin')
+
sbin_PROGRAMS = mount.gfs2
noinst_HEADERS = gfs_ondisk.h util.h