From 5dade080429f461b8f02a8effb835cd309c1d50b Mon Sep 17 00:00:00 2001 From: jow Date: Fri, 18 Jan 2013 12:46:43 +0000 Subject: base-files: use numerically prefixed uci-defaults names git-svn-id: svn://svn.openwrt.org/openwrt/trunk@35218 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/base-files/files/etc/uci-defaults/10_migrate-shadow | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 package/base-files/files/etc/uci-defaults/10_migrate-shadow (limited to 'package/base-files/files/etc/uci-defaults/10_migrate-shadow') diff --git a/package/base-files/files/etc/uci-defaults/10_migrate-shadow b/package/base-files/files/etc/uci-defaults/10_migrate-shadow new file mode 100644 index 000000000..b7ea5718c --- /dev/null +++ b/package/base-files/files/etc/uci-defaults/10_migrate-shadow @@ -0,0 +1,12 @@ +#!/bin/sh + +local ppwd="$(sed -ne '/^root:/s/^root:\([^:]*\):.*$/\1/p' /etc/passwd)" +local 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 -- cgit v1.2.3