#
-# Copyright (C) 2006,2008-2011 OpenWrt.org
+# Copyright (C) 2006-2011 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
PKG_NAME:=openssh
PKG_VERSION:=5.9p1
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/ \
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/sshd $(1)/usr/sbin/
endef
-define Package/openssh-server/postinst
-#!/bin/sh
-
-name=sshd
-id=22
-
-if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then
- echo "adding group $$name to /etc/group"
- echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group
-fi
-
-if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then
- echo "adding user $$name to /etc/passwd"
- echo "$${name}:x:$${id}:$${id}:$${name}:/var/empty/.$${name}:/bin/false" >> $${IPKG_INSTROOT}/etc/passwd
-fi
-endef
-
define Package/openssh-sftp-client/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sftp $(1)/usr/bin/
#!/bin/sh /etc/rc.common
-# Copyright (C) 2006 OpenWrt.org
+# Copyright (C) 2006-2011 OpenWrt.org
+
START=50
STOP=50
+SERVICE_USE_PID=1
+
start() {
for type in rsa dsa; do {
# check for keys
exit 0
}
}; done
- mkdir -p /var/empty
- chmod 0700 /var/empty
- /usr/sbin/sshd
+ user_exists sshd 22 || user_add sshd 22
+ group_exists sshd 22 || group_add ssh 22
+ mkdir -m 0700 -p /var/empty
+ mkdir -m 0755 -p /var/run/sshd
+ service_start /usr/sbin/sshd
}
stop() {
- kill $(cat /var/run/sshd.pid)
+ service_stop /usr/sbin/sshd
}
shutdown() {
- killall sshd
+ local pid
+ local pids
+ local pid_mine
+
+ stop
+
+ # kill active clients
+ pid_mine="$$"
+ pids="$(pidof sshd)"
+ for pid in $pids; do
+ [ "$pid" = "$pid_mine" ] && continue
+ [ -e "/proc/$pid/stat" ] && kill $pid
+ done
}