Skip to content

Commit aa47169

Browse files
authored
improve electron deployment
1 parent f517a55 commit aa47169

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

useful-tools/quick-sharun.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ _determine_what_to_deploy() {
310310
if grep -aoq -m 1 'disable-gpu-sandbox' "$bin" \
311311
&& grep -aoq -m 1 'no-zygote-sandbox' "$bin"; then
312312
DEPLOY_ELECTRON=${DEPLOY_ELECTRON:-1}
313+
ELECTRON_BIN=$(readlink -f "$bin")
313314
fi
314315
fi
315316

@@ -684,6 +685,11 @@ _make_deployment_array() {
684685
"$LIB_DIR"/libnss*.so* \
685686
"$LIB_DIR"/libsoftokn3.so* \
686687
"$LIB_DIR"/libfreeblpriv3.so*
688+
# electron has a resources directory that may have binaries
689+
d="$ELECTRON_BIN"/resources
690+
if [ -d "$d" ]; then
691+
set -- $(find "$d" -type f ! -name '*.so*')
692+
fi
687693
fi
688694
if [ "$DEPLOY_P11KIT" = 1 ]; then
689695
_echo "* Deploying p11kit"
@@ -1889,11 +1895,21 @@ EOF
18891895
# wrap any executable in lib with sharun
18901896
for b in $(find "$APPDIR"/shared/lib/ -type f ! -name '*.so*'); do
18911897
if [ -x "$b" ] && [ -x "$APPDIR"/shared/bin/"${b##*/}" ]; then
1892-
ln -f "$APPDIR"/sharun "$b"
1898+
rm -f "$b"
1899+
ln "$APPDIR"/sharun "$b"
18931900
_echo "* Wrapped lib executable '$b' with sharun"
18941901
fi
18951902
done
18961903

1904+
# do the same for possible nested binaries in bin
1905+
for b in $(find "$APPDIR"/bin/*/ -type f ! -name '*.so*')
1906+
if [ -x "$b" ] && [ -x "$APPDIR"/shared/bin/"${b##*/}" ]; then
1907+
rm -f "$b"
1908+
ln "$APPDIR"/sharun "$b"
1909+
_echo "* Wrapped nested bin executable '$b' with sharun"
1910+
fi
1911+
done
1912+
18971913
# make sure the .env has all the "unset" last, due to a bug in the dotenv
18981914
# library used by sharun all the unsets have to be declared last in the .env
18991915
if [ -f "$APPENV" ]; then

0 commit comments

Comments
 (0)