ice-client: set passwords via uci

This commit is contained in:
Sukru Senli 2017-07-04 13:40:05 +02:00
parent 62d773656c
commit acc3be969d

View file

@ -1,11 +1,12 @@
#!/bin/sh #!/bin/sh
grep -rq "^ice:" /etc/passwd || { grep -rq "^ice:" /etc/passwd || {
local password="$(db get hw.board.wpaKey)" adduser -D -H -s /bin/false ice
if [ -n "$password" ]; then uci -q delete passwords.ice
adduser -D -H -s /bin/false ice uci -q set passwords.ice=usertype
(echo $password; sleep 1; echo $password) | passwd ice >/dev/null 2>&1 uci -q set passwords.ice.password="\$WPAKEY"
fi uci -q add_list passwords.ice._access_r=root
uci -q commit passwords
} }
uci show rpcd | grep username=.*ice.* >/dev/null || { uci show rpcd | grep username=.*ice.* >/dev/null || {
@ -47,6 +48,7 @@ config login
list write 'juci-network-netifd' list write 'juci-network-netifd'
list write 'juci-owsd' list write 'juci-owsd'
list write 'juci-printer' list write 'juci-printer'
list write 'juci-realtime-graphs'
list write 'juci-samba' list write 'juci-samba'
list write 'juci-sfp' list write 'juci-sfp'
list write 'juci-snmpd' list write 'juci-snmpd'
@ -56,6 +58,7 @@ config login
list write 'juci-usb' list write 'juci-usb'
list write 'core' list write 'core'
list write 'unauthenticated' list write 'unauthenticated'
EOF EOF
} }