Added is_ospf field to nodes table
[public/netxms.git] / tools / sharIt
CommitLineData
b78936e5
AK
1#!/bin/sh
2
3trap '
71a419d0 4 rm -f tmp
b78936e5
AK
5' INT EXIT
6
7if [ "x"$3 = "x" ]; then
8 echo "Usage: $0 input.tar.gz scriptname output.sh"
9 exit
10fi
11
71a419d0
AK
12[ -r $1 ] || echo "Can't read $1" && exit
13
b78936e5
AK
14md5=`which md5`
15if [ $? != 0 ]; then
16 md5=`which md5sum`
17 if [ $? != 0 ]; then
18 md5=`which openssl`
19 if [ $? != 0 ]; then
20 echo "Can't calculate MD5, exiting"
21 exit
22 else
23 md5="$md5 md5"
24 fi
25 else
26 md5="$md5 | cut -d' ' -f1"
27 fi
28fi
29
30skip=`echo \`wc -l stub.sh|cut -b1-8\``
31sed "s,__SKIP__,$skip,g" < stub.sh | sed "s,__COMMAND__,$2,g" > tmp
32hash1=`tail -n+5 tmp | $md5`
33hash2=`cat $1 | $md5`
34sed "s,__HASH1__,$hash1,g" < tmp | sed "s,__HASH2__,$hash2,g" > $3
35
36cat $1 >> $3