Make git-annex enable-tor work when using the linux standalone build

Clean the standalone environment before running the su command
to run "sh". Otherwise, PATH leaked through, causing it to run
git-annex.linux/bin/sh, but GIT_ANNEX_DIR was not set,
which caused that script to not work:

[2022-10-26 15:07:02.145466106] (Utility.Process) process [938146] call: pkexec ["sh","-c","cd '/home/joey/tmp/git-annex.linux/r' && '/home/joey/tmp/git-annex.linux/git-annex' 'enable-tor' '1000'"]
/home/joey/tmp/git-annex.linux/bin/sh: 4: exec: /exe/sh: not found

Changed programPath to not use GIT_ANNEX_PROGRAMPATH,
but instead run the scripts at the top of GIT_ANNEX_DIR.
That works both when the standalone environment is set up, and when it's
not.

Sponsored-by: Kevin Mueller on Patreon
This commit is contained in:
Joey Hess 2022-10-26 15:44:06 -04:00
parent a8ce8ac75d
commit 14f7a386f0
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
9 changed files with 48 additions and 35 deletions

View file

@ -164,8 +164,6 @@ installLinkerShim top linker exe = do
createSymbolicLink (fromRawFilePath link) (top </> exelink)
writeFile exe $ unlines
[ "#!/bin/sh"
, "GIT_ANNEX_PROGRAMPATH=\"$0\""
, "export GIT_ANNEX_PROGRAMPATH"
, "exec \"$GIT_ANNEX_DIR/" ++ exelink ++ "\" --library-path \"$GIT_ANNEX_LD_LIBRARY_PATH\" \"$GIT_ANNEX_DIR/shimmed/" ++ base ++ "/" ++ base ++ "\" \"$@\""
]
modifyFileMode (toRawFilePath exe) $ addModes executeModes