forked from liuggio/deBergmannizer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeBergmannize.sh
executable file
·56 lines (42 loc) · 986 Bytes
/
deBergmannize.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
BPATH=/usr/share/php/PHPUnit/Runner/Version.php
EXPECTED_ARGS=1
E_BADARGS=65
E_FILENOTFOUND=66
STRREPLACE="by Sebastian Bergmann."
STRHELP=$(cat <<EOF
Usage with one argument:
`basename $0` REPLACEWITH
EOF
)
STRNOTFOUND=$(cat <<EOF
File not $BPATH found
The Version.php file is not found.
try to run this:
find / -type f -wholename "*PHPUnit/Runner/Version.php*"
then modify that filename
and please please please do a pull request with your file path :)
EOF
)
if [[ $EUID -ne 0 ]]; then
echo "To debergmannize yourself you have to be root";
echo "this file $FILE need the root previlege, Aborting"
echo "YOU ARE STILL BERGMANNIZED."
exit 1;
fi
if [ $# -ne $EXPECTED_ARGS ]
then
echo $STRHELP
exit $E_BADARGS
fi
echo "debergmannizer started"
if [ ! -f $BPATH ];
then
echo $STRNOTFOUND
exit $E_FILENOTFOUND
else
echo "File Found ..."
echo "de-Bergmannizing yourself"
sed -i "s/$STRREPLACE/$1/g" $BPATH
echo "done"
fi