Skip to content

Commit 03ba353

Browse files
committed
Moving bat-extras from dockerfile into the v3 mod
1 parent 1fd0e08 commit 03ba353

File tree

3 files changed

+32
-30
lines changed
  • root/etc/s6-overlay/s6-rc.d
    • init-mod-code-server-bat-add-package
    • init-mod-code-server-bat-install

3 files changed

+32
-30
lines changed

Dockerfile

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,8 @@
11
# syntax=docker/dockerfile:1
22

3-
## Buildstage ##
4-
FROM ghcr.io/linuxserver/baseimage-alpine:3.20 AS buildstage
5-
6-
RUN \
7-
apk add --no-cache \
8-
bat \
9-
git \
10-
ripgrep
11-
12-
# Install bat-extras
13-
RUN git clone https://github.com/eth-p/bat-extras.git /root-layer/bat-extras
14-
WORKDIR /root-layer/bat-extras/src
15-
RUN chmod +x *.sh
16-
RUN mkdir -p /root-layer/bin
17-
RUN ln -s *.sh /root-layer/bin/
18-
19-
# copy local files
20-
COPY root/ /root-layer/
21-
22-
## Single layer deployed image ##
233
FROM scratch
244

25-
LABEL maintainer="somewatson"
5+
LABEL maintainer="username"
266

27-
# Add files from buildstage
28-
COPY --from=buildstage /root-layer/ /
7+
# copy local files
8+
COPY root/ /

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,11 @@ if ! dpkg -s bat >/dev/null 2>&1; then
1717
echo "bat" >> /mod-repo-packages-to-install.list
1818
else
1919
echo "**** bat already installed, skipping ****"
20+
fi
21+
22+
if ! dpkg -s git >/dev/null 2>&1; then
23+
echo "**** Adding git to package install list ****"
24+
echo "git" >> /mod-repo-packages-to-install.list
25+
else
26+
echo "**** git already installed, skipping ****"
2027
fi

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

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ if ! command -v zsh >/dev/null 2>&1; then
1010
else
1111
if [ -f ~/.zshrc ]; then
1212
if ! grep -q 'alias bat="batcat"' ~/.zshrc; then
13-
echo 'Adding alias for bat'
13+
echo 'Adding alias to zsh for bat'
1414
echo 'alias bat="batcat"' >> ~/.zshrc
1515
else
16-
echo 'Alias already exists, skipping'
16+
echo 'Alias already exists in zsh, skipping'
1717
fi
1818
else
1919
echo '~/.zshrc not found, creating one with the alias'
@@ -26,20 +26,35 @@ if ! command -v bash >/dev/null 2>&1; then
2626
else
2727
if [ -f ~/.bash_profile ]; then
2828
if ! grep -q 'alias bat="batcat"' ~/.bash_profile; then
29-
echo 'Adding alias for bat'
29+
echo 'Adding alias to ~/.bash_profile for bat'
3030
echo 'alias bat="batcat"' >> ~/.bash_profile
3131
else
32-
echo 'Alias already exists, skipping'
32+
echo 'Alias already exists in ~/.bash_profile, skipping'
3333
fi
3434
elif [ -f ~/.bashrc ]; then
3535
if ! grep -q 'alias bat="batcat"' ~/.bashrc; then
36-
echo 'Adding alias for bat'
36+
echo 'Adding alias to ~/.bashrc for bat'
3737
echo 'alias bat="batcat"' >> ~/.bashrc
3838
else
39-
echo 'Alias already exists, skipping'
39+
echo 'Alias already exists in ~/.bashrc, skipping'
4040
fi
4141
else
4242
echo '~/.bash_profile or ~/.bashrc not found, creating one with the alias'
4343
echo 'alias bat="batcat"' > ~/.bash_profile
4444
fi
45-
fi
45+
fi
46+
47+
48+
if [ -f ~/bat-extras/README.md ]; then
49+
echo 'Installing bat-extras'
50+
git clone https://github.com/eth-p/bat-extras.git ~/
51+
cd ~/bat-extras/src
52+
chmod +x ~/bat-extras/src/*.sh
53+
mkdir -p ~/bin
54+
ln -s ~/bat-extras/src/*.sh ~/bin
55+
else
56+
echo 'Bat-extras already installed, skipping'
57+
fi
58+
59+
60+

0 commit comments

Comments
 (0)