2023-05-27 20:10:31 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
2023-06-08 21:56:34 +02:00
|
|
|
declare -a flags
|
|
|
|
|
|
|
|
|
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"
|
2023-06-02 21:52:38 +02:00
|
|
|
krisp_bin="${XDG_CONFIG_HOME:-$HOME/.config}/@PKGNAME@/@PKGVER@/modules/@PKGNAME@_krisp/@PKGNAME@_krisp.node"
|
2023-06-08 21:56:34 +02:00
|
|
|
krisp_b2=@KRISPB2@
|
2023-05-27 20:10:31 +02:00
|
|
|
|
2024-01-04 15:07:27 +01:00
|
|
|
if hash rizin &> /dev/null && [[ "${PATCH_KRISP}" == true ]]; then
|
2023-06-02 21:52:38 +02:00
|
|
|
# Patch Krisp binary to ignore signature check
|
2024-01-04 15:07:27 +01:00
|
|
|
if [[ -w "${krisp_bin}" && $(b2sum "${krisp_bin}" | head -c 128) == $krisp_b2 ]]; then
|
2023-08-30 23:56:00 +02:00
|
|
|
addr=$(rz-find -x '4881ec00010000' "${krisp_bin}" | head -n1)
|
|
|
|
rizin -q -w -c "s $addr + 0x30 ; wao nop" "${krisp_bin}" &> /dev/null
|
2023-06-02 21:52:38 +02:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2024-01-04 15:07:27 +01:00
|
|
|
if [[ -w "${flags_file}" ]]; then
|
|
|
|
# Replacing because old flag does not work
|
2023-06-02 21:52:38 +02:00
|
|
|
if grep -q '\--ignore-gpu-blacklist' "${flags_file}"; then
|
2023-05-28 23:55:52 +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
|
|
|
|
|
2023-06-08 21:56:34 +02:00
|
|
|
unset flags_file krisp_bin krisp_b2
|
|
|
|
|
|
|
|
|
2023-11-09 16:57:54 +01:00
|
|
|
exec /usr/lib/@ELECTRON@/electron \
|
2023-05-27 20:10:31 +02:00
|
|
|
/usr/lib/@PKGNAME@/app.asar \
|
|
|
|
--ozone-platform-hint=auto \
|
|
|
|
"${flags[@]}" "$@"
|