-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
163 lines (141 loc) · 7.11 KB
/
install.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
#!/bin/bash
# Print the menu for desktop environment selection
echo "Select a desktop environment:"
echo "1. KDE"
echo "2. Xfce"
echo "3. UKUI"
echo -n "Enter your choice (1/2/3) [default is KDE]: "
# Set timeout for user input (5 seconds)
read -t 10 choice
# Set the default choice if timeout occurs or invalid input is given
if [ -z "$choice" ]; then
choice="1"
fi
# Check if the .config directory exists
config_dir="$HOME/.config"
if [ ! -d "$config_dir" ]; then
echo "The .config directory does not exist. Creating it..."
mkdir -p "$config_dir"
fi
# Print initial message
echo "Preparing to install...."
#Add Debian unstable to sources.list
#echo "deb https://deb.debian.org/debian/ unstable main contrib non-free" | sudo tee -a /etc/apt/sources.list
#echo "deb-src https://deb.debian.org/debian/ unstable main contrib non-free" | sudo tee -a /etc/apt/sources.list
# Unzip and move ngrok binary
curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null && echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | sudo tee /etc/apt/sources.list.d/ngrok.list
# Inform about the following steps
echo ""
echo "Cloud Shell already runs on Debian. Just installing the DE (Xfce amd64) and some apps...."
# Add Microsoft's GPG key and setup Visual Studio Code repository
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -o root -g root -m 644 packages.microsoft.gpg /etc/apt/trusted.gpg.d/
sudo sh -c 'echo "deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/packages.microsoft.gpg] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
#Onedrive install script
wget -qO - https://download.opensuse.org/repositories/home:/npreining:/debian-ubuntu-onedrive/xUbuntu_22.04/Release.key | gpg --dearmor | sudo tee /usr/share/keyrings/obs-onedrive.gpg > /dev/null
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/obs-onedrive.gpg] https://download.opensuse.org/repositories/home:/npreining:/debian-ubuntu-onedrive/xUbuntu_20.04/ ./" | sudo tee /etc/apt/sources.list.d/onedrive.list
wget -P /tmp http://archive.ubuntu.com/ubuntu/pool/universe/l/ldc/libphobos2-ldc-shared90_1.20.1-1_amd64.deb
wget -P /tmp http://archive.ubuntu.com/ubuntu/pool/main/l/llvm-toolchain-10/libllvm10_10.0.0-4ubuntu1_amd64.deb
sudo apt install /tmp/libllvm10_10.0.0-4ubuntu1_amd64.deb /tmp/libphobos2-ldc-shared90_1.20.1-1_amd64.deb
wget -O /tmp/OneDriveGUI-1.0.1_fix82-x86_64.AppImage https://github.com/bpozdena/OneDriveGUI/releases/download/v1.0.1/OneDriveGUI-1.0.1_fix82-x86_64.AppImage
chmod +x /tmp/OneDriveGUI-1.0.1_fix82-x86_64.AppImage
tee ~/.local/share/applications/onedrivegui.desktop >/dev/null <<EOL
[Desktop Entry]
Name=OneDriveGUI
Exec=/tmp/OneDriveGUI-1.0.1_fix82-x86_64.AppImage
Icon=/path/to/icon.png # Replace with the actual path to the icon
Type=Application
Categories=Utility;
EOL
chmod +x ~/.local/share/applications/onedrivegui.desktop
# Backup the existing sources.list
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
# Update package list and install necessary packages
sudo apt update && sudo apt install fonts-lohit-beng-bengali onedrive ngrok nemo code apt-transport-https firefox-esr mesa-utils pv nmap nano dialog autocutsel dbus-x11 dbus neofetch p7zip unzip zip tigervnc-standalone-server tigervnc-xorg-extension novnc python3-websockify -y
# Set some environment variables
cd .. || exit 1
export HOME="$(pwd)"
export DISPLAY=":0"
cd "$HOME" || exit 1
sudo rm -rf "$HOME/.vnc"
sudo mkdir "$HOME/.vnc"
clear
#echo "-- SET A PASSWORD --"
#vncpasswd
# Install the selected desktop environment
if [ "$choice" = "1" ]; then
# KDE installation
echo "You selected KDE..."
sudo apt install ark konsole gwenview kate okular kde-plasma-desktop -y
sudo apt remove kdeconnect -y
sudo printf '#!/bin/bash\ndbus-launch &> /dev/null\nautocutsel -fork\nstartplasma-x11\n' > "$HOME/.vnc/xstartup"
# Restore the backup to HOME
# Extract the compressed archive to home directory
tar -xzvf "$backup_dir/kde_backup*.tar.gz" -C "$HOME" --keep-old-files
echo "Restoration completed successfully!"
elif [ "$choice" = "2" ]; then
# Xfce installation
echo "You selected Xfce..."
# Install
sudo apt install papirus-icon-theme xfce4 xfce4-goodies terminator -y
printf '#!/bin/bash\ndbus-launch &> /dev/null\nautocutsel -fork\nxfce4-session\n' > "$HOME/.vnc/xstartup"
# Define the backup source directory
backup_dir="$HOME/google-cloud-shell-debian-de/xfce4_backup"
# Restore the backup to .config directory
echo "Restoring backup from $backup_dir to $config_dir..."
cp -R "$backup_dir"/* "$config_dir"
echo "Restoration completed successfully!"
elif [ "$choice" = "3" ]; then
# UKUI installation
echo "You selected UKUI..."
# Install additional packages from experimental repository
sudo apt install ukui* ukwm qt5-ukui-platformtheme kylin-nm -y
sudo cp $HOME/.Xauthority /root
sudo apt install ukui-settings-daemon ukwm -y
# Create or update the VNC startup script using printf
printf '#!/bin/bash\nexport GTK_IM_MODULE="fcitx"\nexport QT_IM_MODULE="fcitx"\nexport XMODIFIERS="@im=fcitx"\nunset SESSION_MANAGER\nunset DBUS_SESSION_BUS_ADDRESS\nxrdb $HOME/.xresources\nlightdm &\nexec /usr/bin/ukui-session\n' > "$HOME/.vnc/xstartup"
else
echo "Invalid choice. Installing KDE by default..."
echo "You selected KDE..."
sudo apt install ark konsole gwenview kate okular kde-plasma-desktop -y
printf '#!/bin/bash\ndbus-launch &> /dev/null\nautocutsel -fork\nstartplasma-x11\n' > "$HOME/.vnc/xstartup"
# Restore the backup to HOME
# Extract the compressed archive to home directory
tar -xzvf "$backup_dir/kde_backup*.tar.gz" -C "$HOME" --keep-old-files
echo "Restoration completed successfully!"
fi
chmod 755 $HOME/.vnc/xstartup
# Preparing VNC's desktop environment execution
if [ ! -d "$HOME/.config" ]; then
sudo mkdir "$HOME/.config"
fi
chmod -R 777 "$HOME/.config"
cd "$HOME/google-cloud-shell-debian-de" || exit 1
sudo mv ./vps.sh /usr/bin/vps
sudo chmod +x /usr/bin/vps
# Setting permissions and cleaning up
sudo chmod 777 -R "$HOME/.vnc"
sudo chmod 777 "$HOME/.bashrc"
sudo apt update -y
sudo apt autoremove -y
# Check and install Windows-10-Dark-master theme
if [ ! -d /usr/share/themes/Windows-10-Dark-master ]; then
cd /usr/share/themes/ || exit 1
sudo cp "$HOME/google-cloud-shell-debian-de/app/Windows-10-Dark-master.zip" ./
sudo unzip -qq Windows-10-Dark-master.zip
sudo rm -f Windows-10-Dark-master.zip
fi
cd "$HOME" || exit 1
# Inform about backup and update .bashrc
sudo mv "$HOME/.bashrc" "$HOME/.bashrc_old"
echo "Your $HOME/.bashrc is being modified. Backed up the old .bashrc file as .bashrc_old"
sudo cp "$HOME/google-cloud-shell-debian-de/bashrc.sh" "$HOME/.bashrc"
sudo chmod 777 "$HOME/.bashrc"
# Install WPS-Office
cd /tmp
wget https://wdl1.pcfg.cache.wpscdn.com/wpsdl/wpsoffice/download/linux/11701/wps-office_11.1.0.11701.XA_amd64.deb
sudo apt install ./wps-office_11.1.0.11701.XA_amd64.deb -y
# Installation completed message
echo "Installation completed!"
echo "Type vps to start VNC Server!"
exit 0