Add explicit support for being installed into a system triggered with --enable-fhs-paths.

Add two mechanism for avoiding name-collisions in a system-wide
installation of charybdis. The ssld and bandb daemons, intended to be
directly used by ircd and not the user, install into libexec when
--enable-fhs-paths is set. For binaries which are meant to be in PATH
(bindir), such as ircd and viconf, there is now an option
--with-program-prefix=progprefix inspired by automake. If the user
specifies --with-program-prefix=charybdis, the ircd binary is named
charybdisircd when installed.

Add support for saving the pidfile to a rundir and storing the ban
database in localstatedir instead of in sysconfdir. This is, again,
conditional on --enable-fhs-paths.

Fix(?) genssl.sh to always write created SSL key/certificate/dh
parameters to the sysconfdir specified during ./configure. The
previous behavior was to assume that the user ran genssl.sh after
ensuring that his current working directory was either sysconfdir or a
sibling directory of sysconfdir.
This commit is contained in:
Nathan Phillip Brink 2012-03-01 02:41:09 +00:00
parent f2ee5e6219
commit c74836dc4a
19 changed files with 233 additions and 93 deletions

1
.gitignore vendored
View file

@ -34,6 +34,7 @@ src/y.tab.c
ssld/ssld ssld/ssld
tools/convertilines tools/convertilines
tools/convertklines tools/convertklines
tools/genssl.sh
tools/mkpasswd tools/mkpasswd
tools/viconf tools/viconf
include/serno.h include/serno.h

View file

@ -24,10 +24,17 @@ prefix = @prefix@
exec_prefix = @exec_prefix@ exec_prefix = @exec_prefix@
bindir = @bindir@ bindir = @bindir@
mandir = @mandir@ mandir = @mandir@
libdir = @libdir@
pkglibdir = @pkglibdir@
moduledir = @moduledir@ moduledir = @moduledir@
helpdir = @helpdir@ helpdir = @helpdir@
confdir = @confdir@ confdir = @confdir@
logdir = @logdir@ logdir = @logdir@
rundir = @rundir@
pkgrundir = @pkgrundir@
localstatedir = @localstatedir@
pkglocalstatedir= @pkglocalstatedir@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
# Default CFLAGS # Default CFLAGS
# CFLAGS = -g -O2 -DNDEBUG # CFLAGS = -g -O2 -DNDEBUG
@ -118,19 +125,25 @@ lint:
install-mkdirs: install-mkdirs:
@echo "ircd: setting up ircd directory structure" @echo "ircd: setting up ircd directory structure"
-@if test ! -d $(DESTDIR)$(prefix); then \ -@if test ! -d $(DESTDIR)$(prefix); then \
mkdir $(DESTDIR)$(prefix); \ mkdir -p -m 755 $(DESTDIR)$(prefix); \
fi fi
-@if test ! -d $(DESTDIR)$(bindir); then \ -@if test ! -d $(DESTDIR)$(bindir); then \
mkdir $(DESTDIR)$(bindir); \ mkdir -p -m 755 $(DESTDIR)$(bindir); \
fi fi
-@if test ! -d $(DESTDIR)$(confdir); then \ -@if test ! -d $(DESTDIR)$(confdir); then \
mkdir $(DESTDIR)$(confdir); \ mkdir -p -m 755 $(DESTDIR)$(confdir); \
fi fi
-@if test ! -d $(DESTDIR)$(mandir); then \ -@if test ! -d $(DESTDIR)$(mandir); then \
mkdir $(DESTDIR)$(mandir); \ mkdir -p -m 755 $(DESTDIR)$(mandir); \
fi fi
-@if test ! -d $(DESTDIR)$(logdir); then \ -@if test ! -d $(DESTDIR)$(logdir); then \
mkdir $(DESTDIR)$(logdir); \ mkdir -p -m 755 $(DESTDIR)$(logdir); \
fi
-@if test ! -d '$(DESTDIR)$(pkgrundir)'; then \
mkdir -p -m 755 '$(DESTDIR)$(pkgrundir)'; \
fi
-@if test ! -d '$(DESTDIR)$(pkglocalstatedir)'; then \
mkdir -p -m 755 '$(DESTDIR)$(pkglocalstatedir)'; \
fi fi
install: install-mkdirs all install: install-mkdirs all

8
aclocal.m4 vendored
View file

