Merge #277894: accept directories in mpvScript.buildLua's extraScripts, preserve mode

This commit is contained in:
nicoo
2024-04-29 15:58:53 +00:00
committed by GitHub
3 changed files with 8 additions and 6 deletions
@@ -2,7 +2,10 @@
, stdenvNoCC }:
let
escapedList = with lib; concatMapStringsSep " " (s: "'${escape [ "'" ] s}'");
# Escape strings for embedding in shell scripts
escaped = s: "'${lib.escape [ "'" ] s}'";
escapedList = lib.concatMapStringsSep " " escaped;
fileName = pathStr: lib.last (lib.splitString "/" pathStr);
scriptsDir = "$out/share/mpv/scripts";
@@ -50,14 +53,14 @@ lib.makeOverridable (args: stdenvNoCC.mkDerivation (extendedBy
}
[ ${with builtins; toString (length extraScripts)} -eq 0 ] || {
echo "mpvScripts.buildLua does not support 'extraScripts'" \
"when 'scriptPath' is a directory"
"when 'scriptPath' is a directory" >&2
exit 1
}
mkdir -p "${scriptsDir}"
cp -a "${scriptPath}" "${scriptsDir}/${scriptName}"
else
install -m644 -Dt "${scriptsDir}" \
${escapedList ([ scriptPath ] ++ extraScripts)}
install -m644 -Dt "${scriptsDir}" ${escaped scriptPath}
${lib.optionalString (extraScripts != []) ''cp -at "${scriptsDir}/" ${escapedList extraScripts}''}
fi
runHook postInstall
@@ -29,7 +29,6 @@ buildLua {
extraScripts = [ "c_concat.sh" ];
postInstall = ''
chmod 0755 $out/share/mpv/scripts/c_concat.sh
wrapProgram $out/share/mpv/scripts/c_concat.sh \
--run "mkdir -p ~/.config/mpv/cutter/"
'';
@@ -32,7 +32,7 @@ buildLua {
--replace 'mp.find_config_file("scripts")' "\"$out/share/mpv/scripts\""
'';
postInstall = "cp -a sponsorblock_shared $out/share/mpv/scripts/";
extraScripts = [ "sponsorblock_shared" ];
passthru.updateScript = nix-update-script {
extraArgs = [ "--version=branch" ];