mirror of https://git.envs.net/envs/ops.git
envs_user_updated.sh needs some small fixes
This commit is contained in:
parent
9cab24e72f
commit
4d569d75a7
|
@ -132,11 +132,11 @@ 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='* ]]; then
|
||||||
user_field="${LINE//=*/}"
|
user_field="${LINE//=*/}"
|
||||||
user_value="${LINE//*=/}"
|
user_value="${LINE//*=/}"
|
||||||
|
|
||||||
if ! [ ":${field_exists[*]}:" =~ $user_field ]; then
|
if ! [[ ":${field_exists[*]}:" =~ $user_field ]]; then
|
||||||
# entry will be a single line
|
# entry will be a single line
|
||||||
count_entry="$(( "$count_entry" + 1 ))"; [ "$count_entry" -le '10' ] || continue
|
count_entry="$(( "$count_entry" + 1 ))"; [ "$count_entry" -le '10' ] || continue
|
||||||
field_exists+=( "$user_field" )
|
field_exists+=( "$user_field" )
|
||||||
|
@ -204,7 +204,7 @@ EOM
|
||||||
"ssh-pubkey": [
|
"ssh-pubkey": [
|
||||||
EOM
|
EOM
|
||||||
while read -r LINE ; do
|
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 '\t\r\t\r\t\r\t\r\t"%s",\n' "$LINE" >> "$TMP_JSON"
|
||||||
done < "$USER_HOME"/.ssh/authorized_keys
|
done < "$USER_HOME"/.ssh/authorized_keys
|
||||||
# remove trailing ',' for the last pubkey
|
# remove trailing ',' for the last pubkey
|
||||||
sed -i '$ s/,$//' "$TMP_JSON"
|
sed -i '$ s/,$//' "$TMP_JSON"
|
||||||
|
|
Loading…
Reference in New Issue