Skip to content

Commit 190ffd3

Browse files
author
Some Watson
committed
Update install
- Use absolute paths - Update bat-extras if it has already been cloned - Fix symlink to not error if it already exists Chose to force the symlink because there might be new symlinks after a pull So I want an update to behave the same every time, which is to install all the scripts
1 parent 8b5f478 commit 190ffd3

File tree

1 file changed

+23
-23
lines changed
  • root/etc/s6-overlay/s6-rc.d/init-mod-code-server-bat-install

1 file changed

+23
-23
lines changed

root/etc/s6-overlay/s6-rc.d/init-mod-code-server-bat-install/run

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,54 +7,54 @@
77
if ! command -v zsh >/dev/null 2>&1; then
88
echo "**** zsh not installed, skipping alias setup ****"
99
else
10-
if [ -f ~/.zshrc ]; then
11-
if ! grep -q 'alias bat="batcat"' ~/.zshrc; then
10+
if [ -f /config/.zshrc ]; then
11+
if ! grep -q 'alias bat="batcat"' /config/.zshrc; then
1212
echo 'Adding alias to zsh for bat'
13-
echo 'alias bat="batcat"' >> ~/.zshrc
13+
echo 'alias bat="batcat"' >> /config/.zshrc
1414
else
1515
echo 'Alias already exists in zsh, skipping'
1616
fi
1717
else
18-
echo '~/.zshrc not found, creating one with the alias'
19-
echo 'alias bat="batcat"' > ~/.zshrc
18+
echo '/config/.zshrc not found, creating one with the alias'
19+
echo 'alias bat="batcat"' > /config/.zshrc
2020
fi
2121
fi
2222

2323
if ! command -v bash >/dev/null 2>&1; then
2424
echo "**** bash not installed, skipping alias setup ****"
2525
else
26-
if [ -f ~/.bash_profile ]; then
27-
if ! grep -q 'alias bat="batcat"' ~/.bash_profile; then
28-
echo 'Adding alias to ~/.bash_profile for bat'
29-
echo 'alias bat="batcat"' >> ~/.bash_profile
26+
if [ -f /config/.bash_profile ]; then
27+
if ! grep -q 'alias bat="batcat"' /config/.bash_profile; then
28+
echo 'Adding alias to /config/.bash_profile for bat'
29+
echo 'alias bat="batcat"' >> /config/.bash_profile
3030
else
31-
echo 'Alias already exists in ~/.bash_profile, skipping'
31+
echo 'Alias already exists in /config/.bash_profile, skipping'
3232
fi
33-
elif [ -f ~/.bashrc ]; then
34-
if ! grep -q 'alias bat="batcat"' ~/.bashrc; then
35-
echo 'Adding alias to ~/.bashrc for bat'
36-
echo 'alias bat="batcat"' >> ~/.bashrc
33+
elif [ -f /config/.bashrc ]; then
34+
if ! grep -q 'alias bat="batcat"' /config/.bashrc; then
35+
echo 'Adding alias to /config/.bashrc for bat'
36+
echo 'alias bat="batcat"' >> /config/.bashrc
3737
else
38-
echo 'Alias already exists in ~/.bashrc, skipping'
38+
echo 'Alias already exists in /config/.bashrc, skipping'
3939
fi
4040
else
41-
echo '~/.bash_profile or ~/.bashrc not found, creating one with the alias'
42-
echo 'alias bat="batcat"' > ~/.bash_profile
41+
echo '/config/.bash_profile or /config/.bashrc not found, creating one with the alias'
42+
echo 'alias bat="batcat"' > /config/.bash_profile
4343
fi
4444
fi
4545

46-
if [ -d ~/.bat-extras ]; then
47-
echo 'Bat-extras already cloned, skipping'
46+
if [ -d /config/.bat-extras ]; then
47+
echo 'Bat-extras already cloned, updating'
48+
git -C /config/.bat-extras pull
4849
else
4950
echo 'Cloning bat-extras repo'
50-
git clone https://github.com/eth-p/bat-extras.git ~/.bat-extras
51+
git clone https://github.com/eth-p/bat-extras.git /config/.bat-extras
5152
fi
5253

5354
echo 'Installing bat-extras'
54-
cd ~/.bat-extras/src
55-
chmod +x ~/.bat-extras/src/*.sh
56-
ln -s ~/.bat-extras/src/*.sh /usr/local/bin
55+
ln -sf /config/.bat-extras/src/*.sh /usr/local/bin
5756

5857
echo 'Setting permissions for bat-extras'
58+
chmod +x /config/.bat-extras/src/*.sh
5959
lsiown -R abc:abc \
6060
/config/.bat-extras

0 commit comments

Comments
 (0)