mpvScripts.buildLua: extraScripts support directories, preserve mode

This commit is contained in:
nicoo 2023-12-31 10:57:13 +00:00
parent aa606b10cc
commit c6c0062b2c
3 changed files with 7 additions and 5 deletions

View File

@ -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";
@ -56,8 +59,8 @@ lib.makeOverridable (args: stdenvNoCC.mkDerivation (extendedBy
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

View File

@ -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/"
'';

View File

@ -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" ];