23 lines
417 B
Bash
Executable File
23 lines
417 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# Check we got users
|
|
if [ ! -f 'users.txt' ] ; then
|
|
echo "Missing file users.txt"
|
|
exit -1
|
|
fi
|
|
|
|
|
|
# Generate passwords if not done yet
|
|
function genPassowrd () {
|
|
tr -dc A-Za-z0-9 </dev/urandom | head -c $1
|
|
}
|
|
|
|
if [ ! -f 'passwords.txt' ] ; then
|
|
for user in $(cat users.txt) ; do
|
|
echo $user $(genPassowrd 10) >> passwords.txt
|
|
done
|
|
fi
|
|
|
|
# Start watever the container should be doing
|
|
$@
|