timeshift: patch timeshift-launcher with escapeShellArg instead of a patch file

+4 -30
-26
pkgs/applications/backup/timeshift/timeshift-launcher.patch
··· 1 - diff --git a/src/timeshift-launcher b/src/timeshift-launcher 2 - index 29b8fc4..5f6cb17 100755 3 - --- a/src/timeshift-launcher 4 - +++ b/src/timeshift-launcher 5 - @@ -1,6 +1,6 @@ 6 - #!/bin/bash 7 - 8 - -app_command='timeshift-gtk' 9 - +app_command=''"$(realpath "$(dirname "$0")")"'/timeshift-gtk' 10 - 11 - if [ "$(id -u)" -eq 0 ]; then 12 - # user is admin 13 - @@ -14,11 +14,11 @@ else 14 - # script is running in non-interactive mode 15 - if [ "$XDG_SESSION_TYPE" = "wayland" ] ; then 16 - xhost +SI:localuser:root 17 - - pkexec ${app_command} 18 - + pkexec env DISPLAY="$DISPLAY" XAUTHORITY="$XAUTHORITY" "${app_command}" 19 - xhost -SI:localuser:root 20 - xhost 21 - elif command -v pkexec >/dev/null 2>&1; then 22 - - pkexec ${app_command} 23 - + pkexec env DISPLAY="$DISPLAY" XAUTHORITY="$XAUTHORITY" "${app_command}" 24 - elif command -v sudo >/dev/null 2>&1; then 25 - x-terminal-emulator -e "sudo ${app_command}" 26 - elif command -v su >/dev/null 2>&1; then
+4 -4
pkgs/applications/backup/timeshift/unwrapped.nix
··· 26 26 hash = "sha256-2qNLgUZLMcfoemdLvvjdkR7Ln5loSKGqbd402y5Id8k="; 27 27 }; 28 28 29 - patches = [ 30 - ./timeshift-launcher.patch 31 - ]; 32 - 33 29 postPatch = '' 34 30 for FILE in src/Core/Main.vala src/Utility/Device.vala; do 35 31 substituteInPlace "$FILE" \ ··· 38 34 39 35 substituteInPlace ./src/Utility/IconManager.vala \ 40 36 --replace-fail "/usr/share" "$out/share" 37 + 38 + substituteInPlace ./src/timeshift-launcher \ 39 + --replace-fail "app_command='timeshift-gtk'" ${lib.escapeShellArg ''app_command="$(realpath "$(dirname "$0")")/timeshift-gtk"''} \ 40 + --replace-fail ${lib.escapeShellArg ''pkexec ''${app_command}''} ${lib.escapeShellArg ''pkexec env DISPLAY="$DISPLAY" XAUTHORITY="$XAUTHORITY" "''${app_command}"''} 41 41 ''; 42 42 43 43 nativeBuildInputs = [