summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2011-11-23 11:28:15 +0100
committerMichael Olbrich <m.olbrich@pengutronix.de>2011-11-23 11:28:15 +0100
commit1640a78587c8e3dbd644f06e8586db19d9911a1d (patch)
treee6e3ac350da846400d6a8fc89b4e76edd6653081
parent78c5474ff0c3f14b82f0d03ebf67e86d414b8870 (diff)
downloadptxdist-1640a78587c8e3dbd644f06e8586db19d9911a1d.tar.gz
ptxdist-1640a78587c8e3dbd644f06e8586db19d9911a1d.tar.xz
add install_script_replace to replace in pre/post scripts
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rw-r--r--rules/post/install.make18
-rw-r--r--scripts/lib/ptxd_make_xpkg_finish.sh4
-rw-r--r--scripts/lib/ptxd_make_xpkg_pkg.sh18
3 files changed, 39 insertions, 1 deletions
diff --git a/rules/post/install.make b/rules/post/install.make
index 35b00349b..4ad7f87c9 100644
--- a/rules/post/install.make
+++ b/rules/post/install.make
@@ -278,6 +278,24 @@ install_replace_figlet = \
echo "ptxd_install_replace_figlet '$$FILE' '$$PLACEHOLDER' '$$VALUE'" >> "$(STATEDIR)/$$XPKG.cmds"
#
+# install_script_replace
+#
+# Replace placeholder with value in a script
+#
+# $1: xpkg label
+# $2: script (preinst, postinst, ...)
+# $3: placeholder
+# $4: value
+#
+install_script_replace = \
+ XPKG=$(subst _,-,$(strip $(1))); \
+ FILE=$(strip $(2)); \
+ PLACEHOLDER=$(strip $(3)); \
+ VALUE=$(strip $(4)); \
+ $(call install_check, install_script_replace); \
+ echo "ptxd_install_script_replace '$$FILE' '$$PLACEHOLDER' '$$VALUE'" >> "$(STATEDIR)/$$XPKG.cmds"
+
+#
# install_copy_toolchain_lib
#
# $1: xpkg label
diff --git a/scripts/lib/ptxd_make_xpkg_finish.sh b/scripts/lib/ptxd_make_xpkg_finish.sh
index 542558985..64bed28cd 100644
--- a/scripts/lib/ptxd_make_xpkg_finish.sh
+++ b/scripts/lib/ptxd_make_xpkg_finish.sh
@@ -73,10 +73,12 @@ EOF
#
# add pre-/postinst runs to the command list
+ # make sure we replace in preinst first
#
(
+ cat "${pkg_xpkg_cmds}" | grep ptxd_install_script_replace
echo "ptxd_install_run preinst"
- cat "${pkg_xpkg_cmds}"
+ cat "${pkg_xpkg_cmds}" | grep -v ptxd_install_script_replace
echo "ptxd_install_run postinst"
) > "${pkg_xpkg_cmds}.tmp"
mv "${pkg_xpkg_cmds}.tmp" "${pkg_xpkg_cmds}"
diff --git a/scripts/lib/ptxd_make_xpkg_pkg.sh b/scripts/lib/ptxd_make_xpkg_pkg.sh
index aa02512d8..ecc077ac5 100644
--- a/scripts/lib/ptxd_make_xpkg_pkg.sh
+++ b/scripts/lib/ptxd_make_xpkg_pkg.sh
@@ -369,6 +369,24 @@ install replace:
}
export -f ptxd_install_replace
+ptxd_install_script_replace() {
+ local dst="$1"
+ local placeholder="$2"
+ local value="$3"
+
+ echo "\
+install script replace:
+ script=${dst}
+ '${placeholder}' -> '${value}'
+"
+
+ ptxd_exist "${pkg_xpkg_control_dir}/${dst}" &&
+ sed -i -e "s,${placeholder},${value},g" "${pkg_xpkg_control_dir}/${dst}" ||
+
+ ptxd_install_error "install_script_replace failed!"
+}
+export -f ptxd_install_script_replace
+
ptxd_install_replace_figlet() {
local dst="$1"
local placeholder="$2"