-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup
More file actions
executable file
·182 lines (164 loc) · 4.31 KB
/
setup
File metadata and controls
executable file
·182 lines (164 loc) · 4.31 KB
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
#! /bin/bash
# Winbox Installer
# Coded By Arikun - IndoSec <arifarhan1602@gmail.com>
# Easy To Install WinBox in Linux
welcome() {
banner
echo "
To install
sudo bash setup install
sudo ./setup install
To remove
sudo bash setup uninstall
sduo ./setup uninstall"
exit 1
}
# Installing Wine
wineCheck() {
CHECK_LINUX=`sed "/^ID/s/ID=//gp" -n /etc/os-release`
echo -n "Wine is not installed. Installing wine and dependencies..."
case $CHECK_LINUX in
'fedora' | '"rhel"' | '"centos"' | '"IGN"' )
dnf -q -y install wine wget curl > /dev/null 2>&1 || yum -q -y install wine wget curl > /dev/null 2>&1
echo "DONE"
;;
'ubuntu' | 'debian' | '"elementary"' | 'zorin' | 'linuxmint' | 'kali' | 'neon' | 'pop' | 'Deepin')
if [ -f /etc/os-release ]
then
source /etc/os-release
fi
if [ $(echo $VERSION_ID | awk '{printf "%1.0f",$1}') -ge 18 ]
then
WINEPKG="wine-stable"
else
WINEPKG="wine"
fi
apt-get -q -y install $WINEPKG wget curl > /dev/null 2>&1
echo "DONE"
;;
'arch' )
sed -i "/\[multilib\]/,/Include/"'s/^#//' /etc/pacman.conf
pacman -Sy
pacman -Sq --noconfirm wine wget curl > /dev/null 2>&1
echo "DONE"
;;
*)
echo "FAILED"
exit 1
;;
esac
}
# Download versi terakhir dari situs resmi mikrotik.
w_download() {
if [[ -f winbox.exe ]]
then
echo "Using previously downloaded winbox.exe"
else
echo -n "Downloading Winbox..."
URL="https://mt.lv/winbox"
if [[ $(uname -a | grep -o "x86_64") ]]; then
URL=${URL}64
fi
wget -q -c -O winbox.exe $URL
echo "DONE"
fi
}
copy_file() {
echo -n "Copying files..."
if [[ !$(mkdir -p /usr/local/bin) ]]
then
if [[ !$(cp -f winbox.exe /usr/local/bin/winbox.exe) ]]
then
cp -f winbox.sh /usr/local/bin/winbox.sh
chmod a+x /usr/local/bin/winbox.sh
chmod a+x /usr/local/bin/winbox.exe
for size in $( ls -1 icons/winbox-*.png | cut -d\- -f2 | cut -d\. -f1 | paste -sd ' ') ; do
mkdir -p /usr/share/icons/hicolor/${size}/apps/
cp -f icons/winbox-${size}.png /usr/share/icons/hicolor/${size}/apps/winbox.png
done
echo "DONE"
else
echo "FAILED"
exit 1
fi
else
echo "FAILED"
exit 1
fi
}
make_launcher() {
echo -n "Creating application launcher..."
if touch /usr/share/applications/winbox.desktop
then
echo "[Desktop Entry]" > /usr/share/applications/winbox.desktop
echo "Name=Winbox" >> /usr/share/applications/winbox.desktop
echo "GenericName=Configuration tool for RouterOS" >> /usr/share/applications/winbox.desktop
echo "Comment=Configuration tool for RouterOS" >> /usr/share/applications/winbox.desktop
echo "Exec=/usr/local/bin/winbox.sh" >> /usr/share/applications/winbox.desktop
echo "Icon=winbox" >> /usr/share/applications/winbox.desktop
echo "Terminal=false" >> /usr/share/applications/winbox.desktop
echo "Type=Application" >> /usr/share/applications/winbox.desktop
echo "StartupNotify=true" >> /usr/share/applications/winbox.desktop
echo "StartupWMClass=winbox.exe" >> /usr/share/applications/winbox.desktop
echo "Categories=Network;RemoteAccess;" >> /usr/share/applications/winbox.desktop
echo "Keywords=winbox;mikrotik;" >> /usr/share/applications/winbox.desktop
xdg-desktop-menu forceupdate --mode system
echo "DONE"
else
echo "FAILED"
exit 1
fi
}
uninstall_winbox() {
echo -n "Removing launcher..."
find /usr/share/applications/ -name "winbox.desktop" -delete
echo "DONE"
echo -n "Removing icons..."
find /usr/share/icons -name "winbox.png" -delete
echo "DONE"
echo -n "Removing files..."
rm -rf /usr/local/bin/winbox.exe
rm -rf /usr/local/bin/winbox.sh
echo "DONE"
}
banner() {
echo "
_ _______ ______
| | /| / / _/ |/ / __/ Winbox Installer
| |/ |/ // // /\ \ Coded By Ariikun - IndoSec
|__/|__/___/_/|_/___/ V.0.1
"
}
if [ -z "$1" ]; then
welcome;
fi
case $1 in
'install' )
if [[ ! $(wine --version) ]]
then
banner
wineCheck
fi
if w_download
then
if copy_file
then
make_launcher
else
echo "FAILED"
exit 1
fi
else
echo "FAILED"
exit 1
fi
;;
'uninstall' )
banner
uninstall_winbox
;;
* )
banner
welcome
;;
esac