diff --git a/configure.in b/configure.in index 5a6058b80..7c2342c3e 100644 --- a/configure.in +++ b/configure.in @@ -40,6 +40,7 @@ ARG_WITH_SUBST([nm-ca-dir], [/usr/share/ca-certificates], [directory th ARG_WITH_SUBST([linux-headers], [\${top_srcdir}/src/include], [set directory of linux header files to use]) ARG_WITH_SUBST([routing-table], [220], [set routing table to use for IPsec routes]) ARG_WITH_SUBST([routing-table-prio], [220], [set priority for IPsec routing table]) +ARG_WITH_SUBST([ipsec-script], [ipsec], [change the name of the ipsec script]) ARG_WITH_SET([capabilities], [no], [set capability dropping library. Currently supported values are "libcap" and "native"]) ARG_WITH_SET([mpz_powm_sec], [yes], [use the more side-channel resistant mpz_powm_sec in libgmp, if available]) @@ -65,6 +66,9 @@ AC_ARG_WITH( [AC_SUBST(ipsecgroup, "root")] ) +# convert script name to uppercase +AC_SUBST(ipsec_script_upper, [`echo -n "$ipsec_script" | tr a-z A-Z`]) + m4_include(m4/macros/enable-disable.m4) ARG_ENABL_SET([curl], [enable CURL fetcher plugin to fetch files via libcurl. Requires libcurl.]) diff --git a/init/systemd/Makefile.am b/init/systemd/Makefile.am index e2bbfc451..bdbf502e4 100644 --- a/init/systemd/Makefile.am +++ b/init/systemd/Makefile.am @@ -5,4 +5,7 @@ CLEANFILES = strongswan.service systemdsystemunit_DATA = strongswan.service strongswan.service : strongswan.service.in - sed -e "s:@SBINDIR@:$(sbindir):" $(srcdir)/$@.in > $@ + sed \ + -e "s:@SBINDIR@:$(sbindir):" \ + -e "s:@IPSEC_SCRIPT@:$(ipsec_script):" \ + $(srcdir)/$@.in > $@ diff --git a/init/systemd/strongswan.service.in b/init/systemd/strongswan.service.in index e8dc5e819..dee892e90 100644 --- a/init/systemd/strongswan.service.in +++ b/init/systemd/strongswan.service.in @@ -3,7 +3,7 @@ Description=strongSwan IPsec After=syslog.target [Service] -ExecStart=@SBINDIR@/ipsec start --nofork +ExecStart=@SBINDIR@/@IPSEC_SCRIPT@ start --nofork StandardOutput=syslog [Install] diff --git a/src/ipsec/.gitignore b/src/ipsec/.gitignore index 8517fc4f9..6eca7ddba 100644 --- a/src/ipsec/.gitignore +++ b/src/ipsec/.gitignore @@ -1,2 +1,2 @@ -ipsec -ipsec.8 +_ipsec +_ipsec.8 diff --git a/src/ipsec/Makefile.am b/src/ipsec/Makefile.am index bbf009721..29e710533 100644 --- a/src/ipsec/Makefile.am +++ b/src/ipsec/Makefile.am @@ -1,22 +1,35 @@ -sbin_SCRIPTS = ipsec -CLEANFILES = ipsec ipsec.8 -dist_man8_MANS = ipsec.8 +sbin_SCRIPTS = _ipsec +CLEANFILES = _ipsec _ipsec.8 +dist_man8_MANS = _ipsec.8 EXTRA_DIST = ipsec.in ipsec.8.in Android.mk -ipsec.8 : ipsec.8.in +_ipsec.8 : ipsec.8.in sed \ -e "s:@IPSEC_VERSION@:$(PACKAGE_VERSION):" \ - $(srcdir)/$@.in > $@ + -e "s:@IPSEC_SCRIPT@:$(ipsec_script):g" \ + -e "s:@IPSEC_SCRIPT_UPPER@:$(ipsec_script_upper):g" \ + $< > $@ -ipsec : ipsec.in +_ipsec : ipsec.in sed \ -e "s:@IPSEC_SHELL@:/bin/sh:" \ -e "s:@IPSEC_VERSION@:$(PACKAGE_VERSION):" \ -e "s:@IPSEC_NAME@:$(PACKAGE_NAME):" \ -e "s:@IPSEC_DISTRO@::" \ -e "s:@IPSEC_DIR@:$(ipsecdir):" \ + -e "s:@IPSEC_SCRIPT@:$(ipsec_script):" \ -e "s:@IPSEC_SBINDIR@:$(sbindir):" \ -e "s:@IPSEC_CONFDIR@:$(sysconfdir):" \ -e "s:@IPSEC_PIDDIR@:$(piddir):" \ - $(srcdir)/$@.in > $@ + $< > $@ chmod +x $@ + +install-exec-hook: + mv $(DESTDIR)$(sbindir)/_ipsec $(DESTDIR)$(sbindir)/$(ipsec_script) + +install-data-hook: + mv $(DESTDIR)$(man8dir)/_ipsec.8 $(DESTDIR)$(man8dir)/$(ipsec_script).8 + +uninstall-hook: + rm -f $(DESTDIR)$(sbindir)/$(ipsec_script) + rm -f $(DESTDIR)$(man8dir)/$(ipsec_script).8 diff --git a/src/ipsec/ipsec.8.in b/src/ipsec/ipsec.8.in index ba8df4fc7..41c6ff8d2 100644 --- a/src/ipsec/ipsec.8.in +++ b/src/ipsec/ipsec.8.in @@ -1,13 +1,13 @@ -.TH IPSEC 8 "2010-05-30" "@IPSEC_VERSION@" "strongSwan" +.TH @IPSEC_SCRIPT_UPPER@ 8 "2012-06-19" "@IPSEC_VERSION@" "strongSwan" .SH NAME -ipsec \- invoke IPsec utilities +@IPSEC_SCRIPT@ \- invoke IPsec utilities .SH SYNOPSIS -.B ipsec +.B @IPSEC_SCRIPT@ \fIcommand\fP [ \fIarguments\fP ] [ \fIoptions\fP ] .PP .SH DESCRIPTION The -.B ipsec +.B @IPSEC_SCRIPT@ utility invokes any of several utilities involved in controlling and monitoring the IPsec encryption/authentication system, running the specified \fIcommand\fP with the specified \fIarguments\fP and \fIoptions\fP as if it had been invoked @@ -18,7 +18,7 @@ All the commands described in this manual page are built-in and are used to control and monitor IPsec connections as well as the IKE daemons. .PP For other commands -.I ipsec +.I @IPSEC_SCRIPT@ supplies the invoked .I command with a suitable PATH environment variable, @@ -226,7 +226,9 @@ purges all cached OCSP information records. .SS INFO COMMANDS .TP .B "\-\-help" -returns the usage information for the ipsec command. +returns the usage information for the +.B @IPSEC_SCRIPT@ +command. .PP .TP .B "\-\-version" @@ -260,19 +262,20 @@ returns the \fISYSCONFDIR\fP directory as defined by the configure options. The following environment variables control where strongSwan finds its components. The -.B ipsec +.B @IPSEC_SCRIPT@ command sets them if they are not already set. .nf .na -IPSEC_DIR directory containing ipsec programs and utilities -IPSEC_SBINDIR directory containing \fBipsec\fP command -IPSEC_CONFDIR directory containing configuration files -IPSEC_PIDDIR directory containing PID files -IPSEC_NAME name of ipsec distribution -IPSEC_VERSION version numer of ipsec userland and kernel -IPSEC_STARTER_PID PID file for ipsec starter -IPSEC_CHARON_PID PID file for IKE keying daemon +IPSEC_DIR directory containing ipsec programs and utilities +IPSEC_SBINDIR directory containing \fBipsec\fP command +IPSEC_CONFDIR directory containing configuration files +IPSEC_PIDDIR directory containing PID files +IPSEC_SCRIPT name of the ipsec script +IPSEC_NAME name of ipsec distribution +IPSEC_VERSION version numer of ipsec userland and kernel +IPSEC_STARTER_PID PID file for ipsec starter +IPSEC_CHARON_PID PID file for IKE keying daemon .ad .fi .SH SEE ALSO diff --git a/src/ipsec/ipsec.in b/src/ipsec/ipsec.in index a2d77b6d9..2acf5a3f6 100644 --- a/src/ipsec/ipsec.in +++ b/src/ipsec/ipsec.in @@ -28,6 +28,7 @@ IPSEC_DIR="@IPSEC_DIR@" IPSEC_SBINDIR="@IPSEC_SBINDIR@" IPSEC_CONFDIR="@IPSEC_CONFDIR@" IPSEC_PIDDIR="@IPSEC_PIDDIR@" +IPSEC_SCRIPT="@IPSEC_SCRIPT@" IPSEC_STARTER_PID="${IPSEC_PIDDIR}/starter.pid" IPSEC_CHARON_PID="${IPSEC_PIDDIR}/charon.pid" @@ -35,21 +36,21 @@ IPSEC_CHARON_PID="${IPSEC_PIDDIR}/charon.pid" IPSEC_STROKE="${IPSEC_DIR}/stroke" IPSEC_STARTER="${IPSEC_DIR}/starter" -export IPSEC_DIR IPSEC_SBINDIR IPSEC_CONFDIR IPSEC_PIDDIR IPSEC_VERSION IPSEC_NAME IPSEC_STARTER_PID IPSEC_CHARON_PID +export IPSEC_DIR IPSEC_SBINDIR IPSEC_CONFDIR IPSEC_PIDDIR IPSEC_SCRIPT IPSEC_VERSION IPSEC_NAME IPSEC_STARTER_PID IPSEC_CHARON_PID IPSEC_DISTRO="Institute for Internet Technologies and Applications\nUniversity of Applied Sciences Rapperswil, Switzerland" case "$1" in '') - echo "Usage: ipsec command argument ..." - echo "Use --help for list of commands, or see ipsec(8) manual page" - echo "or the $IPSEC_NAME documentation for names of the common ones." - echo "Most have their own manual pages, e.g. ipsec_auto(8)." + echo "Usage: $IPSEC_SCRIPT command argument ..." + echo "Use --help for list of commands, or see $IPSEC_SCRIPT(8) manual " + echo "page or the $IPSEC_NAME documentation for names of the common " + echo "ones." echo "See for more general info." exit 0 ;; --help) - echo "Usage: ipsec command argument ..." + echo "Usage: $IPSEC_SCRIPT command argument ..." echo "where command is one of:" echo " start|restart arguments..." echo " update|reload|stop" @@ -94,7 +95,7 @@ down) shift if [ "$#" -ne 1 ] then - echo "Usage: ipsec down " + echo "Usage: $IPSEC_SCRIPT down " exit 2 fi rc=7 @@ -109,7 +110,7 @@ down-srcip) shift if [ "$#" -lt 1 ] then - echo "Usage: ipsec down-srcip []" + echo "Usage: $IPSEC_SCRIPT down-srcip []" exit 2 fi rc=7 @@ -183,10 +184,10 @@ reload) exit "$rc" ;; restart) - $IPSEC_SBINDIR/ipsec stop + $IPSEC_SBINDIR/$IPSEC_SCRIPT stop sleep 2 shift - exec $IPSEC_SBINDIR/ipsec start "$@" + exec $IPSEC_SBINDIR/$IPSEC_SCRIPT start "$@" ;; route|unroute) op="$1" @@ -194,7 +195,7 @@ route|unroute) shift if [ "$#" -ne 1 ] then - echo "Usage: ipsec $op " + echo "Usage: $IPSEC_SCRIPT $op " exit 2 fi if [ -e $IPSEC_CHARON_PID ] @@ -282,7 +283,7 @@ up) shift if [ "$#" -ne 1 ] then - echo "Usage: ipsec up " + echo "Usage: $IPSEC_SCRIPT up " exit 2 fi rc=7 @@ -307,7 +308,7 @@ update) version|--version) printf "$OS_NAME $IPSEC_NAME $IPSEC_VERSION\n" printf "$IPSEC_DISTRO\n" - printf "See 'ipsec --copyright' for copyright information.\n" + printf "See '$IPSEC_SCRIPT --copyright' for copyright information.\n" exit 0 ;; --*) @@ -326,7 +327,7 @@ then path="$IPSEC_DIR/$cmd" if [ ! -x "$path" ] then - echo "$0: unknown IPsec command \`$cmd' (\`ipsec --help' for list)" >&2 + echo "$0: unknown IPsec command \`$cmd' (\`$IPSEC_SCRIPT --help' for list)" >&2 exit 2 fi fi