Added an option to rename the ipsec script during installation

Also rename the man page and adjust all references in the script, the
man page and other files.

Closes #194.
This commit is contained in:
Tobias Brunner 2012-06-19 17:12:53 +02:00
parent d86cf32b4b
commit bc6d944705
7 changed files with 64 additions and 40 deletions

View File

@ -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([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], [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([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([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]) 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")] [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) m4_include(m4/macros/enable-disable.m4)
ARG_ENABL_SET([curl], [enable CURL fetcher plugin to fetch files via libcurl. Requires libcurl.]) ARG_ENABL_SET([curl], [enable CURL fetcher plugin to fetch files via libcurl. Requires libcurl.])

View File

@ -5,4 +5,7 @@ CLEANFILES = strongswan.service
systemdsystemunit_DATA = strongswan.service systemdsystemunit_DATA = strongswan.service
strongswan.service : strongswan.service.in 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 > $@

View File

@ -3,7 +3,7 @@ Description=strongSwan IPsec
After=syslog.target After=syslog.target
[Service] [Service]
ExecStart=@SBINDIR@/ipsec start --nofork ExecStart=@SBINDIR@/@IPSEC_SCRIPT@ start --nofork
StandardOutput=syslog StandardOutput=syslog
[Install] [Install]

View File

@ -1,2 +1,2 @@
ipsec _ipsec
ipsec.8 _ipsec.8

View File

@ -1,22 +1,35 @@
sbin_SCRIPTS = ipsec sbin_SCRIPTS = _ipsec
CLEANFILES = ipsec ipsec.8 CLEANFILES = _ipsec _ipsec.8
dist_man8_MANS = ipsec.8 dist_man8_MANS = _ipsec.8
EXTRA_DIST = ipsec.in ipsec.8.in Android.mk EXTRA_DIST = ipsec.in ipsec.8.in Android.mk
ipsec.8 : ipsec.8.in _ipsec.8 : ipsec.8.in
sed \ sed \
-e "s:@IPSEC_VERSION@:$(PACKAGE_VERSION):" \ -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 \ sed \
-e "s:@IPSEC_SHELL@:/bin/sh:" \ -e "s:@IPSEC_SHELL@:/bin/sh:" \
-e "s:@IPSEC_VERSION@:$(PACKAGE_VERSION):" \ -e "s:@IPSEC_VERSION@:$(PACKAGE_VERSION):" \
-e "s:@IPSEC_NAME@:$(PACKAGE_NAME):" \ -e "s:@IPSEC_NAME@:$(PACKAGE_NAME):" \
-e "s:@IPSEC_DISTRO@::" \ -e "s:@IPSEC_DISTRO@::" \
-e "s:@IPSEC_DIR@:$(ipsecdir):" \ -e "s:@IPSEC_DIR@:$(ipsecdir):" \
-e "s:@IPSEC_SCRIPT@:$(ipsec_script):" \
-e "s:@IPSEC_SBINDIR@:$(sbindir):" \ -e "s:@IPSEC_SBINDIR@:$(sbindir):" \
-e "s:@IPSEC_CONFDIR@:$(sysconfdir):" \ -e "s:@IPSEC_CONFDIR@:$(sysconfdir):" \
-e "s:@IPSEC_PIDDIR@:$(piddir):" \ -e "s:@IPSEC_PIDDIR@:$(piddir):" \
$(srcdir)/$@.in > $@ $< > $@
chmod +x $@ 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

View File

@ -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 .SH NAME
ipsec \- invoke IPsec utilities @IPSEC_SCRIPT@ \- invoke IPsec utilities
.SH SYNOPSIS .SH SYNOPSIS
.B ipsec .B @IPSEC_SCRIPT@
\fIcommand\fP [ \fIarguments\fP ] [ \fIoptions\fP ] \fIcommand\fP [ \fIarguments\fP ] [ \fIoptions\fP ]
.PP .PP
.SH DESCRIPTION .SH DESCRIPTION
The The
.B ipsec .B @IPSEC_SCRIPT@
utility invokes any of several utilities involved in controlling and monitoring utility invokes any of several utilities involved in controlling and monitoring
the IPsec encryption/authentication system, running the specified \fIcommand\fP the IPsec encryption/authentication system, running the specified \fIcommand\fP
with the specified \fIarguments\fP and \fIoptions\fP as if it had been invoked 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. control and monitor IPsec connections as well as the IKE daemons.
.PP .PP
For other commands For other commands
.I ipsec .I @IPSEC_SCRIPT@
supplies the invoked supplies the invoked
.I command .I command
with a suitable PATH environment variable, with a suitable PATH environment variable,
@ -226,7 +226,9 @@ purges all cached OCSP information records.
.SS INFO COMMANDS .SS INFO COMMANDS
.TP .TP
.B "\-\-help" .B "\-\-help"
returns the usage information for the ipsec command. returns the usage information for the
.B @IPSEC_SCRIPT@
command.
.PP .PP
.TP .TP
.B "\-\-version" .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 The following environment variables control where strongSwan finds its
components. components.
The The
.B ipsec .B @IPSEC_SCRIPT@
command sets them if they are not already set. command sets them if they are not already set.
.nf .nf
.na .na
IPSEC_DIR directory containing ipsec programs and utilities IPSEC_DIR directory containing ipsec programs and utilities
IPSEC_SBINDIR directory containing \fBipsec\fP command IPSEC_SBINDIR directory containing \fBipsec\fP command
IPSEC_CONFDIR directory containing configuration files IPSEC_CONFDIR directory containing configuration files
IPSEC_PIDDIR directory containing PID files IPSEC_PIDDIR directory containing PID files
IPSEC_NAME name of ipsec distribution IPSEC_SCRIPT name of the ipsec script
IPSEC_VERSION version numer of ipsec userland and kernel IPSEC_NAME name of ipsec distribution
IPSEC_STARTER_PID PID file for ipsec starter IPSEC_VERSION version numer of ipsec userland and kernel
IPSEC_CHARON_PID PID file for IKE keying daemon IPSEC_STARTER_PID PID file for ipsec starter
IPSEC_CHARON_PID PID file for IKE keying daemon
.ad .ad
.fi .fi
.SH SEE ALSO .SH SEE ALSO

View File

@ -28,6 +28,7 @@ IPSEC_DIR="@IPSEC_DIR@"
IPSEC_SBINDIR="@IPSEC_SBINDIR@" IPSEC_SBINDIR="@IPSEC_SBINDIR@"
IPSEC_CONFDIR="@IPSEC_CONFDIR@" IPSEC_CONFDIR="@IPSEC_CONFDIR@"
IPSEC_PIDDIR="@IPSEC_PIDDIR@" IPSEC_PIDDIR="@IPSEC_PIDDIR@"
IPSEC_SCRIPT="@IPSEC_SCRIPT@"
IPSEC_STARTER_PID="${IPSEC_PIDDIR}/starter.pid" IPSEC_STARTER_PID="${IPSEC_PIDDIR}/starter.pid"
IPSEC_CHARON_PID="${IPSEC_PIDDIR}/charon.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_STROKE="${IPSEC_DIR}/stroke"
IPSEC_STARTER="${IPSEC_DIR}/starter" 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" IPSEC_DISTRO="Institute for Internet Technologies and Applications\nUniversity of Applied Sciences Rapperswil, Switzerland"
case "$1" in case "$1" in
'') '')
echo "Usage: ipsec command argument ..." echo "Usage: $IPSEC_SCRIPT command argument ..."
echo "Use --help for list of commands, or see ipsec(8) manual page" echo "Use --help for list of commands, or see $IPSEC_SCRIPT(8) manual "
echo "or the $IPSEC_NAME documentation for names of the common ones." echo "page or the $IPSEC_NAME documentation for names of the common "
echo "Most have their own manual pages, e.g. ipsec_auto(8)." echo "ones."
echo "See <http://www.strongswan.org> for more general info." echo "See <http://www.strongswan.org> for more general info."
exit 0 exit 0
;; ;;
--help) --help)
echo "Usage: ipsec command argument ..." echo "Usage: $IPSEC_SCRIPT command argument ..."
echo "where command is one of:" echo "where command is one of:"
echo " start|restart arguments..." echo " start|restart arguments..."
echo " update|reload|stop" echo " update|reload|stop"
@ -94,7 +95,7 @@ down)
shift shift
if [ "$#" -ne 1 ] if [ "$#" -ne 1 ]
then then
echo "Usage: ipsec down <connection name>" echo "Usage: $IPSEC_SCRIPT down <connection name>"
exit 2 exit 2
fi fi
rc=7 rc=7
@ -109,7 +110,7 @@ down-srcip)
shift shift
if [ "$#" -lt 1 ] if [ "$#" -lt 1 ]
then then
echo "Usage: ipsec down-srcip <start> [<end>]" echo "Usage: $IPSEC_SCRIPT down-srcip <start> [<end>]"
exit 2 exit 2
fi fi
rc=7 rc=7
@ -183,10 +184,10 @@ reload)
exit "$rc" exit "$rc"
;; ;;
restart) restart)
$IPSEC_SBINDIR/ipsec stop $IPSEC_SBINDIR/$IPSEC_SCRIPT stop
sleep 2 sleep 2
shift shift
exec $IPSEC_SBINDIR/ipsec start "$@" exec $IPSEC_SBINDIR/$IPSEC_SCRIPT start "$@"
;; ;;
route|unroute) route|unroute)
op="$1" op="$1"
@ -194,7 +195,7 @@ route|unroute)
shift shift
if [ "$#" -ne 1 ] if [ "$#" -ne 1 ]
then then
echo "Usage: ipsec $op <connection name>" echo "Usage: $IPSEC_SCRIPT $op <connection name>"
exit 2 exit 2
fi fi
if [ -e $IPSEC_CHARON_PID ] if [ -e $IPSEC_CHARON_PID ]
@ -282,7 +283,7 @@ up)
shift shift
if [ "$#" -ne 1 ] if [ "$#" -ne 1 ]
then then
echo "Usage: ipsec up <connection name>" echo "Usage: $IPSEC_SCRIPT up <connection name>"
exit 2 exit 2
fi fi
rc=7 rc=7
@ -307,7 +308,7 @@ update)
version|--version) version|--version)
printf "$OS_NAME $IPSEC_NAME $IPSEC_VERSION\n" printf "$OS_NAME $IPSEC_NAME $IPSEC_VERSION\n"
printf "$IPSEC_DISTRO\n" printf "$IPSEC_DISTRO\n"
printf "See 'ipsec --copyright' for copyright information.\n" printf "See '$IPSEC_SCRIPT --copyright' for copyright information.\n"
exit 0 exit 0
;; ;;
--*) --*)
@ -326,7 +327,7 @@ then
path="$IPSEC_DIR/$cmd" path="$IPSEC_DIR/$cmd"
if [ ! -x "$path" ] if [ ! -x "$path" ]
then 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 exit 2
fi fi
fi fi