Merge branch 'sysconfdir-build' of github.com:OmegaPhil/udevil into OmegaPhil-sysconfdir-build

This commit is contained in:
IgnorantGuru 2013-12-03 06:55:53 -07:00
commit b31a758273
5 changed files with 33 additions and 19 deletions

View File

@ -5,13 +5,17 @@ EXTRA_DIST = udevil.conf
endif endif
install-data-hook: install-data-hook:
test -d $(DESTDIR)/etc/udevil || mkdir -p -- $(DESTDIR)/etc/udevil test -d $(DESTDIR)$(sysconfdir)/udevil || mkdir -p -- \
test -f $(DESTDIR)/etc/udevil/udevil.conf || $(INSTALL_DATA) \ $(DESTDIR)$(sysconfdir)/udevil
$(srcdir)/udevil.conf $(DESTDIR)/etc/udevil/udevil.conf test -f $(DESTDIR)$(sysconfdir)/udevil/udevil.conf || $(INSTALL_DATA) \
$(srcdir)/udevil.conf \
$(DESTDIR)$(sysconfdir)/udevil/udevil.conf
if ADD_SYSTEMD if ADD_SYSTEMD
test -d $(DESTDIR)/etc/conf.d || mkdir -p -- $(DESTDIR)/etc/conf.d test -d $(DESTDIR)$(sysconfdir)/conf.d || mkdir -p -- \
test -f $(DESTDIR)/etc/conf.d/devmon || $(INSTALL_DATA) \ $(DESTDIR)$(sysconfdir)/conf.d
$(srcdir)/systemd/devmon $(DESTDIR)/etc/conf.d/devmon test -f $(DESTDIR)$(sysconfdir)/conf.d/devmon || $(INSTALL_DATA) \
$(srcdir)/systemd/devmon \
$(DESTDIR)$(sysconfdir)/conf.d/devmon
test -d $(DESTDIR)/$(libdir)/systemd/system || \ test -d $(DESTDIR)/$(libdir)/systemd/system || \
mkdir -p -- $(DESTDIR)/$(libdir)/systemd/system mkdir -p -- $(DESTDIR)/$(libdir)/systemd/system
$(INSTALL_DATA) $(srcdir)/systemd/devmon@.service \ $(INSTALL_DATA) $(srcdir)/systemd/devmon@.service \

View File

@ -457,12 +457,16 @@ uninstall-am:
install-data-hook: install-data-hook:
test -d $(DESTDIR)/etc/udevil || mkdir -p -- $(DESTDIR)/etc/udevil test -d $(DESTDIR)$(sysconfdir)/udevil || mkdir -p -- \
test -f $(DESTDIR)/etc/udevil/udevil.conf || $(INSTALL_DATA) \ $(DESTDIR)$(sysconfdir)/udevil
$(srcdir)/udevil.conf $(DESTDIR)/etc/udevil/udevil.conf test -f $(DESTDIR)$(sysconfdir)/udevil/udevil.conf || $(INSTALL_DATA) \
@ADD_SYSTEMD_TRUE@ test -d $(DESTDIR)/etc/conf.d || mkdir -p -- $(DESTDIR)/etc/conf.d $(srcdir)/udevil.conf \
@ADD_SYSTEMD_TRUE@ test -f $(DESTDIR)/etc/conf.d/devmon || $(INSTALL_DATA) \ $(DESTDIR)$(sysconfdir)/udevil/udevil.conf
@ADD_SYSTEMD_TRUE@ $(srcdir)/systemd/devmon $(DESTDIR)/etc/conf.d/devmon @ADD_SYSTEMD_TRUE@ test -d $(DESTDIR)$(sysconfdir)/conf.d || mkdir -p -- \
@ADD_SYSTEMD_TRUE@ $(DESTDIR)$(sysconfdir)/conf.d
@ADD_SYSTEMD_TRUE@ test -f $(DESTDIR)$(sysconfdir)/conf.d/devmon || $(INSTALL_DATA) \
@ADD_SYSTEMD_TRUE@ $(srcdir)/systemd/devmon \
@ADD_SYSTEMD_TRUE@ $(DESTDIR)$(sysconfdir)/conf.d/devmon
@ADD_SYSTEMD_TRUE@ test -d $(DESTDIR)/$(libdir)/systemd/system || \ @ADD_SYSTEMD_TRUE@ test -d $(DESTDIR)/$(libdir)/systemd/system || \
@ADD_SYSTEMD_TRUE@ mkdir -p -- $(DESTDIR)/$(libdir)/systemd/system @ADD_SYSTEMD_TRUE@ mkdir -p -- $(DESTDIR)/$(libdir)/systemd/system
@ADD_SYSTEMD_TRUE@ $(INSTALL_DATA) $(srcdir)/systemd/devmon@.service \ @ADD_SYSTEMD_TRUE@ $(INSTALL_DATA) $(srcdir)/systemd/devmon@.service \

