Friday, 28 September 2018

Building Nagios packages for pi

sudo su

nano /etc/apt/sources.list.d/debian-stretch.list

# Debian Stetch - New Zealand
deb http://ftp.nz.debian.org/debian/ stretch main contrib non-free
deb-src http://ftp.nz.debian.org/debian/ stretch main contrib non-free

nano /etc/apt/sources.list.d/eyemagnet-raspbian-stretch.list

# Eyemagnet [Stable] for Raspberry Pi
#deb https://eyemagnet.com/repo/raspbian-stretch stable/

nano /etc/apt/sources.list.d.off/raspi.list

deb http://archive.raspberrypi.org/debian/ stretch main ui
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
deb-src http://archive.raspberrypi.org/debian/ stretch main ui

nano /etc/apt/sources.list.d.off/sources.list

deb http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
deb-src http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi

nano /home/gpgkey.sh

#!/bin/bash

apt-get update 2> /tmp/keymissing; for key in $(grep "NO_PUBKEY" /tmp/keymissing |sed "s/.*NO_PUBKEY //"); do echo -e "\nProcessing key: $key"; gpg --keyserver pgpkeys.mit.edu --recv $key && gpg --export --armor $key | apt-key add -; done
apt-get update 2> /tmp/keymissing; for key in $(grep "NO_PUBKEY" /tmp/keymissing |sed "s/.*NO_PUBKEY //"); do echo -e "\nProcessing key: $key"; gpg --keyserver subkeys.pgp.net --recv $key && gpg --export --armor $key | apt-key add -; done

chmod 700 /home/gpgkey.sh

/home/gpgkey.sh

apt update && apt upgrade -y

apt install dh-systemd libssl1.0-dev libwrap0-dev

apt-get install build-essential fakeroot dpkg-dev devscripts dh-make git

mkdir sourcebuild

cd sourcebuild

apt search nrpe

apt-get source nagios-nrpe

cd nagios-nrpe-3.0.1

su pi

dpkg-buildpackage -uc -us -rfakeroot

cd ..

ls -l *.deb

-rw-r--r-- 1 root root  28804 Sep 28 10:51 nagios-nrpe-plugin_3.0.1-3+deb9u1_armhf.deb
-rw-r--r-- 1 root root  52262 Sep 28 10:51 nagios-nrpe-plugin-dbgsym_3.0.1-3+deb9u1_armhf.deb
-rw-r--r-- 1 root root 345196 Sep 28 10:51 nagios-nrpe-server_3.0.1-3+deb9u1_armhf.deb
-rw-r--r-- 1 root root  71484 Sep 28 10:51 nagios-nrpe-server-dbgsym_3.0.1-3+deb9u1_armhf.deb

rm -fr nagios-nrpe-plugin-dbgsym_3.0.1-3+deb9u1_armhf.deb nagios-nrpe-server-dbgsym_3.0.1-3+deb9u1_armhf.deb

mkdir -p servernewpack serveroldpack/DEBIAN

dpkg-deb -x nagios-nrpe-server_3.0.1-3+deb9u1_armhf.deb serveroldpack/

dpkg-deb -e nagios-nrpe-server_3.0.1-3+deb9u1_armhf.deb serveroldpack/

nano serveroldpack/DEBIAN/control

Package: eyemagnet-monitoring-nagios
Source: nagios-nrpe
Version: 1.0

nano serveroldpack/etc/nagios/nrpe.cfg

(As per your liking)

dpkg-deb -Z xz -b serveroldpack/ servernewpack/

ls -l servernamepack/

-rw-r--r-- 1 root root 346420 Sep 27 14:42 eyemagnet-monitoring-nagios_1.0_armhf.deb

mkdir -p pluginnewpack pluginoldpack/DEBIAN

dpkg-deb -x nagios-nrpe-plugin_3.0.1-3+deb9u1_armhf.deb pluginoldpack/

dpkg-deb -e nagios-nrpe-plugin_3.0.1-3+deb9u1_armhf.deb pluginoldpack/

nano pluginoldpack/DEBIAN/control

Package: eyemagnet-monitoring-nagios-plugin
Source: nagios-nrpe
Version: 1.0

nano pluginoldpack/etc/nagios/nrpe.cfg

(As per your liking)

dpkg-deb -Z xz -b pluginoldpack/ pluginnewpack/

ls -l pluginnamepack/

-rw-r--r-- 1 root root 346420 Sep 27 14:42 eyemagnet-monitoring-nagios_1.0_armhf.deb

git clone ssh://username@urlofyourwebsite/git/repo.git

Move serveroldpack and pluginoldpack contents to approprite directory into the local repo clone.

Move newly built packages file to the approprite location in the local git repo

git add.

git commit -m "my push"

git push origin master

Job Complete!

No comments:

Post a Comment