diff options
author | Kai Kang <kai.kang@windriver.com> | 2016-01-26 14:16:36 +0800 |
---|---|---|
committer | Martin Jansa <Martin.Jansa@gmail.com> | 2016-02-01 15:58:06 +0100 |
commit | 05960f3299f18f394bdf829e52b1b5c0c5ebbe5f (patch) | |
tree | 92ea81021895e93c2445c1ac9bde79e5dac30a36 | |
parent | 668468d59ce1553c60d729d6f37ddda517b2997f (diff) | |
download | meta-openembedded-05960f3299f18f394bdf829e52b1b5c0c5ebbe5f.tar.gz |
atop: add recipe
Add recipe for atop.
* remove bashisms for scripts
* fix permissions for executable files
* create volatile directory /var/volatile/log/atop
* implement status command in sysvinit script
* drop atopacctd which is excluded from most distribution such as Ubuntu
and Fedora
Signed-off-by: Kai Kang <kai.kang@windriver.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
6 files changed, 176 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/atop/atop/fix-permissions.patch b/meta-oe/recipes-support/atop/atop/fix-permissions.patch new file mode 100644 index 000000000..ee7419993 --- /dev/null +++ b/meta-oe/recipes-support/atop/atop/fix-permissions.patch | |||
@@ -0,0 +1,52 @@ | |||
1 | Update permissions of executable files that remove setuid bit and make everyone | ||
2 | could read. | ||
3 | |||
4 | Upstream-Status: Inappropriate [embedded specific] | ||
5 | |||
6 | Signed-off-by: Kai Kang <kai.kang@windriver.com> | ||
7 | --- | ||
8 | diff --git a/Makefile b/Makefile | ||
9 | index a65b9b6..21d9828 100644 | ||
10 | --- a/Makefile | ||
11 | +++ b/Makefile | ||
12 | @@ -66,7 +66,7 @@ systemdinstall: genericinstall | ||
13 | chmod 0644 $(DESTDIR)$(SYSDPATH)/atopacct.service | ||
14 | cp atop.cronsystemd $(DESTDIR)$(CRNPATH)/atop | ||
15 | cp atop-pm.sh $(DESTDIR)$(PMPATHD) | ||
16 | - chmod 0711 $(DESTDIR)$(PMPATHD)/atop-pm.sh | ||
17 | + chmod 0755 $(DESTDIR)$(PMPATHD)/atop-pm.sh | ||
18 | # | ||
19 | # only when making on target system: | ||
20 | # | ||
21 | @@ -91,11 +91,11 @@ sysvinstall: genericinstall | ||
22 | # | ||
23 | if [ -d $(DESTDIR)$(PMPATH1) ]; \ | ||
24 | then cp 45atoppm $(DESTDIR)$(PMPATH1); \ | ||
25 | - chmod 0711 $(DESTDIR)$(PMPATH1)/45atoppm; \ | ||
26 | + chmod 0755 $(DESTDIR)$(PMPATH1)/45atoppm; \ | ||
27 | fi | ||
28 | if [ -d $(DESTDIR)$(PMPATH2) ]; \ | ||
29 | then cp 45atoppm $(DESTDIR)$(PMPATH2); \ | ||
30 | - chmod 0711 $(DESTDIR)$(PMPATH2)/45atoppm; \ | ||
31 | + chmod 0755 $(DESTDIR)$(PMPATH2)/45atoppm; \ | ||
32 | fi | ||
33 | # | ||
34 | # | ||
35 | @@ -139,7 +139,7 @@ genericinstall: atop atopacctd | ||
36 | # | ||
37 | cp atop $(DESTDIR)$(BINPATH)/atop | ||
38 | chown root $(DESTDIR)$(BINPATH)/atop | ||
39 | - chmod 04711 $(DESTDIR)$(BINPATH)/atop | ||
40 | + chmod 0755 $(DESTDIR)$(BINPATH)/atop | ||
41 | ln -sf atop $(DESTDIR)$(BINPATH)/atopsar | ||
42 | cp atopacctd $(DESTDIR)$(SBINPATH)/atopacctd | ||
43 | chown root $(DESTDIR)$(SBINPATH)/atopacctd | ||
44 | @@ -147,7 +147,7 @@ genericinstall: atop atopacctd | ||
45 | cp atop $(DESTDIR)$(BINPATH)/atop-$(VERS) | ||
46 | ln -sf atop-$(VERS) $(DESTDIR)$(BINPATH)/atopsar-$(VERS) | ||
47 | cp atop.daily $(DESTDIR)$(SCRPATH) | ||
48 | - chmod 0711 $(DESTDIR)$(SCRPATH)/atop.daily | ||
49 | + chmod 0755 $(DESTDIR)$(SCRPATH)/atop.daily | ||
50 | cp man/atop.1 $(DESTDIR)$(MAN1PATH) | ||
51 | cp man/atopsar.1 $(DESTDIR)$(MAN1PATH) | ||
52 | cp man/atoprc.5 $(DESTDIR)$(MAN5PATH) | ||
diff --git a/meta-oe/recipes-support/atop/atop/remove-bashisms.patch b/meta-oe/recipes-support/atop/atop/remove-bashisms.patch new file mode 100644 index 000000000..f1fcbfed7 --- /dev/null +++ b/meta-oe/recipes-support/atop/atop/remove-bashisms.patch | |||
@@ -0,0 +1,33 @@ | |||
1 | Upstream-Status: Inappropriate [embedded specific] | ||
2 | |||
3 | Signed-off-by: Kai Kang <kai.kang@windriver.com> | ||
4 | --- | ||
5 | diff --git a/atop-pm.sh b/atop-pm.sh | ||
6 | index 7f41a86..3ff4ab5 100755 | ||
7 | --- a/atop-pm.sh | ||
8 | +++ b/atop-pm.sh | ||
9 | @@ -1,4 +1,4 @@ | ||
10 | -#!/bin/bash | ||
11 | +#!/bin/sh | ||
12 | |||
13 | case "$1" in | ||
14 | pre) /usr/bin/systemctl stop atop | ||
15 | diff --git a/atop.daily b/atop.daily | ||
16 | index 24d33bd..f29bd94 100755 | ||
17 | --- a/atop.daily | ||
18 | +++ b/atop.daily | ||
19 | @@ -1,4 +1,4 @@ | ||
20 | -#!/bin/bash | ||
21 | +#!/bin/sh | ||
22 | |||
23 | CURDAY=`date +%Y%m%d` | ||
24 | LOGPATH=/var/log/atop | ||
25 | @@ -16,7 +16,7 @@ then | ||
26 | |||
27 | while ps -p `cat $PIDFILE` > /dev/null | ||
28 | do | ||
29 | - let CNT+=1 | ||
30 | + CNT=$((CNT+1)) | ||
31 | |||
32 | if [ $CNT -gt 5 ] | ||
33 | then | ||
diff --git a/meta-oe/recipes-support/atop/atop/sysvinit-implement-status.patch b/meta-oe/recipes-support/atop/atop/sysvinit-implement-status.patch new file mode 100644 index 000000000..5994d3e08 --- /dev/null +++ b/meta-oe/recipes-support/atop/atop/sysvinit-implement-status.patch | |||
@@ -0,0 +1,27 @@ | |||
1 | Implement the sub-command status. | ||
2 | |||
3 | Upstream-Status: Pending | ||
4 | |||
5 | Signed-off-by: Kai Kang <kai.kang@windriver.com> | ||
6 | --- | ||
7 | diff --git a/atop.init b/atop.init | ||
8 | index 108bdc5..9f89fad 100755 | ||
9 | --- a/atop.init | ||
10 | +++ b/atop.init | ||
11 | @@ -18,6 +18,8 @@ | ||
12 | # Check existance of binaries | ||
13 | [ -f /usr/bin/atop ] || exit 0 | ||
14 | |||
15 | +[ -f /etc/init.d/functions ] && . /etc/init.d/functions | ||
16 | + | ||
17 | PIDFILE=/var/run/atop.pid | ||
18 | RETVAL=0 | ||
19 | |||
20 | @@ -63,6 +65,7 @@ case "$1" in | ||
21 | ;; | ||
22 | |||
23 | status) | ||
24 | + status atop | ||
25 | ;; | ||
26 | |||
27 | reload) | ||
diff --git a/meta-oe/recipes-support/atop/atop/volatiles.99_atop b/meta-oe/recipes-support/atop/atop/volatiles.99_atop new file mode 100644 index 000000000..24ea3f205 --- /dev/null +++ b/meta-oe/recipes-support/atop/atop/volatiles.99_atop | |||
@@ -0,0 +1 @@ | |||
d root root 0755 /var/volatile/log/atop none | |||
diff --git a/meta-oe/recipes-support/atop/atop/volatiles.atop.conf b/meta-oe/recipes-support/atop/atop/volatiles.atop.conf new file mode 100644 index 000000000..2f230004d --- /dev/null +++ b/meta-oe/recipes-support/atop/atop/volatiles.atop.conf | |||
@@ -0,0 +1 @@ | |||
d /var/volatile/log/atop - - - - | |||
diff --git a/meta-oe/recipes-support/atop/atop_2.2.3.bb b/meta-oe/recipes-support/atop/atop_2.2.3.bb new file mode 100644 index 000000000..21311e354 --- /dev/null +++ b/meta-oe/recipes-support/atop/atop_2.2.3.bb | |||
@@ -0,0 +1,62 @@ | |||
1 | SUMMARY = "Monitor for system resources and process activity" | ||
2 | DESCRIPTION = "Atop is an ASCII full-screen performance monitor for Linux that \ | ||
3 | is capable of reporting the activity of all processes (even if processes have \ | ||
4 | finished during the interval), daily logging of system and process activity for \ | ||
5 | long-term analysis, highlighting overloaded system resources by using colors, \ | ||
6 | etc. At regular intervals, it shows system-level activity related to the CPU, \ | ||
7 | memory, swap, disks (including LVM) and network layers, and for every process \ | ||
8 | (and thread) it shows e.g. the CPU utilization, memory growth, disk \ | ||
9 | utilization, priority, username, state, and exit code." | ||
10 | HOMEPAGE = "http://www.atoptool.nl" | ||
11 | SECTION = "console/utils" | ||
12 | |||
13 | LICENSE = "GPLv2" | ||
14 | LIC_FILES_CHKSUM = "file://COPYING;md5=393a5ca445f6965873eca0259a17f833" | ||
15 | |||
16 | DEPENDS = "ncurses zlib" | ||
17 | |||
18 | ATOP_VER = "${@'-'.join(d.getVar('PV', True).rsplit('.', 1))}" | ||
19 | |||
20 | SRC_URI = " \ | ||
21 | http://www.atoptool.nl/download/${BPN}-${ATOP_VER}.tar.gz \ | ||
22 | ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'file://volatiles.atop.conf', 'file://volatiles.99_atop', d)} \ | ||
23 | file://remove-bashisms.patch \ | ||
24 | file://fix-permissions.patch \ | ||
25 | file://sysvinit-implement-status.patch \ | ||
26 | " | ||
27 | |||
28 | SRC_URI[md5sum] = "034dc1544f2ec4e4d2c739d320dc326d" | ||
29 | SRC_URI[sha256sum] = "c785b8a2355be28b3de6b58a8ea4c4fcab8fadeaa57a99afeb03c66fac8e055d" | ||
30 | |||
31 | S = "${WORKDIR}/${BPN}-${ATOP_VER}" | ||
32 | |||
33 | do_compile() { | ||
34 | oe_runmake all | ||
35 | } | ||
36 | |||
37 | do_install() { | ||
38 | if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then | ||
39 | make DESTDIR=${D} VERS=${ATOP_VER} SYSDPATH=${systemd_system_unitdir} \ | ||
40 | PMPATHD=${systemd_unitdir}/system-sleep systemdinstall | ||
41 | install -d ${D}${sysconfdir}/tmpfiles.d | ||
42 | install -m 644 ${WORKDIR}/volatiles.atop.conf ${D}${sysconfdir}/tmpfiles.d/atop.conf | ||
43 | rm -f ${D}${systemd_system_unitdir}/atopacct.service | ||
44 | else | ||
45 | make DESTDIR=${D} VERS=${ATOP_VER} sysvinstall | ||
46 | install -d ${D}${sysconfdir}/default/volatiles | ||
47 | install -m 644 ${WORKDIR}/volatiles.99_atop ${D}${sysconfdir}/default/volatiles/99_atop | ||
48 | rm -f ${D}${sysconfdir}/init.d/atopacct | ||
49 | fi | ||
50 | |||
51 | # remove atopacct related files | ||
52 | rm -rf ${D}${sbindir} ${D}${mandir}/man8 | ||
53 | } | ||
54 | |||
55 | inherit systemd | ||
56 | |||
57 | SYSTEMD_SERVICE_${PN} = "atop.service" | ||
58 | SYSTEMD_AUTO_ENABLE = "disable" | ||
59 | |||
60 | FILES_${PN} += "${systemd_unitdir}/system-sleep" | ||
61 | |||
62 | RDEPENDS_${PN} = "procps" | ||