add installation script
This commit is contained in:
parent
24d5ad90c3
commit
818ddec680
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
|
||||
warn() { printf '\E[33m'; echo "$@"; printf '\E[0m'; }
|
||||
error() { printf '\E[31m'; echo "$@"; printf '\E[0m'; }
|
||||
success() { printf '\E[32m'; echo "$@"; printf '\E[0m'; }
|
||||
abort() { warn "$@"; error "Installation aborted."; exit 1; }
|
||||
|
||||
[[ -d "$HOME/.local/share/zsh" || -e "$HOME/.config/.zshrc" || -e "$HOME/.zshenv" ]] && abort ".local/share/zsh, .config/.zshrc and/or .zshenv found in $USER's home directory. Make sure these files don't already exist."
|
||||
|
||||
if hash exa git nano zsh 2>/dev/null; then
|
||||
success "exa git nano and zsh already installed, skipping installation."
|
||||
else
|
||||
ls /root >/dev/null 2>&1 || abort "No root privileges. Run this script as sudo or install exa git nano and zsh manually."
|
||||
hash apt-get 2>/dev/null || abort "apt-get not found. Install exa git nano and zsh with your system's package manager."
|
||||
apt-get update >/dev/null && apt-get -y install exa git nano zsh >/dev/null || abort "apt-get installation failed. After fixing the errors run 'apt-get install exa git nano zsh' or this script again."
|
||||
success "Installation of exa git nano and zsh successfull."
|
||||
fi
|
||||
|
||||
git clone --recurse -q https://git.sdf.org/michael/zsh "$HOME/.local/share/zsh" && success "git clone successfull." || abort "Could not clone git repository."
|
||||
cp "$HOME/.local/share/zsh/zshenv" "$HOME/.zshenv"
|
||||
mkdir -p "$HOME/.config"
|
||||
ln -fs ../.local/share/zsh/zshrc "$HOME/.config/.zshrc"
|
||||
test -x /bin/zsh && chsh -s /bin/zsh && success "Zsh set as default shell." || warn "Could not set Zsh as default shell. Run chsh or edit /etc/passwd."
|
||||
|
||||
success "Installation complete."
|
12
readme.md
12
readme.md
|
@ -1,8 +1,14 @@
|
|||
### Install [exa](https://the.exa.website) and [nano](https://www.nano-editor.org)
|
||||
### Manual installation
|
||||
```
|
||||
git clone --recurse https://git.sdf.org/michael/zsh ~/.local/share/zsh
|
||||
ln -s ../.local/share/zsh/zshrc ~/.config/.zshrc
|
||||
cp ~/.local/share/zsh/zshenv ~/.zshenv
|
||||
usermod --shell $(which zsh) $(whoami)
|
||||
mkdir -p ~/.config
|
||||
ln -s ../.local/share/zsh/zshrc ~/.config/.zshrc
|
||||
```
|
||||
|
||||
### Installation script
|
||||
```
|
||||
curl -s https://git.sdf.org/michael/zsh/raw/branch/master/install.sh | bash
|
||||
```
|
||||
|
||||
![Screenshot](https://michael.sdf.org/zsh.png)
|
2
zshrc
2
zshrc
|
@ -89,4 +89,4 @@ ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE=fg=024
|
|||
ZSH_AUTOSUGGEST_STRATEGY=(history completion)
|
||||
ZSH_HIGHLIGHT_STYLES[comment]=fg=245
|
||||
|
||||
(( $+commands[fortune] && $+commands[cowsay] && $+commands[lolcat] )) && fortune -s | cowsay -f small | lolcat -r -v 1
|
||||
(( $+commands[fortune] && $+commands[cowsay] && $+commands[lolcat] )) && echo && fortune -s | cowsay -f small | lolcat -r -v 1
|
||||
|
|
Loading…
Reference in New Issue