forked from Openwrt/openwrt
4b81c1fd57
uci-defaults are sourced and non-executable, so they do not require a shebang. While at it, apply consistent naming scheme. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
11 lines
395 B
Plaintext
11 lines
395 B
Plaintext
ppwd="$(sed -ne '/^root:/s/^root:\([^:]*\):.*$/\1/p' /etc/passwd)"
|
|
spwd="$(sed -ne '/^root:/s/^root:\([^:]*\):.*$/\1/p' /etc/shadow)"
|
|
|
|
if [ -n "${ppwd#[\!x]}" ] && [ -z "${spwd#[\!x]}" ]; then
|
|
logger -t migrate-shadow "Moving root password hash into shadow database"
|
|
sed -i -e "s:^root\:[^\:]*\::root\:x\::" /etc/passwd
|
|
sed -i -e "s:^root\:[^\:]*\::root\:$ppwd\::" /etc/shadow
|
|
fi
|
|
|
|
exit 0
|