diff options
author | Marc Kleine-Budde <mkl@pengutronix.de> | 2010-07-08 14:27:12 +0200 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2010-07-15 13:28:08 +0200 |
commit | db30bfc28d9a558ac2cdf6ef924fc3360afb2125 (patch) | |
tree | 0de9464b941580848144d8c3c65ee0aff74bdd29 /scripts/lib/ptxd_make_xpkg_prepare.sh | |
parent | d4cc35d3e3ee020c1d7302f3e15171a2f864558a (diff) | |
download | ptxdist-db30bfc28d9a558ac2cdf6ef924fc3360afb2125.tar.gz ptxdist-db30bfc28d9a558ac2cdf6ef924fc3360afb2125.tar.xz |
[ptxd_make_install_init] move into ptxd_make_xpkg_prepare.sh
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'scripts/lib/ptxd_make_xpkg_prepare.sh')
-rw-r--r-- | scripts/lib/ptxd_make_xpkg_prepare.sh | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/scripts/lib/ptxd_make_xpkg_prepare.sh b/scripts/lib/ptxd_make_xpkg_prepare.sh new file mode 100644 index 000000000..079340955 --- /dev/null +++ b/scripts/lib/ptxd_make_xpkg_prepare.sh @@ -0,0 +1,95 @@ +#!/bin/bash +# +# Copyright (C) 2005, 2006, 2007 Robert Schwebel <r.schwebel@pengutronix.de> +# 2008, 2009 by Marc Kleine-Budde <mkl@pengutronix.de> +# +# See CREDITS for details about who has contributed to this project. +# +# For further information about the PTXdist project and license conditions +# see the README file. +# + +# +# -p PACKET +# +ptxd_make_install_init() { + . ${PTXDIST_TOPDIR}/scripts/ptxdist_vars.sh || return + + ptxd_make_xpkg_init || return + + local opt + while getopts "p:t:" opt; do + case "${opt}" in + p) + local packet="${OPTARG}" + ;; + t) + local target="${OPTARG##*/}" + target="${target%%.targetinstall*}" + ;; + *) + return 1 + ;; + esac + done + + if [ -z "${packet}" ]; then + echo + echo "Error: empty parameter to 'install_init()'" + echo + return 1 + fi + + echo "install_init: preparing for image creation..." + + rm -fr -- \ + "${pkg_xpkg_tmp}" \ + "${pkg_xpkg_cmds}" \ + "${pkg_xpkg_perms}" && + mkdir -p -- "${pkg_ipkg_control_dir}" && + touch "${pkg_xpkg_cmds}" || return + + local replace_from="ARCH" + local replace_to="${PTXDIST_IPKG_ARCH_STRING}" + + echo -n "install_init: @${replace_from}@ -> ${replace_to} ... " + sed -e "s,@${replace_from}@,${replace_to},g" "${RULESDIR}/default.ipkg" > \ + "${pkg_ipkg_control}" || return + echo "done" + + local script rd found + for script in \ + preinst postinst prerm postrm; do + + echo -n "install_init: ${script} " + unset found + + for rd in \ + "${PROJECTRULESDIR}" "${RULESDIR}"; do + + local abs_script="${rd}/${packet}.${script}" + + if [ -f "${abs_script}" ]; then + install -m 0755 \ + -D "${abs_script}" \ + "${pkg_ipkg_control_dir}/${script}" || return + + echo "packaging: '${abs_script}'" + + if [ "${script}" = "preinst" ]; then + echo "install_init: executing '${abs_script}'" + DESTDIR="${ROOTDIR}" /bin/sh "${abs_script}" || return + fi + + found=true + break + fi + done + + if [ -z "${found}" ]; then + echo "not available" + fi + done +} + +export -f ptxd_make_install_init |