-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpowerline_install.sh
133 lines (109 loc) · 3.64 KB
/
powerline_install.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#!/bin/bash
powerline_prereq () {
source /etc/os-release
OS_VERS="${ID}"
echo "distro is $OS_VERS"
if [ -f /usr/bin/powerline ] && [ -f /usr/share/fonts/truetype/PowerlineSymbols.otf ] && [ -f /usr/bin/git ] && [ -f /usr/bin/pip3 ]; then
echo "All Powerline prerequisites are installed";
else
echo "Installing Powerline prerequisites..."
source /etc/os-release
OS_VERS="${ID}"
VERSION="$REDHAT_SUPPORT_PRODUCT_VERSION"
case $OS_VERS in
Fedora)
sudo dnf install -y \
python3-pip \
git \
powerline \
powerline-fonts
;;
rhel)
echo "distro is $OS_VERS"
sudo dnf config-manager --set-enabled crb
sudo dnf install -y \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-$(echo ${VERSION} | awk -F '.' {'print $1'}).noarch.rpm \
https://dl.fedoraproject.org/pub/epel/epel-next-release-latest-$(echo ${VERSION}| awk -F '.' {'print $1'}).noarch.rpm
sudo dnf install -y \
python3-pip \
git \
powerline \
powerline-fonts
ansible-vim
;;
rocky)
echo "distro is $OS_VERS"
#sudo dnf config-manager --set-enabled crb
sudo dnf install -y \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-${VERSION}.noarch.rpm \
https://dl.fedoraproject.org/pub/epel/epel-next-release-latest-${VERSION}.noarch.rpm
sudo dnf install -y \
python3-pip \
git \
powerline \
powerline-fonts
ansible-vim
;;
*)
echo "This script only works for rhel/fedora/rocky distros"
;;
esac
fi
}
powerline_bash () {
echo "Modifying $HOME/.bashrc..."
cat <<'EOF' >> $HOME/.bashrc
TERM=xterm-256color
powerline-daemon -q
POWERLINE_BASH_CONTINUATION=1
POWERLINE_BASH_SELECT=1
source /usr/share/powerline/bash/powerline.sh
EOF
}
powerline_vim () {
echo "Modifying $HOME/.vimrc"
cat << 'EOF' >> $HOME/.vimrc
python3 from powerline.vim import setup as powerline_setup
python3 powerline_setup()
python3 del powerline_setup
set paste
set nrformats+=alpha
set laststatus=2
EOF
}
powerline_screenrc () {
echo "Modifying $HOME/.screenrc"
cat << 'EOF' >> $HOME/.screenrc
# GNU Screen - main configuration file
# All other .screenrc files will source this file to inherit settings.
# Allow bold colors - necessary for some reason
attrcolor b ".I"
# Tell screen how to set colors. AB = background, AF=foreground
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
# Enables use of shift-PgUp and shift-PgDn
termcapinfo xterm|xterms|xs|rxvt ti@:te@
# Erase background with current bg color
defbce "on"
# Enable 256 color term
term xterm-256color
# Cache 30000 lines for scroll back
scrollback 100000
defscrollback 100000
hardstatus alwayslastline
# Very nice tabbed colored hardstatus line
hardstatus string '%{= Kd} %{= Kd}%-w%{= Kr}[%{= KW}%n %t%{= Kr}]%{= Kd}%+w %-= %{KG} %H%{KW}|%{KY}%101`%{KW}|%D %M %d %Y%{= Kc} %C%A%{-}'
# change command character from ctrl-a to ctrl-b (emacs users may want this)
#escape ^Bb
# Hide hardstatus: ctrl-a f
bind f eval "hardstatus ignore"
# Show hardstatus: ctrl-a F
bind F eval "hardstatus alwayslastline"
bind j focus down
bind k focus up
screen -t bash0
screen -t bash1
screen -t bash2
screen -t bash3
select 0
EOF
}