diff options
Diffstat (limited to 'home/dot_local/share/bin/executable_installbd')
| -rw-r--r-- | home/dot_local/share/bin/executable_installbd | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/home/dot_local/share/bin/executable_installbd b/home/dot_local/share/bin/executable_installbd new file mode 100644 index 0000000..ae17002 --- /dev/null +++ b/home/dot_local/share/bin/executable_installbd @@ -0,0 +1,20 @@ +#!/bin/sh +discord_path="$(dirname "$(find "$XDG_CONFIG_HOME/discord" -name core.asar)")" +discord_version="$(echo "$discord_path" | tr '/' '\n' | tac | sed -n '/^[0-9.]\+$/p' | head -n1)" +betterdiscord_path="$XDG_CONFIG_HOME/BetterDiscord/data/betterdiscord.asar" +cache_file="$XDG_CACHE_HOME/bdversion" + +if [ "$discord_path" -nt "$betterdiscord_path" ] ; then + echo "download betterdiscord.asar" + curl -sLo - 'https://betterdiscord.app/Download/betterdiscord.asar' > "$betterdiscord_path" +fi +if ! grep "$(basename "$betterdiscord_path")" "$discord_path/index.js" > /dev/null ; then + echo "patch discord desktop core index.js" + printf 'require("%s");\n%s' "$betterdiscord_path" "$(cat "$discord_path/index.js")" > "$discord_path/index.js" +fi + +# store discord version used for this install +mkdir -p "$(dirname "$cache_file")" +echo "$discord_version" > "$cache_file" + +echo "done!" |