I just finished (I think) writing a bash script to install all my essential software to Ubuntu GNOME. I'll be making more for different distributions but once I have one to go off of, I can do the rest fine.
I am very new to it all, however, and have barely gotten into using the cli so I'm sure that there are a ton of errors below. If you could just read through it and let me know what I can fix/improve, that would be wonderful! This is meant to run a nearly clean install; I'll have to open Firefox and download two files; the script and the extensions list. Other than that, everything is still set to default.
#!/bin/bash
sudo apt-get install -y gnome-tweak-tool
sudo apt-get install -y variety
sudo apt-get install -y hunspell-en-gb
sudo apt-get install -y gdebi
sudo apt-get install -y gparted
sudo apt-get install -y libreoffice-style-breeze
sudo apt-get install -y evolution
sudo apt-get install -y evolution-indicator
sudo apt-get install -y cairo-dock
cd
cd Downloads
mkdir Programs
cd Programs
wget https://steamcdn-a.akamaihd.net/client/installer/steam.deb
sudo dpkg -i steam.deb
sudo apt-get install -f
wget https://atom.io/download/deb
sudo dpkg -i atom*
sudo apt-get install -f
wget https://www.realvnc.com/download/file/vnc.files/VNC-Server-6.2.0-Linux-x64.deb
sudo dpkg -i VNC-Server*
sudo apt-get install -f
wget https://www.realvnc.com/download/file/viewer.files/VNC-Viewer-6.17.731-Linux-x64.deb
sudo dpkg -i VNC-Viewer*
sudo apt-get install -f
sudo cd /usr/share/icons
wget https://dl.opendesktop.org/api/files/download/id/1464728434/164587-bridge.tar.gz
tar -xvzf 164587-bridge.tar.gz
sudo add-apt-repository ppa:papirus/papirus
sudo apt update
sudo apt-get install papirus-icon-theme
sudo apt install numix-gtk-theme
xterm -e "echo Make sure you select Bridge as the cursor, Papirus as the icon theme, and Numix as the GTK+ theme && gnome-tweak-tool"
cd
xterm -e "echo Replace whatever is there with Bridge && sudo gedit /usr/share/icons/default/index.theme"
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key FDC247B7
echo 'deb https://repo.windscribe.com/ubuntu zesty main' | sudo tee /etc/apt/sources.list.d/windscribe-repo.list
sudo apt-get update
sudo apt-get install windscribe-cli
xterm windscribe login && windscribe start && echo Connect to Windscribe with windscribe connect best
echo All thats left is to do is, if youre using GNOME, enable all of your chosen extensions at extensions.gnome.org
cd
echo Use gedit /Documents/Scripts/Extension_Links to view my links to GNOME Shell Extensions
1 Answer 1
Wall of code
The script looks like a wall of code. It would be a lot more pleasant to read if related groups of commands were separated from each other by blank lines, for example:
# install steam
wget https://steamcdn-a.akamaihd.net/client/installer/steam.deb
sudo dpkg -i steam.deb
sudo apt-get install -f
# install atom
wget https://atom.io/download/deb
sudo dpkg -i atom*
sudo apt-get install -f
Displaying info
This is not a very user-friendly (or pretty) way to show a message to the user before opening gnome-tweak-tool
:
xterm -e "echo Make sure you select Bridge as the cursor, Papirus as the icon theme, and Numix as the GTK+ theme && gnome-tweak-tool"
Since you are on a Gnome Desktop, you can benefit from zenity
,
a scriptable tool to display dialogs, for example like this:
zenity --info --text="Make sure you select Bridge as the cursor, Papirus as the icon theme, and Numix as the GTK+ theme" && gnome-tweak-tool
Pointless command
This command will have no useful effect:
sudo cd /usr/share/icons
In fact, instead of this:
sudo cd /usr/share/icons wget https://dl.opendesktop.org/api/files/download/id/1464728434/164587-bridge.tar.gz tar -xvzf 164587-bridge.tar.gz
You probably want to do something like this:
wget -O /tmp/bridge.tar.gz https://dl.opendesktop.org/api/files/download/id/1464728434/164587-bridge.tar.gz
sudo tar -xvzf /tmp/bridge.tar.gz -C /usr/share/icons
That is, download the tarball to a temporary folder,
and extract the content with root
into /usr/share/icons
.
-
\$\begingroup\$ The command at the bottom is to put the cursor theme Bridge in the Icon folder so it shows up in the Tweak Tool. Thank you so much! \$\endgroup\$Amolith– Amolith2017年09月18日 20:33:17 +00:00Commented Sep 18, 2017 at 20:33
-
\$\begingroup\$ @Amolith I thought you might expect that, but that's not will actually happen. The
164587-bridge.tar.gz
file will be extracted in the folder where the current user is, which is~/Downloads/Programs
in your script \$\endgroup\$janos– janos2017年09月18日 20:48:36 +00:00Commented Sep 18, 2017 at 20:48 -
\$\begingroup\$ Since I'm extracting it after I've cd'd to that directory, wouldn't I be in that directory? \$\endgroup\$Amolith– Amolith2017年09月18日 21:02:34 +00:00Commented Sep 18, 2017 at 21:02
-
\$\begingroup\$ @Amolith
sudo cd /somepath
makes theroot
usercd
to/somepath
. The current user will not change its working directory. Only theroot
user will, and until thesudo
shell ends. On the nextsudo
execution, theroot
user will be back in its home. \$\endgroup\$janos– janos2017年09月18日 21:04:00 +00:00Commented Sep 18, 2017 at 21:04 -
\$\begingroup\$ So would
sudo tar . . .
extract it in the correct directory or should I just download/extract it in some other directory andsudo cp
it into/usr/share/icons
? \$\endgroup\$Amolith– Amolith2017年09月18日 21:05:45 +00:00Commented Sep 18, 2017 at 21:05