summaryrefslogtreecommitdiffstats
path: root/lass/5pkgs/mk_sql_pair
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2016-06-06 17:17:07 +0200
committertv <tv@krebsco.de>2016-06-06 17:17:07 +0200
commitdda2887e2cf618a7c7744bee2eed806e3a38fe36 (patch)
tree19ad3210a2b8485ac22d26f75b2e2493d3f61596 /lass/5pkgs/mk_sql_pair
parentc1c645b545b960eb639fc6d41dfa35ee187ae164 (diff)
parent7e344c0627a266685ef1ad79f5193b4e7ba27408 (diff)
Merge remote-tracking branch 'cloudkrebs/master'
Diffstat (limited to 'lass/5pkgs/mk_sql_pair')
-rw-r--r--lass/5pkgs/mk_sql_pair/default.nix19
1 files changed, 19 insertions, 0 deletions
diff --git a/lass/5pkgs/mk_sql_pair/default.nix b/lass/5pkgs/mk_sql_pair/default.nix
new file mode 100644
index 000000000..738a8daf6
--- /dev/null
+++ b/lass/5pkgs/mk_sql_pair/default.nix
@@ -0,0 +1,19 @@
+{ pkgs, ... }:
+
+pkgs.writeScriptBin "mk_sql_pair" ''
+ #!/bin/sh
+
+ name=$1
+ password=$2
+
+ if [ $# -ne 2 ]; then
+ echo '$1=name, $2=password'
+ exit 23;
+ fi
+
+ cat <<EOF
+ create database $name;
+ create user $name;
+ grant all on $name.* to $name@'localhost' identified by '$password';
+ EOF
+''