1
0
mirror of https://github.com/rlister/dockerfiles.git synced 2025-12-12 17:26:15 +00:00
Files
rlister-dockerfiles/htpasswd/htpasswd.sh
Richard Lister 9bb012b4c2 add htpasswd
2015-01-21 00:43:36 -05:00

15 lines
272 B
Bash

#!/bin/sh
## make sure output dir exists
dir=$(dirname $OUTPUT)
if [ ! -d $dir ] ; then
mkdir -p $dir
fi
## loop user:pass args
for arg in $* ; do
user=$(echo ${arg%%:*})
pass=$(echo ${arg##*:})
printf "${user}:$(openssl passwd -$CRYPT $pass)\n" >> $OUTPUT
done