Last active
December 15, 2015 04:59
-
-
Save mickours/5205750 to your computer and use it in GitHub Desktop.
Bash script to configure a debian-based distribution (like ubutnu)
It checks the user rights and install the package only if necessary
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
################################# | |
# Config script for Ubuntu # | |
################################# | |
# exit if error | |
set -e | |
# check rights | |
if [ "$(whoami)" != "root" ]; then | |
echo "ERROR: You must be root to run this script. Try: | |
sudo $0 $1" | |
exit 1 | |
fi | |
### SETTINGS ### | |
# Add wathever you what to install | |
TO_ADD_REPO="ppa:webupd8team/sublime-text-2" | |
TO_INSTALL="zsh terminator git sublime-text" | |
### UTILS ### | |
install(){ | |
if ! dpkg-query -Wf'${db:Status-abbrev}' $1 2>/dev/null; then | |
apt-get install $1 | |
fi | |
} | |
### MAIN ### | |
add-apt-repository $TO_ADD_REPO | |
apt-get update | |
install $TO_INSTALL | |
#zsh conf | |
ZSH_PATH=$(which zsh) | |
if [ $? -eq 1 ]; then | |
chsh $USER -s ZSH_PATH | |
wget -O .zshrc http://git.grml.org/f/grml-etc-core/etc/zsh/zshrc | |
fi | |
### END ### |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment