2023-05-27 20:10:31 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2024-06-09 21:51:20 +02:00
|
|
|
set -euo pipefail
|
2023-05-27 20:10:31 +02:00
|
|
|
|
2023-06-08 21:56:34 +02:00
|
|
|
declare -a flags
|
2024-06-09 21:51:20 +02:00
|
|
|
declare -l PATCH_KRISP
|
2023-06-08 21:56:34 +02:00
|
|
|
|
2024-01-04 15:07:27 +01:00
|
|
|
[[ -r "${XDG_CONFIG_HOME:-$HOME/.config}/@PKGNAME@.conf" ]] && source "${XDG_CONFIG_HOME:-$HOME/.config}/@PKGNAME@.conf"
|
|
|
|
|
2023-05-27 20:10:31 +02:00
|
|
|
flags_file="${XDG_CONFIG_HOME:-$HOME/.config}/@PKGNAME@-flags.conf"
|
2024-06-09 21:51:20 +02:00
|
|
|
krisp_bin="${DISCORD_USER_DATA_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/@PKGNAME@}/@PKGVER@/modules/@PKGNAME@_krisp/@PKGNAME@_krisp.node"
|
2023-05-27 20:10:31 +02:00
|
|
|
|
2024-06-10 20:33:44 +02:00
|
|
|
if [[ "${PATCH_KRISP:-}" == true ]] && [[ -w "${krisp_bin}" ]]; then
|
|
|
|
if hash python &> /dev/null && python -c 'import capstone; import elftools' &> /dev/null; then
|
|
|
|
# Patch Krisp binary to ignore signature check
|
|
|
|
echo -n 'Running Krisp patcher... '
|
|
|
|
python /usr/lib/@PKGNAME@/krisp-patcher.py "${krisp_bin}"
|
|
|
|
fi
|
2023-06-02 21:52:38 +02:00
|
|
|
fi
|
|
|
|
|
2024-01-04 22:47:50 +01:00
|
|
|
if [[ -r "${flags_file}" ]]; then
|
2024-01-04 15:07:27 +01:00
|
|
|
# Replacing because old flag does not work
|
2024-01-04 22:47:50 +01:00
|
|
|
if [[ -w "${flags_file}" ]] && grep -q '\--ignore-gpu-blacklist' "${flags_file}"; then
|
2024-06-10 20:33:44 +02:00
|
|
|
sed -i 's|--ignore-gpu-blacklist|--ignore-gpu-blocklist|' "${flags_file}"
|
2023-06-02 21:52:38 +02:00
|
|
|
fi
|
2023-05-27 20:10:31 +02:00
|
|
|
mapfile -t < "${flags_file}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
for line in "${MAPFILE[@]}"; do
|
2023-07-13 06:40:55 +02:00
|
|
|
if [[ ! "${line}" =~ ^[[:space:]]*#.* ]] && [[ -n "${line}" ]]; then
|
2023-05-27 20:10:31 +02:00
|
|
|
flags+=("${line}")
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2024-06-09 21:51:20 +02:00
|
|
|
unset flags_file krisp_bin
|
2023-06-08 21:56:34 +02:00
|
|
|
|
|
|
|
|
2023-11-09 16:57:54 +01:00
|
|
|
exec /usr/lib/@ELECTRON@/electron \
|
2024-04-09 12:08:16 +02:00
|
|
|
/usr/lib/@PKGNAME@/resources/app.asar \
|
2023-05-27 20:10:31 +02:00
|
|
|
--ozone-platform-hint=auto \
|
|
|
|
"${flags[@]}" "$@"
|