forked from traefikturkey/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup_zsh.sh
executable file
·80 lines (70 loc) · 1.96 KB
/
setup_zsh.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/usr/bin/env bash
if [ -f /etc/NIXOS ]; then
echo "NixOS found, nothing to be done!"
exit 0
fi
BASE_PACKAGES="coreutils eza fzf make ssh-import-id zsh zsh-autosuggestions zsh-completions zsh-syntax-highlighting zsh-vcs"
PYTHON_PACKAGES="python3-dev python3-pip python3-setuptools"
HEADER_PACKAGES="linux-headers-generic"
OS=$(uname -s | tr A-Z a-z)
if command -v systemctl >/dev/null 2>&1; then
if systemctl status pve-cluster | grep -q "running"; then
OS=proxmox
HEADER_PACKAGES="pve-headers proxmox-default-headers"
fi
fi
PACKAGES="$BASE_PACKAGES $HEADER_PACKAGES $PYTHON_PACKAGES"
case $OS in
linux)
source /etc/os-release
case $ID in
debian|ubuntu|mint)
PACKAGES += " tldr"
if [[ "$EUID" -ne 0 ]]; then
sudo apt update
sudo apt -y install $PACKAGES
else
apt update
apt -y install $PACKAGES
fi
;;
alpine)
PACKAGES="$BASE_PACKAGES apk-tools-zsh-completion linux-headers shadow py3-pip py3-setuptools"
if [[ "$EUID" -ne 0 ]]; then
sudo apk add --update $PACKAGES
echo "auth sufficient pam_rootok.so" | sudo tee /etc/pam.d/chsh
else
apk add --update $PACKAGES
fi
;;
fedora|rhel|centos)
if [[ "$EUID" -ne 0 ]]; then
sudo yum install $PACKAGES
else
yum install $PACKAGES
fi
;;
*)
echo -n "unsupported linux distro"
;;
esac
;;
proxmox)
apt update
apt -y install $PACKAGES
;;
*)
echo -n "unsupported OS"
;;
esac
# https://stackoverflow.com/questions/68673221/warning-running-pip-as-the-root-user
# export PIP_ROOT_USER_ACTION=ignore
ssh-import-id gh:ilude
# check if we are in proxmox
if [[ "$EUID" -ne 0 ]]; then
echo Setting $(whoami) shell to $(which zsh)
sudo chsh -s $(which zsh) $(whoami)
else
echo Setting $(whoami) shell to $(which zsh)
chsh -s $(which zsh) $(whoami)
fi