Fix #349: pre-extraction script execution in combination with --notemp

- MS_Preextract uses basename of pre-extraction script to run it
- New test case to verify the fix in test/preextracttest
This commit is contained in:
Vladislav Ermolaev
2025-10-15 18:26:07 -04:00
committed by Stéphane Peter
parent 6a29bfb15a
commit a9d64f31b9
2 changed files with 14 additions and 1 deletions

View File

@@ -327,7 +327,8 @@ MS_Preextract()
echo "\$preextract" | base64 -d > "\$prescript"
chmod a+x "\$prescript"
(cd "\$tmpdir"; eval "\"\$prescript\" \$scriptargs \"\\\$@\""); res=\$?
prescript_basename=\$(basename "\$prescript")
(cd "\$tmpdir"; eval "\"./\$prescript_basename\" \$scriptargs \"\\\$@\""); res=\$?
rm -f "\$prescript"
if test \$res -ne 0; then

View File

@@ -80,6 +80,18 @@ testPreextractArgs() {
assertEquals 0 $?
}
testPreextractNotemp() {
echo 'echo Validating pre-extraction script execution.' > preextract.sh
${SUT} --notemp --nox11 --preextract preextract.sh src src_notemp.sh alabel ./startup.sh
assertEquals 0 $?
./src_notemp.sh
assertEquals 0 $?
./src_notemp.sh | grep -qF 'Validating pre-extraction script execution.'
assertEquals 0 $?
}
testPreextractEnvPassing() {
# imitate user input
echo 'echo "export INSTALLATION_DIR=/usr/bin" > preextract.env' > preextract.sh