mirror of
git://git.openembedded.org/meta-openembedded
synced 2026-04-02 02:49:12 +00:00
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>
This commit is contained in:
parent
668468d59c
commit
05960f3299
52
meta-oe/recipes-support/atop/atop/fix-permissions.patch
Normal file
52
meta-oe/recipes-support/atop/atop/fix-permissions.patch
Normal file
@ -0,0 +1,52 @@
|
||||
Update permissions of executable files that remove setuid bit and make everyone
|
||||
could read.
|
||||
|
||||
Upstream-Status: Inappropriate [embedded specific]
|
||||
|
||||
Signed-off-by: Kai Kang <kai.kang@windriver.com>
|
||||
---
|
||||
diff --git a/Makefile b/Makefile
|
||||
index a65b9b6..21d9828 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -66,7 +66,7 @@ systemdinstall: genericinstall
|
||||
chmod 0644 $(DESTDIR)$(SYSDPATH)/atopacct.service
|
||||
cp atop.cronsystemd $(DESTDIR)$(CRNPATH)/atop
|
||||
cp atop-pm.sh $(DESTDIR)$(PMPATHD)
|
||||
- chmod 0711 $(DESTDIR)$(PMPATHD)/atop-pm.sh
|
||||
+ chmod 0755 $(DESTDIR)$(PMPATHD)/atop-pm.sh
|
||||
#
|
||||
# only when making on target system:
|
||||
#
|
||||
@@ -91,11 +91,11 @@ sysvinstall: genericinstall
|
||||
#
|
||||
if [ -d $(DESTDIR)$(PMPATH1) ]; \
|
||||
then cp 45atoppm $(DESTDIR)$(PMPATH1); \
|
||||
- chmod 0711 $(DESTDIR)$(PMPATH1)/45atoppm; \
|
||||
+ chmod 0755 $(DESTDIR)$(PMPATH1)/45atoppm; \
|
||||
fi
|
||||
if [ -d $(DESTDIR)$(PMPATH2) ]; \
|
||||
then cp 45atoppm $(DESTDIR)$(PMPATH2); \
|
||||
- chmod 0711 $(DESTDIR)$(PMPATH2)/45atoppm; \
|
||||
+ chmod 0755 $(DESTDIR)$(PMPATH2)/45atoppm; \
|
||||
fi
|
||||
#
|
||||
#
|
||||
@@ -139,7 +139,7 @@ genericinstall: atop atopacctd
|
||||
#
|
||||
cp atop $(DESTDIR)$(BINPATH)/atop
|
||||
chown root $(DESTDIR)$(BINPATH)/atop
|
||||
- chmod 04711 $(DESTDIR)$(BINPATH)/atop
|
||||
+ chmod 0755 $(DESTDIR)$(BINPATH)/atop
|
||||
ln -sf atop $(DESTDIR)$(BINPATH)/atopsar
|
||||
cp atopacctd $(DESTDIR)$(SBINPATH)/atopacctd
|
||||
chown root $(DESTDIR)$(SBINPATH)/atopacctd
|
||||
@@ -147,7 +147,7 @@ genericinstall: atop atopacctd
|
||||
cp atop $(DESTDIR)$(BINPATH)/atop-$(VERS)
|
||||
ln -sf atop-$(VERS) $(DESTDIR)$(BINPATH)/atopsar-$(VERS)
|
||||
cp atop.daily $(DESTDIR)$(SCRPATH)
|
||||
- chmod 0711 $(DESTDIR)$(SCRPATH)/atop.daily
|
||||
+ chmod 0755 $(DESTDIR)$(SCRPATH)/atop.daily
|
||||
cp man/atop.1 $(DESTDIR)$(MAN1PATH)
|
||||
cp man/atopsar.1 $(DESTDIR)$(MAN1PATH)
|
||||
cp man/atoprc.5 $(DESTDIR)$(MAN5PATH)
|
||||
33
meta-oe/recipes-support/atop/atop/remove-bashisms.patch
Normal file
33
meta-oe/recipes-support/atop/atop/remove-bashisms.patch
Normal file
@ -0,0 +1,33 @@
|
||||
Upstream-Status: Inappropriate [embedded specific]
|
||||
|
||||
Signed-off-by: Kai Kang <kai.kang@windriver.com>
|
||||
---
|
||||
diff --git a/atop-pm.sh b/atop-pm.sh
|
||||
index 7f41a86..3ff4ab5 100755
|
||||
--- a/atop-pm.sh
|
||||
+++ b/atop-pm.sh
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/bin/bash
|
||||
+#!/bin/sh
|
||||
|
||||
case "$1" in
|
||||
pre) /usr/bin/systemctl stop atop
|
||||
diff --git a/atop.daily b/atop.daily
|
||||
index 24d33bd..f29bd94 100755
|
||||
--- a/atop.daily
|
||||
+++ b/atop.daily
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/bin/bash
|
||||
+#!/bin/sh
|
||||
|
||||
CURDAY=`date +%Y%m%d`
|
||||
LOGPATH=/var/log/atop
|
||||
@@ -16,7 +16,7 @@ then
|
||||
|
||||
while ps -p `cat $PIDFILE` > /dev/null
|
||||
do
|
||||
- let CNT+=1
|
||||
+ CNT=$((CNT+1))
|
||||
|
||||
if [ $CNT -gt 5 ]
|
||||
then
|
||||
@ -0,0 +1,27 @@
|
||||
Implement the sub-command status.
|
||||
|
||||
Upstream-Status: Pending
|
||||
|
||||
Signed-off-by: Kai Kang <kai.kang@windriver.com>
|
||||
---
|
||||
diff --git a/atop.init b/atop.init
|
||||
index 108bdc5..9f89fad 100755
|
||||
--- a/atop.init
|
||||
+++ b/atop.init
|
||||
@@ -18,6 +18,8 @@
|
||||
# Check existance of binaries
|
||||
[ -f /usr/bin/atop ] || exit 0
|
||||
|
||||
+[ -f /etc/init.d/functions ] && . /etc/init.d/functions
|
||||
+
|
||||
PIDFILE=/var/run/atop.pid
|
||||
RETVAL=0
|
||||
|
||||
@@ -63,6 +65,7 @@ case "$1" in
|
||||
;;
|
||||
|
||||
status)
|
||||
+ status atop
|
||||
;;
|
||||
|
||||
reload)
|
||||
1
meta-oe/recipes-support/atop/atop/volatiles.99_atop
Normal file
1
meta-oe/recipes-support/atop/atop/volatiles.99_atop
Normal file
@ -0,0 +1 @@
|
||||
d root root 0755 /var/volatile/log/atop none
|
||||
1
meta-oe/recipes-support/atop/atop/volatiles.atop.conf
Normal file
1
meta-oe/recipes-support/atop/atop/volatiles.atop.conf
Normal file
@ -0,0 +1 @@
|
||||
d /var/volatile/log/atop - - - -
|
||||
62
meta-oe/recipes-support/atop/atop_2.2.3.bb
Normal file
62
meta-oe/recipes-support/atop/atop_2.2.3.bb
Normal file
@ -0,0 +1,62 @@
|
||||
SUMMARY = "Monitor for system resources and process activity"
|
||||
DESCRIPTION = "Atop is an ASCII full-screen performance monitor for Linux that \
|
||||
is capable of reporting the activity of all processes (even if processes have \
|
||||
finished during the interval), daily logging of system and process activity for \
|
||||
long-term analysis, highlighting overloaded system resources by using colors, \
|
||||
etc. At regular intervals, it shows system-level activity related to the CPU, \
|
||||
memory, swap, disks (including LVM) and network layers, and for every process \
|
||||
(and thread) it shows e.g. the CPU utilization, memory growth, disk \
|
||||
utilization, priority, username, state, and exit code."
|
||||
HOMEPAGE = "http://www.atoptool.nl"
|
||||
SECTION = "console/utils"
|
||||
|
||||
LICENSE = "GPLv2"
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=393a5ca445f6965873eca0259a17f833"
|
||||
|
||||
DEPENDS = "ncurses zlib"
|
||||
|
||||
ATOP_VER = "${@'-'.join(d.getVar('PV', True).rsplit('.', 1))}"
|
||||
|
||||
SRC_URI = " \
|
||||
http://www.atoptool.nl/download/${BPN}-${ATOP_VER}.tar.gz \
|
||||
${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'file://volatiles.atop.conf', 'file://volatiles.99_atop', d)} \
|
||||
file://remove-bashisms.patch \
|
||||
file://fix-permissions.patch \
|
||||
file://sysvinit-implement-status.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "034dc1544f2ec4e4d2c739d320dc326d"
|
||||
SRC_URI[sha256sum] = "c785b8a2355be28b3de6b58a8ea4c4fcab8fadeaa57a99afeb03c66fac8e055d"
|
||||
|
||||
S = "${WORKDIR}/${BPN}-${ATOP_VER}"
|
||||
|
||||
do_compile() {
|
||||
oe_runmake all
|
||||
}
|
||||
|
||||
do_install() {
|
||||
if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
|
||||
make DESTDIR=${D} VERS=${ATOP_VER} SYSDPATH=${systemd_system_unitdir} \
|
||||
PMPATHD=${systemd_unitdir}/system-sleep systemdinstall
|
||||
install -d ${D}${sysconfdir}/tmpfiles.d
|
||||
install -m 644 ${WORKDIR}/volatiles.atop.conf ${D}${sysconfdir}/tmpfiles.d/atop.conf
|
||||
rm -f ${D}${systemd_system_unitdir}/atopacct.service
|
||||
else
|
||||
make DESTDIR=${D} VERS=${ATOP_VER} sysvinstall
|
||||
install -d ${D}${sysconfdir}/default/volatiles
|
||||
install -m 644 ${WORKDIR}/volatiles.99_atop ${D}${sysconfdir}/default/volatiles/99_atop
|
||||
rm -f ${D}${sysconfdir}/init.d/atopacct
|
||||
fi
|
||||
|
||||
# remove atopacct related files
|
||||
rm -rf ${D}${sbindir} ${D}${mandir}/man8
|
||||
}
|
||||
|
||||
inherit systemd
|
||||
|
||||
SYSTEMD_SERVICE_${PN} = "atop.service"
|
||||
SYSTEMD_AUTO_ENABLE = "disable"
|
||||
|
||||
FILES_${PN} += "${systemd_unitdir}/system-sleep"
|
||||
|
||||
RDEPENDS_${PN} = "procps"
|
||||
Loading…
x
Reference in New Issue
Block a user