Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

Commit

Permalink
feat: build.sh for .deb packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
ggmartins committed Feb 26, 2021
1 parent 5edef6d commit e519827
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 1 deletion.
26 changes: 26 additions & 0 deletions package/deb/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

#PROC=$(uname -a)
PROC=arm64
mv *.deb backup/
version_pyc=$(cat ../../src/netrics.py | grep "__version__" | grep -Po '(\d)+.(\d)+.(\d)+')
version_deb=$(cat nm-exp-active-netrics/DEBIAN/control| grep "Version:" | grep -Po '(\d)+.(\d)+.(\d)+')
echo "python version:" ${version_pyc}
echo "debian version:" ${version_deb}

cp -R /usr/local/src/nm-exp-active-netrics/src/ nm-exp-active-netrics/usr/local/src/nm-exp-active-netrics/
cp -R /usr/local/src/nm-exp-active-netrics/venv/ nm-exp-active-netrics/usr/local/src/nm-exp-active-netrics/

mkdir -p nm-exp-active-netrics/etc/nm-exp-active-netrics/
mkdir -p nm-exp-active-netrics/etc/init.d/
mkdir -p nm-exp-active-netrics/usr/local/src/nm-exp-active-netrics/databases
mkdir -p nm-exp-active-netrics/usr/local/src/nm-exp-active-netrics/bin/
mkdir -p nm-exp-active-netrics/usr/local/bin
mkdir -p nm-exp-active-netrics/usr/bin
cp ../../conf/nm-exp-active-netrics.toml nm-exp-active-netrics/etc/nm-exp-active-netrics/
cp /etc/init.d/nm-exp-active-netrics nm-exp-active-netrics/etc/init.d/
cp /usr/local/src/nm-exp-active-netrics/bin/netrics nm-exp-active-netrics/usr/local/src/nm-exp-active-netrics/bin/
cp /usr/bin/nm-exp-active-netrics nm-exp-active-netrics/usr/bin/
fakeroot dpkg-deb --build nm-exp-active-netrics
mv nm-exp-active-netrics.deb nm-exp-active-netrics-v${version_pyc}-${PROC}.deb

11 changes: 11 additions & 0 deletions package/deb/nm-exp-active-netrics/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Package: nm-exp-active-netrics
Version: 0.1.10
Section: custom
Priority: optional
Architecture: arm64
Essential: no
Installed-Size: 28192
Maintainer: gmartins
Homepage: https://github.com/chicago-cdac/nm-exp-active-netrics
Description: NetMicroscope Experiment - Active Measurements Netrics
Depends: net-tools, traceroute, dnsutils, nmap
6 changes: 6 additions & 0 deletions package/deb/nm-exp-active-netrics/DEBIAN/postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

chmod +x /etc/init.d/nm-exp-active-netrics
update-rc.d nm-exp-active-netrics defaults
/etc/init.d/nm-exp-active-netrics start
/usr/local/bin/netrics -C
Empty file added package/docker/.placeholder
Empty file.
2 changes: 1 addition & 1 deletion src/netrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#TODO: move this to setup.py
__name__ = "nm-exp-active-netrics"
__version__ = "0.0.1"
__version__ = "0.1.10"
__author__ = "Kyle-MacMillan, James Saxon, Guilherme Martins"

def build_parser():
Expand Down
2 changes: 2 additions & 0 deletions src/nmexpactive/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ def get_checks(self):
'ping': which("ping"),
'dig': which("dig"),
'traceroute': which("traceroute"),
'speedtest': which("speedtest"),
}

print("ip: {0}".format((r['ip'], "OK") if r['ip'] is not None else None))
Expand All @@ -178,6 +179,7 @@ def get_checks(self):
print("ping: {0}".format((r['ping'], "OK") if r['ping'] is not None else None))
print("dig: {0}".format((r['dig'], "OK") if r['dig'] is not None else None))
print("traceroute: {0}".format((r['traceroute'], "OK") if r['traceroute'] is not None else None))
print("speedtest: {0}".format((r['speedtest'], "OK") if r['speedtest'] is not None else None))
cat_log_cmd = "cat {0}".format(TMP_LOG_FILE)
loglines = Popen(cat_log_cmd, shell=True,
stdout=PIPE).stdout.readlines()
Expand Down

0 comments on commit e519827

Please sign in to comment.