-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlsi.sh
executable file
·164 lines (143 loc) · 3.45 KB
/
lsi.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#!/bin/sh
#
# install_all.sh
# A script that automates the process of installing useful software.
# > commands:
# -h, --help
# -v, --verbose verbose output
# -l, --list [package] list unique installation functions
# -i, --install [package] invokes a specific installation function
# > packages:
# all
# programming_tools
# security_tools
# media_tools
# vivaldi_browser
# office_tools
# commands
C_HELP="-h --help"
C_VERBOSE="-v --verbose"
C_LIST="-l --list"
C_INSTALL="-i --install"
# flags
F_VERBOSE=0
# functions / packages
P_ALL="all"
P_PROG="programming_tools"
P_SECURITY="security_tools"
P_MEDIA="media_tools"
P_VIVALDI="vivaldi_browser"
P_OFFICE="office_tools"
print_help(){
this_script="$(readlink -f $0)" # find the location of this script
sed -n 7,10p "$this_script" # print lines 7-10
}
print_list(){
this_script="$(readlink -f $0)"
sed -n 12,18p "$this_script"
}
inst_all(){
inst_programming_tools
inst_security_tools
inst_media_tools
inst_vivaldi_browser
inst_office_tools
}
# install programming tools
# gcc, git, nano-extensions
inst_programming_tools(){
sudo apt-get install {gcc,git}
# addons for nano
wget https://raw.githubusercontent.com/scopatz/nanorc/master/install.sh -O- | sh
}
# install security tools
# aircrack-ng
inst_security_tools(){
sudo apt-get install {aircrack-ng}
}
# install media tools:
# python-pip, myplayer, mencoder, ffmpeg, youtube-dl retspan
inst_media_tools(){
sudo apt-get install {python-pip,myplayer,mencoder,ffmpeg}
pip install --upgrade youtube-dl
git clone https://github.com/unawarecitizen/retspan
chmod +x "retspan/install.sh"
exec "retspan/install.sh"
sudo rm -r retspan # clean up the directory
}
# install vivaldi
# vivaldi, vivaldi-netflix-compatibility
inst_vivaldi(){
wget https://downloads.vivaldi.com/stable/vivaldi-stable_*_amd64.deb
sudo apt -f install vivaldi-stable_*_amd64.deb
wget https://downloads.vivaldi.com/snapshot/vivaldi-snapshot_*_amd64.deb
sudo dpkg -i vivaldi-snapshot_*_amd64.deb
rm vivaldi-*.deb # clean up the directory
}
# install office tools
# libreoffice
inst_office_tools(){
sudo apt-get install libreoffice
}
# main function
echo "[$0]: args count = $#"
if [ $# -eq 0 ] ; then
echo "[$0]: no arguments passed. Try -h, --help"
exit
fi
# loop through command line args
count=1;
for var in "$@" ; do
echo {"$C_HELP","$C_VERBOSE","$C_LIST","$C_INSTALL"} > "temp.txt"
arg="$(grep $var temp.txt)"
rm "temp.txt"
echo "[$0]: grep result = $arg"
# -h, --help
if [ $var -eq $C_HELP ] ; then
print_help
exit
# -v, --verbose
elif [ $var -eq $C_VERBOSE ] ; then
$F_VERBOSE=1
# -l, --list
elif [ $var -eq $C_LIST ] ; then
print_list
exit
# -i, -install
elif [ $var -eq $C_INSTALL && $count < $# ] ; then
package=$(var + 1)
# all
if [ $package -eq $P_ALL ] ; then
inst_all
exit
# programming_tools
elif [ $package -eq $P_PROG ] ; then
inst_programming_tools
var=$(( var + 1 ))
# security_tools
elif [ $package -eq $P_SECURITY ] ; then
inst_security_tools
var=$(( var + 1 ))
# media_tools
elif [ $package -eq $P_MEDIA ] ; then
inst_media_tools
var=$(( var + 1 ))
# vivaldi_browser
elif [ $package -eq $P_VIVALDI ] ; then
inst_vivaldi_browser
var=$(( var + 1 ))
# office_tools
elif [ $package -eq $P_OFFICE ] ; then
inst_office_tools
var=$(( var + 1 ))
# default
else
echo "[$#]: unknown package. Try -l,--list."
fi
# default
else
echo "[$#]: unkown command. Try -h,--help."
fi
count=$(( count + 1 ))
done
exit