-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathchroot-env
executable file
·331 lines (288 loc) · 8.81 KB
/
chroot-env
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
#!/bin/bash
mount -t proc none /proc
mount -t sysfs none /sys
mount -t devpts none /dev/pts
echo "Inside the belly of the beast..."
# "Avoid problems of languages in GPG keys"
export HOME=/root
export LC_ALL=C
dbus-uuidgen > /var/lib/dbus/machine-id
dpkg-divert --local --rename --add /sbin/initctl
ln -s /bin/true /sbin/initctl
# "Avoid problems with internet"
# STAT=`grep '#dns=dnsmasq' /etc/NetworkManager/NetworkManager.conf`
# if [ "$STAT" == "" ]; then
# sed -i 's/dns=dnsmasq/#dns=dnsmasq/g' /etc/NetworkManager/NetworkManager.conf
# sudo chmod 644 /etc/NetworkManager/NetworkManager.conf
# service network-manager restart
# sleep 5
# fi
# Customizations
HASPROXY=$(cat /etc/apt/apt.conf | grep "Acquire::http::proxy" | wc -l)
if [ "$HASPROXY" == "1" ]; then
HTTPPROXY=$(cat /etc/apt/apt.conf | grep "Acquire::http::proxy" | awk '{split($0,a,"\""); print a[2]}')
HTTPSROXY=$(cat /etc/apt/apt.conf | grep "Acquire::https::proxy" | awk '{split($0,a,"\""); print a[2]}')
export http_proxy=${HTTPROXY%?};
export https_proxy=${HTTPSROXY%?};
fi
# Timezone
ln -sf /usr/share/zoneinfo/America/Fortaleza /etc/localtime
# Set Language
locale-gen pt_BR.UTF-8
update-locale LANG=\"pt_BR.UTF-8\" LANGUAGE=\"pt_BR:\"
# Remove apps
aptRemove () {
apt remove --purge $1 -y 2>&1 >/tmp/aptlog
}
aptRemove "mtpaint*"
aptRemove "abiword"
aptRemove "gnumeric"
aptRemove "pidgin*"
aptRemove "sylpheed*"
aptRemove "alsamixergui*"
aptRemove "gnome-mpv*"
aptRemove "xfburn"
aptRemove "rdesktop"
aptRemove "usb-creator*"
aptRemove "libabiword*"
aptRemove "libmpv*"
aptRemove "default-jre*"
aptRemove "openjdk-11-jre*"
aptRemove "noblenote"
aptRemove "trojita"
aptRemove "quassel"
aptRemove "2048-qt"
aptRemove "libreoffice-qt5"
aptRemove "qpdfview"
aptRemove "ark"
# aptRemove "software-properties-qt"
# rm -rf /usr/share/applications/info.desktop
# Adding Repositories
dpkg --add-architecture i386
# Get Code Name
codeName=$(cat /etc/lsb-release | grep DISTRIB_CODENAME | cut -d'=' -f2)
# WinuniX focal repository
wget -qO - "https://winunix.github.io/debian/public.key" | sudo apt-key add -
sudo echo "deb https://winunix.github.io/debian $codeName main" > /etc/apt/sources.list.d/winunix-$codeName.list
# AnyDesk all repository
wget -qO - "https://keys.anydesk.com/repos/DEB-GPG-KEY" | sudo apt-key add -
sudo echo "deb http://deb.anydesk.com/ all main" > /etc/apt/sources.list.d/anydesk-stable.list
# Java ppa repository 'sudo add-apt-repository ppa:linuxuprising/java -y'
wget -qO - "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x1cc3d16e460a94ee17fe581cea8cacc073c3db2a" | sudo apt-key add -
sudo echo "deb http://ppa.launchpad.net/linuxuprising/java/ubuntu $codeName main" > /etc/apt/sources.list.d/linuxuprising-ubuntu-java-$codeName.list
# Libreoffice 6.4 repository
if [ "$codeName" == "bionic" ]; then
sudo add-apt-repository ppa:libreoffice/libreoffice-6-4
fi
## upgrade of system
apt update >/tmp/aptlog
#apt-mark hold grub-*
apt upgrade -y >/tmp/aptlog
#apt-mark unhold grub-*
# Install apps
aptInstall () {
sudo DEBIAN_FRONTEND=noninteractive apt install $1 -y 2>&1 >/tmp/aptlog
}
# Reconfigure apps
dpkgReconf () {
sudo DEBIAN_FRONTEND=noninteractive dpkg-reconfigure $1 2>&1 >/tmp/aptlog
}
# TTF MS Core Fonts
echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections
aptInstall "ttf-mscorefonts-installer"
echo ttf-mscorefonts-installer msttcorefonts/dldir select "/tmp/mscoref" | debconf-set-selections
dpkgReconf "ttf-mscorefonts-installer"
# EFI Deps
aptInstall "grub-efi-amd64-signed"
# aptInstall "grub-efi"
# Language
aptInstall "language-pack-pt"
aptInstall "language-pack-pt-base"
aptInstall "language-pack-gnome-pt"
aptInstall "language-pack-gnome-pt-base"
aptInstall "language-pack-kde-pt"
aptInstall "hyphen-pt-pt"
aptInstall "hyphen-pt-br"
aptInstall "myspell-pt-pt"
aptInstall "myspell-pt-br"
aptInstall "myspell-pt"
aptInstall "hunspell-pt-pt"
aptInstall "hunspell-pt-br"
aptInstall "mythes-pt-pt"
aptInstall "wportuguese"
aptInstall "wbrazilian"
dpkgReconf "locales"
# Appearance Common
aptInstall "fonts-dejavu"
aptInstall "lubuntu-win10-theme"
aptInstall "lubuntu-win10-icon-theme"
aptInstall "lubuntu-win8-cursor-theme"
# Appearance LXQt
aptInstall "qt5-style-plugin-gtk2"
aptInstall "lubuntu-win10-qt-theme"
aptInstall "sddm-theme-win10"
# Java
echo debconf shared/accepted-oracle-license-v1-2 select true | sudo debconf-set-selections
aptInstall "oracle-java16-installer"
# utils
aptInstall "winunix-software-center"
aptInstall "proxy-linux"
aptInstall "lxreset"
aptInstall "gstreamer1.0-plugins-ugly"
aptInstall "gstreamer1.0-plugins-bad"
aptInstall "gstreamer1.0-libav"
aptInstall "rar"
aptInstall "unrar"
aptInstall "p7zip"
aptInstall "p7zip-full"
aptInstall "zenity"
aptInstall "traceroute"
aptInstall "net-tools"
aptInstall "cups"
aptInstall "openssh-server"
aptInstall "libnss3-tools"
aptInstall "apt-transport-https"
aptInstall "libpam-mount"
aptInstall "libpam-gnome-keyring"
aptInstall "smbclient"
aptInstall "samba"
aptInstall "libdvd-pkg"
dpkgReconf "libdvd-pkg"
aptInstall "python3-smbc"
aptInstall "mesa-utils"
aptInstall "xdotool"
aptInstall "xdg-utils"
aptInstall "curl"
aptInstall "graphicsmagick"
aptInstall "blueman"
aptInstall "software-properties-gtk"
# Drivers
aptInstall "bcmwl-kernel-source"
# aptInstall "xsettingsd" Just on 20.04
# aptInstall "xserver-xorg-input-synaptics" Just on 20.04
# Accessories
aptInstall "xpad"
aptInstall "gnome-disk-utility"
aptInstall "cheese"
aptInstall "hardinfo"
aptInstall "gucharmap"
# Apps
aptInstall "file-roller"
aptInstall "firefox"
aptInstall "firefox-locale-pt"
aptInstall "vlc"
aptInstall "gimp"
aptInstall "inkscape"
aptInstall "evince"
aptInstall "kdenlive"
aptInstall "imagination"
aptInstall "libreoffice"
aptInstall "libreoffice-sdbc-hsqldb"
aptInstall "libreoffice-l10n-pt"
aptInstall "libreoffice-l10n-pt-br"
aptInstall "libreoffice-help-pt-br"
aptInstall "openoffice.org-hyphenation"
aptInstall "eog"
aptInstall "flashplugin-installer"
aptInstall "rdesktop"
aptInstall "remmina"
aptInstall "remmina-plugin-rdp"
aptInstall "lsb"
aptInstall "yad"
aptInstall "python-gi"
aptInstall "pdfshuffler"
aptInstall "audacious"
aptInstall "anydesk"
aptInstall "cifs-utils"
aptInstall "nodejs"
aptInstall "npm"
aptInstall "system-config-samba-wx"
aptInstall "fonts-3rd-party"
aptInstall "youtube-dl-full"
# Deps
aptInstall "extlinux"
aptInstall "libaudio2"
aptInstall "syslinux"
aptInstall "libu2f-udev"
aptInstall "libqt4-declarative"
# Wine
aptInstall "wine64"
aptInstall "wine32"
aptInstall "wine-stable"
if [ "$codeName" == "bionic" ]; then
aptInstall "gnome-screenshot"
aptInstall "winunix-randr"
fi
if [ "$codeName" == "focal" ]; then
aptInstall "winunix-language-pt-br"
fi
# aptInstall "/tmp/libpng12-0.deb"
# aptInstall "/tmp/rdesktop.deb" # usando xenial pois atual tem bug no winServer2003
# aptInstall "libgtk2.0-0:i386"
# aptInstall "libxft2:i386"
# aptInstall "libxt6:i386"
# Adobe Reader 8
# aptInstall "/tmp/adobeReader.deb"
# aptInstall "gtk2-engines-murrine:i386"
# aptInstall "gtk2-engines-pixbuf:i386"
# Remove default profile
rm -rf /usr/wx-center/profiles/Administrativo.csv
rm -rf /usr/wx-center/profiles/Laboratorio.csv
# Hardinfo icon
cp -f /usr/share/icons/win10-icons/48x48/devices/audio-card.png /usr/share/hardinfo/pixmaps/logo.png
# EoG light theme
if [ "$codeName" == "bionic" ]; then
EoGName="eog"
else
EoGName="org.gnome.eog"
fi
sed -i "s#Exec=eog %U#Exec=env GTK_THEME=\"Windows 10 forLxde\" eog %U#g" /usr/share/applications/$EoGName.desktop
sudo chmod 644 /usr/share/applications/$EoGName.desktop
# Check Winunix Apps
chmod +x /usr/bin/verify-winunix
# Services
sudo systemctl disable anydesk.service
sudo systemctl disable sshd.service
# Notifications of update
if [ "$codeName" == "bionic" ]; then
sed -i '/Prompt=/c\Prompt=never' /etc/update-manager/release-upgrades
sudo chmod 644 /etc/update-manager/release-upgrades
sed -i '/APT::Periodic::Update-Package-Lists/c\APT::Periodic::Update-Package-Lists "0";' /etc/apt/apt.conf.d/10periodic
sudo chmod 644 /etc/apt/apt.conf.d/10periodic
fi
## Fix Libreoffice export pdf
# hasEnvVar=`grep 'SAL_VCL_QT5_USE_CAIRO' /etc/environment`
# if [ "$hasEnvVar" == "" ]; then
# echo "SAL_VCL_QT5_USE_CAIRO=true" >> /etc/environment
# sudo chmod 644 /etc/environment
# fi
# Apport
#sed -i 's/enabled=1/enabled=0/g' /etc/default/apport
#sudo chmod 644 /etc/default/apport
# Cleaning chrome environment
apt autoremove -y
apt autoclean -y
rm -rf ~/.bash_history /tmp/*
rm -rf /var/lib/dbus/machine-id
rm -rf /sbin/initctl
rm -rf /root/.wgetrc
rm -rf /root/.config
rm -rf /var/crash/*
rm -rf /root/.mozilla
dpkg-divert --rename --remove /sbin/initctl
# Unmount specials files and exiting of chroot
while [ ! -z "$(ls -A /proc)" ]; do
umount /proc
umount -lf /proc
sleep 1
done
while [ ! -z "$(ls -A /sys)" ]; do
umount /sys
umount -lf /sys
sleep 1
done
while [ ! -z "$(ls -A /dev/pts)" ]; do
umount /dev/pts
umount -lf /dev/pts
sleep 1
done