@ -2,8 +2,12 @@
AC_DEFUN([AC_DEFINE_DIR], [ AC_DEFUN([AC_DEFINE_DIR], [
test "x$prefix" = xNONE && prefix="$ac_default_prefix" test "x$prefix" = xNONE && prefix="$ac_default_prefix"
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
ac_define_dir=`eval echo [$]$2` last_ac_define_dir=`eval echo [$]$2`
ac_define_dir=`eval echo [$]ac_define_dir` ac_define_dir=`eval echo [$]last_ac_define_dir`
while test "x[$]last_ac_define_dir" != "x[$]ac_define_dir"; do
last_ac_define_dir="[$]ac_define_dir"
ac_define_dir=`eval echo [$]last_ac_define_dir`
done
$1="$ac_define_dir" $1="$ac_define_dir"
AC_SUBST($1) AC_SUBST($1)
ifelse($3, , ifelse($3, ,

View file

@ -22,8 +22,12 @@ exec_prefix = @exec_prefix@
bindir = @bindir@ bindir = @bindir@
libdir = @libdir@ libdir = @libdir@
libexecdir = @libexecdir@ libexecdir = @libexecdir@
pkglibexecdir = @pkglibexecdir@
confdir = @confdir@ confdir = @confdir@
localstatedir = @localstatedir@ localstatedir = @localstatedir@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PROGRAM_PREFIX = @PROGRAM_PREFIX@
ZIP_LIB = @ZLIB_LD@ ZIP_LIB = @ZLIB_LD@
@ -34,7 +38,9 @@ CPPFLAGS = ${INCLUDES} @CPPFLAGS@
CFLAGS += -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION=1 CFLAGS += -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION=1
PROGS = bandb bantool pkglibexec_PROGS = bandb
bin_PROGS = bantool
PROGS = $(pkglibexec_PROGS) $(bin_PROGS)
BANDB_SOURCES = \ BANDB_SOURCES = \
bandb.c \ bandb.c \
@ -64,12 +70,18 @@ bantool: ${BANTOOL_OBJECTS}
install: build install: build
@echo "ircd: installing bandb ($(PROGS))" @echo "ircd: installing bandb ($(PROGS))"
@for i in $(PROGS); do \ @for i in $(bin_PROGS); do \
if test -f $(DESTDIR)$(bindir)/$$i; then \ if test -f $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)$$i; then \
$(MV) $(DESTDIR)$(bindir)/$$i $(DESTDIR)$(bindir)/$$i.old; \ $(MV) $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)$$i $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)$$i.old; \
fi; \ fi; \
$(INSTALL_BIN) $$i $(DESTDIR)$(bindir); \ $(INSTALL_BIN) $$i $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)$$i; \
done done
@for i in $(pkglibexec_PROGS); do \
if test -f '$(DESTDIR)$(pkglibexecdir)/'$$i; then \
$(MV) '$(DESTDIR)$(pkglibexecdir)/'$$i '$(DESTDIR)$(pkglibexecdir)/'$$i.old; \
fi; \
$(INSTALL_BIN) $$i '$(DESTDIR)$(pkglibexecdir)/'$$i; \
done
.c.o: .c.o:
${CC} ${CPPFLAGS} ${CFLAGS} -c $< ${CC} ${CPPFLAGS} ${CFLAGS} -c $<

View file

@ -225,12 +225,37 @@ if test "$LEX" = ":"; then
AC_MSG_ERROR([could not locate a suitable lexical generator, install flex or lex.]) AC_MSG_ERROR([could not locate a suitable lexical generator, install flex or lex.])
fi fi
AC_ARG_ENABLE([fhs-paths],
[AS_HELP_STRING([--enable-fhs-paths], [User more FHS-like pathnames (for packagers).])],
[],
[dnl detect if the user appears to want --enable-fhs-paths
AS_IF([test "$libexecdir" = '${exec_prefix}/libexec' && \
test "$localstatedir" = '${prefix}/var' && \
test "$libdir" = '${exec_prefix}/lib'],
[enable_fhs_paths=no],
[enable_fhs_paths=yes])
])
dnl use directory structure of cached as default (hack) dnl use directory structure of cached as default (hack)
if test "$libexecdir" = '${exec_prefix}/libexec' && AS_IF([test "x$enable_fhs_paths" = "xyes"],
test "$localstatedir" = '${prefix}/var'; then [dnl Avoid name collisions.
libexecdir='${bindir}' pkglibexecdir='${libexecdir}/${PACKAGE_TARNAME}'
rundir=${rundir-'${prefix}/run'}
pkgrundir='${rundir}/${PACKAGE_TARNAME}'
pkglocalstatedir='${localstatedir}/${PACKAGE_TARNAME}'],
[libexecdir='${bindir}'
pkglibexecdir='${libexecdir}'
rundir='${sysconfdir}'
pkgrundir='${rundir}'
localstatedir='${prefix}' localstatedir='${prefix}'
fi pkglocalstatedir='${sysconfdir}'])
pkglibdir='${libdir}/${PACKAGE_TARNAME}'
AC_SUBST([pkglibdir])
AC_SUBST([rundir])
AC_SUBST([pkgrundir])
AC_SUBST([pkglocalstatedir])
AC_DEFINE_DIR([PKGLOCALSTATEDIR], [pkglocalstatedir], [[Directory in which to store state, such as band database]])
AC_SUBST([pkglibexecdir])
AC_DEFINE_DIR([PKGLIBEXECDIR], [pkglibexecdir], [Directory where binaries the IRCd itself spawns live])
dnl Checks for header files. dnl Checks for header files.
AC_HEADER_STDC AC_HEADER_STDC
@ -595,7 +620,7 @@ AC_HELP_STRING([--with-confdir=DIR],
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
AC_DEFINE_DIR(ETC_DIR, confdir, [Prefix where config files are installed.]) AC_DEFINE_DIR(ETC_DIR, confdir, [Prefix where config files are installed.])
AC_SUBST_DIR([confdir]) ], AC_SUBST_DIR([confdir]) ],
[ confdir='${prefix}/etc' [ confdir='${sysconfdir}'
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
AC_DEFINE_DIR(ETC_DIR, confdir, [Prefix where config files are installed.]) AC_DEFINE_DIR(ETC_DIR, confdir, [Prefix where config files are installed.])
AC_SUBST_DIR([confdir])] AC_SUBST_DIR([confdir])]
@ -610,14 +635,13 @@ AC_ARG_WITH(logdir,
AC_HELP_STRING([--with-logdir=DIR], AC_HELP_STRING([--with-logdir=DIR],
[Directory where to write logfiles.]), [Directory where to write logfiles.]),
[ logdir=`echo $withval | sed 's/\/$//'` [ logdir=`echo $withval | sed 's/\/$//'`
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)],
AC_DEFINE_DIR(LOG_DIR, logdir, [Prefix where to write logfiles.]) [ AS_IF([test "x$enable_fhs_paths" = "xyes"],
AC_SUBST_DIR([logdir]) ], [logdir='${localstatedir}/log/${PACKAGE_TARNAME}'],
[ logdir='${prefix}/logs' [logdir='${prefix}/logs'])
AC_MSG_RESULT(no) AC_MSG_RESULT(no)])
AC_DEFINE_DIR(LOG_DIR, logdir, [Prefix where to write logfiles.]) AC_DEFINE_DIR([LOG_DIR], [logdir], [Prefix where to write logfiles.])
AC_SUBST_DIR([logdir])] AC_SUBST_DIR([logdir])
)
dnl ********************************************************************** dnl **********************************************************************
dnl Check for --with-helpdir dnl Check for --with-helpdir
@ -628,14 +652,13 @@ AC_ARG_WITH(helpdir,
AC_HELP_STRING([--with-helpdir=DIR], AC_HELP_STRING([--with-helpdir=DIR],
[Directory to install help files.]), [Directory to install help files.]),
[ helpdir=`echo $withval | sed 's/\/$//'` [ helpdir=`echo $withval | sed 's/\/$//'`
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes) ],
AC_DEFINE_DIR(HELP_DIR, helpdir, [Prefix where help files are installed.]) [ AS_IF([test "x$enable_fhs_paths" = "xyes"],
AC_SUBST_DIR([helpdir]) ], [helpdir='${datadir}/${PACKAGE_TARNAME}/help'],
[ helpdir='${prefix}/help' [helpdir='${prefix}/help'])
AC_MSG_RESULT(no) AC_MSG_RESULT(no) ])
AC_DEFINE_DIR(HELP_DIR, helpdir, [Prefix where help file are installed.]) AC_DEFINE_DIR([HELP_DIR], [helpdir], [Prefix where help files are installed.])
AC_SUBST_DIR([helpdir])] AC_SUBST_DIR([helpdir])
)
dnl ********************************************************************** dnl **********************************************************************
dnl Check for --with-moduledir dnl Check for --with-moduledir
@ -643,17 +666,44 @@ dnl **********************************************************************
AC_MSG_CHECKING([whether to modify moduledir]) AC_MSG_CHECKING([whether to modify moduledir])
AC_ARG_WITH(moduledir, AC_ARG_WITH(moduledir,
AC_HELP_STRING([--with-moduledir=DIR], [AC_HELP_STRING([--with-moduledir=DIR],
[Directory to install modules.]), [Directory to install modules.])],
[ moduledir=`echo $withval | sed 's/\/$//'` [ moduledir=`echo $withval | sed 's/\/$//'`
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)],
AC_DEFINE_DIR(MODULE_DIR, moduledir, [Prefix where modules are installed.]) [ AS_IF([test "x$enable_fhs_paths" = "xyes"],
AC_SUBST_DIR([moduledir]) ], [moduledir='${pkglibdir}/modules'],
[ moduledir='${prefix}/modules' [moduledir='${prefix}/modules'])
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
AC_DEFINE_DIR(MODULE_DIR, moduledir, [Prefix where modules are installed.]) ])
AC_SUBST_DIR([moduledir])] AC_DEFINE_DIR(MODULE_DIR, moduledir, [Prefix where modules are installed.])
) AC_SUBST_DIR([moduledir])
dnl Check for --with-rundir
AC_MSG_CHECKING([whether or modify rundir])
AC_ARG_WITH([rundir],
[AC_HELP_STRING([--with-rundir=DIR],
[Directory in which to store pidfile.])],
[AC_MSG_RESULT([yes])
rundir=`echo $withval | sed 's/\/$//'`],
[AC_MSG_RESULT([no])
AS_IF([test "x$enable_fhs_paths" = "xyes"],
[rundir='${prefix}/run'],
[rundir='${sysconfdir}'])])
AC_SUBST([rundir])
AC_DEFINE_DIR([PKGRUNDIR], [pkgrundir], [Directory to store pidfile in.])
dnl Installed utility program prefixes (does not affect binaries
dnl installed into pkglibexecdir)
AC_MSG_CHECKING([for program prefix])
AC_ARG_WITH([program-prefix],
[AS_HELP_STRING([--with-program-prefix=], [If set, programs installed into PATH will be installed with names prefixed by this prefix.])],
[test "x$with_program_prefix" = "xno" && with_program_prefix=],
[with_program_prefix=])
AC_MSG_RESULT(["$with_program_prefix"])
PROGRAM_PREFIX="$with_program_prefix"
AC_SUBST([PROGRAM_PREFIX])
AC_DEFINE_UNQUOTED([PROGRAM_PREFIX], ["$with_program_prefix"], [String with which all programs intended to be in PATH are prefixed.])
dnl ********************************************************************** dnl **********************************************************************
dnl Branding dnl Branding
@ -1197,9 +1247,11 @@ AC_CONFIG_FILES( \
src/Makefile \ src/Makefile \
modules/Makefile \ modules/Makefile \
tools/Makefile \ tools/Makefile \
tools/genssl.sh \
doc/Makefile \ doc/Makefile \
help/Makefile \ help/Makefile \
) )
AC_CONFIG_COMMANDS([tools/genssl.sh_chmod], [chmod 755 tools/genssl.sh])
AC_OUTPUT AC_OUTPUT

