|
7 | 7 | if ! command -v zsh >/dev/null 2>&1; then |
8 | 8 | echo "**** zsh not installed, skipping alias setup ****" |
9 | 9 | 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 |
12 | 12 | echo 'Adding alias to zsh for bat' |
13 | | - echo 'alias bat="batcat"' >> ~/.zshrc |
| 13 | + echo 'alias bat="batcat"' >> /config/.zshrc |
14 | 14 | else |
15 | 15 | echo 'Alias already exists in zsh, skipping' |
16 | 16 | fi |
17 | 17 | 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 |
20 | 20 | fi |
21 | 21 | fi |
22 | 22 |
|
23 | 23 | if ! command -v bash >/dev/null 2>&1; then |
24 | 24 | echo "**** bash not installed, skipping alias setup ****" |
25 | 25 | 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 |
30 | 30 | else |
31 | | - echo 'Alias already exists in ~/.bash_profile, skipping' |
| 31 | + echo 'Alias already exists in /config/.bash_profile, skipping' |
32 | 32 | 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 |
37 | 37 | else |
38 | | - echo 'Alias already exists in ~/.bashrc, skipping' |
| 38 | + echo 'Alias already exists in /config/.bashrc, skipping' |
39 | 39 | fi |
40 | 40 | 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 |
43 | 43 | fi |
44 | 44 | fi |
45 | 45 |
|
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 |
48 | 49 | else |
49 | 50 | 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 |
51 | 52 | fi |
52 | 53 |
|
53 | 54 | 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 |
57 | 56 |
|
58 | 57 | echo 'Setting permissions for bat-extras' |
| 58 | +chmod +x /config/.bat-extras/src/*.sh |
59 | 59 | lsiown -R abc:abc \ |
60 | 60 | /config/.bat-extras |
0 commit comments