shellcheck: prevent globbing and word splitting in package shell scripts

This commit is contained in:
Otto Sabart 2022-08-25 21:00:00 +02:00
parent c3b97e6728
commit acd341426a
No known key found for this signature in database
GPG Key ID: 823BAE99F8BE1E3C
7 changed files with 22 additions and 22 deletions

View File

@ -60,18 +60,18 @@ let
buildInputs = [ python ]; buildInputs = [ python ];
buildCommand = '' buildCommand = ''
cp --no-preserve=mode -r ${src}/${name} $out cp --no-preserve=mode -r '${src}/${name}' "$out"
cd $out cd "$out"
${lib.optionalString (plugin ? patchRequirements) '' ${lib.optionalString (plugin ? patchRequirements) ''
substituteInPlace requirements.txt ${plugin.patchRequirements} substituteInPlace requirements.txt ${plugin.patchRequirements}
''} ''}
# Check that requirements are met # Check that requirements are met
PYTHONPATH=${toString python}/${python.sitePackages} \ PYTHONPATH='${toString python}/${python.sitePackages}' \
${pkgs.python3Packages.pip}/bin/pip install -r requirements.txt --no-cache --no-index ${pkgs.python3Packages.pip}/bin/pip install -r requirements.txt --no-cache --no-index
chmod +x ${script} chmod +x '${script}'
patchShebangs ${script} patchShebangs '${script}'
''; '';
passthru.path = "${drv}/${script}"; passthru.path = "${drv}/${script}";

View File

@ -39,8 +39,8 @@ let self = stdenvNoCC.mkDerivation {
--exclude=/{screenshots,'*.Dockerfile'} \ --exclude=/{screenshots,'*.Dockerfile'} \
$dest $dest
makeWrapper ${self.nodejsRuntime}/bin/node $out/bin/cl-rest \ makeWrapper ${self.nodejsRuntime}/bin/node "$out/bin/cl-rest" \
--add-flags $dest/cl-rest.js --add-flags "$dest/cl-rest.js"
runHook postInstall runHook postInstall
''; '';

View File

@ -34,14 +34,14 @@ stdenv.mkDerivation {
buildInputs = [ pythonEnv ]; buildInputs = [ pythonEnv ];
installPhase = '' installPhase = ''
mkdir -p $out/bin mkdir -p "$out/bin"
# add-utxo.py -> bin/jm-add-utxo # add-utxo.py -> bin/jm-add-utxo
cpBin() { cpBin() {
cp scripts/$1 $out/bin/jm-''${1%.py} cp "scripts/$1" "$out/bin/jm-''${1%.py}"
} }
cp scripts/joinmarketd.py $out/bin/joinmarketd cp scripts/joinmarketd.py "$out/bin/joinmarketd"
cpBin add-utxo.py cpBin add-utxo.py
cpBin convert_old_wallet.py cpBin convert_old_wallet.py
cpBin receive-payjoin.py cpBin receive-payjoin.py
@ -52,17 +52,17 @@ stdenv.mkDerivation {
cpBin yg-privacyenhanced.py cpBin yg-privacyenhanced.py
cpBin genwallet.py cpBin genwallet.py
chmod +x -R $out/bin chmod +x -R "$out/bin"
patchShebangs $out/bin patchShebangs "$out/bin"
## ob-watcher ## ob-watcher
obw=$out/libexec/joinmarket-ob-watcher obw=$out/libexec/joinmarket-ob-watcher
install -D scripts/obwatch/ob-watcher.py $obw/ob-watcher install -D scripts/obwatch/ob-watcher.py "$obw/ob-watcher"
patchShebangs $obw/ob-watcher patchShebangs "$obw/ob-watcher"
ln -s $obw/ob-watcher $out/bin/jm-ob-watcher ln -s "$obw/ob-watcher" "$out/bin/jm-ob-watcher"
# These files must be placed in the same dir as ob-watcher # These files must be placed in the same dir as ob-watcher
cp -r scripts/obwatch/{orderbook.html,sybil_attack_calculations.py,vendor} $obw cp -r scripts/obwatch/{orderbook.html,sybil_attack_calculations.py,vendor} "$obw"
''; '';
meta = with lib; { meta = with lib; {

View File

@ -5,6 +5,6 @@ stdenv.mkDerivation {
buildInputs = [ pkgs.libcap ]; buildInputs = [ pkgs.libcap ];
src = ./src; src = ./src;
installPhase = '' installPhase = ''
cp main $out cp main "$out"
''; '';
} }

View File

@ -34,8 +34,8 @@ let
}; };
src = runCommand "src" {} '' src = runCommand "src" {} ''
cp --no-preserve=mode -r ${origSrc} $out cp --no-preserve=mode -r '${origSrc}' "$out"
cd $out cd "$out"
patch -p1 < ${./release.nix.patch} patch -p1 < ${./release.nix.patch}
''; '';

View File

@ -19,7 +19,7 @@ buildPythonPackage rec {
checkInputs = [ mock pytest ]; checkInputs = [ mock pytest ];
checkPhase = '' checkPhase = ''
runHook preCheck runHook preCheck
USE_TWISTED=true py.test $out USE_TWISTED=true py.test "$out"
runHook postCheck runHook postCheck
''; '';

View File

@ -58,8 +58,8 @@ let self = stdenvNoCC.mkDerivation {
${self.nodeModules}/lib/node_modules \ ${self.nodeModules}/lib/node_modules \
$dest $dest
makeWrapper ${self.nodejsRuntime}/bin/node $out/bin/rtl \ makeWrapper ${self.nodejsRuntime}/bin/node "$out/bin/rtl" \
--add-flags $dest/rtl.js --add-flags "$dest/rtl.js"
runHook postInstall runHook postInstall
''; '';