aboutsummaryrefslogtreecommitdiff
path: root/install.sh
diff options
context:
space:
mode:
authorVendicated <vendicated@riseup.net>2022-09-16 19:26:03 +0200
committerVendicated <vendicated@riseup.net>2022-09-16 19:26:13 +0200
commit358f77e5523df0ba78269c9682cd6d44ccc3f666 (patch)
treecf99fa93ce3781fae58b2af6d9032442c15fb316 /install.sh
parentdc6b32706a1e215fb8638cd962fe88186578525d (diff)
downloadVencord-358f77e5523df0ba78269c9682cd6d44ccc3f666.tar.gz
Vencord-358f77e5523df0ba78269c9682cd6d44ccc3f666.tar.bz2
Vencord-358f77e5523df0ba78269c9682cd6d44ccc3f666.zip
install.sh: Add support for discord_arch_electron pkg
Diffstat (limited to 'install.sh')
-rwxr-xr-xinstall.sh47
1 files changed, 39 insertions, 8 deletions
diff --git a/install.sh b/install.sh
index 0bf9336..1b938af 100755
--- a/install.sh
+++ b/install.sh
@@ -9,19 +9,50 @@
# - inside app create the files index.js and package.json.
# See the two tee commands at the end of the file for their contents
-set -e
-
patcher="$PWD/dist/patcher.js"
-dicksword="$(dirname "$(readlink "$(which discord)")")"
-resources="$dicksword/resources"
+discord_bin="$(which discord)"
+discord_actual="$(readlink "$discord_bin")"
-if [ ! -f "$resources/app.asar" ]; then
- echo "Couldn't find Discord folder rip"
- exit
+if [ -z "$discord_actual" ]; then
+ case "$(head -n1 "$discord_bin")" in
+ # 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
+resources="$discord/resources"
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
echo "app folder exists. Looks like your Discord is already modified."
exit
@@ -30,7 +61,7 @@ fi
mkdir "$app"
tee > "$app/index.js" << EOF
require("$patcher");
-require("../app.asar");
+require("../$app_asar");
EOF
tee > "$app/package.json" << EOF