This package provides ruptime, rwho and rwhod including start/stop scripts.

signed-off-by: Oliver Gerler <roc...@rockus.at>

Index: package/netkit-rwho/files/rwhod
===================================================================
--- package/netkit-rwho/files/rwhod     (revision 0)
+++ package/netkit-rwho/files/rwhod     (revision 0)
@@ -0,0 +1,19 @@
+#!/bin/sh /etc/rc.common
+
+START=40
+STOP=90
+
+APP=rwhod
+BIN=/usr/sbin/$APP
+PID_FILE=/var/run/$APP.pid
+
+start () {
+       mkdir -p /var/spool/rwho
+       start-stop-daemon -S -x $BIN -p $PID_FILE -m
+       PID=`cat $PID_FILE`;PID=`expr $PID + 1`;echo $PID >$PID_FILE
+}
+
+stop() {
+       start-stop-daemon -K -n $APP -p $PID_FILE -s TERM
+       rm $PID_FILE
+}

Property changes on: package/netkit-rwho/files/rwhod
___________________________________________________________________
Added: svn:executable
   + *

Index: package/netkit-rwho/Makefile
===================================================================
--- package/netkit-rwho/Makefile        (revision 0)
+++ package/netkit-rwho/Makefile        (revision 0)
@@ -0,0 +1,89 @@
+# makefile: http://manoftoday.wordpress.com/2007/10/11/writing-and-compiling-a-simple-program-for-openwrt/
+# how-to: http://wiki.openwrt.org/doc/devel/packages
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=netkit-rwho
+PKG_VERSION:=0.17
+PKG_RELEASE:=1
+
+PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+
+PKG_SOURCE := $(PKG_NAME)_$(PKG_VERSION).orig.tar.gz
+PKG_SOURCE_URL := http://ftp.de.debian.org/debian/pool/main/n/netkit-rwho/
+PKG_CAT := zcat
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/netkit-rwho
+       SECTION:=net
+       CATEGORY:=Network
+       TITLE:=ruptime, rwho, rwhod
+       MAINTAINER:=Oliver Gerler <roc...@rockus.at>
+endef
+
+define Package/netkit-rwho/description
+       System status server and clients
+endef
+
+# Switching off configuring.
+# The original script isn't intelligent enough to deal with --target
+define Build/Configure
+endef
+
+define Build/Compile
+        $(TARGET_CC) $(TARGET_CFLAGS) -Wall \
+ -o $(PKG_BUILD_DIR)/ruptime/ruptime $(PKG_BUILD_DIR)/ruptime/ruptime.c; \
+        $(TARGET_CC) $(TARGET_CFLAGS) -Wall \
+ -o $(PKG_BUILD_DIR)/rwhod/rwhod $(PKG_BUILD_DIR)/rwhod/rwhod.c $(PKG_BUILD_DIR)/rwhod/daemon.c; \
+        $(TARGET_CC) $(TARGET_CFLAGS) -Wall \
+                -o $(PKG_BUILD_DIR)/rwho/rwho $(PKG_BUILD_DIR)/rwho/rwho.c
+endef
+
+define Package/netkit-rwho/install
+       $(INSTALL_DIR) $(1)/tmp/spool/rwho
+               # /var is symbolic link to /tmp
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/ruptime/ruptime $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/rwho/rwho $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/rwhod/rwhod $(1)/usr/sbin/
+       $(INSTALL_BIN) ./files/rwhod $(1)/etc/init.d/rwhod
+endef
+
+define Package/netkit-rwho/postinst
+#!/bin/sh
+# check if we are on real system
+if [ -z "$${IPKG_INSTROOT}" ]; then
+       echo "Enabling rc.d symlink for rwhod"
+       /etc/init.d/rwhod enable
+       #
+       echo "Adding 'who 513/udp' to /etc/services"
+       grep -v 513/udp /etc/services >/tmp/services
+       echo "who          513/udp" >>/tmp/services
+       cp /tmp/services /etc/services
+       #
+       echo "Starting rwhod"
+       /etc/init.d/rwhod start
+fi
+exit 0
+endef
+
+define Package/netkit-rwho/prerm
+#!/bin/sh
+# check if we are on real system
+if [ -z "$${IPKG_INSTROOT}" ]; then
+       echo "Stopping rwhod"
+       /etc/init.d/rwhod stop
+       #
+       echo "Removing rc.d symlink for rwhod"
+       /etc/init.d/rwhod disable
+       #
+       echo "Removing /var/spool/rwho"
+       rm -R /var/spool/rwho
+fi
+exit 0
+endef
+
+$(eval $(call BuildPackage,netkit-rwho))
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to