-
Notifications
You must be signed in to change notification settings - Fork 73
/
Copy patha2bchk.sh
executable file
·28 lines (27 loc) · 1.16 KB
/
a2bchk.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
# example of testing md5sums prior to execution
scriptmd5sum=`curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/master/apache2buddy.pl | md5sum | cut -d " " -f1`
originmd5sum=`curl -s https://raw.githubusercontent.com/richardforth/apache2buddy/master/md5sums.txt | cut -d " " -f1`
echo $scriptmd5sum
echo $originmd5sum
if [ $scriptmd5sum == $originmd5sum ]
then
scriptsha256sum=`curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/master/apache2buddy.pl | sha256sum | cut -d " " -f1`
originsha256sum=`curl -s https://raw.githubusercontent.com/richardforth/apache2buddy/master/sha256sums.txt | cut -d " " -f1`
echo $scriptsha256sum
echo $originsha256sum
if [ $scriptsha256sum == $originsha256sum ]
then
# execute the code, its safe - we can assume
curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/master/apache2buddy.pl | perl
if [[ $? != 0 ]]; then
exit 1
fi
else
echo "Error: SHA256SUM mismatch, execution aborted."
exit 1
fi
else
echo "Error: MD5SUM mismatch, execution aborted."
exit 1
fi