View file

@ -15,6 +15,8 @@ RM = @RM@
CP = @CP@ CP = @CP@
TOUCH = @TOUCH@ TOUCH = @TOUCH@
PROGRAM_PREFIX = @PROGRAM_PREFIX@
prefix = @prefix@ prefix = @prefix@
exec_prefix = @exec_prefix@ exec_prefix = @exec_prefix@
exec_suffix = @exec_suffix@ exec_suffix = @exec_suffix@
@ -73,8 +75,8 @@ install: install-mkdirs build
@echo "ircd: installing manpage" @echo "ircd: installing manpage"
@for i in $(MANPAGES); do \ @for i in $(MANPAGES); do \
if test ! -f $(DESTDIR)$(mandir)/$$i; then \ if test ! -f $(DESTDIR)$(mandir)/$(PROGRAM_PREFIX)$$i; then \
$(INSTALL_DATA) $$i $(DESTDIR)$(mandir); \ $(INSTALL_DATA) $$i $(DESTDIR)$(mandir)/$(PROGRAM_PREFIX)$$i; \
fi; \ fi; \
done done

View file

@ -16,7 +16,14 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_SUID = @INSTALL_PROGRAM@ -o root -m 4755 INSTALL_SUID = @INSTALL_PROGRAM@ -o root -m 4755
SHELL = /bin/sh SHELL = /bin/sh
AUTOMODULEDIR = @moduledir@/extensions
prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@
pkglibdir = @pkglibdir@
moduledir = @moduledir@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
AUTOMODULEDIR = $(moduledir)/extensions
SSL_LIBS = @SSL_LIBS@ SSL_LIBS = @SSL_LIBS@
SSL_INCLUDES = @SSL_INCLUDES@ SSL_INCLUDES = @SSL_INCLUDES@

