mirror of https://git.envs.net/envs/ops.git
envs_user_updated.sh: add irc and matrix part for `~/.envs`-file
This commit is contained in:
parent
0c209087e9
commit
2b6e1c948d
|
@ -55,10 +55,10 @@ EOM
|
||||||
"home": "$USER_HOME",
|
"home": "$USER_HOME",
|
||||||
"email": "$USERNAME@$DOMAIN",
|
"email": "$USERNAME@$DOMAIN",
|
||||||
EOM
|
EOM
|
||||||
# desc
|
# desc / irc / matrix
|
||||||
if [ -f "$INFO_FILE" ]; then
|
if [ -f "$INFO_FILE" ]; then
|
||||||
|
# desc
|
||||||
desc="$(sed -n '/^desc=/{s#^.*=##;p}' "$INFO_FILE")"
|
desc="$(sed -n '/^desc=/{s#^.*=##;p}' "$INFO_FILE")"
|
||||||
|
|
||||||
if [ -z "$desc" ] || [ "$desc" == 'a short describtion or message' ]; then
|
if [ -z "$desc" ] || [ "$desc" == 'a short describtion or message' ]; then
|
||||||
cat << EOM >> "$TMP_JSON"
|
cat << EOM >> "$TMP_JSON"
|
||||||
"desc": "",
|
"desc": "",
|
||||||
|
@ -68,9 +68,34 @@ EOM
|
||||||
"desc": "$desc",
|
"desc": "$desc",
|
||||||
EOM
|
EOM
|
||||||
fi
|
fi
|
||||||
|
# irc
|
||||||
|
irc="$(sed -n '/^irc=/{s#^.*=##;p}' "$INFO_FILE")"
|
||||||
|
if [ -z "$irc" ]; then
|
||||||
|
cat << EOM >> "$TMP_JSON"
|
||||||
|
"irc": "",
|
||||||
|
EOM
|
||||||
|
else
|
||||||
|
cat << EOM >> "$TMP_JSON"
|
||||||
|
"irc": "$irc",
|
||||||
|
EOM
|
||||||
|
fi
|
||||||
|
# matrix
|
||||||
|
matrix="$(sed -n '/^matrix=/{s#^.*=##;p}' "$INFO_FILE")"
|
||||||
|
if [ -z "$matrix" ]; then
|
||||||
|
cat << EOM >> "$TMP_JSON"
|
||||||
|
"matrix": "",
|
||||||
|
EOM
|
||||||
|
else
|
||||||
|
cat << EOM >> "$TMP_JSON"
|
||||||
|
"matrix": "$matrix",
|
||||||
|
EOM
|
||||||
|
fi
|
||||||
|
# end desc / irc / matrix
|
||||||
else
|
else
|
||||||
cat << EOM >> "$TMP_JSON"
|
cat << EOM >> "$TMP_JSON"
|
||||||
"desc": "",
|
"desc": "",
|
||||||
|
"irc": "",
|
||||||
|
"matrix": "",
|
||||||
EOM
|
EOM
|
||||||
fi
|
fi
|
||||||
# website
|
# website
|
||||||
|
@ -132,7 +157,8 @@ EOM
|
||||||
|
|
||||||
# check 'INFO_FILE' and add entrys to 'line_to_set' array
|
# check 'INFO_FILE' and add entrys to 'line_to_set' array
|
||||||
while read -r LINE ; do
|
while read -r LINE ; do
|
||||||
if [[ -n "$LINE" ]] && ! [[ "$LINE" = '#'* ]] && ! [[ "$LINE" = 'desc='* ]]; then
|
if [[ -n "$LINE" ]] && ! [[ "$LINE" = '#'* ]] && ! [[ "$LINE" = 'desc='* ]] && \
|
||||||
|
! [[ "$LINE" = 'irc='* ]] && ! [[ "$LINE" = 'matrix='* ]]; then
|
||||||
user_field="${LINE//=*/}"
|
user_field="${LINE//=*/}"
|
||||||
user_value="${LINE//*=/}"
|
user_value="${LINE//*=/}"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue