forked from naryal2580/shebang
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.sh
executable file
·84 lines (58 loc) · 1.29 KB
/
main.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/sh
# Bit of fanciness
b='\033[1m'
r='\033[0m'
banner(){
printf "$b
___ _ ____ _ _ _ ___
| __| |_ |__ / | |__| | | _ _ / __|
|__ \ ' \ |_ \ | '_ \_ _| ' \ (_ |
|___/_||_|___/_|_.__/ |_||_||_\___|
|___| $r $1\n"
}
install(){
ipath=$1
sname=$2
printf "[$b+$r] Installing to $b $ipath $r\n"
sudo cp ./shebang.sh $ipath
printf "[$b+$r] Can be shebanged via $b $sname $r\n"
sudo ln -s $ipath $sname
}
uninstall(){
ipath=$1
sname=$2
printf "[$b-$r] Uninstalling from $b $ipath $r\n"
sudo rm $ipath
printf "[$b-$r] Now, Cannot be $b #!$sname $r\n"
sudo rm $sname
}
sudo echo > /dev/null
case "$1" in
i|-i|--install|install)
banner "Installer"
install "/usr/bin/sb" "/shebang"
;;
u|-u|--uninstall|uninstall)
banner "Uninstaller"
uninstall "/usr/bin/sb" "/shebang"
;;
r|-r|--reinstall|reinstall)
banner "Re-Installer"
uninstall "/usr/bin/sb" "/shebang"
install "/usr/bin/sb" "/shebang"
;;
h|-h|--help|help|"")
banner
printf "\nInstall 5h3_b4nG:\n"
echo " ./main.sh --install"
printf "\nRe-install 5h3_b4nG:\n"
echo " ./main.sh --reinstall"
printf "\nUninstall 5h3_b4nG:\n"
echo " ./main.sh --uninstall"
;;
*)
banner
echo "5h3_b4nG: Unsupported argument $1" >& 2
exit 1
;;
esac