View File

@ -1,4 +1,5 @@
INCLUDES = -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" INCLUDES = -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
-DSYSCONFDIR=\""$(sysconfdir)"\"
noinst_PROGRAMS = udevil noinst_PROGRAMS = udevil

View File

@ -346,7 +346,9 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@ top_srcdir = @top_srcdir@
INCLUDES = -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" INCLUDES = -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
-DSYSCONFDIR=\""$(sysconfdir)"\"
udevil_SOURCES = udevil.c device-info.c canonicalize.c udevil_SOURCES = udevil.c device-info.c canonicalize.c
bin_SCRIPTS = devmon bin_SCRIPTS = devmon
INSTALL_DIR = $(DESTDIR)/$(prefix)/bin INSTALL_DIR = $(DESTDIR)/$(prefix)/bin

View File

@ -784,12 +784,12 @@ static char* parse_config()
char* str; char* str;
char* msg = NULL; char* msg = NULL;
conf_path = g_strdup_printf( "/etc/udevil/udevil-user-%s.conf", g_get_user_name() ); conf_path = g_strdup_printf( "%s/udevil/udevil-user-%s.conf", SYSCONFDIR, g_get_user_name() );
file = fopen( conf_path, "r" ); file = fopen( conf_path, "r" );
if ( !file ) if ( !file )
{ {
g_free( conf_path ); g_free( conf_path );
conf_path = g_strdup_printf( "/etc/udevil/udevil.conf" ); conf_path = g_strdup_printf( SYSCONFDIR "/udevil/udevil.conf" );
file = fopen( conf_path, "r" ); file = fopen( conf_path, "r" );
} }
drop_privileges( 0 ); // file is open now so drop priv drop_privileges( 0 ); // file is open now so drop priv
@ -900,7 +900,7 @@ static char* parse_config()
} }
else else
{ {
msg = g_strdup_printf( _("udevil: warning 7: /etc/udevil/udevil.conf could not be read\n") ); msg = g_strdup_printf( _("udevil: warning 7: %s/udevil/udevil.conf could not be read\n"), SYSCONFDIR );
g_free( conf_path ); g_free( conf_path );
conf_path = NULL; conf_path = NULL;
} }
@ -4900,7 +4900,8 @@ static void show_help()
printf( _("HELP - Show this help\n") ); printf( _("HELP - Show this help\n") );
printf( " udevil help|--help|-h\n" ); printf( " udevil help|--help|-h\n" );
printf( "\n" ); printf( "\n" );
printf( "http://ignorantguru.github.com/udevil/ %s\n", _("See /etc/udevil/udevil.conf for config.") ); printf( "http://ignorantguru.github.com/udevil/ " );
printf( _("See %s/udevil/udevil.conf for config.\n"), SYSCONFDIR );
printf( _("For automounting with udevil run 'devmon --help'\n") ); printf( _("For automounting with udevil run 'devmon --help'\n") );
printf( "\n" ); printf( "\n" );
@ -4997,8 +4998,10 @@ printf("\n-----------------------\n");
wlog( str, NULL, 0 ); wlog( str, NULL, 0 );
g_free( str ); g_free( str );
} }
// Configuration file path left out as it is dependent on SYSCONFDIR
if ( config_msg && strcmp( config_msg, if ( config_msg && strcmp( config_msg,
_("udevil: read config /etc/udevil/udevil.conf\n") ) ) _("udevil: read config ") ) )
// this only works for english // this only works for english
wlog( config_msg, NULL, strstr( config_msg, "warning:" ) ? 1 : 0 ); wlog( config_msg, NULL, strstr( config_msg, "warning:" ) ? 1 : 0 );
g_free( config_msg ); g_free( config_msg );