aboutsummaryrefslogtreecommitdiffstats
path: root/main/atop
diff options
context:
space:
mode:
Diffstat (limited to 'main/atop')
-rw-r--r--main/atop/APKBUILD45
-rw-r--r--main/atop/atop-bb-compat.patch30
-rw-r--r--main/atop/atop.initd21
3 files changed, 96 insertions, 0 deletions
diff --git a/main/atop/APKBUILD b/main/atop/APKBUILD
new file mode 100644
index 0000000000..ecbfb102ba
--- /dev/null
+++ b/main/atop/APKBUILD
@@ -0,0 +1,45 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=atop
+pkgver=1.24
+pkgrel=1
+pkgdesc="Resource-specific view of processes"
+url="http://www.atcomputing.nl/Tools/atop"
+license="GPL-2"
+depends=
+makedepends="zlib-dev ncurses-dev"
+subpackages="$pkgname-doc"
+source="http://www.atoptool.nl/packages/atop-$pkgver.tar.gz
+ atop-bb-compat.patch
+ atop.initd"
+
+_builddir="$srcdir"/$pkgname-$pkgver
+prepare() {
+ cd "$_builddir"
+ patch -p1 -i "$srcdir"/atop-bb-compat.patch || return 1
+ sed -i -e '/^CFLAGS/s: = -O : += :' \
+ -e '/^LDFLAGS/s: = : += :' Makefile
+ cp "$srcdir"/atop.initd atop.init
+ chmod a+rx atop.init
+}
+
+build() {
+ cd "$_builddir"
+ make
+}
+
+package() {
+ cd "$_builddir"
+ mkdir -p "$pkgdir"/var/log/atop "$pkgdir"/var/run
+ make DESTDIR="$pkgdir" \
+ INIPATH=/etc/init.d \
+ SCRPATH=/etc/periodic/daily \
+ install
+ rm -f "$pkgdir"/etc/cron.d
+ mv "$pkgdir"/etc/periodic/daily/atop.daily \
+ "$pkgdir"/etc/periodic/daily/atop
+
+}
+
+md5sums="46522f7da28460e810e193ab46907af9 atop-1.24.tar.gz
+a4119e314cdc6d50bf027add32e1902b atop-bb-compat.patch
+06aba14ddeadbb1d0c3594536785213b atop.initd"
diff --git a/main/atop/atop-bb-compat.patch b/main/atop/atop-bb-compat.patch
new file mode 100644
index 0000000000..ec46d24266
--- /dev/null
+++ b/main/atop/atop-bb-compat.patch
@@ -0,0 +1,30 @@
+diff --git a/atop.daily b/atop.daily
+index e0d994f..8c0cfc0 100755
+--- a/atop.daily
++++ b/atop.daily
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/bin/sh
+ CURDAY=`date +%Y%m%d`
+ LOGPATH=/var/log/atop
+ BINPATH=/usr/bin
+@@ -7,11 +7,15 @@ INTERVAL=600 # interval 10 minutes
+
+ # verify if atop still runs for daily logging
+ #
+-if [ -e $PIDFILE ] && ps -p `cat $PIDFILE` | grep 'atop$' > /dev/null
+-then
+- kill -USR1 `cat $PIDFILE` # take final sample
++pid=
++if [ -e $PIDFILE ]; then
++ pid=$(cat $PIDFILE)
++fi
++
++if [ -n "$pid" ] && [ -d /proc/$pid ]; then
++ kill -USR1 $pid # take final sample
+ sleep 3
+- kill -TERM `cat $PIDFILE`
++ kill -TERM $pid
+ rm $PIDFILE
+ sleep 1
+ fi
diff --git a/main/atop/atop.initd b/main/atop/atop.initd
new file mode 100644
index 0000000000..6d471c2721
--- /dev/null
+++ b/main/atop/atop.initd
@@ -0,0 +1,21 @@
+#!/sbin/runscript
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-process/atop/files/atop.rc,v 1.1 2005/06/14 23:01:10 vapier Exp $
+
+_daily=/etc/periodic/daily/atop
+start(){
+ ebegin "Starting atop"
+ if [ -f "$_daily" ] ; then
+ start-stop-daemon --start --quiet --exec "$_daily"
+ eend $?
+ else
+ eend 1 "/etc/cron.d/atop doesnt exist!"
+ fi
+}
+
+stop(){
+ ebegin "Stopping atop"
+ start-stop-daemon --stop --pidfile /var/run/atop.pid
+ eend $?
+}