Skip to content

Instantly share code, notes, and snippets.

@FZX
Last active September 15, 2021 21:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FZX/0f2b4c65a05d556a7e5623f80243de05 to your computer and use it in GitHub Desktop.
Save FZX/0f2b4c65a05d556a7e5623f80243de05 to your computer and use it in GitHub Desktop.
Shell script for configuring Linux Mint. Installing Chromium, Vim, Git. Changing system settings. Changing theme. Adding python script for modify brightness level.
#! /bin/sh
#
# setup.sh
# Copyright (C) 2016 FZX <FZX@users.noreply.github.com>
#
# Distributed under terms of the GPL v2.0 license.
#
wrapper() {
RED="\033[0;31m"
GREEN="\033[0;32m"
YELLOW="\033[0;33m"
BLUE="\033[0;36m"
NORMAL="\033[0m"
echo "${BLUE}"
cat << "HELLO_TEXT"
Hello this script will configure Linux Mint for me.
I am too lazy.
It will updete and install few packages.
It will modify settings as I want.
HELLO_TEXT
echo "${NORMAL}"
sudo apt-get update
sudo apt-get install -y chromium-browser git vim python3-gevent python3-pip python3-setuptools python3-bs4 sqlitebrowser
sudo pip3 install --upgrade pip
sudo pip3 install sqlalchemy
#adding Georgian keyboard layout
setxkbmap -option grp:switch,grp:alt_shift_toggle us,ge
# Changing timezone to Tbilisi
sudo timedatectl set-timezone Asia/Tbilisi
# Privacy
gsettings set org.cinnamon.desktop.privacy remember-recent-files false
# Configuring Theme settings.
gsettings set org.cinnamon.theme name "Mint-Y-Dark"
gsettings set org.cinnamon.desktop.interface gtk-theme "Mint-Y-Dark"
gsettings set org.cinnamon.desktop.wm.preferences theme "Mint-Y-Dark"
gsettings set org.cinnamon.desktop.interface icon-theme 'Mint-X-Grey'
# Disabling cursor blinking
gsettings set org.cinnamon.desktop.interface cursor-blink false
# Disabling reverse mouse scrolling
gsettings set org.cinnamon.settings-daemon.peripherals.touchpad natural-scroll false
# Disabling sound while volume control
gsettings set org.cinnamon.desktop.sound volume-sound-enabled false
# Setup proxy settings.
#gsettings set org.gnome.system.proxy autoconfig-url "http://mediahint.com/default.pac"
#gsettings set org.gnome.system.proxy mode auto
# Setup default editor.
xdg-mime default vim.desktop text/plain
xdg-mime default vim.desktop text/x-python
# Panel applets.
gsettings set org.cinnamon enabled-applets "['panel1:left:0:menu@cinnamon.org:0', 'panel1:left:2:panel-launchers@cinnamon.org:2', 'panel1:left:3:window-list@cinnamon.org:3', 'panel1:right:1:user@cinnamon.org:5', 'panel1:right:2:removable-drives@cinnamon.org:6', 'panel1:right:3:keyboard@cinnamon.org:7', 'panel1:right:11:show-desktop@cinnamon.org:1', 'panel1:right:5:network@cinnamon.org:9', 'panel1:right:6:sound@cinnamon.org:10', 'panel1:right:7:power@cinnamon.org:11', 'panel1:right:8:systray@cinnamon.org:12', 'panel1:right:9:calendar@cinnamon.org:13']"
# Power settings.
gsettings set org.cinnamon.settings-daemon.plugins.power sleep-display-ac 0
gsettings set org.cinnamon.settings-daemon.plugins.power sleep-display-battery 0
# Adding custom shortcuts for controling brightness with my script.
gsettings set org.cinnamon.desktop.keybindings.custom-keybinding:/org/cinnamon/desktop/keybindings/custom-keybindings/custom0/ binding "['<Primary><Shift>KP_Add']"
gsettings set org.cinnamon.desktop.keybindings.custom-keybinding:/org/cinnamon/desktop/keybindings/custom-keybindings/custom0/ command 'sudo python3 /home/mint/.brightness.py +'
gsettings set org.cinnamon.desktop.keybindings.custom-keybinding:/org/cinnamon/desktop/keybindings/custom-keybindings/custom0/ name 'Brightness UP'
gsettings set org.cinnamon.desktop.keybindings.custom-keybinding:/org/cinnamon/desktop/keybindings/custom-keybindings/custom1/ binding "['<Primary><Shift>KP_Subtract']"
gsettings set org.cinnamon.desktop.keybindings.custom-keybinding:/org/cinnamon/desktop/keybindings/custom-keybindings/custom1/ command 'sudo python3 /home/mint/.brightness.py -'
gsettings set org.cinnamon.desktop.keybindings.custom-keybinding:/org/cinnamon/desktop/keybindings/custom-keybindings/custom1/ name 'Brightness Down'
gsettings set org.cinnamon.desktop.keybindings custom-list "['custom0','custom1']"
# Adding alises in to .bashrc file.
echo 'alias br="sudo python3 /home/$USER/.brightness.py"' | tee -a $HOME/.bashrc
echo 'alias :q="exit"' | tee -a $HOME/.bashrc
echo 'alias :Q="exit"' | tee -a $HOME/.bashrc
echo 'alias py="python3"' | tee -a $HOME/.bashrc
echo 'alias cl="clear"' | tee -a $HOME/.bashrc
# Setting up Chromium with config file.
wget 'https://gist.githubusercontent.com/FZX/d37d11850ffc4cfe108ab11254f21408/raw/02ee58fc117d45367c8177d4b09bffd0ac23e3fd/mintchromium' -O $HOME/.config/chromium/Default/Preferences
# Downloading Brightness.py file for controling Screen Brightness level.
wget 'https://gist.githubusercontent.com/FZX/499df015bb2f19c8c3054f09381b6124/raw/7a491cd7cf3aaf15a23ee076232ca39edeeed914/brightness.py' -O $HOME/.brightness.py
# Download and setup Maia-Cursor theme.
git clone https://github.com/manjaro/maia-cursor.git $HOME/cursor
mkdir ~/.icons
mv $HOME/cursor/Maia-Cursor $HOME/.icons/Maia-Cursor
sudo rm -rf cursor/
printf '[Icon Theme]\nInherits=Maia-Cursor' | tee -a $HOME/.icons/Maia-Cursor/cursor.theme
sudo update-alternatives --install /usr/share/icons/default/index.theme x-cursor-theme $HOME/.icons/Maia-Cursor/cursor.theme 91
printf '[Icon Theme]\nInherits=Maia-Cursor' | sudo tee /usr/share/icons/default/index.theme
gsettings set org.cinnamon.desktop.interface cursor-theme 'Maia-Cursor'
sudo ufw enable
git config --global user.name "FZX"
git config --global user.email "FZX@users.noreply.github.com"
VUNDLE_HTTPS="https://github.com/VundleVim/Vundle.vim.git"
if [ ! -n "$VIM" ]; then
VIM=~/.vim
fi
if [ -d "$VIM" ]; then
printf "${YELLOW}%s${NORMAL}\n" "You already have $VIM directory."
printf "${YELLOW}%s${NORMAL}\n" "You have to remove $VIM if you want to re-install."
exit 0
fi
umask g-w,o-w
hash git >/dev/null 2>&1 || {
printf "${RED}%s${NORMAL}\n" "Error: git is not installed."
exit 1
}
mkdir -p $VIM/bundle
wget 'https://gist.githubusercontent.com/FZX/638f39aa788c77a439e8df5daf436aea/raw/1dd97a1258823bd32d64a1b88e9a3d15f335fea6/Random%2520Vimrc' -O $VIM/vimrc
printf "${BLUE}%s${NORMAL}\n" "Looking for an existing vim config..."
if [ -f ~/.vimrc ] || [ -h ~/.vimrc ]; then
printf "${YELLOW}%s${NORMAL}\n" "Found ~/.vimrc."
printf "${BLUE}%s${NORMAL}\n" "You will see your old ~/.vimrc as $VIM/vimrc.bak"
mv ~/.vimrc $VIM/vimrc.bak
fi
printf "${BLUE}%s${NORMAL}\n" "Symlinking $VIM/vimrc with ~/.vimrc..."
ln -fs $VIM/vimrc ~/.vimrc
if [ ! -d "$VIM/bundle/Vundle.vim" ]; then
printf "${BLUE}%s${NORMAL}\n" "Installing Vundle..."
env git clone --depth=1 $VUNDLE_HTTPS "$VIM/bundle/Vundle.vim"
fi
if [ ! -f $VIM/colors/wombat256mod.vim ]; then
if [ ! -d $VIM/colors/ ]; then
mkdir -p $VIM/colors
fi
wget 'http://www.vim.org/scripts/download_script.php?src_id=13400' -O $VIM/colors/wombat256mod.vim
fi
rm -- "$0"
printf "${GREEN}%s${NORMAL}\n" "Chromium, Git and Vim are installed."
printf "${BLUE}%s${NORMAL}\n" "Theme changed to Mint-Y-Dark!"
printf "${YELLOW}%s${NORMAL}\n" "Automatic proxy set."
printf "${BLUE}%s${NORMAL}\n" "Panel applets are configured."
printf "${GREEN}%s${NORMAL}\n" "Power managment settings are configured."
printf "${GREEN}%s${NORMAL}\n" "Vim has been configured."
printf "${YELLOW}%s${NORMAL}\n" "Keyboard shortcuts created."
}
wrapper
vim +PluginInstall +qall
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment