[packages] polipo: update to v1.0.3, add config and initscript
authorNicolas Thill <nico@openwrt.org>
Wed, 10 Oct 2007 12:54:45 +0000 (12:54 +0000)
committerNicolas Thill <nico@openwrt.org>
Wed, 10 Oct 2007 12:54:45 +0000 (12:54 +0000)
SVN-Revision: 9238

net/polipo/Makefile
net/polipo/files/polipo.config [new file with mode: 0644]
net/polipo/files/polipo.init [new file with mode: 0755]

index 73478c1..df0e552 100644 (file)
@@ -9,12 +9,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=polipo
-PKG_VERSION:=1.0.2
-PKG_RELEASE:=2
+PKG_VERSION:=1.0.3
+PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://www.pps.jussieu.fr/~jch/software/files/$(PKG_NAME)/
-PKG_MD5SUM:=2d1d8af414429e5823675a781604c70a
+PKG_MD5SUM:=a0b00ca01541cf77ff3d725c27cf68bb
 
 include $(INCLUDE_DIR)/package.mk
 
@@ -22,7 +22,7 @@ define Package/polipo
   SUBMENU:=Proxy Servers
   SECTION:=net
   CATEGORY:=Network
-  TITLE:=a caching web proxy
+  TITLE:=A caching web proxy
   URL:=http://www.pps.jussieu.fr/~jch/software/polipo/
 endef
 
@@ -41,14 +41,19 @@ define Build/Compile
 endef
 
 define Package/polipo/conffiles
-/etc/polipo/polipo.conf
+/etc/config/polipo
+/etc/polipo/config
 endef
 
 define Package/polipo/install
        $(INSTALL_DIR) $(1)/usr/sbin
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/polipo $(1)/usr/sbin/
        $(INSTALL_DIR) $(1)/etc/polipo
-       $(INSTALL_CONF) $(PKG_BUILD_DIR)/config.sample $(1)/etc/polipo/polipo.conf
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/config.sample $(1)/etc/polipo/config
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/polipo.config $(1)/etc/config/polipo
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/polipo.init $(1)/etc/init.d/polipo
 endef
 
 $(eval $(call BuildPackage,polipo))
diff --git a/net/polipo/files/polipo.config b/net/polipo/files/polipo.config
new file mode 100644 (file)
index 0000000..80e9940
--- /dev/null
@@ -0,0 +1,5 @@
+config polipo
+       option enabled       0
+       #option config_file  '/etc/polipo/config'
+       #option pid_file     '/var/run/polipo.pid'
+
diff --git a/net/polipo/files/polipo.init b/net/polipo/files/polipo.init
new file mode 100755 (executable)
index 0000000..4eac9c7
--- /dev/null
@@ -0,0 +1,64 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2007 OpenWrt.org
+
+START=99
+
+NAME=polipo
+BIN_F=/usr/sbin/$NAME
+SSD=start-stop-daemon
+
+is_enabled() {
+       local cfg="$1"
+
+       config_get_bool enabled "$cfg" enabled '1'
+       [ $enabled -ne 0 ] || {
+               echo "$initscript: not enabled"
+               return 1
+       }
+}
+
+get_pid_file() {
+       local cfg="$1"
+
+       config_get pid_file "$cfg" pid-file
+       [ -n "$pid_file" ] || pid_file="/var/run/$NAME.pid"
+}
+
+get_options() {
+       local cfg="$1"
+
+       config_get options "$cfg" options
+
+       config_get config_file "$cfg" config_file
+       [ -n "$config_script" ] && append options "-c $config_file"
+}
+
+start_service() {
+       local cfg="$1"
+
+       is_enabled "$cfg" || return
+       get_pid_file "$cfg"
+       get_options "$cfg"
+
+       $SSD -S -p $pid_file -b -m -x $BIN_F -- $options &>/dev/null
+}
+
+stop_service() {
+       local cfg="$1"
+
+       is_enabled "$cfg" || return
+       get_pid_file "$cfg"
+
+       $SSD -K -p $pid_file &>/dev/null
+}
+
+start() {
+       config_load $NAME
+       config_foreach start_service $NAME
+}
+
+stop() {
+       config_load $NAME
+       config_foreach stop_service $NAME
+}
+