Skip to content

Commit f4bb5c1

Browse files
committed
fix: in codeflare launcher, don't install linux electron deps for cli execution
1 parent 2c6ea39 commit f4bb5c1

File tree

1 file changed

+23
-22
lines changed

1 file changed

+23
-22
lines changed

bin/codeflare

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -92,28 +92,6 @@ fi
9292
# This points the headless->electron launcher to our Electron
9393
export KUI_ELECTRON_HOME="${KUI_ELECTRON_HOME-$NODE}"
9494

95-
# Linux may not have the prereqs needed to run Electron
96-
if [ ! -f ~/.codeflare ] && [ $(uname) = Linux ]; then
97-
if [ $(grep '^ID_LIKE' /etc/os-release) = "ID_LIKE=debian" ]; then
98-
if [ $(apt -qq list sudo curl libx11-6 libglib2.0-0 libx11-xcb1 libxcb-dri3-0 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxi6 libxtst6 libnss3 libatk1.0-0 libdrm2 libgbm1 libatk-bridge2.0-0 libgdk-pixbuf2.0-0 libgtk-3-0 libasound2 | grep installed 2> /dev/null | wc -l) != 20 ]; then
99-
# it's also possible we didn't see these in the list, because we have an out-of-date package list
100-
# so apt update to refresh that, then recheck
101-
apt update
102-
if [ $(apt -qq list sudo curl libx11-6 libglib2.0-0 libx11-xcb1 libxcb-dri3-0 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxi6 libxtst6 libnss3 libatk1.0-0 libdrm2 libgbm1 libatk-bridge2.0-0 libgdk-pixbuf2.0-0 libgtk-3-0 libasound2 | grep installed 2> /dev/null | wc -l) != 20 ]; then
103-
# we really don't have them installed, so install them
104-
apt install -y sudo curl libx11-6 libglib2.0-0 libx11-xcb1 libxcb-dri3-0 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxi6 libxtst6 libnss3 libatk1.0-0 libdrm2 libgbm1 libatk-bridge2.0-0 libgdk-pixbuf2.0-0 libgtk-3-0 libasound2
105-
touch ~/.codeflare
106-
else
107-
touch ~/.codeflare
108-
fi
109-
else
110-
touch ~/.codeflare
111-
fi
112-
else
113-
touch ~/.codeflare
114-
fi
115-
fi
116-
11795
if [ $# = 1 ] && [ "$1" = "-v" ] || [ "$1" = "--version" ]; then
11896
shift
11997
args=(version)
@@ -147,11 +125,34 @@ if [ -n "$do_cli" ]; then
147125
# using electron as the nodejs binary (this is what
148126
# ELECTRON_RUN_AS_NODE does for us)
149127
export ELECTRON_RUN_AS_NODE=true
128+
export MWSTORE="$GUIDEBOOK_STORE"
150129
exec "$NODE" \
151130
--experimental-specifier-resolution=node --no-warnings --experimental-import-meta-resolve \
152131
"$HEADLESS"/../../node_modules/madwizard/bin/madwizard.js \
153132
$*
154133
fi
155134

135+
# Linux may not have the prereqs needed to run Electron
136+
if [ ! -f ~/.codeflare ] && [ $(uname) = Linux ]; then
137+
if [ $(grep '^ID_LIKE' /etc/os-release) = "ID_LIKE=debian" ]; then
138+
if [ $(apt -qq list sudo curl libx11-6 libglib2.0-0 libx11-xcb1 libxcb-dri3-0 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxi6 libxtst6 libnss3 libatk1.0-0 libdrm2 libgbm1 libatk-bridge2.0-0 libgdk-pixbuf2.0-0 libgtk-3-0 libasound2 | grep installed 2> /dev/null | wc -l) != 20 ]; then
139+
# it's also possible we didn't see these in the list, because we have an out-of-date package list
140+
# so apt update to refresh that, then recheck
141+
apt update
142+
if [ $(apt -qq list sudo curl libx11-6 libglib2.0-0 libx11-xcb1 libxcb-dri3-0 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxi6 libxtst6 libnss3 libatk1.0-0 libdrm2 libgbm1 libatk-bridge2.0-0 libgdk-pixbuf2.0-0 libgtk-3-0 libasound2 | grep installed 2> /dev/null | wc -l) != 20 ]; then
143+
# we really don't have them installed, so install them
144+
apt install -y sudo curl libx11-6 libglib2.0-0 libx11-xcb1 libxcb-dri3-0 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxi6 libxtst6 libnss3 libatk1.0-0 libdrm2 libgbm1 libatk-bridge2.0-0 libgdk-pixbuf2.0-0 libgtk-3-0 libasound2
145+
touch ~/.codeflare
146+
else
147+
touch ~/.codeflare
148+
fi
149+
else
150+
touch ~/.codeflare
151+
fi
152+
else
153+
touch ~/.codeflare
154+
fi
155+
fi
156+
156157
# otherwise, we launch the UI version
157158
exec "$NODE" "$HEADLESS"/codeflare.min.js -- $args 3>&1 1>&2 2>&3 3>&- | grep -v WebSwapCGLLayer

0 commit comments

Comments
 (0)