View file

@ -7,7 +7,9 @@ INSTALL_DATA= @INSTALL_DATA@
RM= @RM@ RM= @RM@
prefix= @prefix@ prefix= @prefix@
exec_prefix= @execprefix@ exec_prefix= @exec_prefix@
datarootdir = @datarootdir@
datadir = @datadir@
helpdir= @helpdir@ helpdir= @helpdir@
uhelpdir= ${helpdir}/users uhelpdir= ${helpdir}/users
ohelpdir= ${helpdir}/opers ohelpdir= ${helpdir}/opers

View file

@ -59,14 +59,13 @@
#define HPATH HELP_DIR "/opers" #define HPATH HELP_DIR "/opers"
/* files */ /* files */
#define SPATH BINPATH "/ircd" /* ircd executable */ #define SPATH BINPATH "/" PROGRAM_PREFIX "ircd" /* ircd executable */
#define LIPATH LIBPATH "/libircd" SHARED_SUFFIX /* ircd library */
#define CPATH ETCPATH "/ircd.conf" /* ircd.conf file */ #define CPATH ETCPATH "/ircd.conf" /* ircd.conf file */
#define MPATH ETCPATH "/ircd.motd" /* MOTD file */ #define MPATH ETCPATH "/ircd.motd" /* MOTD file */
#define LPATH LOGPATH "/ircd.log" /* ircd logfile */ #define LPATH LOGPATH "/ircd.log" /* ircd logfile */
#define PPATH ETCPATH "/ircd.pid" /* pid file */ #define PPATH PKGRUNDIR "/ircd.pid" /* pid file */
#define OPATH ETCPATH "/opers.motd" /* oper MOTD file */ #define OPATH ETCPATH "/opers.motd" /* oper MOTD file */
#define DBPATH ETCPATH "/ban.db" /* bandb file */ #define DBPATH PKGLOCALSTATEDIR "/ban.db" /* bandb file */
/* IGNORE_BOGUS_TS /* IGNORE_BOGUS_TS
* Ignore bogus timestamps from other servers. Yes this will desync * Ignore bogus timestamps from other servers. Yes this will desync

View file

@ -2,8 +2,12 @@
AC_DEFUN([AC_DEFINE_DIR], [ AC_DEFUN([AC_DEFINE_DIR], [
test "x$prefix" = xNONE && prefix="$ac_default_prefix" test "x$prefix" = xNONE && prefix="$ac_default_prefix"
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
ac_define_dir=`eval echo [$]$2` last_ac_define_dir=`eval echo [$]$2`
ac_define_dir=`eval echo [$]ac_define_dir` ac_define_dir=`eval echo [$]last_ac_define_dir`
while test "x[$]last_ac_define_dir" != "x[$]ac_define_dir"; do
last_ac_define_dir="[$]ac_define_dir"
ac_define_dir=`eval echo [$]last_ac_define_dir`
done
$1="$ac_define_dir" $1="$ac_define_dir"
AC_SUBST($1) AC_SUBST($1)
ifelse($3, , ifelse($3, ,

View file

@ -28,7 +28,11 @@ SSL_INCLUDES = @SSL_INCLUDES@
IRCDLIBS = @LIBS@ $(SSL_LIBS) IRCDLIBS = @LIBS@ $(SSL_LIBS)
prefix = @prefix@ prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@
pkglibdir = @pkglibdir@
moduledir = @moduledir@ moduledir = @moduledir@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
# Change this later! -- adrian # Change this later! -- adrian
automoduledir = @moduledir@/autoload automoduledir = @moduledir@/autoload

View file

@ -12,7 +12,7 @@ RM = @RM@
LEX = @LEX@ LEX = @LEX@
LEXLIB = @LEXLIB@ LEXLIB = @LEXLIB@
PICFLAGS = @PICFLAGS@ PICFLAGS = @PICFLAGS@
CFLAGS = @IRC_CFLAGS@ -DIRCD_PREFIX=\"@prefix@\" CFLAGS = @IRC_CFLAGS@
LDFLAGS = @LDFLAGS@ LDFLAGS = @LDFLAGS@
MKDEP = @MKDEP@ -DIRCD_PREFIX=\"@prefix@\" MKDEP = @MKDEP@ -DIRCD_PREFIX=\"@prefix@\"
MV = @MV@ MV = @MV@
@ -23,6 +23,9 @@ exec_prefix = @exec_prefix@
bindir = @bindir@ bindir = @bindir@
libdir = @libdir@ libdir = @libdir@
libexecdir = @libexecdir@ libexecdir = @libexecdir@
pkglibexecdir = @pkglibexecdir@
PROGRAM_PREFIX = @PROGRAM_PREFIX@
DOLLAR = $$ DOLLAR = $$
@ -36,7 +39,7 @@ SSL_INCLUDES = @SSL_INCLUDES@
IRCDLIBS = @MODULES_LIBS@ -L../libratbox/src/.libs -lratbox @LIBS@ $(SSL_LIBS) IRCDLIBS = @MODULES_LIBS@ -L../libratbox/src/.libs -lratbox @LIBS@ $(SSL_LIBS)
INCLUDES = -I../include -I../libratbox/include $(SSL_INCLUDES) INCLUDES = -I../include -I../libratbox/include $(SSL_INCLUDES)
CPPFLAGS = ${INCLUDES} @CPPFLAGS@ CPPFLAGS = ${INCLUDES} -DIRCD_PREFIX=\"@prefix@\" @CPPFLAGS@
default: all default: all
@ -133,10 +136,10 @@ install: install-mkdirs build
fi fi
@echo "ircd: installing ircd ($(PROGS))" @echo "ircd: installing ircd ($(PROGS))"
@for i in $(PROGS); do \ @for i in $(PROGS); do \
if test -f $(DESTDIR)$(bindir)/$$i; then \ if test -f $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)$$i; then \
$(MV) $(DESTDIR)$(bindir)/$$i $(DESTDIR)$(bindir)/$$i.old; \ $(MV) $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)$$i $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)$$i.old; \
fi; \ fi; \
$(INSTALL_BIN) $$i $(DESTDIR)$(bindir); \ $(INSTALL_BIN) $$i $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)$$i; \
done done
version.c: version.c.SH version.c: version.c.SH

View file

@ -85,7 +85,7 @@ start_bandb(void)
rb_setenv("BANDB_DPATH", ConfigFileEntry.dpath, 1); rb_setenv("BANDB_DPATH", ConfigFileEntry.dpath, 1);
if(bandb_path == NULL) if(bandb_path == NULL)
{ {
rb_snprintf(fullpath, sizeof(fullpath), "%s/bandb%s", BINPATH, suffix); rb_snprintf(fullpath, sizeof(fullpath), "%s/bandb%s", PKGLIBEXECDIR, suffix);
if(access(fullpath, X_OK) == -1) if(access(fullpath, X_OK) == -1)
{ {
@ -95,8 +95,8 @@ start_bandb(void)
if(access(fullpath, X_OK) == -1) if(access(fullpath, X_OK) == -1)
{ {
ilog(L_MAIN, ilog(L_MAIN,
"Unable to execute bandb in %s or %s/bin", "Unable to execute bandb%s in %s or %s/bin",
BINPATH, ConfigFileEntry.dpath); suffix, PKGLIBEXECDIR, ConfigFileEntry.dpath);
return 0; return 0;
} }
} }

View file

@ -261,7 +261,7 @@ start_ssldaemon(int count, const char *ssl_cert, const char *ssl_private_key, co
if(ssld_path == NULL) if(ssld_path == NULL)
{ {
rb_snprintf(fullpath, sizeof(fullpath), "%s/ssld%s", BINPATH, suffix); rb_snprintf(fullpath, sizeof(fullpath), "%s/ssld%s", PKGLIBEXECDIR, suffix);
if(access(fullpath, X_OK) == -1) if(access(fullpath, X_OK) == -1)
{ {
@ -270,8 +270,8 @@ start_ssldaemon(int count, const char *ssl_cert, const char *ssl_private_key, co
if(access(fullpath, X_OK) == -1) if(access(fullpath, X_OK) == -1)
{ {
ilog(L_MAIN, ilog(L_MAIN,
"Unable to execute ssld%s in %s/bin or %s", "Unable to execute ssld%s in %s or %s/bin",
ConfigFileEntry.dpath, suffix, BINPATH); suffix, PKGLIBEXECDIR, ConfigFileEntry.dpath);
return 0; return 0;
} }
} }

View file

@ -22,8 +22,12 @@ exec_prefix = @exec_prefix@
bindir = @bindir@ bindir = @bindir@
libdir = @libdir@ libdir = @libdir@
libexecdir = @libexecdir@ libexecdir = @libexecdir@
pkglibexecdir = @pkglibexecdir@
confdir = @confdir@ confdir = @confdir@
localstatedir = @localstatedir@ localstatedir = @localstatedir@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PROGRAM_PREFIX = @PROGRAM_PREFIX@
ZIP_LIB = @ZLIB_LD@ ZIP_LIB = @ZLIB_LD@
@ -32,7 +36,8 @@ IRCDLIBS = @MODULES_LIBS@ -L../libratbox/src/.libs -lratbox @LIBS@ $(SSL_LIBS) $
INCLUDES = -I. -I../include -I../libratbox/include $(SSL_INCLUDES) INCLUDES = -I. -I../include -I../libratbox/include $(SSL_INCLUDES)
CPPFLAGS = ${INCLUDES} @CPPFLAGS@ CPPFLAGS = ${INCLUDES} @CPPFLAGS@
PROGS = ssld pkglibexec_PROGS = ssld
PROGS = $(pkglibexec_PROGS)
SOURCES = \ SOURCES = \
ssld.c ssld.c
@ -47,14 +52,27 @@ build: all
ssld: ${OBJECTS} ssld: ${OBJECTS}
${CC} ${CFLAGS} ${LDFLAGS} -o $@ ${OBJECTS} ${IRCDLIBS} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ ${OBJECTS} ${IRCDLIBS}
install: build install-mkdirs:
-@for dir in '$(bindir)' '$(pkglibexecdir)'; do \
if test ! -d '$(DESTDIR)'"$${dir}"; then \
mkdir -p -m 755 '$(DESTDIR)'"$${dir}"; \
fi; \
done
install: install-mkdirs build
@echo "ircd: installing ssld ($(PROGS))" @echo "ircd: installing ssld ($(PROGS))"
@for i in $(PROGS); do \ @for i in $(bin_PROGS); do \
if test -f $(DESTDIR)$(bindir)/$$i; then \ if test -f $(DESTDIR)$(bindir)/$$i; then \
$(MV) $(DESTDIR)$(bindir)/$$i $(DESTDIR)$(bindir)/$$i.old; \ $(MV) $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)$$i $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)$$i.old; \
fi; \ fi; \
$(INSTALL_BIN) $$i $(DESTDIR)$(bindir); \ $(INSTALL_BIN) $$i $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)$$i; \
done done
@for i in $(pkglibexec_PROGS); do \
if test -f '$(DESTDIR)$(pkglibexecdir)/'$$i; then \
$(MV) '$(DESTDIR)$(pkglibexecdir)/'$$i '$(DESTDIR)$(pkglibexecdir)/'$$i.old; \
fi; \
$(INSTALL_BIN) $$i '$(DESTDIR)$(pkglibexecdir)/'$$i; \
done
.c.o: .c.o:
${CC} ${CPPFLAGS} ${CFLAGS} -c $< ${CC} ${CPPFLAGS} ${CFLAGS} -c $<

View file

@ -15,6 +15,8 @@ MV = @MV@
RM = @RM@ RM = @RM@
LN = @LN@ LN = @LN@
PROGRAM_PREFIX = @PROGRAM_PREFIX@
IRCDLIBS = -L../libratbox/src/.libs -lratbox @LIBS@ IRCDLIBS = -L../libratbox/src/.libs -lratbox @LIBS@
INCLUDES = -I../include -I../libratbox/include INCLUDES = -I../include -I../libratbox/include
CPPFLAGS = ${INCLUDES} @CPPFLAGS@ CPPFLAGS = ${INCLUDES} @CPPFLAGS@
@ -45,13 +47,14 @@ convertilines: convertilines.c
convertklines: convertklines.c convertklines: convertklines.c
$(CC) $(CFLAGS) $(LDFLAGS) $(INCLUDES) convertklines.c -o convertklines $(IRCDLIBS) $(CC) $(CFLAGS) $(LDFLAGS) $(INCLUDES) convertklines.c -o convertklines $(IRCDLIBS)
genssl.sh: genssl.sh: genssl.sh.in
cd .. && ./config.status tools/genssl.sh && ./config.status tools/genssl.sh_chmod
clean: clean:
$(RM) -f encspeed viconf chkconf mkpasswd *~ core *.exe convertklines convertilines $(RM) -f encspeed viconf chkconf mkpasswd *~ core *.exe convertklines convertilines
distclean: clean distclean: clean
$(RM) -f Makefile $(RM) -f genssl.sh Makefile
lint: lint:
lint -aacgprxhH $(CPPFLAGS) -DIRCD_PREFIX=\"@prefix@\" $(convertklines_SOURCES) $(mkpasswd_SOURCES) $(viconf_SOURCES) $(encspeed_SOURCES) >>../lint.out lint -aacgprxhH $(CPPFLAGS) -DIRCD_PREFIX=\"@prefix@\" $(convertklines_SOURCES) $(mkpasswd_SOURCES) $(viconf_SOURCES) $(encspeed_SOURCES) >>../lint.out
@ -91,11 +94,11 @@ install-mkdirs:
install: install-mkdirs build install: install-mkdirs build
@echo "ircd: installing tools ($(PROGS))" @echo "ircd: installing tools ($(PROGS))"
@for i in $(PROGS); do \ @for i in $(PROGS); do \
if test -f $(DESTDIR)$(bindir)/$$i; then \ if test -f $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)$$i; then \
$(MV) $(DESTDIR)$(bindir)/$$i $(DESTDIR)$(bindir)/$$i.old; \ $(MV) $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)$$i $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)$$i.old; \
fi; \ fi; \
$(INSTALL_BIN) $$i $(DESTDIR)$(bindir); \ $(INSTALL_BIN) $$i $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)$$i; \
done; \ done; \
$(RM) -f $(DESTDIR)$(bindir)/vimotd $(RM) -f $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)vimotd
$(LN) $(DESTDIR)$(bindir)/viconf $(DESTDIR)$(bindir)/vimotd $(LN) $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)viconf $(DESTDIR)$(bindir)/$(PROGRAM_PREFIX)vimotd

View file

@ -1,16 +0,0 @@
#!/bin/sh
echo "Generating self-signed certificate .. "
openssl req -x509 -nodes -newkey rsa:1024 -keyout ../etc/ssl.key -out ../etc/ssl.cert
echo "Generating Diffie-Hellman file for secure SSL/TLS negotiation .. "
openssl dhparam -out ../etc/dh.pem 1024
echo "
Now change these lines in the IRCd config file:
ssl_private_key = "etc/ssl.key";
ssl_cert = "etc/ssl.cert";
ssl_dh_params = "etc/dh.pem";
Enjoy using ssl.
"

29
tools/genssl.sh.in Executable file
View file

@ -0,0 +1,29 @@
#!/bin/sh
prefix="@prefix@"
exec_prefix="@exec_prefix@"
sysconfdir="@sysconfdir@"
echo "Generating self-signed certificate .. "
openssl req -x509 -nodes -newkey rsa:1024 -keyout "${sysconfdir}"/ssl.key -out "${sysconfdir}"/ssl.cert
echo "Generating Diffie-Hellman file for secure SSL/TLS negotiation .. "
openssl dhparam -out "${sysconfdir}"/dh.pem 1024
# If sysconfdir is relative to prefix, make the path relative. I.e.,
# prefix=/usr and sysconfdir=/etc -> relative_sysconfdir=/etc,
# prefix=/home/binki/chary and sysconfdir=/home/binki/chary/etc ->
# relative_sysconfdir=etc
relative_sysconfdir="${sysconfdir#${prefix%/}/}"
relative_sysconfdir="${relative_sysconfdir%/}"
cat <<EOF
Now change these lines in the IRCd config file:
ssl_private_key = "${relative_sysconfdir}/ssl.key";
ssl_cert = "${relative_sysconfdir}/ssl.cert";
ssl_dh_params = "${relative_sysconfdir}/dh.pem";
Enjoy using ssl.
EOF

View file

@ -13,6 +13,9 @@
#include <signal.h> #include <signal.h>
#include "config.h" #include "config.h"
#ifndef PROGRAM_PREFIX
#define PROGRAM_PREFIX ""
#endif
/* wait.h is in /include on solaris, likely on other SYSV machines as well /* wait.h is in /include on solaris, likely on other SYSV machines as well
* but wait.h is normally in /include/sys on BSD boxen, * but wait.h is normally in /include/sys on BSD boxen,
@ -45,7 +48,7 @@ int main(int argc, char *argv[])
else else
p++; p++;
if(strcmp(p, "vimotd") == 0) if(strcmp(p, PROGRAM_PREFIX "vimotd") == 0)
filename = MPATH; filename = MPATH;
if(LockedFile(filename)) if(LockedFile(filename))