diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2013-01-18 12:46:43 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2013-01-18 12:46:43 +0000 |
commit | 648bd409e35b1e05e585751a23aab8bbc2848359 (patch) | |
tree | ad2368285f6d8b72649e353c1ce77d47ac2427c1 /package/base-files/files/etc/uci-defaults/10_migrate-shadow | |
parent | 3a2cccda2eb45c6b55ef33c73a4af2c88935f383 (diff) | |
download | upstream-648bd409e35b1e05e585751a23aab8bbc2848359.tar.gz upstream-648bd409e35b1e05e585751a23aab8bbc2848359.tar.bz2 upstream-648bd409e35b1e05e585751a23aab8bbc2848359.zip |
base-files: use numerically prefixed uci-defaults names
SVN-Revision: 35218
Diffstat (limited to 'package/base-files/files/etc/uci-defaults/10_migrate-shadow')
-rw-r--r-- | package/base-files/files/etc/uci-defaults/10_migrate-shadow | 12 |
1 files changed, 12 insertions, 0 deletions
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 0000000000..b7ea5718c9 --- /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 |