Files
infix/board/common/rootfs/usr/bin/askpass
T
2024-08-26 20:54:49 +02:00

24 lines
388 B
Bash
Executable File

#!/bin/sh
# shellcheck disable=SC3045
OUTPUT=$1
read -r -s -p "New password: " password
>&2 echo
read -r -s -p "Retype password: " password_again
>&2 echo
if [ "$password" != "$password_again" ]; then
echo "Passwords do not match, try again."
exit 1
fi
if [ -z "$OUTPUT" ]; then
echo "$password"
exit 0
fi
umask 0177
echo "$password" | mkpasswd -s > "$OUTPUT"
exit 0