From: Jo-Philipp Wich Date: Fri, 18 Jan 2013 12:46:43 +0000 (+0000) Subject: base-files: use numerically prefixed uci-defaults names X-Git-Tag: reboot~11549 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=648bd409e35b1e05e585751a23aab8bbc2848359;p=openwrt%2Fopenwrt.git base-files: use numerically prefixed uci-defaults names SVN-Revision: 35218 --- 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 diff --git a/package/base-files/files/etc/uci-defaults/11_migrate-sysctl b/package/base-files/files/etc/uci-defaults/11_migrate-sysctl new file mode 100644 index 0000000000..b3796a4d2d --- /dev/null +++ b/package/base-files/files/etc/uci-defaults/11_migrate-sysctl @@ -0,0 +1,17 @@ +#!/bin/sh + +if [ ! -f "/rom/etc/sysctl.conf" ] || cmp -s "/rom/etc/sysctl.conf" "/etc/sysctl.conf"; then + exit 0 +fi + +fingerprint="$(md5sum /etc/sysctl.conf)" +fingerprint="${fingerprint%% *}" + +if [ "$fingerprint" = "1b05ebb41f72cb84e5510573cd4aca26" ] || \ + [ "$fingerprint" = "62deb895be1a7f496040187b7c930e4e" ]; then + logger -t migrate-sysctl "Updating sysctl.conf to use current defaults" + cp "/rom/etc/sysctl.conf" "/etc/sysctl.conf" +fi + +exit 0 + diff --git a/package/base-files/files/etc/uci-defaults/12_network-generate-ula b/package/base-files/files/etc/uci-defaults/12_network-generate-ula new file mode 100644 index 0000000000..f3e493145f --- /dev/null +++ b/package/base-files/files/etc/uci-defaults/12_network-generate-ula @@ -0,0 +1,18 @@ +#!/bin/sh + +[ "$(uci get network.globals.ula_prefix)" != "auto" ] && exit 0 +# Sometimes results are empty, therefore try until it works... +local r1 r2 r3 +while [ -z "$r1" -o -z "$r2" -o -z "$r3" ]; do + r1=$(printf "%02x" $(($(/dev/null + set network.globals.ula_prefix=fd$r1:$r2:$r3::/48 + commit network +EOF + +exit 0 + diff --git a/package/base-files/files/etc/uci-defaults/migrate-shadow b/package/base-files/files/etc/uci-defaults/migrate-shadow deleted file mode 100644 index b7ea5718c9..0000000000 --- a/package/base-files/files/etc/uci-defaults/migrate-shadow +++ /dev/null @@ -1,12 +0,0 @@ -#!/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 diff --git a/package/base-files/files/etc/uci-defaults/migrate-sysctl b/package/base-files/files/etc/uci-defaults/migrate-sysctl deleted file mode 100644 index b3796a4d2d..0000000000 --- a/package/base-files/files/etc/uci-defaults/migrate-sysctl +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -if [ ! -f "/rom/etc/sysctl.conf" ] || cmp -s "/rom/etc/sysctl.conf" "/etc/sysctl.conf"; then - exit 0 -fi - -fingerprint="$(md5sum /etc/sysctl.conf)" -fingerprint="${fingerprint%% *}" - -if [ "$fingerprint" = "1b05ebb41f72cb84e5510573cd4aca26" ] || \ - [ "$fingerprint" = "62deb895be1a7f496040187b7c930e4e" ]; then - logger -t migrate-sysctl "Updating sysctl.conf to use current defaults" - cp "/rom/etc/sysctl.conf" "/etc/sysctl.conf" -fi - -exit 0 - diff --git a/package/base-files/files/etc/uci-defaults/network-generate-ula b/package/base-files/files/etc/uci-defaults/network-generate-ula deleted file mode 100644 index f3e493145f..0000000000 --- a/package/base-files/files/etc/uci-defaults/network-generate-ula +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -[ "$(uci get network.globals.ula_prefix)" != "auto" ] && exit 0 -# Sometimes results are empty, therefore try until it works... -local r1 r2 r3 -while [ -z "$r1" -o -z "$r2" -o -z "$r3" ]; do - r1=$(printf "%02x" $(($(/dev/null - set network.globals.ula_prefix=fd$r1:$r2:$r3::/48 - commit network -EOF - -exit 0 -