home-automation-home-assistant/scripts/create-secrets-skel.sh

24 řádky
424 B
Bash
Surový Normální zobrazení Historie

2019-10-13 00:40:29 +00:00
#!/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