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([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.])

View File

@ -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 > $@

View File

@ -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]

View File

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

View File

@ -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

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
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

View File

@ -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 <http://www.strongswan.org> 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 <connection name>"
echo "Usage: $IPSEC_SCRIPT down <connection name>"
exit 2
fi
rc=7
@ -109,7 +110,7 @@ down-srcip)
shift
if [ "$#" -lt 1 ]
then
echo "Usage: ipsec down-srcip <start> [<end>]"
echo "Usage: $IPSEC_SCRIPT down-srcip <start> [<end>]"
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 <connection name>"
echo "Usage: $IPSEC_SCRIPT $op <connection name>"
exit 2
fi
if [ -e $IPSEC_CHARON_PID ]
@ -282,7 +283,7 @@ up)
shift
if [ "$#" -ne 1 ]
then
echo "Usage: ipsec up <connection name>"
echo "Usage: $IPSEC_SCRIPT up <connection name>"
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