Commit 21440f27 authored by Natanael Copa's avatar Natanael Copa

extra/clamsmtp: fix for upgrade script

fixes #71
parent f9b021fa
From 539dfdd4b0358fa78f26c38853c36fabc65c54cd Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Fri, 17 Jul 2009 08:48:42 +0000
Subject: [PATCH] extra/clamsmtp: renamed init.d script to clamsmtpd
partly fixes #64
---
extra/clamsmtp/APKBUILD | 18 +++++++++++-------
extra/clamsmtp/clamsmtp.confd | 5 -----
extra/clamsmtp/clamsmtp.initd | 22 ----------------------
extra/clamsmtp/clamsmtp.post-upgrade | 16 ++++++++++++++++
extra/clamsmtp/clamsmtp.pre-upgrade | 12 ++++++++++++
extra/clamsmtp/clamsmtpd.confd | 5 +++++
extra/clamsmtp/clamsmtpd.initd | 22 ++++++++++++++++++++++
7 files changed, 66 insertions(+), 34 deletions(-)
delete mode 100644 extra/clamsmtp/clamsmtp.confd
delete mode 100644 extra/clamsmtp/clamsmtp.initd
create mode 100644 extra/clamsmtp/clamsmtp.post-upgrade
create mode 100644 extra/clamsmtp/clamsmtp.pre-upgrade
create mode 100644 extra/clamsmtp/clamsmtpd.confd
create mode 100644 extra/clamsmtp/clamsmtpd.initd
diff --git a/extra/clamsmtp/APKBUILD b/extra/clamsmtp/APKBUILD
index 5402d09..0ad433a 100644
--- a/extra/clamsmtp/APKBUILD
+++ b/extra/clamsmtp/APKBUILD
@@ -2,16 +2,18 @@
# Maintainer: Carlo Landmeter <clandmeter at gmail>
pkgname=clamsmtp
pkgver=1.10
-pkgrel=1
+pkgrel=2
pkgdesc="An SMTP Virus Filter"
url="http://memberwebs.com/stef/software/clamsmtp/"
license="as-is"
-depends="uclibc"
-makedepends=""
+depends=
+makedepends=
+install="$pkgname.pre-upgrade $pkgname.post-upgrade"
subpackages="$pkgname-doc"
source="http://memberwebs.com/stef/software/clamsmtp/${pkgname}-${pkgver}.tar.gz
-clamsmtp.confd
-clamsmtp.initd"
+ clamsmtpd.confd
+ clamsmtpd.initd
+ $install"
build() {
cd "$srcdir/$pkgname-$pkgver"
@@ -30,5 +32,7 @@ build() {
}
md5sums="b068ba6e444859782bbdd88f290c1abf clamsmtp-1.10.tar.gz
-e84205681f64c07af9ec5b6a3dd8bc38 clamsmtp.confd
-161baf2fb444b67d8a08fbfe4375a12c clamsmtp.initd"
+e84205681f64c07af9ec5b6a3dd8bc38 clamsmtpd.confd
+161baf2fb444b67d8a08fbfe4375a12c clamsmtpd.initd
+32e7b12f3a1f4669d080d8cfdb537e78 clamsmtp.pre-upgrade
+d9fbdc217d12cf1e85b0323f822b7e47 clamsmtp.post-upgrade"
diff --git a/extra/clamsmtp/clamsmtp.confd b/extra/clamsmtp/clamsmtp.confd
deleted file mode 100644
index 8d08b68..0000000
--- a/extra/clamsmtp/clamsmtp.confd
+++ /dev/null
@@ -1,5 +0,0 @@
-#
-# Specify daemon $OPTS here.
-#
-
-OPTS=""
diff --git a/extra/clamsmtp/clamsmtp.initd b/extra/clamsmtp/clamsmtp.initd
deleted file mode 100644
index dbd817f..0000000
--- a/extra/clamsmtp/clamsmtp.initd
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/sbin/runscript
-
-NAME=clamsmtpd
-DAEMON=/usr/sbin/$NAME
-
-depend() {
- need net
-}
-
-start() {
- ebegin "Starting ${NAME}"
- start-stop-daemon --start --quiet \
- --exec ${DAEMON} -- ${OPTS}
- eend $?
-}
-
-stop() {
- ebegin "Stopping ${NAME}"
- start-stop-daemon --stop --quiet \
- --exec ${DAEMON}
- eend $?
-}
diff --git a/extra/clamsmtp/clamsmtp.post-upgrade b/extra/clamsmtp/clamsmtp.post-upgrade
new file mode 100644
index 0000000..c418ff8
--- /dev/null
+++ b/extra/clamsmtp/clamsmtp.post-upgrade
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+moved=
+for i in /etc/runlevels/*/clamsmtp; do
+ if [ -L $i ]; then
+ mv ${i} ${i}d
+ moved=1
+ fi
+done
+
+if [ -n "$moved" ]; then
+ echo " *"
+ echo " * NOTICE: /etc/init.d/clamsmtp is renamed to /etc/init.d/clamsmtpd"
+ echo " *"
+fi
+
diff --git a/extra/clamsmtp/clamsmtp.pre-upgrade b/extra/clamsmtp/clamsmtp.pre-upgrade
new file mode 100644
index 0000000..12de39f
--- /dev/null
+++ b/extra/clamsmtp/clamsmtp.pre-upgrade
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+old=/etc/conf.d/clamsmtp
+new=/etc/conf.d/clamsmtpd
+
+if [ -f "$old" ] && [ ! -f "$new" ]; then
+ mv "$old" "$new"
+ echo " *"
+ echo " * NOTICE: $old was renamed to $new"
+ echo " *"
+fi
+
diff --git a/extra/clamsmtp/clamsmtpd.confd b/extra/clamsmtp/clamsmtpd.confd
new file mode 100644
index 0000000..8d08b68
--- /dev/null
+++ b/extra/clamsmtp/clamsmtpd.confd
@@ -0,0 +1,5 @@
+#
+# Specify daemon $OPTS here.
+#
+
+OPTS=""
diff --git a/extra/clamsmtp/clamsmtpd.initd b/extra/clamsmtp/clamsmtpd.initd
new file mode 100644
index 0000000..dbd817f
--- /dev/null
+++ b/extra/clamsmtp/clamsmtpd.initd
@@ -0,0 +1,22 @@
+#!/sbin/runscript
+
+NAME=clamsmtpd
+DAEMON=/usr/sbin/$NAME
+
+depend() {
+ need net
+}
+
+start() {
+ ebegin "Starting ${NAME}"
+ start-stop-daemon --start --quiet \
+ --exec ${DAEMON} -- ${OPTS}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping ${NAME}"
+ start-stop-daemon --stop --quiet \
+ --exec ${DAEMON}
+ eend $?
+}
--
1.6.3.3
......@@ -2,7 +2,7 @@
# Maintainer: Carlo Landmeter <clandmeter at gmail>
pkgname=clamsmtp
pkgver=1.10
pkgrel=2
pkgrel=3
pkgdesc="An SMTP Virus Filter"
url="http://memberwebs.com/stef/software/clamsmtp/"
license="as-is"
......@@ -35,4 +35,4 @@ md5sums="b068ba6e444859782bbdd88f290c1abf clamsmtp-1.10.tar.gz
e84205681f64c07af9ec5b6a3dd8bc38 clamsmtpd.confd
161baf2fb444b67d8a08fbfe4375a12c clamsmtpd.initd
32e7b12f3a1f4669d080d8cfdb537e78 clamsmtp.pre-upgrade
d9fbdc217d12cf1e85b0323f822b7e47 clamsmtp.post-upgrade"
63c7360d9a0a75433bca461fe819bc49 clamsmtp.post-upgrade"
......@@ -3,7 +3,8 @@
moved=
for i in /etc/runlevels/*/clamsmtp; do
if [ -L $i ]; then
mv ${i} ${i}d
rm $i
ln -s /etc/init.d/clamsmtpd ${i}d
moved=1
fi
done
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment