diff options
Diffstat (limited to 'irc.nix')
-rw-r--r-- | irc.nix | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/irc.nix b/irc.nix index e8bdb09..2d03c5c 100644 --- a/irc.nix +++ b/irc.nix @@ -25,9 +25,24 @@ in { name = "sojupw"; text = '' #!/bin/sh - read password - ${pkgs.apacheHttpd}/bin/htpasswd -bnBC 10 "" $password | tr -d ':\n' - echo + printf 'soju password: ' + read -rs password + printf '\nretype soju password: ' + read -rs confirmation + + file=$(mktemp) + trap 'rm $file' EXIT + htpasswd -bBC 10 $file "" $password 2> /dev/null + if htpasswd -bv $file "" $confirmation 2> /dev/null + then + printf '\nbcrypt: ' + cat $file | tr -d ':\n' + echo + exit 0 + else + printf '\nsorry, passwords do not match\n' + exit 1 + fi ''; executable = true; destination = "/bin/${name}"; |