base-files: use numerically prefixed uci-defaults names
authorJo-Philipp Wich <jow@openwrt.org>
Fri, 18 Jan 2013 12:46:43 +0000 (12:46 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Fri, 18 Jan 2013 12:46:43 +0000 (12:46 +0000)
SVN-Revision: 35218

package/base-files/files/etc/uci-defaults/10_migrate-shadow [new file with mode: 0644]
package/base-files/files/etc/uci-defaults/11_migrate-sysctl [new file with mode: 0644]
package/base-files/files/etc/uci-defaults/12_network-generate-ula [new file with mode: 0644]
package/base-files/files/etc/uci-defaults/migrate-shadow [deleted file]
package/base-files/files/etc/uci-defaults/migrate-sysctl [deleted file]
package/base-files/files/etc/uci-defaults/network-generate-ula [deleted file]

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 (file)
index 0000000..b7ea571
--- /dev/null
@@ -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 (file)
index 0000000..b3796a4
--- /dev/null
@@ -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 (file)
index 0000000..f3e4931
--- /dev/null
@@ -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/urandom tr -dc 0-9 | dd bs=9 count=1) % 256)))
+       r2=$(printf "%01x" $(($(</dev/urandom tr -dc 0-9 | dd bs=9 count=1) % 65536)))
+       r3=$(printf "%01x" $(($(</dev/urandom tr -dc 0-9 | dd bs=9 count=1) % 65536)))
+done
+
+uci -q batch <<-EOF >/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 (file)
index b7ea571..0000000
+++ /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 (file)
index b3796a4..0000000
+++ /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 (file)
index f3e4931..0000000
+++ /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/urandom tr -dc 0-9 | dd bs=9 count=1) % 256)))
-       r2=$(printf "%01x" $(($(</dev/urandom tr -dc 0-9 | dd bs=9 count=1) % 65536)))
-       r3=$(printf "%01x" $(($(</dev/urandom tr -dc 0-9 | dd bs=9 count=1) % 65536)))
-done
-
-uci -q batch <<-EOF >/dev/null
-       set network.globals.ula_prefix=fd$r1:$r2:$r3::/48
-       commit network
-EOF
-
-exit 0
-