Skip to content

Instantly share code, notes, and snippets.

@lovato
Last active October 24, 2022 04:43
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lovato/2cbf5a26e3ca2ce8607a7fe0068e36c8 to your computer and use it in GitHub Desktop.
Save lovato/2cbf5a26e3ca2ce8607a7fe0068e36c8 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
set -x
# Root Access
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
TARGETUSER=`ls -t /home | head -1`
read -p "$TARGETUSER, are you using XFCE? (y/n)" -n 1 -r
REPLY_XFCE=$REPLY
echo
read -p "Should I install DropBox? (y/n)" -n 1 -r
REPLY_DROPBOX=$REPLY
echo
read -p "Install Virtualbox? (y/n)" -n 1 -r
REPLY_VBOX=$REPLY
echo
read -p "Is this a Virtualbox Machine (install guest addons)? (y/n)" -n 1 -r
REPLY_ISVM=$REPLY
echo
read -p "Install Development Tools (lots of)? (y/n)" -n 1 -r
REPLY_ISNERD=$REPLY
apt install -y curl
echo Custom Repos
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
# add-apt-repository -y ppa:shutter/ppa # Shutter
# add-apt-repository -y ppa:webupd8team/sublime-text-3
add-apt-repository -y ppa:linuxgndu/sqlitebrowser
# add-apt-repository -y ppa:webupd8team/atom
add-apt-repository -y ppa:git-core/ppa
echo MS VSCODE Repos
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
echo Update Local Data
apt update
echo Install All Packages
apt install -y google-chrome-stable
update-alternatives --set x-www-browser /usr/bin/google-chrome-stable
update-alternatives --auto x-www-browser
apt install -y p7zip-rar p7zip-full unace unrar zip unzip sharutils rar uudeview mpack arj cabextract file-roller
# wget http://ftp.de.debian.org/debian/pool/contrib/m/msttcorefonts/ttf-mscorefonts-installer_3.6_all.deb
# dpkg -i ttf-mscorefonts-installer_3.6_all.deb
echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections
apt install -y ttf-mscorefonts-installer
apt install -y ttf-ancient-fonts
fc-cache -f -v
if [[ $REPLY_XFCE =~ ^[Yy]$ ]]
then
apt install -y xfce4-goodies # (For XFCE4 only!)
fi
apt install -y openssh-server
apt install -y vim
echo set nocompatible > $HOME/.vimrc
apt install -y samba nfs-common portmap cifs-utils
apt install -y cups
apt install -y vlc
apt install -y synaptic # Linux cool Package Manager
apt install -y mplayer
apt install -y mediainfo
apt install -y flameshot
# apt install -y shutter
# read -p "Install XnViewMP? (y/n)" -n 1 -r
# echo # (optional) move to a new line
# if [[ $REPLY =~ ^[Yy]$ ]]
# then
# URL='http://download.xnview.com/XnViewMP-linux-x64.deb'; FILE=`mktemp`; wget "$URL" $FILE && dpkg -i $FILE
# fi
if [[ $REPLY_DROPBOX =~ ^[Yy]$ ]]
then
#sudo -H -u $TARGETUSER bash -c 'google-chrome &'
apt install -y nautilus-dropbox
fi
if [[ $REPLY_VBOX =~ ^[Yy]$ ]]
then
apt install -y virtualbox
# TODO https://askubuntu.com/questions/920689/how-to-fix-modprobe-vboxdrv-error-in-virtualbox
fi
if [[ $REPLY_ISVM =~ ^[Yy]$ ]]
then
apt install -y virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11
usermod -aG vboxsf $TARGETUSER
fi
if [[ $REPLY_ISNERD =~ ^[Yy]$ ]]
then
apt install -y iotop
apt install -y git
apt install -y gitg
# apt install -y meld
apt install -y libxslt-dev libxml2-dev libmemcached-dev python-dev libaio-dev
apt install -y libffi-dev libldap2-dev libsasl2-dev libssl-dev libcups2-dev
apt install -y terminator
apt install -y redis-server
apt install -y docker.io
usermod -aG docker $TARGETUSER
apt install -y linux-headers-generic
apt install -y nginx
apt install -y remmina
apt install -y rpm
apt install -y python-gpg
apt install -y ffmpeg # libav-tools # former apt-get install -y avconv
apt install -y zsh # check https://github.com/sorin-ionescu/prezto
apt install -y code # VSCode
apt install -y usb-creator-gtk
apt install -y sqlitebrowser
apt install -y python-pip
apt install -y python3-pip
apt install -y ipython
apt install -y default-jdk
curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
sdk install gradle 6.0.1
apt install -y ant
apt install -y ipcalc
apt install -y libblas-dev liblapack-dev libatlas-base-dev gfortran #(for pypi spicy)
apt install -y cmake
apt install -y httpie # [security] # https://github.com/jakubroztocil/httpie
apt install -y gparted
sudo -H -u $TARGETUSER bash -c 'pip install -U --user hooks4git'
sudo -H -u $TARGETUSER bash -c 'pip install -U --user virtualenv'
sudo -H -u $TARGETUSER bash -c 'pip install -U --user virtualenvwrapper'
sudo -H -u $TARGETUSER bash -c 'pip install -U --user vex'
sudo -H -u $TARGETUSER bash -c 'pip install -U --user flake8'
sudo -H -u $TARGETUSER bash -c 'pip install -U --user speedtest-cli' # https://github.com/sivel/speedtest-cli
sudo -H -u $TARGETUSER bash -c 'pip3 install -U --user asciinema' # https://github.com/asciinema/asciinema
sudo -H -u $TARGETUSER bash -c 'pip3 install -U --user you-get' # https://github.com/soimort/you-get
sudo -H -u $TARGETUSER bash -c 'pip3 install -U --user thefuck'
sudo -H -u $TARGETUSER bash -c 'pip3 install -U --user PyScaffold'
sudo -H -u $TARGETUSER bash -c 'pip install -U --user git+https://github.com/jeffkaufman/icdiff.git'
pip install -U pip
apt install -y npm
sudo -H -u $TARGETUSER bash -c 'pip install -U --user pipenv'
npm install -g n
npm install -g eslint
npm install -g markdownlint-cli # https://github.com/igorshubovych/markdownlint-cli
npm install -g dockerfile_lint # https://www.npmjs.com/package/dockerfile_lint
npm install -g travis-lint # https://www.npmjs.com/package/travis-lint
apt remove -y nodejs
n lts
# /usr/local/bin/npm install -g yo
# /usr/local/bin/npm install -g bower
/usr/local/bin/npm install -g npm
git clone https://github.com/ekalinin/pip-bash-completion.git
cp ./pip-bash-completion/pip /etc/bash_completion.d/
. /etc/bash_completion.d/pip
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && chmod +x minikube && mv minikube /usr/local/bin/
fi
echo Configuring GIT
sudo -H -u $TARGETUSER bash -c 'ssh-keygen -t rsa -b 4096 -N "" -C `whoami`@`hostname` -f ~/.ssh/id_rsa'
echo Customize some ENV stuff
#echo PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\] \[\033[01;32m\]$(__git_ps1 "(%s) ")\[\033[00m\]\n\$ ' > $HOME/.bashrc
sudo -H -u $TARGETUSER bash -c 'echo set nocompatible > $HOME/.vimrc'
sudo -H -u $TARGETUSER bash -c 'mkdir $HOME/code'
sudo -H -u $TARGETUSER bash -c 'mkdir $HOME/.virtualenvs'
sudo -H -u $TARGETUSER bash -c 'mkdir $HOME/www'
sudo -H -u $TARGETUSER bash -c 'echo Hey $TARGETUSER, it works! > $HOME/www/index.html'
mv /var/www/html /var/www/html.original
ln -s /home/$TARGETUSER/www /var/www/html
git clone git@github.com:lovato/linux.git $HOME/linux
sudo -H -u $TARGETUSER bash -c 'ln -s $HOME/linux/configs/git/.gitconfig $HOME/.gitconfig'
sudo -H -u $TARGETUSER bash -c 'ln -s $HOME/linux/bin $HOME/bin'
sudo -H -u $TARGETUSER bash -c 'ln -s $HOME/linux/.aws $HOME/.aws'
sudo -H -u $TARGETUSER bash -c 'ln -s $HOME/linux/.ssh/config $HOME/.ssh/config'
sudo -H -u $TARGETUSER bash -c 'ln -s $HOME/linux/configs/.inputrc $HOME/.inputrc'
sudo -H -u $TARGETUSER bash -c 'ln -s $HOME/linux/configs/.bash_aliases $HOME/.bash_aliases'
sudo -H -u $TARGETUSER bash -c 'ln -s $HOME/linux/configs/terminator $HOME/.config/'
sudo -H -u $TARGETUSER bash -c 'ln -s $HOME/linux/configs/asciinema $HOME/.config/'
if [[ $REPLY_DROPBOX =~ ^[Yy]$ ]]
then
sudo -H -u $TARGETUSER bash -c 'rm -f $HOME/.config/autostart/dropbox.desktop'
sudo -H -u $TARGETUSER bash -c 'ln -s $HOME/linux/configs/dropbox/dropbox.desktop $HOME/.config/autostart/dropbox.desktop'
fi
if [[ $REPLY_DROPBOX =~ ^[Yy]$ ]]
then
echo Now, start Dropbox
echo Right after, do a 'killall dropbox' to stop it, or else it will perform a full sync
echo Do a 'dbus-launch dropbox start -i'
echo Configure Dropbox Seletive Sync
echo Wait Dropbox sync
fi
set +x
if [[ $REPLY_ISNERD =~ ^[Yy]$ ]]
then
echo Almost done. Now on your user bash, execute zsh and press \'q\' to get the bare zsh prompt
echo Do a \'git clone --recursive https://github.com/lovato/prezto.git "~/.zprezto"\'
echo Follow only step 3 at \'https://github.com/lovato/prezto#installation\'
echo Finally, configure VSCode installing \'Sync Settings\' extension, press Shift+Alt+D, add your GH token and use GIST \'3c6fec0172ae1221ff23a77b542ca8c3\'
fi
TZ=UTC0 printf '\nInstallation Time: %(%H:%M:%S)T\n' "$SECONDS"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment