mirror of https://git.envs.net/envs/ops.git
changes for json pretty print output
This commit is contained in:
parent
3842c7ce05
commit
69074c62c9
|
@ -80,7 +80,7 @@ print_pkg_version() {
|
|||
for pkg in $(dpkg-query -f '${binary:Package}\n' -W); do
|
||||
pkg_version="$(dpkg-query -f '${Version}\n' -W "$pkg")"
|
||||
|
||||
printf '\t\t\t"%s": "%s",\n' "$pkg" "$pkg_version"
|
||||
printf ' "%s": "%s",\n' "$pkg" "$pkg_version"
|
||||
done
|
||||
}
|
||||
|
||||
|
@ -332,17 +332,17 @@ probably! send an email with your suggestion to <a href="mailto:sudoers@$DOMAIN"
|
|||
</pre>
|
||||
<br />
|
||||
$(print_category 'services' "${sorted_services[@]}")
|
||||
<br />
|
||||
<p></p>
|
||||
$(print_category 'shells' "${sorted_shells[@]}")
|
||||
<br />
|
||||
<p></p>
|
||||
$(print_category 'editors' "${sorted_editors[@]}")
|
||||
<br />
|
||||
<p></p>
|
||||
$(print_category 'online_browser_and_clients' "${sorted_inet_clients[@]}")
|
||||
<br />
|
||||
<p></p>
|
||||
$(print_category 'coding_packages' "${sorted_coding_pkg[@]}")
|
||||
<br />
|
||||
<p></p>
|
||||
$(print_category 'coding_tools' "${sorted_coding_tools[@]}")
|
||||
<br />
|
||||
<p></p>
|
||||
$(print_category 'misc' "${sorted_misc[@]}")
|
||||
</div>
|
||||
|
||||
|
|
|
@ -55,9 +55,8 @@ EOM
|
|||
"home": "$USER_HOME",
|
||||
"email": "$USERNAME@$DOMAIN",
|
||||
EOM
|
||||
# desc / irc / matrix
|
||||
if [ -f "$INFO_FILE" ]; then
|
||||
# desc
|
||||
if [ -f "$INFO_FILE" ]; then
|
||||
desc="$(sed -n '/^desc=/{s#^.*=##;p}' "$INFO_FILE")"
|
||||
if [ -z "$desc" ] || [ "$desc" == 'a short describtion or message' ]; then
|
||||
cat << EOM >> "$TMP_JSON"
|
||||
|
@ -68,34 +67,9 @@ EOM
|
|||
"desc": "$desc",
|
||||
EOM
|
||||
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
|
||||
cat << EOM >> "$TMP_JSON"
|
||||
"desc": "",
|
||||
"irc": "",
|
||||
"matrix": "",
|
||||
EOM
|
||||
fi
|
||||
# website
|
||||
|
@ -157,8 +131,7 @@ EOM
|
|||
|
||||
# check 'INFO_FILE' and add entrys to 'line_to_set' array
|
||||
while read -r LINE ; do
|
||||
if [[ -n "$LINE" ]] && ! [[ "$LINE" = '#'* ]] && ! [[ "$LINE" = 'desc='* ]] && \
|
||||
! [[ "$LINE" = 'irc='* ]] && ! [[ "$LINE" = 'matrix='* ]]; then
|
||||
if [[ -n "$LINE" ]] && ! [[ "$LINE" = '#'* ]] && ! [[ "$LINE" = 'desc='* ]]; then
|
||||
user_field="${LINE//=*/}"
|
||||
user_value="${LINE//*=/}"
|
||||
|
||||
|
@ -230,7 +203,7 @@ EOM
|
|||
"ssh-pubkey": [
|
||||
EOM
|
||||
while read -r LINE ; do
|
||||
[[ "$LINE" == 'ssh'* ]] && printf '\t\r\t\r\t\r\t\r\t"%s",\n' "$LINE" >> "$TMP_JSON"
|
||||
[[ "$LINE" == 'ssh'* ]] && printf ' "%s",\n' "$LINE" >> "$TMP_JSON"
|
||||
done < "$USER_HOME"/.ssh/authorized_keys
|
||||
# remove trailing ',' for the last pubkey
|
||||
sed -i '$ s/,$//' "$TMP_JSON"
|
||||
|
|
Loading…
Reference in New Issue