packages/net/polipo/files/polipo.init
nico cfb5a88573 [packages] polipo: update to v1.0.3, add config and initscript
git-svn-id: svn://svn.openwrt.org/openwrt/packages@9238 3c298f89-4303-0410-b956-a3cf2f4a3e73
2007-10-10 12:54:45 +00:00

65 lines
1008 B
Bash
Executable File

#!/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
}