home-automation-home-assistant/scripts/create-secrets-skel.sh
2019-10-13 11:25:14 +02:00

24 line
424 B
Bash
Executable File

#!/usr/bin/env bash
DIR=$(dirname "$(readlink -f "$0")")
SECRETS_FILE="$DIR/../secrets.yaml"
SKEL_FILE="$SECRETS_FILE.skel"
if [ ! -f $SECRETS_FILE ]; then
echo "File missing: \"$SECRETS_FILE\""
exit 1
fi
touch $SKEL_FILE
echo "" > $SKEL_FILE
while read LINE; do
# do nothing with empty lines
if [[ $LINE = *:* ]]; then
LINE="${LINE%%:*}: "
fi
echo "$LINE" >> $SKEL_FILE
done < $SECRETS_FILE