Commit 30020562 authored by Olav Kvittem's avatar Olav Kvittem
Browse files

major rewrite mp-rude to microdep - run under a user, new preinst file-to...

major rewrite mp-rude to microdep - run under a user, new preinst file-to handle new user, new make-rude-peers.sh to make central config, file, update-config to make local config
parent 61801c17
Package: microdep
Priority: extra
Section: uninett
Architecture: all
Depends: rude, crude, traceroute, perl-base, cron, libstatistics-linefit-perl, libjson-xs-perl, libdatetime-perl
Maintainer: kolbjorn.barmen@uninett.no
Maintainer:olav.kvittem@uninett.no
Version: {VERSION}
Provides: microdep
Replaces: microdep
Description: Software for measuring network using rude/crude and traceroute.
#! /bin/sh
echo microdep 'ALL=(ALL) NOPASSWD: /usr/local/sbin/get-icmp.sh' > /etc/sudoers.d/microdep.sudo
find /home/microdep -user root -exec chown microdep.microdep \{} \;
sudo microdep /home/microdep/microdep/bin/update-config
crontab -u /home/microdep/microdep/etc/crontab
#! /bin/sh
if ! test -d /home/microdep ; then
useradd -m -G ssh microdep
fi
FROM debian:buster
WORKDIR /root/
COPY microdep microdep
COPY build.sh build.sh
RUN ./build.sh
CMD tar c *.deb
File mode changed from 100644 to 100755
......@@ -2,7 +2,11 @@
source $HOME/microdep/etc/start.cfg
sudo /usr/local/sbin/get-icmp.sh > ${logpath}/icmp-%F-%T.pcap 2> ${logpath}/icmp.log
dato=`date +%F-%T`
sudo /usr/local/sbin/get-icmp.sh > ${logpath}/icmp-$dato.pcap 2> ${logpath}/icmp.log
#!/bin/sh
# pick up changed config either in /etc or on web address
. $HOME/microdep/microdep/etc/start.cfg
if test -s /etc/mp-rude/rude-list.conf ; then # distributed by puppet
if test /etc/mp-rude/rude-list.conf -nt $root/etc/rude.conf ; then
$root/bin/rude-config-maker -target $node $root/etc/rude-list.conf
fi
else # get config from server
tmp=/tmp/rude-list.conf$$
curl -z $root/etc/rude-list.conf -o $tmp http://drift.uninett.no/microdep/rude-list.conf
if test -s $tmp ; then
cp $tmp $root/etc/rude-list.conf
$root/bin/rude-config-maker -target $node $root/etc/rude-list.conf
fi
if test -f $tmp
rm $tmp
fi
fi
#! /bin/bash
set -e
rm -f *.deb
apt-get update
apt-get -y upgrade
package="microdep"
version="0.1"
target="${package}_${version}_all"
rm -rf "$target"
mkdir -p "$target"/home/microdep/microdep
cp -dR --preserve=mode bin etc "${target}"/home/microdep/microdep/
cp -dR --preserve=mode DEBIAN "${target}"/
sed -i -e "s/{VERSION}/${version}/" "${target}/DEBIAN/control"
chmod o-w -R "${target}"
dpkg -b "$target"
ls -l *.deb
......@@ -6,4 +6,4 @@ CRON_TZ='Europe/Oslo'
# m h dom mon dow command
*/1 * * * * $HOME/microdep/bin/autostart.sh
55 23 * * * $HOME/microdep/bin/update-config
#!/bin/bash
# generate list of peers where each mp peers with the two closest regional servers
mplist=$1
reglist=$2
regnames=`cat $reglist`
function path_lth {
echo `traceroute -n -q 3 $1| wc -l || echo 99`
}
for mp in `cat $mplist`; do
reg1l=99
reg2l=99
for reg in $regnames ; do
if test $reg != $mp ; then
lth=$( path_lth $reg )
if test $lth -lt $reg1l; then
reg1l=$lth
reg1=$reg
elif test $lth -lt $reg2l; then
reg2l=$lth
reg2=$reg
fi
fi
done
echo $mp $reg1 $reg2
done
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment