shell: use writeDash

This commit is contained in:
tv 2017-06-30 04:56:21 +02:00
parent dbe4cc21e3
commit a2ea8740a4

View File

@ -4,8 +4,7 @@
slib = import ./lib; slib = import ./lib;
# usage: deploy system=SYSTEM [target=TARGET] # usage: deploy system=SYSTEM [target=TARGET]
cmds.deploy = pkgs.writeScript "cmds.deploy" /* sh */ '' cmds.deploy = pkgs.writeDash "cmds.deploy" ''
#! ${pkgs.dash}/bin/dash
set -efu set -efu
command=deploy command=deploy
@ -17,8 +16,7 @@
''; '';
# usage: test system=SYSTEM target=TARGET # usage: test system=SYSTEM target=TARGET
cmds.test = pkgs.writeScript "cmds.test" /* sh */ '' cmds.test = pkgs.writeDash "cmds.test" /* sh */ ''
#! ${pkgs.dash}/bin/dash
set -efu set -efu
command=test command=test
@ -65,8 +63,7 @@
fi fi
fi fi
'' // { '' // {
parsetarget = pkgs.writeScript "init.env.parsetarget" /* sh */ '' parsetarget = pkgs.writeDash "init.env.parsetarget" ''
#! ${pkgs.dash}/bin/dash
set -efu set -efu
exec ${pkgs.jq}/bin/jq \ exec ${pkgs.jq}/bin/jq \
-enr \ -enr \
@ -86,8 +83,7 @@
} }
''; '';
}; };
populate = pkgs.writeScript "init.env.populate" /* sh */ '' populate = pkgs.writeDash "init.env.populate" ''
#! ${pkgs.dash}/bin/dash
set -efu set -efu
${pkgs.nix}/bin/nix-instantiate \ ${pkgs.nix}/bin/nix-instantiate \
--eval \ --eval \
@ -102,8 +98,7 @@
"$target_user@$target_host:$target_port$target_path" \ "$target_user@$target_host:$target_port$target_path" \
>&2 >&2
''; '';
proxy = pkgs.writeScript "init.env.proxy" /* sh */ '' proxy = pkgs.writeDash "init.env.proxy" ''
#! ${pkgs.dash}/bin/dash
set -efu set -efu
q() { q() {
${pkgs.jq}/bin/jq -nr --arg x "$*" '$x | @sh "\(.)"' ${pkgs.jq}/bin/jq -nr --arg x "$*" '$x | @sh "\(.)"'
@ -124,8 +119,7 @@
''; '';
}; };
utils.build = pkgs.writeScript "utils.build" /* sh */ '' utils.build = pkgs.writeDash "utils.build" ''
#! ${pkgs.dash}/bin/dash
set -efu set -efu
expr=$1 expr=$1
shift shift
@ -140,8 +134,7 @@
${pkgs.whatsupnix}/bin/whatsupnix ${pkgs.whatsupnix}/bin/whatsupnix
''; '';
utils.deploy = pkgs.writeScript "utils.deploy" /* sh */ '' utils.deploy = pkgs.writeDash "utils.deploy" ''
#! ${pkgs.dash}/bin/dash
set -efu set -efu
PATH=/run/current-system/sw/bin nixos-rebuild \ PATH=/run/current-system/sw/bin nixos-rebuild \
switch \ switch \
@ -153,8 +146,7 @@
${pkgs.whatsupnix}/bin/whatsupnix ${pkgs.whatsupnix}/bin/whatsupnix
''; '';
hook.get-version = pkgs.writeScript "hook.get-version" /* sh */ '' hook.get-version = pkgs.writeDash "hook.get-version" ''
#! ${pkgs.dash}/bin/dash
set -efu set -efu
version=git.$(${pkgs.git}/bin/git describe --always --dirty) version=git.$(${pkgs.git}/bin/git describe --always --dirty)
case $version in (*-dirty) case $version in (*-dirty)