2023-08-23 21:25:12 -05:00
|
|
|
#!/usr/bin/env bash
|
2023-08-21 13:13:13 -05:00
|
|
|
# Exit if there's an error
|
|
|
|
set -e
|
2023-08-20 21:35:16 -05:00
|
|
|
|
2023-08-23 21:25:12 -05:00
|
|
|
if [ $(whoami) != "root" ]; then
|
2023-08-31 10:28:37 -05:00
|
|
|
SUDO="sudo"
|
2023-08-30 22:15:13 -05:00
|
|
|
else
|
|
|
|
echo "Run as a normal user, not root"
|
2023-08-23 21:25:12 -05:00
|
|
|
exit 1
|
|
|
|
fi
|
2023-08-30 22:15:13 -05:00
|
|
|
|
2023-08-28 18:01:19 -05:00
|
|
|
command_exists() { type "$1" &>/dev/null; }
|
2023-08-20 21:35:16 -05:00
|
|
|
|
2023-08-23 21:25:12 -05:00
|
|
|
if command_exists "apt-get"; then
|
2023-09-06 15:18:40 -05:00
|
|
|
sudo apt-get install zsh -y
|
2023-08-23 21:25:12 -05:00
|
|
|
elif command_exists "yum"; then
|
2023-09-06 15:18:40 -05:00
|
|
|
sudo apt-get install zsh -y
|
2023-08-23 21:25:12 -05:00
|
|
|
elif command_exists "pacman"; then
|
2023-09-06 15:18:40 -05:00
|
|
|
sudo pacman -S zsh --noconfirm --needed
|
2023-08-23 21:25:12 -05:00
|
|
|
elif command_exists "zypper"; then
|
2023-09-06 15:18:40 -05:00
|
|
|
sudo zypper install zsh -y
|
2023-08-23 21:25:12 -05:00
|
|
|
elif command_exists "emerge"; then
|
2023-09-06 15:18:40 -05:00
|
|
|
sudo emerge app-shells/zsh
|
|
|
|
sudo emerge app-shells/zsh-completions
|
|
|
|
sudo emerge app-shells/gentoo-zsh-completions
|
2023-08-23 21:25:12 -05:00
|
|
|
elif command_exists "apk"; then
|
2023-09-06 15:18:40 -05:00
|
|
|
sudo apk add zsh -y
|
2023-08-23 21:25:12 -05:00
|
|
|
else
|
2023-09-06 20:54:23 -05:00
|
|
|
echo >&2 "Unsupported: unknown package manager and distro"
|
2023-08-23 21:25:12 -05:00
|
|
|
exit 1
|
|
|
|
fi
|
2023-08-20 21:35:16 -05:00
|
|
|
|
2023-09-07 09:03:55 -05:00
|
|
|
cp -r zsh-files/.oh-my-zsh ~/
|
|
|
|
cp -r zsh-files/.zkbd ~/
|
|
|
|
cp zsh-files/.zshrc ~/
|
|
|
|
|
|
|
|
chsh -s $(which zsh)
|