Added is_ospf field to nodes table
[public/netxms.git] / tools / sharIt
1 #!/bin/sh
2
3 trap '
4 rm -f tmp
5 ' INT EXIT
6
7 if [ "x"$3 = "x" ]; then
8 echo "Usage: $0 input.tar.gz scriptname output.sh"
9 exit
10 fi
11
12 [ -r $1 ] || echo "Can't read $1" && exit
13
14 md5=`which md5`
15 if [ $? != 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
28 fi
29
30 skip=`echo \`wc -l stub.sh|cut -b1-8\``
31 sed "s,__SKIP__,$skip,g" < stub.sh | sed "s,__COMMAND__,$2,g" > tmp
32 hash1=`tail -n+5 tmp | $md5`
33 hash2=`cat $1 | $md5`
34 sed "s,__HASH1__,$hash1,g" < tmp | sed "s,__HASH2__,$hash2,g" > $3
35
36 cat $1 >> $3