install.sh: Add support for discord_arch_electron pkg

This commit is contained in:
Vendicated 2022-09-16 19:26:03 +02:00
parent dc6b32706a
commit 358f77e552
No known key found for this signature in database
GPG key ID: EC781ADFB93EFFA3
3 changed files with 42 additions and 11 deletions

View file

@ -117,7 +117,7 @@ await Promise.all([
], ],
sourcemap: false, sourcemap: false,
watch, watch,
minify: false, minify: true,
}) })
]).then(res => { ]).then(res => {
const took = performance.now() - begin; const took = performance.now() - begin;

View file

@ -9,19 +9,50 @@
# - inside app create the files index.js and package.json. # - inside app create the files index.js and package.json.
# See the two tee commands at the end of the file for their contents # See the two tee commands at the end of the file for their contents
set -e
patcher="$PWD/dist/patcher.js" patcher="$PWD/dist/patcher.js"
dicksword="$(dirname "$(readlink "$(which discord)")")" discord_bin="$(which discord)"
resources="$dicksword/resources" discord_actual="$(readlink "$discord_bin")"
if [ ! -f "$resources/app.asar" ]; then if [ -z "$discord_actual" ]; then
echo "Couldn't find Discord folder rip" case "$(head -n1 "$discord_bin")" in
exit # has shebang?
\#!/*)
# Wrapper script, assume 2nd line has exec electron call and try to match asar path
path="$(head -n2 "$discord_bin" | tail -1 | grep -Eo "/.+?/app.asar")"
if [ -e "$path" ]; then
discord="$(dirname "$path")"
else
echo "Unsupported Install at $path"
exit 1
fi
;;
*)
echo "Unsupported Install.";
exit 1
;;
esac
else
discord="$(dirname "$discord_actual")"
fi fi
resources="$discord/resources"
app="$resources/app" app="$resources/app"
app_asar="app.asar"
if [ ! -e "$resources" ]; then
if [ -e "$discord/app.asar.unpacked" ]; then
# System Electron Install
mv "$discord/app.asar" "$discord/_app.asar"
mv "$discord/app.asar.unpacked" "$discord/_app.asar.unpacked"
app="$discord/app.asar"
app_asar="_app.asar"
else
echo "Unsupported Install"
exit
fi
fi
if [ -e "$app" ]; then if [ -e "$app" ]; then
echo "app folder exists. Looks like your Discord is already modified." echo "app folder exists. Looks like your Discord is already modified."
exit exit
@ -30,7 +61,7 @@ fi
mkdir "$app" mkdir "$app"
tee > "$app/index.js" << EOF tee > "$app/index.js" << EOF
require("$patcher"); require("$patcher");
require("../app.asar"); require("../$app_asar");
EOF EOF
tee > "$app/package.json" << EOF tee > "$app/package.json" << EOF

View file

@ -5,5 +5,5 @@
set -e set -e
dicksword="$(dirname "$(readlink "$(which discord)")")" discord="$(dirname "$(readlink "$(which discord)")")"
rm -r --interactive=never "${dicksword:?Cant find discord}/resources/app" rm -r --interactive=never "${discord:?Cant find discord}/resources/app"