Skip to content

Commit 7c33f5f

Browse files
authored
fix: Chrome and Decktape installation scripts (#39)
1 parent a430b22 commit 7c33f5f

File tree

4 files changed

+50
-7
lines changed

4 files changed

+50
-7
lines changed

.github/.devcontainer/chrome/install.sh

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,31 @@ elif [ "${USERNAME}" = "none" ] || ! id -u "${USERNAME}" >/dev/null 2>&1; then
3636
USERNAME=root
3737
fi
3838

39+
apt_get_update() {
40+
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
41+
echo "Running apt-get update..."
42+
apt-get update -y
43+
fi
44+
}
45+
46+
# Checks if packages are installed and installs them if not
47+
check_packages() {
48+
if ! dpkg -s "$@" >/dev/null 2>&1; then
49+
apt_get_update
50+
apt-get -y install --no-install-recommends "$@"
51+
fi
52+
}
53+
3954
install_chrome() {
40-
local arch="$(dpkg --print-architecture)"
55+
local arch="$1"
4156
check_packages wget gnupg
4257
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
4358
echo "deb [arch=${arch}] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google.list
4459
check_packages google-chrome-stable
4560
}
4661

62+
install_chrome ${arch}
63+
4764
apt-get clean && rm -rf /var/lib/apt/lists/*
65+
66+
echo "Done!"

.github/.devcontainer/decktape/install.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,21 @@ elif [ "${USERNAME}" = "none" ] || ! id -u "${USERNAME}" >/dev/null 2>&1; then
3030
USERNAME=root
3131
fi
3232

33+
apt_get_update() {
34+
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
35+
echo "Running apt-get update..."
36+
apt-get update -y
37+
fi
38+
}
39+
40+
# Checks if packages are installed and installs them if not
41+
check_packages() {
42+
if ! dpkg -s "$@" >/dev/null 2>&1; then
43+
apt_get_update
44+
apt-get -y install --no-install-recommends "$@"
45+
fi
46+
}
47+
3348
install_decktape() {
3449
local version=$1
3550
local url="https://deb.nodesource.com/setup_${version}.x "
@@ -39,4 +54,8 @@ install_decktape() {
3954
npm install -g decktape
4055
}
4156

57+
install_decktape ${VERSION}
58+
4259
apt-get clean && rm -rf /var/lib/apt/lists/*
60+
61+
echo "Done!"

.github/.devcontainer/tinytex/install.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,16 @@ check_packages() {
4949
fi
5050
}
5151

52-
echo "Installing TinyTeX..."
53-
check_packages libfontconfig
54-
# su "${USERNAME}" -c 'quarto install tinytex --quiet'
55-
check_packages curl ca-certificates
56-
su "${USERNAME}" -c 'curl -sL "https://yihui.org/tinytex/install-bin-unix.sh" | sh'
57-
echo "TinyTeX installation complete."
52+
install_tinytex() {
53+
echo "Installing TinyTeX..."
54+
check_packages libfontconfig
55+
# su "${USERNAME}" -c 'quarto install tinytex --quiet'
56+
check_packages curl ca-certificates
57+
su "${USERNAME}" -c 'curl -sL "https://yihui.org/tinytex/install-bin-unix.sh" | sh'
58+
echo "TinyTeX installation complete."
59+
}
60+
61+
install_tinytex
5862

5963
apt-get clean && rm -rf /var/lib/apt/lists/*
6064

.github/workflows/devcontainer.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ jobs:
9494
ANNOTATION_URL: ${{ github.server_url }}/${{ github.repository }}
9595
ANNOTATION_LICENSE: "MIT"
9696
- name: Test Dev Container
97+
if: ${{ github.event_name == 'release' }}
9798
env:
9899
QUARTO_VERSION: ${{ matrix.QUARTO_VERSION }}
99100
run: |

0 commit comments

Comments
 (0)