-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathCRD_COLAB_EXE.sh
156 lines (120 loc) · 4.88 KB
/
CRD_COLAB_EXE.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
#! /bin/bash
# Make Instance Ready for Remote Desktop or RDP
b='\033[1m'
r='\E[31m'
g='\E[32m'
c='\E[36m'
endc='\E[0m'
enda='\033[0m'
clear
# Branding
printf """$c$b
_____ _ _ _ _ _
/ ____| | | | | | | | | | |
| | ___ | | __ _| |__ | |__| | __ _ ___| | _____
| | / _ \| |/ _\` | '_ \ | __ |/ _\` |/ __| |/ / __|
| |___| (_) | | (_| | |_) | | | | | (_| | (__| <\__ \\
\_____\___/|_|\__,_|_.__/ |_| |_|\__,_|\___|_|\_\___/
$r By Pradyumna Krishna © 2020 $c Edited by https://fb.com/thuong.hai.581 (v3)
Github : https://github.com/PradyumnaKrishna/Colab-Hacks
$endc$enda""";
# Used Two if else type statements, one is simple second is complex. So, don't get confused or fear by seeing complex if else statement '^^.
# Creation of user
printf "\n\nCreating user " >&2
if sudo useradd -m user &> /dev/null
then
printf "\ruser created $endc$enda\n" >&2
else
printf "\r$r$b Error Occured $endc$enda\n" >&2
exit
fi
# Add user to sudo group
sudo adduser user sudo
# Set password of user to 'root'
echo 'user:root' | sudo chpasswd
# Change default shell from sh to bash
sed -i 's/\/bin\/sh/\/bin\/bash/g' /etc/passwd
# Initialisation of Installer
printf "\n\n$c$b Loading Installer $endc$enda" >&2
if sudo apt-get update &> /dev/null
then
printf "\r$g$b Installer Loaded $endc$enda\n" >&2
else
printf "\r$r$b Error Occured $endc$enda\n" >&2
exit
fi
# Installing Chrome Remote Desktop
printf "\n$g$b Installing Chrome Remote Desktop $endc$enda" >&2
{
wget https://dl.google.com/linux/direct/chrome-remote-desktop_current_amd64.deb
sudo dpkg --install chrome-remote-desktop_current_amd64.deb
sudo apt install --assume-yes --fix-broken
} &> /dev/null &&
printf "\r$c$b Chrome Remote Desktop Installed $endc$enda\n" >&2 ||
{ printf "\r$r$b Error Occured $endc$enda\n" >&2; exit; }
# Install Desktop Environment (XFCE4)
printf "$g$b Installing Desktop Environment $endc$enda" >&2
{
sudo DEBIAN_FRONTEND=noninteractive \
apt install --assume-yes xfce4 desktop-base
sudo bash -c 'echo "exec /etc/X11/Xsession /usr/bin/xfce4-session" > /etc/chrome-remote-desktop-session'
sudo apt install --assume-yes xscreensaver
sudo systemctl disable lightdm.service
} &> /dev/null &&
printf "\r$c$b Desktop Environment Installed $endc$enda\n" >&2 ||
{ printf "\r$r$b Error Occured $endc$enda\n" >&2; exit; }
# Install Google Chrome
printf "$g$b Installing Google Chrome $endc$enda" >&2
{
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg --install google-chrome-stable_current_amd64.deb
sudo apt install --assume-yes --fix-broken
} &> /dev/null &&
printf "\r$c$b Google Chrome Installed $endc$enda\n" >&2 ||
printf "\r$r$b Error Occured $endc$enda\n" >&2
# Install CrossOver (Run exe on linux)
printf "$g$b Installing CrossOver $endc$enda" >&2
{
wget https://media.codeweavers.com/pub/crossover/cxlinux/demo/crossover_20.0.2-1.deb
sudo dpkg -i crossover_20.0.2-1.deb
sudo apt install --assume-yes --fix-broken
} &> /dev/null &&
printf "\r$c$b CrossOver Installed $endc$enda\n" >&2 ||
printf "\r$r$b Error Occured $endc$enda\n" >&2
# Install OBS-Studio (Livestream)
printf "$g$b Installing Obs-studio $endc$enda" >&2
{
sudo apt install ffmpeg -y
sudo add-apt-repository ppa:obsproject/obs-studio -y
sudo apt install obs-studio -y
sudo apt install --assume-yes --fix-broken
} &> /dev/null &&
printf "\r$c$b OBS-Studio Installed $endc$enda\n" >&2 ||
printf "\r$r$b Error Occured $endc$enda\n" >&2
# Install VLC Media Player
printf "$g$b Installing VLC Media Player $endc$enda" >&2
{
sudo apt install vlc -y
} &> /dev/null &&
printf "\r$c$b VLC Media Player Installed $endc$enda\n" >&2 ||
printf "\r$r$b Error Occured $endc$enda\n" >&2
# Install other tools like nano
sudo apt-get install gdebi -y &> /dev/null
sudo apt-get install vim -y &> /dev/null
printf "$g$b Installing other Tools $endc$enda" >&2
if sudo apt install nautilus nano -y &> /dev/null
then
printf "\r$c$b Other Tools Installed $endc$enda\n" >&2
else
printf "\r$r$b Error Occured $endc$enda\n" >&2
fi
printf "\n$g$b Installation Completed $endc$enda\n\n" >&2
# Adding user to CRP group
sudo adduser user chrome-remote-desktop
# Finishing Work
printf '\nVisit http://remotedesktop.google.com/headless and Copy the command after authentication\n'
read -p "Paste Command: " CRP
su - user -c """$CRP"""
printf "\n$c$b I hope everthing done correctly if mistakenly wrote wrong command or pin, Rerun the current box or run command 'su - user -c '<CRP Command Here>' $endc$enda\n" >&2
printf "\n$c$b https://remotedesktop.google.com/access to access your VM, do not close browser tab to keep colab running ' $endc$enda\n" >&2
printf "\n$g$b Finished Succesfully$endc$enda"