Remove installation related stuff from envsetup.sh.
sudo access is not guaranteed, so why bother?
This commit is contained in:
parent
84e529a2e4
commit
9b54b6bfb9
57
envsetup.sh
57
envsetup.sh
@ -1,7 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Environment setup redone in bash, because using call in Python is lame
|
# Basic requirements - bash, git
|
||||||
# Basic requirements - bash, sudo (Also make sure your user has sudo privileges!)
|
|
||||||
|
|
||||||
# a die function as always
|
# a die function as always
|
||||||
die() {
|
die() {
|
||||||
@ -11,37 +10,13 @@ die() {
|
|||||||
|
|
||||||
# Some variable(s)
|
# Some variable(s)
|
||||||
|
|
||||||
userdistro="NULL"
|
|
||||||
repo="git://github.com/staticsafe/dotfiles.git"
|
repo="git://github.com/staticsafe/dotfiles.git"
|
||||||
|
|
||||||
portpath="/opt/local/bin/port" # This is the default install directory for the MacPorts port binary, you may find this useful.
|
|
||||||
|
|
||||||
# Lets get this party on the road, shall we?
|
# Lets get this party on the road, shall we?
|
||||||
|
|
||||||
sudocheck() {
|
gitcheck() {
|
||||||
hash sudo &>/dev/null || die 'sudo does not exist, exiting'
|
hash git &>/dev/null || die 'git does not exist, exiting'
|
||||||
printf '%s\n' "sudo check : PASSED"
|
printf '%s\n' "git check : PASSED"
|
||||||
}
|
|
||||||
|
|
||||||
distrocheck() {
|
|
||||||
hash apt-get &>/dev/null && userdistro="Debian" # For Debian based distros.
|
|
||||||
hash yum &>/dev/null && userdistro="Fedora" # For RHEL/CentOS/Fedora
|
|
||||||
hash pacman &>/dev/null && userdistro="Arch" # For Arch Linux
|
|
||||||
hash pkg_add &>/dev/null && userdistro="FreeBSD" # For FreeBSD
|
|
||||||
}
|
|
||||||
|
|
||||||
installpackages() {
|
|
||||||
if [[ "$userdistro" == "Debian" ]]; then
|
|
||||||
sudo apt-get install --assume-yes vim zsh tmux git subversion mercurial most python-pip
|
|
||||||
elif [[ "$userdistro" == "Fedora" ]]; then
|
|
||||||
sudo yum install -y vim zsh tmux git subversion mercurial most python-pip
|
|
||||||
elif [[ "$userdistro" == "Arch" ]]; then
|
|
||||||
sudo pacman --noconfirm -S vim zsh tmux git mercurial subversion most python-pip
|
|
||||||
elif [[ "$userdistro" == "FreeBSD" && $(uname -s) == "FreeBSD" ]]; then
|
|
||||||
sudo pkg_add -r vim zsh tmux git subversion mercurial most py27-pip
|
|
||||||
else
|
|
||||||
printf '%s\n' "Your distro's package manager is not supported in this script, continuing with changing shell & linking dotfiles."
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
changeshell() {
|
changeshell() {
|
||||||
@ -56,32 +31,28 @@ changeshell() {
|
|||||||
linkfiles() {
|
linkfiles() {
|
||||||
#find ~/dev/dotfiles -type f -name ".*" -execdir ln -s -f {}
|
#find ~/dev/dotfiles -type f -name ".*" -execdir ln -s -f {}
|
||||||
# --target-directory=$HOME \; # removed until I can figure out the issue
|
# --target-directory=$HOME \; # removed until I can figure out the issue
|
||||||
ln -sf ~/dev/dotfiles/.zshrc $HOME/
|
ln -sf ~/dotfiles/.zshrc $HOME/
|
||||||
ln -sf ~/dev/dotfiles/.vimrc $HOME/
|
ln -sf ~/dotfiles/.vimrc $HOME/
|
||||||
ln -sf ~/dev/dotfiles/.tmux.conf $HOME/
|
ln -sf ~/dotfiles/.tmux.conf $HOME/
|
||||||
ln -sf ~/dev/dotfiles/.conkyrc $HOME/
|
ln -sf ~/dotfiles/.conkyrc $HOME/
|
||||||
ln -sf ~/dev/dotfiles/.zsh $HOME/
|
ln -sf ~/dotfiles/.zsh $HOME/
|
||||||
ln -sf ~/dev/dotfiles/.vim $HOME/
|
ln -sf ~/dotfiles/.vim $HOME/
|
||||||
touch ~/.zhistory
|
touch ~/.zhistory
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
getdotfiles() {
|
getdotfiles() {
|
||||||
if [[ -d ~/dev/dotfiles ]]; then
|
if [[ -d ~/dotfiles ]]; then
|
||||||
cd ~/dev/dotfiles
|
cd ~/dotfiles
|
||||||
git pull
|
git pull
|
||||||
linkfiles
|
linkfiles
|
||||||
else
|
else
|
||||||
mkdir ~/dev
|
cd
|
||||||
cd ~/dev
|
|
||||||
git clone $repo
|
git clone $repo
|
||||||
linkfiles
|
linkfiles
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
sudocheck
|
gitcheck
|
||||||
distrocheck
|
|
||||||
installpackages
|
|
||||||
changeshell
|
changeshell
|
||||||
getdotfiles
|
getdotfiles
|
||||||
exec zsh
|
exec zsh
|
||||||
|
Loading…
Reference in New Issue
Block a user