aboutsummaryrefslogtreecommitdiff
path: root/security/dropbear
diff options
context:
space:
mode:
authorRong-En Fan <rafan@FreeBSD.org>2007-04-16 19:33:06 +0000
committerRong-En Fan <rafan@FreeBSD.org>2007-04-16 19:33:06 +0000
commit1f411f39e94c4b7df11f63051d82bc2eab606e50 (patch)
treefe2fd26bc15d99f0a0c812d0cc12d88972312fa6 /security/dropbear
parentb5029dc680c01f4cf2ec326dec62ac5b1ee21b93 (diff)
downloadports-1f411f39e94c4b7df11f63051d82bc2eab606e50.tar.gz
ports-1f411f39e94c4b7df11f63051d82bc2eab606e50.zip
- Use new world rc script
PR: ports/111361 Approved by: Alex Kozlov (maintainer) Tested by: Alex Kozlov, rafan
Notes
Notes: svn path=/head/; revision=190143
Diffstat (limited to 'security/dropbear')
-rw-r--r--security/dropbear/Makefile15
-rw-r--r--security/dropbear/files/dropbear.in62
-rw-r--r--security/dropbear/files/dropbear.sh27
-rw-r--r--security/dropbear/pkg-plist1
4 files changed, 66 insertions, 39 deletions
diff --git a/security/dropbear/Makefile b/security/dropbear/Makefile
index 205794496482..1da7c12ddf5a 100644
--- a/security/dropbear/Makefile
+++ b/security/dropbear/Makefile
@@ -7,6 +7,7 @@
PORTNAME= dropbear
PORTVERSION= 0.49
+PORTREVISION= 1
CATEGORIES= security ipv6
MASTER_SITES= http://matt.ucc.asn.au/dropbear/releases/
@@ -16,7 +17,9 @@ COMMENT= An SSH 2 server, designed to be usable in small memory environments
GNU_CONFIGURE= YES
USE_GMAKE= YES
-OPTIONS= STATIC "Build statically" off \
+OPTIONS= STATIC "Build statically" off
+
+USE_RC_SUBR= ${PORTNAME}
.include <bsd.port.pre.mk>
@@ -30,8 +33,6 @@ post-patch:
@${REINPLACE_CMD} -e "s,sys/dir.h,dirent.h," ${WRKSRC}/*.[ch]
@${REINPLACE_CMD} -e "s,make clean,\$${MAKE} clean," \
${WRKSRC}/libtomcrypt/Makefile.in
- @${SED} -e 's:__PREFIX__:${PREFIX}:g' \
- ${FILESDIR}/dropbear.sh > ${WRKSRC}/dropbear.sh
post-install:
@${MKDIR} ${PREFIX}/etc/dropbear
@@ -40,13 +41,5 @@ post-install:
@${ECHO_MSG} " WARNING: deprecated option WANT_STATIC used, use 'make config' instead"
@${ECHO_MSG} ""
.endif
- @${INSTALL_SCRIPT} ${WRKSRC}/dropbear.sh ${PREFIX}/etc/rc.d/dropbear.sh.sample
- @${ECHO_MSG} " Now you have to create your SSH host key."
- @${ECHO_MSG} ""
- @${ECHO_MSG} " To create RSA key:"
- @${ECHO_MSG} " ${PREFIX}/bin/dropbearkey -t rsa -f ${PREFIX}/etc/dropbear/dropbear_rsa_host_key"
- @${ECHO_MSG} ""
- @${ECHO_MSG} " For more details, run ${PREFIX}/bin/dropbearkey -h"
- @${ECHO_MSG} ""
.include <bsd.port.post.mk>
diff --git a/security/dropbear/files/dropbear.in b/security/dropbear/files/dropbear.in
new file mode 100644
index 000000000000..331ec53799bf
--- /dev/null
+++ b/security/dropbear/files/dropbear.in
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+# PROVIDE: dropbear
+# REQUIRE: LOGIN cleanvar
+#
+# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
+# to enable this service:
+#
+# dropbear_enable (bool): Set to NO by default.
+# Set it to YES to enable dropbear.
+#
+
+. %%RC_SUBR%%
+
+name="dropbear"
+rcvar=`set_rcvar`
+command="%%PREFIX%%/sbin/${name}"
+keygen_cmd="dropbear_keygen"
+start_precmd="dropbear_precmd"
+pidfile="/var/run/${name}.pid"
+extra_commands="keygen"
+
+etcdir="%%PREFIX%%/etc/${name}"
+
+dropbear_keygen()
+{
+ (
+ umask 022
+
+ if [ -f ${etcdir}/dropbear_rsa_host_key ]; then
+ echo "You already have an RSA host key" \
+ "in ${etcdir}/dropbear_rsa_host_key"
+ echo "Skipping protocol version 2 RSA Key Generation"
+ else
+ %%PREFIX%%/bin/dropbearkey -t rsa -f ${etcdir}/dropbear_rsa_host_key
+ fi
+
+ if [ -f ${etcdir}/dropbear_dss_host_key ]; then
+ echo "You already have an DSS host key" \
+ "in ${etcdir}/dropbear_dss_host_key"
+ echo "Skipping protocol version 2 DSS Key Generation"
+ else
+ %%PREFIX%%/bin/dropbearkey -t dss -f ${etcdir}/dropbear_dss_host_key
+ fi
+ )
+}
+
+dropbear_precmd()
+{
+ if [ ! -f ${etcdir}/dropbear_rsa_host_key -o \
+ ! -f ${etcdir}/dropbear_dss_host_key ]; then
+ run_rc_command keygen
+ fi
+}
+
+load_rc_config $name
+
+: ${dropbear_enable="NO"}
+
+command_args="-P $pidfile"
+
+run_rc_command "$1"
diff --git a/security/dropbear/files/dropbear.sh b/security/dropbear/files/dropbear.sh
deleted file mode 100644
index bc6fbbd0dd75..000000000000
--- a/security/dropbear/files/dropbear.sh
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/sh
-PREFIX=__PREFIX__
-ETCDIR=${PREFIX}/etc/dropbear
-SBINDIR=${PREFIX}/sbin
-BINDIR=${PREFIX}/bin
-case "$1" in
-start)
- [ -f ${ETCDIR}/dropbear_rsa_host_key ] || \
- ${BINDIR}/dropbearkey -t rsa -f ${ETCDIR}/dropbear_rsa_host_key
- [ -f __PREFIX__/dropbear_dss_host_key ] || \
- ${BINDIR}/dropbearkey -t dss -f ${ETCDIR}/dropbear_dss_host_key
- ${SBINDIR}/dropbear
- echo $! > /var/run/dropbear.pid
- echo -n ' dropbear'
- ;;
-stop)
- if [ -f /var/run/dropbear.pid ]; then
- kill -TERM `cat /var/run/dropbear.pid`
- rm -f /var/run/dropbear.pid
- echo -n ' dropbear'
- fi
- ;;
-*)
- echo "Usage: ${0##*/}: { start | stop }" 2>&1
- exit 65
- ;;
-esac
diff --git a/security/dropbear/pkg-plist b/security/dropbear/pkg-plist
index cba6ff8deb8e..d0f11bb560fe 100644
--- a/security/dropbear/pkg-plist
+++ b/security/dropbear/pkg-plist
@@ -1,6 +1,5 @@
bin/dbclient
bin/dropbearkey
bin/dropbearconvert
-etc/rc.d/dropbear.sh.sample
sbin/dropbear
@unexec rmdir %D/etc/dropbear 2>/dev/null || echo "===> You can safely remove %D/etc/dropbear directory, if you don't want to use dropbear anymore."