mirror of
https://git.decapod.one/brethil/dotfiles
synced 2024-11-22 11:31:30 +01:00
fix install
This commit is contained in:
parent
875b109854
commit
025f3d3240
63
install.sh
63
install.sh
|
@ -7,7 +7,7 @@ DOTFILES=$PWD
|
||||||
|
|
||||||
# Install packages
|
# Install packages
|
||||||
# vim, zsh
|
# vim, zsh
|
||||||
# antigen: zsh plugin manager
|
# antibody: zsh plugin manager
|
||||||
# grc: generic colourizer, colors output of any command
|
# grc: generic colourizer, colors output of any command
|
||||||
# ccze: similar to the above
|
# ccze: similar to the above
|
||||||
# byobu: configuration/wrapper for tmux
|
# byobu: configuration/wrapper for tmux
|
||||||
|
@ -17,7 +17,7 @@ DOTFILES=$PWD
|
||||||
# byobu: tmux wrapper
|
# byobu: tmux wrapper
|
||||||
# htop: like top, but bettah
|
# htop: like top, but bettah
|
||||||
# bat: a cat clone on wings
|
# bat: a cat clone on wings
|
||||||
PACKAGES="vim zsh antigen git grc ccze bmon mtr pv tmux byobu htop bat"
|
PACKAGES="vim zsh antibody git grc ccze bmon mtr tmux byobu htop baantibody path robbyrussell/oh-my-zsht"
|
||||||
|
|
||||||
function setup_git {
|
function setup_git {
|
||||||
# set up some git stuff
|
# set up some git stuff
|
||||||
|
@ -137,68 +137,16 @@ function fix_annoyances {
|
||||||
|
|
||||||
# First setup
|
# First setup
|
||||||
function brethil_dotfiles_setup {
|
function brethil_dotfiles_setup {
|
||||||
|
antibody &>/dev/null || (echo "Please install antibody then continue." 1>&2 && echo "Other useful packages: $PACKAGES" && exit)
|
||||||
bin="$HOME/bin"
|
bin="$HOME/bin"
|
||||||
projects="$HOME/projects"
|
projects="$HOME/projects"
|
||||||
git="$HOME/git"
|
git="$HOME/git"
|
||||||
mkdir -p "$bin" "$projects" "$git" && echo "Created dirs $bin, $projects, $git"
|
mkdir -p "$bin" "$projects" "$git" && echo "Created dirs $bin, $projects, $git"
|
||||||
|
|
||||||
# Check if running as root, if try using sudo to install packages.
|
|
||||||
# If sudo is not installed, launch a shell to try and install it
|
|
||||||
if [[ $(id -u) != 0 ]]; then
|
|
||||||
if [[ ! -f $(which sudo) ]] ; then
|
|
||||||
unset yn
|
|
||||||
until [[ $yn == "y" || $yn == "n" ]]; do
|
|
||||||
echo "Cannot install new packages without root access. Do you want to try to manually install sudo? (yn) "
|
|
||||||
read yn
|
|
||||||
done
|
|
||||||
if [[ $yn == "y" ]]; then
|
|
||||||
echo "Launching an interactive shell. Type exit after installing sudo."
|
|
||||||
# Launch bash
|
|
||||||
$(which bash)
|
|
||||||
else
|
|
||||||
echo "Quitting."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
elif [[ -f $(which sudo) ]]; then
|
|
||||||
sudo="sudo "
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $(which apt-get ) ]]; then
|
|
||||||
PACKAGES=${PACKAGES/antigen/zsh-antigen/}
|
|
||||||
antigen_path=/usr/share/zsh-antigen/antigen.zsh
|
|
||||||
install_command="${sudo}apt-get install"
|
|
||||||
elif [[ $(which pacman) ]]; then
|
|
||||||
pacman -Sy yay # also install the yay aur package managery
|
|
||||||
antigen_path=/usr/share/zsh/share/antigen.zsh
|
|
||||||
grc_path=/etc/grc.zsh
|
|
||||||
install_command="${sudo}yay -Sy"
|
|
||||||
elif [[ $(which yum) ]]; then
|
|
||||||
antigen_path=/usr/share/zsh/share/antigen.zsh
|
|
||||||
install_command="${sudo}yum"
|
|
||||||
elif [[ $(which brew) ]]; then
|
|
||||||
antigen_path=/usr/local/share/antigen/antigen.zsh
|
|
||||||
install_command="${sudo}brew install"
|
|
||||||
else
|
|
||||||
echo "I do not know how to install the required packages. Quitting."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -f $antigen_path ]]; then
|
|
||||||
echo "antigen.zsh not found, please set up manually in ~/.zshrc" 1>&2
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# actually install the packages
|
|
||||||
$install_command $PACKAGES
|
|
||||||
|
|
||||||
# prepare .zshrc
|
# prepare .zshrc
|
||||||
exec 3>&1 # save stdout
|
exec 3>&1 # save stdout
|
||||||
exec 1>$HOME/.zshrc
|
exec 1>$HOME/.zshrc
|
||||||
echo "source $antigen_path"
|
|
||||||
echo -e "\n\n# brethil's dotfiles:"
|
echo -e "\n\n# brethil's dotfiles:"
|
||||||
# Source antigen
|
|
||||||
echo "source $antigen_path"
|
|
||||||
echo "DOTFILES=$DOTFILES"
|
echo "DOTFILES=$DOTFILES"
|
||||||
echo "source \$DOTFILES/brethil_dotfile.sh"
|
echo "source \$DOTFILES/brethil_dotfile.sh"
|
||||||
echo -e "# End of brethil's dotfiles\n\n"
|
echo -e "# End of brethil's dotfiles\n\n"
|
||||||
|
@ -215,10 +163,11 @@ function brethil_dotfiles_setup {
|
||||||
# pdbpp rc
|
# pdbpp rc
|
||||||
setup_pdbprc
|
setup_pdbprc
|
||||||
|
|
||||||
|
oh_my_zsh_path="$(antibody path robbyrussell/oh-my-zsh)"
|
||||||
# Symlink brethil.zsh-theme
|
# Symlink brethil.zsh-theme
|
||||||
ln -s $DOTFILES/brethil.zsh-theme $HOME/.antigen/bundles/robbyrussell/oh-my-zsh/themes/ # TODO: improve this
|
ln -s $DOTFILES/brethil.zsh-theme ${oh_my_zsh_path}/themes/ # TODO: improve this
|
||||||
# Symlink brethil-minimal.zsh-theme
|
# Symlink brethil-minimal.zsh-theme
|
||||||
ln -s $DOTFILES/brethil-minimal.zsh-theme $HOME/.antigen/bundles/robbyrussell/oh-my-zsh/themes/
|
ln -s $DOTFILES/brethil-minimal.zsh-theme ${oh_my_zsh_path}/themes/
|
||||||
|
|
||||||
# TODO: powerline?
|
# TODO: powerline?
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user