summaryrefslogtreecommitdiffstats
path: root/extra/tinyproxy
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-02-24 10:21:10 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-02-24 10:21:10 +0000
commit2164218472c7e0e946931f050a927702c91a1454 (patch)
treee0471434a70adefd19c77d421ef573ade209622d /extra/tinyproxy
parent246c02013c1e1840e0e3e333157981c82b7d620a (diff)
downloadaports-2164218472c7e0e946931f050a927702c91a1454.tar.bz2
aports-2164218472c7e0e946931f050a927702c91a1454.tar.xz
extra/tinyproxy: run as "tinyproxy" by default. fixed it so it works
- run sed to set correct user, group and pidfile in default config - copied init.d script from gentoo - killed unused conf.d file. - fix installscript to create user and set perms to pidfile dir - actually install the init.d script
Diffstat (limited to 'extra/tinyproxy')
-rw-r--r--extra/tinyproxy/APKBUILD16
-rw-r--r--extra/tinyproxy/tinyproxy.confd9
-rw-r--r--extra/tinyproxy/tinyproxy.initd52
-rw-r--r--extra/tinyproxy/tinyproxy.install31
4 files changed, 47 insertions, 61 deletions
diff --git a/extra/tinyproxy/APKBUILD b/extra/tinyproxy/APKBUILD
index 2bca7212..046daa83 100644
--- a/extra/tinyproxy/APKBUILD
+++ b/extra/tinyproxy/APKBUILD
@@ -12,23 +12,29 @@ install="tinyproxy.install"
subpackages="$pkgname-doc"
source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz
tinyproxy.initd
- tinyproxy.confd
$install
"
build() {
cd "$srcdir/$pkgname-$pkgver"
+ # set default user to tinyproxy:tinyproxy and correct pidfile
+ sed -i -e 's:^User.*:User tinyproxy:' \
+ -e 's:^Group.*:Group tinyproxy:' \
+ -e 's:^PidFile.*:PidFile "/var/run/tinyproxy/tinyproxy.pid":' \
+ doc/tinyproxy.conf
+
./configure --prefix=/usr \
--sysconfdir=/etc \
--mandir=/usr/share/man \
--infodir=/usr/share/info
+
make || return 1
make DESTDIR="$pkgdir" install
-
+ mkdir -p "$pkgdir"/var/run/tinyproxy
+ install -Dm755 "$srcdir"/tinyproxy.initd "$pkgdir"/etc/init.d/tinyproxy
}
md5sums="bd14d029b12621bcfd7ee71b2f4893da tinyproxy-1.6.3.tar.gz
-d0c708403940c51e52eb27ea1610a27d tinyproxy.initd
-431dfe7403323e247a88b97beade5d78 tinyproxy.confd
-b730b3d200f52027868378ad5ee0226b tinyproxy.install"
+554da6fc363fbe251f081b342541bef4 tinyproxy.initd
+2f5d9f4a8b7f4c7f1f5b9d59d99839e4 tinyproxy.install"
diff --git a/extra/tinyproxy/tinyproxy.confd b/extra/tinyproxy/tinyproxy.confd
deleted file mode 100644
index 0abb80c6..00000000
--- a/extra/tinyproxy/tinyproxy.confd
+++ /dev/null
@@ -1,9 +0,0 @@
-# Sample conf.d file for alpine linux
-
-#
-# Specify daemon $OPTS here.
-#
-
-OPTS=""
-USER="nobody"
-GROUP="nobody"
diff --git a/extra/tinyproxy/tinyproxy.initd b/extra/tinyproxy/tinyproxy.initd
index 980c53e7..bee5d041 100644
--- a/extra/tinyproxy/tinyproxy.initd
+++ b/extra/tinyproxy/tinyproxy.initd
@@ -1,39 +1,45 @@
#!/sbin/runscript
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-proxy/tinyproxy/files/tinyproxy.initd,v 1.1 2008/02/16 07:11:25 mrness Exp $
-# Sample init.d file for alpine linux.
-
-NAME=
-DAEMON=/usr/sbin/$NAME
+CONFFILE="/etc/tinyproxy/${SVCNAME}.conf"
depend() {
+ use logger dns
need net
}
+checkconfig() {
+ if [ ! -f "${CONFFILE}" ]; then
+ eerror "Configuration file ${CONFFILE} not found!"
+ return 1
+ fi
+
+ PIDFILE=$(sed -n -e 's/^[[:space:]]*PidFile[[:space:]]\+"\(.*\)"[[:space:]]*$/\1/p' "${CONFFILE}")
+ return 0
+}
+
start() {
- ebegin "Starting ${NAME}"
- start-stop-daemon --start --quiet --background \
- --make-pidfile --pidfile /var/run/${NAME}.pid \
- --chuid ${USER}:${GROUP} \
- --exec ${DAEMON} -- ${OPTS}
+ checkconfig || return 1
+
+ ebegin "Starting tinyproxy"
+ if [ -n "${PIDFILE}" ]; then
+ start-stop-daemon --start --pidfile "${PIDFILE}" --startas /usr/sbin/tinyproxy -- -c "${CONFFILE}"
+ else
+ start-stop-daemon --start --exec /usr/sbin/tinyproxy -- -c "${CONFFILE}"
+ fi
eend $?
}
stop() {
- ebegin "Stopping ${NAME}"
- start-stop-daemon --stop --quiet \
- --exec ${DAEMON} \
- --pidfile /var/run/${NAME}.pid \
- eend $?
-}
+ checkconfig || return 1
-reload() {
- ebegin "Reloading ${NAME}"
- if ! service_started "${NAME}" ; then
- eend 1 "${NAME} is not started"
- return 1
+ ebegin "Stopping tinyproxy"
+ if [ -n "${PIDFILE}" ]; then
+ start-stop-daemon --stop --pidfile "${PIDFILE}"
+ else
+ start-stop-daemon --stop --exec /usr/sbin/tinyproxy
fi
- start-stop-daemon --stop --oknodo --signal HUP \
- --exec ${DAEMON} --pidfile /var/run/${NAME}.pid
eend $?
}
-
diff --git a/extra/tinyproxy/tinyproxy.install b/extra/tinyproxy/tinyproxy.install
index a05d28b4..5fa36673 100644
--- a/extra/tinyproxy/tinyproxy.install
+++ b/extra/tinyproxy/tinyproxy.install
@@ -2,29 +2,12 @@
case "$1" in
pre_install)
- # add something which happends before install
- # $2 contains package version
- ;;
+ adduser -h /dev/null -s /bin/false -D tinyproxy 2>/dev/null
+ ;;
post_install)
- # add something which happends after install
- # $2 contains package version
- ;;
- pre_upgrade)
- # add something which happends before update
- # $2 contains new package version
- # $3 contains old package version
- ;;
- post_upgrade)
- # add something which happends after update
- # $2 contains new package version
- # $3 contains old package version
- ;;
- pre_deinstall)
- # add something which happends before delete
- # $2 contains package version
- ;;
- post_deinstall)
- # add something which happends after delete
- # $2 contains package version
- ;;
+ chown tinyproxy:tinyproxy /var/run/tinyproxy
+ ;;
esac
+
+# return with success even if user already exist
+exit 0