From 9e69780c57b27ea6641f5693c990aa6e4f8444c1 Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Fri, 25 Jun 2010 15:43:41 +0200 Subject: [libptxdist] remove obsolete DOPERMISSIONS definition Signed-off-by: Marc Kleine-Budde --- scripts/libptxdist.sh | 7 ------- 1 file changed, 7 deletions(-) (limited to 'scripts') diff --git a/scripts/libptxdist.sh b/scripts/libptxdist.sh index 6af6aaaa3..d94cc5eef 100644 --- a/scripts/libptxdist.sh +++ b/scripts/libptxdist.sh @@ -1,13 +1,6 @@ #!/bin/bash PTX_DEBUG=${PTX_DEBUG:="false"} - -# -# awk script for permission fixing -# -DOPERMISSIONS='{ if ($1 == "f") printf("chmod %s .%s; chown %s.%s .%s;\n", $5, $2, $3, $4, $2); if ($1 == "n") printf("mknod -m %s .%s %s %s %s; chown %s.%s .%s;\n", $5, $2, $6, $7, $8, $3, $4, $2);}' - - PTX_DIALOG="dialog --aspect 60" PTX_DIALOG_HEIGHT=0 PTX_DIALOG_WIDTH=0 -- cgit v1.2.3 From a7e72cb90c294188935e31163509a64969fe010b Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Fri, 9 Jul 2010 10:41:24 +0200 Subject: [libptxdist] ptxd_replace_magic: don't replace unset MAGICs This patch changes the semantics of the function. Originally all @MAGIC@ are replaced with their environemnt value. Even if MAGIC is unset in the env, resulting in @MAGIC@ to be removed from the output. With this patch ptxd_replace_magic will only replace @MAGIC@ if MAGIC is set in the environment. Signed-off-by: Marc Kleine-Budde --- scripts/libptxdist.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/libptxdist.sh b/scripts/libptxdist.sh index d94cc5eef..632bd37b8 100644 --- a/scripts/libptxdist.sh +++ b/scripts/libptxdist.sh @@ -369,7 +369,8 @@ ptxd_make_log() { # -# replaces @MAGIC@ with MAGIC from environment +# replaces @MAGIC@ with MAGIC from environment (if available) +# it will stay @MAGIC@ if MAGIC is unset in the environment # # $1 input file # stdout: output @@ -377,9 +378,14 @@ ptxd_make_log() { ptxd_replace_magic() { gawk ' $0 ~ /@[A-Z0-9_]+@/ { - while (match($0, "@[A-Z0-9_]+@")) { - var = substr($0, RSTART+1, RLENGTH-2); - gsub("@" var "@", ENVIRON[var]); + line = $0 + + while (match(line, "@[A-Z0-9_]+@")) { + var = substr(line, RSTART + 1, RLENGTH - 2); + line = substr(line, RSTART + RLENGTH); + + if (var in ENVIRON) + gsub("@" var "@", ENVIRON[var]); } } -- cgit v1.2.3 From 087c050517035ed0ca64aa91d4a0e21989830a78 Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Sun, 27 Jun 2010 14:52:49 +0200 Subject: [libptxdist] rename "ptxd_get_dirs" -> "ptxd_get_path" ...because this function works for directories and/or files. Signed-off-by: Marc Kleine-Budde --- scripts/lib/ptxd_make_world_patchin.sh | 2 +- scripts/libptxdist.sh | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/lib/ptxd_make_world_patchin.sh b/scripts/lib/ptxd_make_world_patchin.sh index 158acb931..c677e0fa1 100644 --- a/scripts/lib/ptxd_make_world_patchin.sh +++ b/scripts/lib/ptxd_make_world_patchin.sh @@ -30,7 +30,7 @@ ptxd_make_world_patchin_apply_init() ${PTXDIST_PATH_PATCHES//://${pkg_pkg} }" # find patch_dir - if ! ptxd_get_dirs "${path}"; then + if ! ptxd_get_path "${path}"; then echo "patchin: no patches found" return fi diff --git a/scripts/libptxdist.sh b/scripts/libptxdist.sh index 632bd37b8..80c24f99d 100644 --- a/scripts/libptxdist.sh +++ b/scripts/libptxdist.sh @@ -435,17 +435,20 @@ ptxd_dumpstack() { # +# ptxd_get_path - look for files and/or dirs # # return: -# 0 if dirs are found -# 1 if no dirs are found +# 0 if files/dirs are found +# 1 if no files/dirs are found # -ptxd_get_dirs() { +# array "ptxd_reply" containing the found files/dirs +# +ptxd_get_path() { ptxd_reply=( $(eval command ls -f -d "${@}" 2>/dev/null) ) [ ${#ptxd_reply[@]} -ne 0 ] } -export -f ptxd_get_dirs +export -f ptxd_get_path # -- cgit v1.2.3 From ea14e7ab2d76e310cfc7e7b73276b716a19a57a4 Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Thu, 15 Jul 2010 12:44:10 +0200 Subject: [ptxd_get_path] return with error if first argument is empty Signed-off-by: Marc Kleine-Budde --- scripts/libptxdist.sh | 2 ++ 1 file changed, 2 insertions(+) (limited to 'scripts') diff --git a/scripts/libptxdist.sh b/scripts/libptxdist.sh index 80c24f99d..430452f2d 100644 --- a/scripts/libptxdist.sh +++ b/scripts/libptxdist.sh @@ -444,6 +444,8 @@ ptxd_dumpstack() { # array "ptxd_reply" containing the found files/dirs # ptxd_get_path() { + [ -n "${1}" ] || return + ptxd_reply=( $(eval command ls -f -d "${@}" 2>/dev/null) ) [ ${#ptxd_reply[@]} -ne 0 ] -- cgit v1.2.3 From 1112b3809eecffd71507fbfc67178e57509a1296 Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Thu, 8 Jul 2010 16:29:10 +0200 Subject: [ptxd_make_00-init] introduce PTXDIST_PATH_RULES This variable defines where to find the rules dirs. However it's not used for now. Signed-off-by: Marc Kleine-Budde --- scripts/lib/ptxd_make_00-init.sh | 3 +++ 1 file changed, 3 insertions(+) (limited to 'scripts') diff --git a/scripts/lib/ptxd_make_00-init.sh b/scripts/lib/ptxd_make_00-init.sh index 709f7936d..5568efc2c 100644 --- a/scripts/lib/ptxd_make_00-init.sh +++ b/scripts/lib/ptxd_make_00-init.sh @@ -148,6 +148,9 @@ ptxd_init_ptxdist_path() { PTXDIST_PATH_PATCHES="${PTXDIST_PATH//://patches:}" export PTXDIST_PATH_PATCHES + PTXDIST_PATH_RULES="${PTXDIST_PATH//://rules:}" + export PTXDIST_PATH_RULES + ptxd_init_ptxdist_path_sysroot } -- cgit v1.2.3 From db30bfc28d9a558ac2cdf6ef924fc3360afb2125 Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Thu, 8 Jul 2010 14:27:12 +0200 Subject: [ptxd_make_install_init] move into ptxd_make_xpkg_prepare.sh Signed-off-by: Marc Kleine-Budde --- scripts/lib/ptxd_make_install.sh | 86 ------------------------------- scripts/lib/ptxd_make_xpkg_prepare.sh | 95 +++++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+), 86 deletions(-) create mode 100644 scripts/lib/ptxd_make_xpkg_prepare.sh (limited to 'scripts') diff --git a/scripts/lib/ptxd_make_install.sh b/scripts/lib/ptxd_make_install.sh index 539a67a21..ab06de5b2 100644 --- a/scripts/lib/ptxd_make_install.sh +++ b/scripts/lib/ptxd_make_install.sh @@ -9,92 +9,6 @@ # 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 - - # # # 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 +# 2008, 2009 by Marc Kleine-Budde +# +# 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 -- cgit v1.2.3 From 974ac83334efcfd6294e2153eb42181cd0d99d53 Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Fri, 9 Jul 2010 11:36:25 +0200 Subject: [ptxd_make_xpkg_prepare] ged rid of cmd line options -p and -t Signed-off-by: Marc Kleine-Budde --- rules/post/ptxd_make_xpkg_prepare.make | 4 +--- scripts/lib/ptxd_make_xpkg_prepare.sh | 27 ++------------------------- 2 files changed, 3 insertions(+), 28 deletions(-) (limited to 'scripts') diff --git a/rules/post/ptxd_make_xpkg_prepare.make b/rules/post/ptxd_make_xpkg_prepare.make index 93e48f067..6188e5e06 100644 --- a/rules/post/ptxd_make_xpkg_prepare.make +++ b/rules/post/ptxd_make_xpkg_prepare.make @@ -18,8 +18,6 @@ # install_init = \ $(call xpkg/env, $(1)) \ - ptxd_make_install_init \ - -p '$(strip $(1))' \ - -t '$(@)' + ptxd_make_install_init # vim: syntax=make diff --git a/scripts/lib/ptxd_make_xpkg_prepare.sh b/scripts/lib/ptxd_make_xpkg_prepare.sh index 079340955..0f6f83784 100644 --- a/scripts/lib/ptxd_make_xpkg_prepare.sh +++ b/scripts/lib/ptxd_make_xpkg_prepare.sh @@ -1,7 +1,7 @@ #!/bin/bash # # Copyright (C) 2005, 2006, 2007 Robert Schwebel -# 2008, 2009 by Marc Kleine-Budde +# 2008, 2009, 2010 by Marc Kleine-Budde # # See CREDITS for details about who has contributed to this project. # @@ -17,29 +17,6 @@ ptxd_make_install_init() { 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 -- \ @@ -67,7 +44,7 @@ ptxd_make_install_init() { for rd in \ "${PROJECTRULESDIR}" "${RULESDIR}"; do - local abs_script="${rd}/${packet}.${script}" + local abs_script="${rd}/${pkg_xpkg}.${script}" if [ -f "${abs_script}" ]; then install -m 0755 \ -- cgit v1.2.3 From 551299ad43175d6ce69e83336d64dc7913abc588 Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Thu, 8 Jul 2010 16:31:26 +0200 Subject: [ptxd_make_xpkg_prepare] clean up shell implementation - rename ptxd_make_install_init to ptxd_make_xpkg_prepare - use ptxd_get_path and PTXDIST_PATH_RULES to look for pre/post scripts Signed-off-by: Marc Kleine-Budde --- rules/post/ptxd_make_xpkg_prepare.make | 21 ++++++++++---- scripts/lib/ptxd_make_xpkg_prepare.sh | 50 ++++++++++++---------------------- 2 files changed, 33 insertions(+), 38 deletions(-) (limited to 'scripts') diff --git a/rules/post/ptxd_make_xpkg_prepare.make b/rules/post/ptxd_make_xpkg_prepare.make index 6188e5e06..3568eb57e 100644 --- a/rules/post/ptxd_make_xpkg_prepare.make +++ b/rules/post/ptxd_make_xpkg_prepare.make @@ -12,12 +12,23 @@ # # install_init # -# Deletes $(PKGDIR)/$$PACKET.tmp/ipkg and prepares for new ipkg package creation +# prepares for new xpkg package creation # -# $1: packet label +# $1: xpkg label # -install_init = \ - $(call xpkg/env, $(1)) \ - ptxd_make_install_init +install_init = \ + $(call xpkg/prepare, $(1)) + + +# +# xpkg/prepare +# +# prepares for new xpkg package creation +# +# $1: xpkg label +# +xpkg/prepare = \ + $(call xpkg/env, $(1)) \ + ptxd_make_xpkg_prepare # vim: syntax=make diff --git a/scripts/lib/ptxd_make_xpkg_prepare.sh b/scripts/lib/ptxd_make_xpkg_prepare.sh index 0f6f83784..7c27183bb 100644 --- a/scripts/lib/ptxd_make_xpkg_prepare.sh +++ b/scripts/lib/ptxd_make_xpkg_prepare.sh @@ -10,16 +10,13 @@ # # -# -p PACKET # -ptxd_make_install_init() { - . ${PTXDIST_TOPDIR}/scripts/ptxdist_vars.sh || return - +ptxd_make_xpkg_prepare() { ptxd_make_xpkg_init || return - echo "install_init: preparing for image creation..." + echo "install_init: preparing for image creation of '${pkg_xpkg}'..." - rm -fr -- \ + rm -fr -- \ "${pkg_xpkg_tmp}" \ "${pkg_xpkg_cmds}" \ "${pkg_xpkg_perms}" && @@ -34,39 +31,26 @@ ptxd_make_install_init() { "${pkg_ipkg_control}" || return echo "done" - local script rd found - for script in \ - preinst postinst prerm postrm; do - + local script + 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}/${pkg_xpkg}.${script}" - if [ -f "${abs_script}" ]; then - install -m 0755 \ - -D "${abs_script}" \ - "${pkg_ipkg_control_dir}/${script}" || return + if ptxd_get_path "${PTXDIST_PATH_RULES//://${pkg_xpkg}.${script} }"; then + install -m 0755 \ + -D "${ptxd_reply}" \ + "${pkg_ipkg_control_dir}/${script}" || return - echo "packaging: '${abs_script}'" + echo "packaging: '$(ptxd_print_path "${ptxd_reply}")'" - if [ "${script}" = "preinst" ]; then - echo "install_init: executing '${abs_script}'" - DESTDIR="${ROOTDIR}" /bin/sh "${abs_script}" || return - fi - - found=true - break + # FIXME: install ipkg rather than executing script + if [ "${script}" = "preinst" ]; then + echo "install_init: executing '${ptxd_reply}'" + DESTDIR="${ptx_nfsroot}" /bin/sh "${ptxd_reply}" + DESTDIR="${ptx_nfsroot_dbg}" /bin/sh "${ptxd_reply}" fi - done - - if [ -z "${found}" ]; then + else echo "not available" fi done } - -export -f ptxd_make_install_init +export -f ptxd_make_xpkg_prepare -- cgit v1.2.3 From 8d5e5d02fedfa83c1a626cbe16f06486a0c55a48 Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Thu, 8 Jul 2010 16:41:15 +0200 Subject: [ptxd_make_xpkg_prepare] move default.ipkg to config/xpkg/ipkg.control Signed-off-by: Marc Kleine-Budde --- config/xpkg/ipkg.control | 10 ++++++++++ rules/default.ipkg | 10 ---------- scripts/lib/ptxd_make_xpkg_prepare.sh | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) create mode 100644 config/xpkg/ipkg.control delete mode 100644 rules/default.ipkg (limited to 'scripts') diff --git a/config/xpkg/ipkg.control b/config/xpkg/ipkg.control new file mode 100644 index 000000000..c6181d1ff --- /dev/null +++ b/config/xpkg/ipkg.control @@ -0,0 +1,10 @@ +Package: @PACKAGE@ +Priority: @PRIORITY@ +Version: @VERSION@ +Section: @SECTION@ +Architecture: @ARCH@ +Maintainer: @AUTHOR@ +Depends: @DEPENDS@ +Source: http://www.ptxdist.org/ +Description: @DESCRIPTION@ + diff --git a/rules/default.ipkg b/rules/default.ipkg deleted file mode 100644 index c6181d1ff..000000000 --- a/rules/default.ipkg +++ /dev/null @@ -1,10 +0,0 @@ -Package: @PACKAGE@ -Priority: @PRIORITY@ -Version: @VERSION@ -Section: @SECTION@ -Architecture: @ARCH@ -Maintainer: @AUTHOR@ -Depends: @DEPENDS@ -Source: http://www.ptxdist.org/ -Description: @DESCRIPTION@ - diff --git a/scripts/lib/ptxd_make_xpkg_prepare.sh b/scripts/lib/ptxd_make_xpkg_prepare.sh index 7c27183bb..4f7e44000 100644 --- a/scripts/lib/ptxd_make_xpkg_prepare.sh +++ b/scripts/lib/ptxd_make_xpkg_prepare.sh @@ -27,7 +27,7 @@ ptxd_make_xpkg_prepare() { 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" > \ + sed -e "s,@${replace_from}@,${replace_to},g" "${PTXDIST_TOPDIR}/config/xpkg/ipkg.control" > \ "${pkg_ipkg_control}" || return echo "done" -- cgit v1.2.3 From 450dbe5b6dd2c7d16eb62a291bc68524ca5470d0 Mon Sep 17 00:00:00 2001 From: Michael Olbrich Date: Fri, 9 Jul 2010 17:08:57 +0200 Subject: [ptxd_make_xpkg_finish] use PTXDIST_PATH_RULES Signed-off-by: Michael Olbrich Signed-off-by: Marc Kleine-Budde --- scripts/lib/ptxd_make_xpkg_finish.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/lib/ptxd_make_xpkg_finish.sh b/scripts/lib/ptxd_make_xpkg_finish.sh index 719b07598..f2b94fc05 100644 --- a/scripts/lib/ptxd_make_xpkg_finish.sh +++ b/scripts/lib/ptxd_make_xpkg_finish.sh @@ -99,12 +99,9 @@ ptxd_make_xpkg_finish() { # # post install # - if [ -f "${PTXDIST_WORKSPACE}/rules/${pkg_xpkg}.postinst" ]; then + if ptxd_get_path "${PTXDIST_PATH_RULES//://${pkg_xpkg}.postinst }"; then echo "xpkg_finish: running postinst" - DESTDIR="${ROOTDIR}" /bin/sh "${PTXDIST_WORKSPACE}/rules/${pkg_xpkg}.postinst" - elif [ -f "${PTXDIST_TOPDIR}/rules/${pkg_xpkg}.postinst" ]; then - echo "xpkg_finish: running postinst" - DESTDIR="${ROOTDIR}" /bin/sh "${PTXDIST_TOPDIR}/rules/${pkg_xpkg}.postinst" + DESTDIR="${ROOTDIR}" /bin/sh "${ptxd_reply}" fi return -- cgit v1.2.3 From c60e94a04952a3fb78d46e87a5a30b0c794b3b52 Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Mon, 12 Jul 2010 18:45:16 +0200 Subject: [ptxd_make_xpkg_finish] use ptx_nfsroot instead of ROOTDIR Thus we can remove the sourcing of "ptxdist_vars.sh" Run postinst for both root and root-debug. Signed-off-by: Marc Kleine-Budde --- scripts/lib/ptxd_make_xpkg_finish.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/lib/ptxd_make_xpkg_finish.sh b/scripts/lib/ptxd_make_xpkg_finish.sh index f2b94fc05..996afbd5f 100644 --- a/scripts/lib/ptxd_make_xpkg_finish.sh +++ b/scripts/lib/ptxd_make_xpkg_finish.sh @@ -50,8 +50,6 @@ export -f ptxd_make_xpkg_deps # function to create a generic package # ptxd_make_xpkg_finish() { - . ${PTXDIST_TOPDIR}/scripts/ptxdist_vars.sh || return - ptxd_make_xpkg_init || return # @@ -99,9 +97,11 @@ ptxd_make_xpkg_finish() { # # post install # + # FIXME: install ipkg rather than executing script if ptxd_get_path "${PTXDIST_PATH_RULES//://${pkg_xpkg}.postinst }"; then echo "xpkg_finish: running postinst" - DESTDIR="${ROOTDIR}" /bin/sh "${ptxd_reply}" + DESTDIR="${ptx_nfsroot}" /bin/sh "${ptxd_reply}" + DESTDIR="${ptx_nfsroot_dbg}" /bin/sh "${ptxd_reply}" fi return -- cgit v1.2.3 From 59905676d7eb29037ff24ba8d5bc71bdc1bc6818 Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Thu, 8 Jul 2010 14:29:34 +0200 Subject: [ptxd_make_xpkg_fixup] move ptxd_make_xpkg_fixup.sh Signed-off-by: Marc Kleine-Budde --- scripts/lib/ptxd_make_install.sh | 91 ------------------------------------- scripts/lib/ptxd_make_xpkg_fixup.sh | 91 +++++++++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+), 91 deletions(-) delete mode 100644 scripts/lib/ptxd_make_install.sh create mode 100644 scripts/lib/ptxd_make_xpkg_fixup.sh (limited to 'scripts') diff --git a/scripts/lib/ptxd_make_install.sh b/scripts/lib/ptxd_make_install.sh deleted file mode 100644 index ab06de5b2..000000000 --- a/scripts/lib/ptxd_make_install.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2005, 2006, 2007 Robert Schwebel -# 2008, 2009 by Marc Kleine-Budde -# -# 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. -# - -# -# -# -ptxd_make_install_fixup() { - . ${PTXDIST_TOPDIR}/scripts/ptxdist_vars.sh || return - - ptxd_make_xpkg_init || return - - local opt - while getopts "p:f:t:s:" opt; do - case "${opt}" in - p) - local packet="${OPTARG}" - ;; - f) - local replace_from="${OPTARG}" - ;; - t) - local replace_to="${OPTARG}" - ;; - s) - local target="${OPTARG##*/}" - target="${target%%.targetinstall*}" - ;; - *) - return 1 - ;; - esac - done - - if [ -z "${packet}" ]; then - echo - echo "Error: empty parameter to 'install_fixup()'" - echo - return 1 - fi - - case "${replace_from}" in - AUTHOR) - replace_to="`echo ${replace_to} | sed -e 's/\([^\\]\)@/\1\\\@/g'`" - ;; - PACKAGE) - replace_to="`echo ${replace_to} | sed -e 's/_/-/g'`" - - # - # track "pkg name" to "xpkg filename" - # - if [ -e "${pkg_xpkg_map}" ]; then - sed -i -e "/^${replace_to}$/d" "${pkg_xpkg_map}" && - - if [ -s "${pkg_xpkg_map}" ]; then - cat >&2 <> "${pkg_xpkg_map}" || return - - - ;; - VERSION) - replace_to="${replace_to//[-_]/.}${PTXCONF_PROJECT_BUILD//[-_]/.}" - ;; - DEPENDS) - return - ;; - esac - - echo -n "install_fixup: @${replace_from}@ -> ${replace_to} ... " - sed -i -e "s,@$replace_from@,$replace_to,g" "${pkg_ipkg_control}" || return - echo "done." -} - -export -f ptxd_make_install_fixup diff --git a/scripts/lib/ptxd_make_xpkg_fixup.sh b/scripts/lib/ptxd_make_xpkg_fixup.sh new file mode 100644 index 000000000..ab06de5b2 --- /dev/null +++ b/scripts/lib/ptxd_make_xpkg_fixup.sh @@ -0,0 +1,91 @@ +#!/bin/bash +# +# Copyright (C) 2005, 2006, 2007 Robert Schwebel +# 2008, 2009 by Marc Kleine-Budde +# +# 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. +# + +# +# +# +ptxd_make_install_fixup() { + . ${PTXDIST_TOPDIR}/scripts/ptxdist_vars.sh || return + + ptxd_make_xpkg_init || return + + local opt + while getopts "p:f:t:s:" opt; do + case "${opt}" in + p) + local packet="${OPTARG}" + ;; + f) + local replace_from="${OPTARG}" + ;; + t) + local replace_to="${OPTARG}" + ;; + s) + local target="${OPTARG##*/}" + target="${target%%.targetinstall*}" + ;; + *) + return 1 + ;; + esac + done + + if [ -z "${packet}" ]; then + echo + echo "Error: empty parameter to 'install_fixup()'" + echo + return 1 + fi + + case "${replace_from}" in + AUTHOR) + replace_to="`echo ${replace_to} | sed -e 's/\([^\\]\)@/\1\\\@/g'`" + ;; + PACKAGE) + replace_to="`echo ${replace_to} | sed -e 's/_/-/g'`" + + # + # track "pkg name" to "xpkg filename" + # + if [ -e "${pkg_xpkg_map}" ]; then + sed -i -e "/^${replace_to}$/d" "${pkg_xpkg_map}" && + + if [ -s "${pkg_xpkg_map}" ]; then + cat >&2 <> "${pkg_xpkg_map}" || return + + + ;; + VERSION) + replace_to="${replace_to//[-_]/.}${PTXCONF_PROJECT_BUILD//[-_]/.}" + ;; + DEPENDS) + return + ;; + esac + + echo -n "install_fixup: @${replace_from}@ -> ${replace_to} ... " + sed -i -e "s,@$replace_from@,$replace_to,g" "${pkg_ipkg_control}" || return + echo "done." +} + +export -f ptxd_make_install_fixup -- cgit v1.2.3 From 3daf5d5056c822cf7a28c121c923ed3e3a8a0f23 Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Thu, 8 Jul 2010 17:48:34 +0200 Subject: [ptxd_make_xpkg_fixup] remove PTXCONF_PROJECT_BUILD The variable has been introduced in commit ab1b51cfe10cfa6f2597848c3a595b27d7fbb0b7, but as read only value. No one sets it, so remove it. Signed-off-by: Marc Kleine-Budde --- rules/post/ptxd_make_xpkg_fixup.make | 1 - scripts/lib/ptxd_make_xpkg_fixup.sh | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'scripts') diff --git a/rules/post/ptxd_make_xpkg_fixup.make b/rules/post/ptxd_make_xpkg_fixup.make index 2c0e486b3..e64b1e1f6 100644 --- a/rules/post/ptxd_make_xpkg_fixup.make +++ b/rules/post/ptxd_make_xpkg_fixup.make @@ -20,7 +20,6 @@ # install_fixup = \ $(call xpkg/env, $(1)) \ - PTXCONF_PROJECT_BUILD="$(PTXCONF_PROJECT_BUILD)" \ ptxd_make_install_fixup \ -p '$(strip $(1))' \ -f '$(strip $(2))' \ diff --git a/scripts/lib/ptxd_make_xpkg_fixup.sh b/scripts/lib/ptxd_make_xpkg_fixup.sh index ab06de5b2..da14a31a1 100644 --- a/scripts/lib/ptxd_make_xpkg_fixup.sh +++ b/scripts/lib/ptxd_make_xpkg_fixup.sh @@ -76,7 +76,7 @@ EOF ;; VERSION) - replace_to="${replace_to//[-_]/.}${PTXCONF_PROJECT_BUILD//[-_]/.}" + replace_to="${replace_to//[-_]/.}" ;; DEPENDS) return -- cgit v1.2.3 From 2787825d117a003838e8748ae85debe9fba4ce3f Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Tue, 13 Jul 2010 12:08:51 +0200 Subject: [ptxd_make_xpkg_fixup] remove obsolete sourcing of "ptxdist_vars.sh" Signed-off-by: Marc Kleine-Budde --- scripts/lib/ptxd_make_xpkg_fixup.sh | 2 -- 1 file changed, 2 deletions(-) (limited to 'scripts') diff --git a/scripts/lib/ptxd_make_xpkg_fixup.sh b/scripts/lib/ptxd_make_xpkg_fixup.sh index da14a31a1..3d055010a 100644 --- a/scripts/lib/ptxd_make_xpkg_fixup.sh +++ b/scripts/lib/ptxd_make_xpkg_fixup.sh @@ -13,8 +13,6 @@ # # ptxd_make_install_fixup() { - . ${PTXDIST_TOPDIR}/scripts/ptxdist_vars.sh || return - ptxd_make_xpkg_init || return local opt -- cgit v1.2.3 From 1b882ec0936b3c3fc00e00075099f4d5fecb9a3a Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Thu, 8 Jul 2010 18:13:33 +0200 Subject: [ptxd_make_xpkg_fixup] ged rid of cmd line options -p and -s Signed-off-by: Marc Kleine-Budde --- rules/post/ptxd_make_xpkg_fixup.make | 6 ++---- scripts/lib/ptxd_make_xpkg_fixup.sh | 18 ++---------------- 2 files changed, 4 insertions(+), 20 deletions(-) (limited to 'scripts') diff --git a/rules/post/ptxd_make_xpkg_fixup.make b/rules/post/ptxd_make_xpkg_fixup.make index e64b1e1f6..433158f38 100644 --- a/rules/post/ptxd_make_xpkg_fixup.make +++ b/rules/post/ptxd_make_xpkg_fixup.make @@ -1,7 +1,7 @@ # -*-makefile-*- # # Copyright (C) 2005, 2006, 2007 Robert Schwebel -# 2008, 2009 by Marc Kleine-Budde +# 2008, 2009, 2010 by Marc Kleine-Budde # # See CREDITS for details about who has contributed to this project. # @@ -21,9 +21,7 @@ install_fixup = \ $(call xpkg/env, $(1)) \ ptxd_make_install_fixup \ - -p '$(strip $(1))' \ -f '$(strip $(2))' \ - -t '$(strip $(3))' \ - -s '$(@)' + -t '$(strip $(3))' # vim: syntax=make diff --git a/scripts/lib/ptxd_make_xpkg_fixup.sh b/scripts/lib/ptxd_make_xpkg_fixup.sh index 3d055010a..a015f1cd5 100644 --- a/scripts/lib/ptxd_make_xpkg_fixup.sh +++ b/scripts/lib/ptxd_make_xpkg_fixup.sh @@ -1,7 +1,7 @@ #!/bin/bash # # Copyright (C) 2005, 2006, 2007 Robert Schwebel -# 2008, 2009 by Marc Kleine-Budde +# 2008, 2009, 2010 by Marc Kleine-Budde # # See CREDITS for details about who has contributed to this project. # @@ -18,32 +18,18 @@ ptxd_make_install_fixup() { local opt while getopts "p:f:t:s:" opt; do case "${opt}" in - p) - local packet="${OPTARG}" - ;; f) local replace_from="${OPTARG}" ;; t) local replace_to="${OPTARG}" ;; - s) - local target="${OPTARG##*/}" - target="${target%%.targetinstall*}" - ;; *) return 1 ;; esac done - if [ -z "${packet}" ]; then - echo - echo "Error: empty parameter to 'install_fixup()'" - echo - return 1 - fi - case "${replace_from}" in AUTHOR) replace_to="`echo ${replace_to} | sed -e 's/\([^\\]\)@/\1\\\@/g'`" @@ -62,7 +48,7 @@ ptxd_make_install_fixup() { ${PREFIX}warning: more than one ipkg per PTXdist package detected: -pkg: '${target}' +pkg: '${pkg_pkg}' ipkg: '${replace_to}' and '$(cat "${pkg_xpkg_map}")' -- cgit v1.2.3 From c9fb00407e4fc7b399907e874f5a53863c9edebb Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Thu, 8 Jul 2010 18:13:33 +0200 Subject: [ptxd_make_xpkg_fixup] ged rid of cmd line options -f and -t Signed-off-by: Marc Kleine-Budde --- rules/post/ptxd_make_xpkg_fixup.make | 10 +++++----- scripts/lib/ptxd_make_xpkg_fixup.sh | 33 +++++++++------------------------ 2 files changed, 14 insertions(+), 29 deletions(-) (limited to 'scripts') diff --git a/rules/post/ptxd_make_xpkg_fixup.make b/rules/post/ptxd_make_xpkg_fixup.make index 433158f38..3b8535b33 100644 --- a/rules/post/ptxd_make_xpkg_fixup.make +++ b/rules/post/ptxd_make_xpkg_fixup.make @@ -12,16 +12,16 @@ # # install_fixup # -# Replaces @...@ sequences in rules/*.ipkg files +# Replaces @MAGIC@ sequences in rules/*.ipkg files # # $1: packet label -# $2: sequence to be replaced +# $2: MAGIC to be replaced # $3: replacement # install_fixup = \ $(call xpkg/env, $(1)) \ - ptxd_make_install_fixup \ - -f '$(strip $(2))' \ - -t '$(strip $(3))' + pkg_xpkg_fixup_from='$(strip $(2))' \ + pkg_xpkg_fixup_to='$(strip $(3))' \ + ptxd_make_install_fixup # vim: syntax=make diff --git a/scripts/lib/ptxd_make_xpkg_fixup.sh b/scripts/lib/ptxd_make_xpkg_fixup.sh index a015f1cd5..99c410cc4 100644 --- a/scripts/lib/ptxd_make_xpkg_fixup.sh +++ b/scripts/lib/ptxd_make_xpkg_fixup.sh @@ -15,33 +15,18 @@ ptxd_make_install_fixup() { ptxd_make_xpkg_init || return - local opt - while getopts "p:f:t:s:" opt; do - case "${opt}" in - f) - local replace_from="${OPTARG}" - ;; - t) - local replace_to="${OPTARG}" - ;; - *) - return 1 - ;; - esac - done - - case "${replace_from}" in + case "${pkg_xpkg_fixup_from}" in AUTHOR) - replace_to="`echo ${replace_to} | sed -e 's/\([^\\]\)@/\1\\\@/g'`" + pkg_xpkg_fixup_to="`echo ${pkg_xpkg_fixup_to} | sed -e 's/\([^\\]\)@/\1\\\@/g'`" ;; PACKAGE) - replace_to="`echo ${replace_to} | sed -e 's/_/-/g'`" + pkg_xpkg_fixup_to="`echo ${pkg_xpkg_fixup_to} | sed -e 's/_/-/g'`" # # track "pkg name" to "xpkg filename" # if [ -e "${pkg_xpkg_map}" ]; then - sed -i -e "/^${replace_to}$/d" "${pkg_xpkg_map}" && + sed -i -e "/^${pkg_xpkg_fixup_to}$/d" "${pkg_xpkg_map}" && if [ -s "${pkg_xpkg_map}" ]; then cat >&2 <> "${pkg_xpkg_map}" || return + echo "${pkg_xpkg_fixup_to}" >> "${pkg_xpkg_map}" || return ;; VERSION) - replace_to="${replace_to//[-_]/.}" + pkg_xpkg_fixup_to="${pkg_xpkg_fixup_to//[-_]/.}" ;; DEPENDS) return ;; esac - echo -n "install_fixup: @${replace_from}@ -> ${replace_to} ... " - sed -i -e "s,@$replace_from@,$replace_to,g" "${pkg_ipkg_control}" || return + echo -n "install_fixup: @${pkg_xpkg_fixup_from}@ -> ${pkg_xpkg_fixup_to} ... " + sed -i -e "s,@$pkg_xpkg_fixup_from@,$pkg_xpkg_fixup_to,g" "${pkg_ipkg_control}" || return echo "done." } -- cgit v1.2.3 From 4526895b9a3528e5d1e422ba523c9257305e4096 Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Fri, 9 Jul 2010 12:52:17 +0200 Subject: [ptxd_make_xpkg_fixup] rename ptxd_make_install_fixup to ptxd_make_xpkg_fixup Signed-off-by: Marc Kleine-Budde --- rules/post/ptxd_make_xpkg_fixup.make | 24 ++++++++++++++++++------ scripts/lib/ptxd_make_xpkg_fixup.sh | 4 ++-- 2 files changed, 20 insertions(+), 8 deletions(-) (limited to 'scripts') diff --git a/rules/post/ptxd_make_xpkg_fixup.make b/rules/post/ptxd_make_xpkg_fixup.make index 3b8535b33..89339beba 100644 --- a/rules/post/ptxd_make_xpkg_fixup.make +++ b/rules/post/ptxd_make_xpkg_fixup.make @@ -14,14 +14,26 @@ # # Replaces @MAGIC@ sequences in rules/*.ipkg files # -# $1: packet label +# $1: xpkg label # $2: MAGIC to be replaced # $3: replacement # -install_fixup = \ - $(call xpkg/env, $(1)) \ - pkg_xpkg_fixup_from='$(strip $(2))' \ - pkg_xpkg_fixup_to='$(strip $(3))' \ - ptxd_make_install_fixup +install_fixup = \ + $(call xpkg/fixup, $(1), $(2), $(3)) + +# +# xpkg/fixup +# +# replaces @MAGIC@ sequences in rules/*.ipkg files +# +# $1: xpkg label +# $2: MAGIC to be replaced +# $3: replacement +# +xpkg/fixup = \ + $(call xpkg/env, $(1)) \ + pkg_xpkg_fixup_from='$(strip $(2))' \ + pkg_xpkg_fixup_to='$(strip $(3))' \ + ptxd_make_xpkg_fixup # vim: syntax=make diff --git a/scripts/lib/ptxd_make_xpkg_fixup.sh b/scripts/lib/ptxd_make_xpkg_fixup.sh index 99c410cc4..285646c75 100644 --- a/scripts/lib/ptxd_make_xpkg_fixup.sh +++ b/scripts/lib/ptxd_make_xpkg_fixup.sh @@ -12,7 +12,7 @@ # # # -ptxd_make_install_fixup() { +ptxd_make_xpkg_fixup() { ptxd_make_xpkg_init || return case "${pkg_xpkg_fixup_from}" in @@ -57,4 +57,4 @@ EOF echo "done." } -export -f ptxd_make_install_fixup +export -f ptxd_make_xpkg_fixup -- cgit v1.2.3 From a7dabeb0feb611ce3e99916070a37b00ed7a1388 Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Fri, 9 Jul 2010 10:59:43 +0200 Subject: [targetinstall] sanitize xpkg variable This patch sanitizes value of the pkg_xpkg variable. It should only contain the chars allowed for ipkg package names. For now we only replace "_" by "-". Signed-off-by: Marc Kleine-Budde --- rules/post/install.make | 28 ++++++++++++++-------------- scripts/lib/ptxd_make_xpkg_common.sh | 7 +++++++ 2 files changed, 21 insertions(+), 14 deletions(-) (limited to 'scripts') diff --git a/rules/post/install.make b/rules/post/install.make index b942aa371..7b7109873 100644 --- a/rules/post/install.make +++ b/rules/post/install.make @@ -1,7 +1,7 @@ # -*-makefile-*- # # Copyright (C) 2005, 2006, 2007 Robert Schwebel -# 2008, 2009 by Marc Kleine-Budde +# 2008, 2009, 2010 by Marc Kleine-Budde # # See CREDITS for details about who has contributed to this project. # @@ -44,7 +44,7 @@ install_check = \ # binaries are stripped automatically # install_copy = \ - XPKG="$(strip $(1))"; \ + XPKG="$(subst _,-,$(strip $(1)))"; \ OWN="$(strip $(2))"; \ GRP="$(strip $(3))"; \ PER="$(strip $(4))"; \ @@ -76,7 +76,7 @@ install_copy = \ # $7: destination (optional) # install_alternative = \ - XPKG=$(strip $(1)); \ + XPKG=$(subst _,-,$(strip $(1))); \ OWN=$(strip $(2)); \ GRP=$(strip $(3)); \ PER=$(strip $(4)); \ @@ -100,7 +100,7 @@ install_alternative = \ # $5: the target directory. # install_tree = \ - XPKG=$(strip $(1)); \ + XPKG=$(subst _,-,$(strip $(1))); \ OWN=$(strip $(2)); \ GRP=$(strip $(3)); \ DIR=$(strip $(4)); \ @@ -122,7 +122,7 @@ install_tree = \ # $5: the target directory. # install_archive = \ - XPKG=$(strip $(1)); \ + XPKG=$(subst _,-,$(strip $(1))); \ OWN=$(strip $(2)); \ GRP=$(strip $(3)); \ DIR=$(strip $(4)); \ @@ -144,7 +144,7 @@ install_archive = \ # $2: spec file to parse # install_spec = \ - XPKG=$(strip $(1)); \ + XPKG=$(subst _,-,$(strip $(1))); \ SPECFILE=$(strip $(2)); \ $(call install_check, install_spec); \ echo "ptxd_install_spec '$$SPECFILE'" >> "$(STATEDIR)/$$XPKG.cmds" @@ -161,7 +161,7 @@ install_spec = \ # $2: the toplevel directory # install_package = \ - XPKG=$(strip $(1)); \ + XPKG=$(subst _,-,$(strip $(1))); \ $(call install_check, install_package); \ echo "ptxd_install_package" >> "$(STATEDIR)/$$XPKG.cmds" @@ -176,7 +176,7 @@ install_package = \ # $2: library name without suffix. # install_lib = \ - XPKG=$(strip $(1)); \ + XPKG=$(subst _,-,$(strip $(1))); \ OWN="$(strip $(2))"; \ GRP="$(strip $(3))"; \ PER="$(strip $(4))"; \ @@ -196,7 +196,7 @@ install_lib = \ # $4: value # install_replace = \ - XPKG=$(strip $(1)); \ + XPKG=$(subst _,-,$(strip $(1))); \ FILE=$(strip $(2)); \ PLACEHOLDER=$(strip $(3)); \ VALUE=$(strip $(4)); \ @@ -212,7 +212,7 @@ install_replace = \ # $4: strip (y|n) default is to strip # install_copy_toolchain_lib = \ - XPKG=$(strip $(1)); \ + XPKG=$(subst _,-,$(strip $(1))); \ LIB="$(strip $2)"; \ DST="$(strip $3)"; \ STRIP="$(strip $4)"; \ @@ -229,7 +229,7 @@ install_copy_toolchain_lib = \ # $3: strip (y|n) default is to strip # install_copy_toolchain_dl = \ - XPKG=$(strip $(1)); \ + XPKG=$(subst _,-,$(strip $(1))); \ DST="$(strip $2)"; \ STRIP="$(strip $3)"; \ test "$${DST}" != "" && DST="-d $${DST}"; \ @@ -246,7 +246,7 @@ install_copy_toolchain_dl = \ # $4: strip (y|n) default is to strip # install_copy_toolchain_usr = \ - XPKG=$(strip $(1)); \ + XPKG=$(subst _,-,$(strip $(1))); \ LIB="$(strip $2)"; \ DST="$(strip $3)"; \ STRIP="$(strip $4)"; \ @@ -265,7 +265,7 @@ install_copy_toolchain_usr = \ # $3: destination # install_link = \ - XPKG=$(strip $(1)); \ + XPKG=$(subst _,-,$(strip $(1))); \ SRC=$(strip $(2)); \ DST=$(strip $(3)); \ $(call install_check, install_link); \ @@ -286,7 +286,7 @@ install_link = \ # $8: device node name # install_node = \ - XPKG=$(strip $(1)); \ + XPKG=$(subst _,-,$(strip $(1)));\ OWN=$(strip $(2)); \ GRP=$(strip $(3)); \ PER=$(strip $(4)); \ diff --git a/scripts/lib/ptxd_make_xpkg_common.sh b/scripts/lib/ptxd_make_xpkg_common.sh index 89cde2c81..95aa714fd 100644 --- a/scripts/lib/ptxd_make_xpkg_common.sh +++ b/scripts/lib/ptxd_make_xpkg_common.sh @@ -32,6 +32,13 @@ ptxd_make_xpkg_init() { ptxd_bailout "'pkg_xpkg' or 'pkg_xpkg_type' undefined" fi + # + # sanitize pkg_xpkg name + # + # replace "_" by "-" + # + pkg_xpkg="${pkg_xpkg//_/-}" + ptxd_make_world_init || return # license -- cgit v1.2.3 From 71ce3979e14afbe9561f7daeaab73313aa3c1f6e Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Fri, 9 Jul 2010 11:58:23 +0200 Subject: [ptxd_make_xpkg_fixup] use pkg_xpkg for ipkg control file This patch uses the sanitized pkg_xpkg for ipkg's PACKAGE variable, i.e. the package name. The actual replacement of PACKAGE is moved to ptxd_make_xpkg_prepare, the fiddling with xpkg_map to ptxd_make_xpkg_finish. Signed-off-by: Marc Kleine-Budde --- scripts/lib/ptxd_make_xpkg_finish.sh | 26 ++++++++++++++++++-------- scripts/lib/ptxd_make_xpkg_fixup.sh | 27 +-------------------------- scripts/lib/ptxd_make_xpkg_prepare.sh | 16 ++++++++++------ 3 files changed, 29 insertions(+), 40 deletions(-) (limited to 'scripts') diff --git a/scripts/lib/ptxd_make_xpkg_finish.sh b/scripts/lib/ptxd_make_xpkg_finish.sh index 996afbd5f..d7ba5ac94 100644 --- a/scripts/lib/ptxd_make_xpkg_finish.sh +++ b/scripts/lib/ptxd_make_xpkg_finish.sh @@ -53,23 +53,33 @@ ptxd_make_xpkg_finish() { ptxd_make_xpkg_init || return # - # no perm file -> no files to package -> exit + # no command file -> no files to package -> exit # if [ \! -s "${pkg_xpkg_cmds}" ]; then - ptxd_pedantic "Packet '${pkg_xpkg}' is empty. not generating" && rm -rf -- "${pkg_xpkg_tmp}" && + ptxd_pedantic "Packet '${pkg_xpkg}' is empty. not generating" + return + fi && - #FIXME: we rely in 1-to-1 mapping here + # + # track "pkg name" to "xpkg filename" mapping + # + if [ -e "${pkg_xpkg_map}" ]; then sed -i -e "/^${pkg_xpkg}$/d" "${pkg_xpkg_map}" && + if [ -s "${pkg_xpkg_map}" ]; then + cat >&2 <> "${pkg_xpkg_map}" || return + # # license # diff --git a/scripts/lib/ptxd_make_xpkg_fixup.sh b/scripts/lib/ptxd_make_xpkg_fixup.sh index 285646c75..3c7c2c677 100644 --- a/scripts/lib/ptxd_make_xpkg_fixup.sh +++ b/scripts/lib/ptxd_make_xpkg_fixup.sh @@ -18,36 +18,11 @@ ptxd_make_xpkg_fixup() { case "${pkg_xpkg_fixup_from}" in AUTHOR) pkg_xpkg_fixup_to="`echo ${pkg_xpkg_fixup_to} | sed -e 's/\([^\\]\)@/\1\\\@/g'`" - ;; - PACKAGE) - pkg_xpkg_fixup_to="`echo ${pkg_xpkg_fixup_to} | sed -e 's/_/-/g'`" - - # - # track "pkg name" to "xpkg filename" - # - if [ -e "${pkg_xpkg_map}" ]; then - sed -i -e "/^${pkg_xpkg_fixup_to}$/d" "${pkg_xpkg_map}" && - - if [ -s "${pkg_xpkg_map}" ]; then - cat >&2 <> "${pkg_xpkg_map}" || return - - ;; VERSION) pkg_xpkg_fixup_to="${pkg_xpkg_fixup_to//[-_]/.}" ;; - DEPENDS) + DEPENDS|PACKAGE) return ;; esac diff --git a/scripts/lib/ptxd_make_xpkg_prepare.sh b/scripts/lib/ptxd_make_xpkg_prepare.sh index 4f7e44000..665803ba7 100644 --- a/scripts/lib/ptxd_make_xpkg_prepare.sh +++ b/scripts/lib/ptxd_make_xpkg_prepare.sh @@ -23,13 +23,17 @@ ptxd_make_xpkg_prepare() { 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" "${PTXDIST_TOPDIR}/config/xpkg/ipkg.control" > \ + # + # replace ARCH and PACKAGE in control file + # + echo -e "\ +install_init: @ARCH@ -> ${PTXDIST_IPKG_ARCH_STRING} +install_init: @PACKAGE@ -> ${pkg_xpkg}" + + ARCH="${PTXDIST_IPKG_ARCH_STRING}" \ + PACKAGE="${pkg_xpkg}" \ + ptxd_replace_magic "${PTXDIST_TOPDIR}/config/xpkg/ipkg.control" > \ "${pkg_ipkg_control}" || return - echo "done" local script for script in preinst postinst prerm postrm; do -- cgit v1.2.3 From 6def60e366004905f0b59fb1e8f185bbeff96210 Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Fri, 9 Jul 2010 13:39:28 +0200 Subject: [ptxd_make_xpkg_prepare] provide a sanitized pkg_xpkg_version pkg_xpkg_version has "_" replaced by "." so that this version string is suitable for ipkg. Signed-off-by: Marc Kleine-Budde --- scripts/lib/ptxd_make_xpkg_common.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/lib/ptxd_make_xpkg_common.sh b/scripts/lib/ptxd_make_xpkg_common.sh index 95aa714fd..66ba8e73f 100644 --- a/scripts/lib/ptxd_make_xpkg_common.sh +++ b/scripts/lib/ptxd_make_xpkg_common.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright (C) 2008, 2009 by Marc Kleine-Budde +# Copyright (C) 2008, 2009, 2010 by Marc Kleine-Budde # # See CREDITS for details about who has contributed to this project. # @@ -39,6 +39,16 @@ ptxd_make_xpkg_init() { # pkg_xpkg="${pkg_xpkg//_/-}" + # + # sanitize pkg_version + # + # replace "_" by "." + # + pkg_xpkg_version="${pkg_version//_/.}" + if [ -z ${pkg_xpkg_version} ]; then + ptxd_bailout "${FUNCNAME}: please define _VERSION" + fi + ptxd_make_world_init || return # license -- cgit v1.2.3 From 98d64c43791b97077c35f1ab418c9680bb1004c8 Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Fri, 9 Jul 2010 13:39:28 +0200 Subject: [ptxd_make_xpkg_prepare] use pkg_xpkg_version for ipkg control file This patch uses the sanitized pkg_xpkg_version for ipkg's VERSION variable. The actual replacement of PACKAGE is moved to ptxd_make_xpkg_prepare. Signed-off-by: Marc Kleine-Budde --- scripts/lib/ptxd_make_xpkg_fixup.sh | 5 +---- scripts/lib/ptxd_make_xpkg_prepare.sh | 4 +++- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/lib/ptxd_make_xpkg_fixup.sh b/scripts/lib/ptxd_make_xpkg_fixup.sh index 3c7c2c677..42cebdaf2 100644 --- a/scripts/lib/ptxd_make_xpkg_fixup.sh +++ b/scripts/lib/ptxd_make_xpkg_fixup.sh @@ -19,10 +19,7 @@ ptxd_make_xpkg_fixup() { AUTHOR) pkg_xpkg_fixup_to="`echo ${pkg_xpkg_fixup_to} | sed -e 's/\([^\\]\)@/\1\\\@/g'`" ;; - VERSION) - pkg_xpkg_fixup_to="${pkg_xpkg_fixup_to//[-_]/.}" - ;; - DEPENDS|PACKAGE) + DEPENDS|PACKAGE|VERSION) return ;; esac diff --git a/scripts/lib/ptxd_make_xpkg_prepare.sh b/scripts/lib/ptxd_make_xpkg_prepare.sh index 665803ba7..079b13dd0 100644 --- a/scripts/lib/ptxd_make_xpkg_prepare.sh +++ b/scripts/lib/ptxd_make_xpkg_prepare.sh @@ -28,10 +28,12 @@ ptxd_make_xpkg_prepare() { # echo -e "\ install_init: @ARCH@ -> ${PTXDIST_IPKG_ARCH_STRING} -install_init: @PACKAGE@ -> ${pkg_xpkg}" +install_init: @PACKAGE@ -> ${pkg_xpkg} +install_init: @VERSION@ -> ${pkg_xpkg_version}" ARCH="${PTXDIST_IPKG_ARCH_STRING}" \ PACKAGE="${pkg_xpkg}" \ + VERSION="${pkg_xpkg_version}" \ ptxd_replace_magic "${PTXDIST_TOPDIR}/config/xpkg/ipkg.control" > \ "${pkg_ipkg_control}" || return -- cgit v1.2.3 From ef1850f89c6cfeb33e5c016c0ae68b2364608808 Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Sun, 27 Jun 2010 12:36:23 +0200 Subject: [ptxd_make_xpkg_common] introduce ptxd_do_xpkg_map this function does the mapping from pkg name to xpkg name Signed-off-by: Marc Kleine-Budde --- scripts/lib/ptxd_make_xpkg_common.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'scripts') diff --git a/scripts/lib/ptxd_make_xpkg_common.sh b/scripts/lib/ptxd_make_xpkg_common.sh index 66ba8e73f..b87daa6cf 100644 --- a/scripts/lib/ptxd_make_xpkg_common.sh +++ b/scripts/lib/ptxd_make_xpkg_common.sh @@ -24,6 +24,30 @@ ptxd_dopermissions() { export -f ptxd_dopermissions +# +# ptxd_do_xpkg_map - do the mapping from package name to xpkg name(s) +# +# in: +# ${@} package name(s) +# +# out: +# ${ptxd_reply[@]} array of xpkg names +# +# return: +# 0 if xpkg names are found +# 1 if no xpkg names are found +# +# ptxd_reply (array) +# +ptxd_do_xpkg_map() { + set -- "${@/#/${ptx_state_dir}/}" + ptxd_reply=( $(cat "${@/%/.xpkg.map}" 2>/dev/null) ) + + [ ${#ptxd_reply[@]} -ne 0 ] +} +export -f ptxd_do_xpkg_map + + # # initialize variables needed for packaging # -- cgit v1.2.3 From f1adca40067af65bb6b9994aaa1ed91c2bdbdfbe Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Thu, 15 Jul 2010 13:35:23 +0200 Subject: [ptxd_make_image_common] provide function to get selected ipkg files This patch provides a function to gather all selected ipkg files that should be instelled. It takes care of collecting the parmission files, too. Signed-off-by: Marc Kleine-Budde --- scripts/lib/ptxd_make_image_common.sh | 77 +++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 scripts/lib/ptxd_make_image_common.sh (limited to 'scripts') diff --git a/scripts/lib/ptxd_make_image_common.sh b/scripts/lib/ptxd_make_image_common.sh new file mode 100644 index 000000000..7cb0ed64d --- /dev/null +++ b/scripts/lib/ptxd_make_image_common.sh @@ -0,0 +1,77 @@ +#!/bin/bash +# +# Copyright (C) 2010 by Marc Kleine-Budde +# +# 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. +# + + +# +# ptxd_get_ipkg_files - get full path to ipkgs that should be installed +# +# in: +# - $image_pkgs_selected_target space seperated list of selected +# packages +# +# out: +# - $ptxd_reply_ipkg_files array of ipkg files +# - $ptxd_reply_perm_files array of permission files +# +ptxd_get_ipkg_files() { + # map pkg_label to pkg's ipkg files + local -a ptxd_reply + ptxd_do_xpkg_map ${image_pkgs_selected_target} + + unset ptxd_reply_ipkg_files ptxd_reply_perm_files + + set -- "${ptxd_reply[@]}" + while [ ${#} -ne 0 ]; do + # look in "image_ipkg_repo_dirs" for ipkg files + + # FIXME: add IPKG_ARCH, pkg_version? + local -a ipkg_files + ipkg_files="${image_ipkg_repo_dirs[@]/%//${1}_*.ipk}" + + # take first hit + if ptxd_get_path "${ipkg_files[@]}"; then + ptxd_reply_ipkg_files[${#ptxd_reply_ipkg_files[@]}]="${ptxd_reply}" + ptxd_reply_perm_files[${#ptxd_reply_perm_files[@]}]="${ptxd_reply%/*/*}/state/${1}.perms" + else + ptxd_bailout "\ + +Unable to find xpkg file for '${1}', this should not happen! +Run first 'ptxdist clean root' then 'ptxdist images' again. +" + fi + + shift + done + + # + # take care about production build + # + if [ -n "${PTXDIST_PROD_PLATFORMDIR}" ]; then + if ! ptxd_get_path "${PTXDIST_PROD_PLATFORMDIR}/packages/*.ipk"; then + ptxd_bailout "use production BSP: no ipkg files found in '${PTXDIST_PROD_PLATFORMDIR}/packages'" + fi + ptxd_reply_ipkg_files=( "${ptxd_reply_ipkg_files[@]}" "${ptxd_reply[@]}" ) + + if ! ptxd_get_path "${PTXDIST_PROD_PLATFORMDIR}/state/*.perms"; then + ptxd_bailout "use production BSP: no perms files found in '${PTXDIST_PROD_PLATFORMDIR}/state" + fi + ptxd_reply_perm_files=( "${ptxd_reply_perm_files[@]}" "${ptxd_reply[@]}" ) + fi +} +export -f ptxd_get_ipkg_files + + +# +# initialize variables needed for image creation +# +ptxd_make_image_init() { + image_ipkg_repo_dirs=( "${ptx_pkg_dir}" ) +} +export -f ptxd_make_image_init -- cgit v1.2.3 From 5081b8b649a2f87f6c1e8901670bceef786467d8 Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Mon, 12 Jul 2010 14:52:43 +0200 Subject: [fix permissions] rename ptxd_make_fixpermissions.sh -> ptxd_make_image_fix_permissions.sh Signed-off-by: Marc Kleine-Budde --- scripts/lib/ptxd_make_fixpermissions.sh | 156 ------------------------- scripts/lib/ptxd_make_image_fix_permissions.sh | 156 +++++++++++++++++++++++++ 2 files changed, 156 insertions(+), 156 deletions(-) delete mode 100644 scripts/lib/ptxd_make_fixpermissions.sh create mode 100644 scripts/lib/ptxd_make_image_fix_permissions.sh (limited to 'scripts') diff --git a/scripts/lib/ptxd_make_fixpermissions.sh b/scripts/lib/ptxd_make_fixpermissions.sh deleted file mode 100644 index 0d3d7b982..000000000 --- a/scripts/lib/ptxd_make_fixpermissions.sh +++ /dev/null @@ -1,156 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2008, 2009 by Marc Kleine-Budde -# -# 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. -# - -ptxd_make_fixpermissions_generate() { - case "${kind}" in - n) - # erase existing nodes - cat >&3 < "${fixscript}" - while [ ${#} -ne 0 ]; do - ptxd_make_fixpermissions_check "${1}" || return - shift - done - exec 3>&- - - # nothing to do! - if [ \! -s "${fixscript}" ]; then - return - fi - -cat <&2 < +# +# 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. +# + +ptxd_make_fixpermissions_generate() { + case "${kind}" in + n) + # erase existing nodes + cat >&3 < "${fixscript}" + while [ ${#} -ne 0 ]; do + ptxd_make_fixpermissions_check "${1}" || return + shift + done + exec 3>&- + + # nothing to do! + if [ \! -s "${fixscript}" ]; then + return + fi + +cat <&2 < Date: Mon, 12 Jul 2010 14:55:12 +0200 Subject: [ptxd_make_image_fix_permissions] refactore function names to match file name Signed-off-by: Marc Kleine-Budde --- rules/post/ptxd_make_image_fix_permissions.make | 2 +- scripts/lib/ptxd_make_image_fix_permissions.sh | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) (limited to 'scripts') diff --git a/rules/post/ptxd_make_image_fix_permissions.make b/rules/post/ptxd_make_image_fix_permissions.make index 7a6eb9aa3..f375a27c1 100644 --- a/rules/post/ptxd_make_image_fix_permissions.make +++ b/rules/post/ptxd_make_image_fix_permissions.make @@ -20,6 +20,6 @@ world: $(PTX_FIXPERM_RUN) endif $(PTX_FIXPERM_RUN): $(PTX_PERMISSIONS) $(STATEDIR)/world.targetinstall - @ptxd_make_fixpermissions -p "$<" -r "$(ROOTDIR)" -r "$(ROOTDIR_DEBUG)" + @ptxd_make_image_fix_permissions -p "$<" -r "$(ROOTDIR)" -r "$(ROOTDIR_DEBUG)" # vim: syntax=make diff --git a/scripts/lib/ptxd_make_image_fix_permissions.sh b/scripts/lib/ptxd_make_image_fix_permissions.sh index 0d3d7b982..9a9a11309 100644 --- a/scripts/lib/ptxd_make_image_fix_permissions.sh +++ b/scripts/lib/ptxd_make_image_fix_permissions.sh @@ -8,7 +8,7 @@ # see the README file. # -ptxd_make_fixpermissions_generate() { +ptxd_make_image_fix_permissions_generate() { case "${kind}" in n) # erase existing nodes @@ -25,11 +25,11 @@ EOF ;; esac } -export -f ptxd_make_fixpermissions_generate +export -f ptxd_make_image_fix_permissions_generate -ptxd_make_fixpermissions_check() { +ptxd_make_image_fix_permissions_check() { local workdir="${1}" local ifs_orig="${IFS}" IFS=":" @@ -73,17 +73,16 @@ ptxd_make_fixpermissions_check() { fi if [ "${fixup}" = "true" ]; then - ptxd_make_fixpermissions_generate + ptxd_make_image_fix_permissions_generate fi done IFS="${ifs_orig}" } -export -f ptxd_make_fixpermissions_check +export -f ptxd_make_image_fix_permissions_check - -ptxd_make_fixpermissions() { +ptxd_make_image_fix_permissions() { local permfile workdirs opt while getopts "p:r:" opt; do @@ -110,7 +109,7 @@ ptxd_make_fixpermissions() { exec 3> "${fixscript}" while [ ${#} -ne 0 ]; do - ptxd_make_fixpermissions_check "${1}" || return + ptxd_make_image_fix_permissions_check "${1}" || return shift done exec 3>&- @@ -153,4 +152,4 @@ WARNING: NFS-root might not be working correctly! EOF fi } -export -f ptxd_make_fixpermissions +export -f ptxd_make_image_fix_permissions -- cgit v1.2.3 From a29b308f810b30591abbc03b00dbbf0ab7c9a7a5 Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Thu, 15 Jul 2010 14:51:49 +0200 Subject: [ptxd_make_image_fix_permissions] get rid of cmd line option -r Signed-off-by: Marc Kleine-Budde --- rules/post/ptxd_make_image_fix_permissions.make | 3 ++- scripts/lib/ptxd_make_image_fix_permissions.sh | 12 ++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) (limited to 'scripts') diff --git a/rules/post/ptxd_make_image_fix_permissions.make b/rules/post/ptxd_make_image_fix_permissions.make index f375a27c1..f121fd917 100644 --- a/rules/post/ptxd_make_image_fix_permissions.make +++ b/rules/post/ptxd_make_image_fix_permissions.make @@ -20,6 +20,7 @@ world: $(PTX_FIXPERM_RUN) endif $(PTX_FIXPERM_RUN): $(PTX_PERMISSIONS) $(STATEDIR)/world.targetinstall - @ptxd_make_image_fix_permissions -p "$<" -r "$(ROOTDIR)" -r "$(ROOTDIR_DEBUG)" + @$(call image/env) \ + ptxd_make_image_fix_permissions -p "$<" # vim: syntax=make diff --git a/scripts/lib/ptxd_make_image_fix_permissions.sh b/scripts/lib/ptxd_make_image_fix_permissions.sh index 9a9a11309..54b2c1556 100644 --- a/scripts/lib/ptxd_make_image_fix_permissions.sh +++ b/scripts/lib/ptxd_make_image_fix_permissions.sh @@ -83,16 +83,15 @@ export -f ptxd_make_image_fix_permissions_check ptxd_make_image_fix_permissions() { - local permfile workdirs opt + ptxd_make_image_init || return + + local permfile opt while getopts "p:r:" opt; do case "$opt" in p) permfile="${OPTARG}" ;; - r) - workdirs="${workdirs}${workdirs:+:}${OPTARG}" - ;; *) ;; esac @@ -102,10 +101,7 @@ ptxd_make_image_fix_permissions() { fixscript="$(mktemp "${PTXDIST_TEMPDIR}/fixpermissions.XXXXXXXXXX")" || ptxd_bailout "failed to create tempfile" chmod +x "${fixscript}" - local ifs_orig="${IFS}" - IFS=":" - set -- ${workdirs} - IFS="${ifs_orig}" + set -- "${ptx_nfsroot}" "${ptx_nfsroot_dbg}" exec 3> "${fixscript}" while [ ${#} -ne 0 ]; do -- cgit v1.2.3 From d28e842fedff8e1298b975f4b02c69b5bc5920a1 Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Thu, 15 Jul 2010 15:13:26 +0200 Subject: [ptxd_make_image_fix_permissions] get rid of cmd line option -p Signed-off-by: Marc Kleine-Budde --- rules/post/ptxd_make_image_fix_permissions.make | 4 ++-- scripts/lib/ptxd_make_image_fix_permissions.sh | 21 +++++++-------------- 2 files changed, 9 insertions(+), 16 deletions(-) (limited to 'scripts') diff --git a/rules/post/ptxd_make_image_fix_permissions.make b/rules/post/ptxd_make_image_fix_permissions.make index f121fd917..65d9f10ea 100644 --- a/rules/post/ptxd_make_image_fix_permissions.make +++ b/rules/post/ptxd_make_image_fix_permissions.make @@ -19,8 +19,8 @@ ifeq ($(MAKECMDGOALS)-$(PTXCONF_FIX_PERMISSIONS)-$(PTXDIST_QUIET),world-y-) world: $(PTX_FIXPERM_RUN) endif -$(PTX_FIXPERM_RUN): $(PTX_PERMISSIONS) $(STATEDIR)/world.targetinstall +$(PTX_FIXPERM_RUN): $(STATEDIR)/world.targetinstall @$(call image/env) \ - ptxd_make_image_fix_permissions -p "$<" + ptxd_make_image_fix_permissions # vim: syntax=make diff --git a/scripts/lib/ptxd_make_image_fix_permissions.sh b/scripts/lib/ptxd_make_image_fix_permissions.sh index 54b2c1556..33a6914f5 100644 --- a/scripts/lib/ptxd_make_image_fix_permissions.sh +++ b/scripts/lib/ptxd_make_image_fix_permissions.sh @@ -35,7 +35,8 @@ ptxd_make_image_fix_permissions_check() { IFS=":" # just care about dev-nodes, for now - egrep "^[n]:" "${permfile}" | while read kind file uid_should gid_should prm_should type major_should minor_should; do + egrep -h "^[n]:" "${ptxd_reply_perm_files[@]}" | + while read kind file uid_should gid_should prm_should type major_should minor_should; do local fixup=false file="${workdir}/${file#/}" @@ -85,21 +86,13 @@ export -f ptxd_make_image_fix_permissions_check ptxd_make_image_fix_permissions() { ptxd_make_image_init || return - local permfile opt - - while getopts "p:r:" opt; do - case "$opt" in - p) - permfile="${OPTARG}" - ;; - *) - ;; - esac - done - local fixscript fixscript="$(mktemp "${PTXDIST_TEMPDIR}/fixpermissions.XXXXXXXXXX")" || ptxd_bailout "failed to create tempfile" - chmod +x "${fixscript}" + chmod +x "${fixscript}" && + + # get permission files + local -a ptxd_reply_ipkg_file ptxd_reply_perm_files && + ptxd_get_ipkg_files && set -- "${ptx_nfsroot}" "${ptx_nfsroot_dbg}" -- cgit v1.2.3 From 2724ab1fd87f4367e4735118bdb9eb7ec989b088 Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Thu, 15 Jul 2010 15:25:39 +0200 Subject: [ptxd_make_image_fix_permissions] clean up implementation Signed-off-by: Marc Kleine-Budde --- rules/post/ptxd_make_image_fix_permissions.make | 10 +++---- scripts/lib/ptxd_make_image_fix_permissions.sh | 35 ++++++++++++++----------- 2 files changed, 23 insertions(+), 22 deletions(-) (limited to 'scripts') diff --git a/rules/post/ptxd_make_image_fix_permissions.make b/rules/post/ptxd_make_image_fix_permissions.make index 65d9f10ea..4a727e14f 100644 --- a/rules/post/ptxd_make_image_fix_permissions.make +++ b/rules/post/ptxd_make_image_fix_permissions.make @@ -1,6 +1,6 @@ # -*-makefile-*- # -# Copyright (C) 2008, 2009 by Marc Kleine-Budde +# Copyright (C) 2008, 2009, 2010 by Marc Kleine-Budde # # See CREDITS for details about who has contributed to this project. # @@ -8,18 +8,16 @@ # see the README file. # -### --- internal --- - -PTX_FIXPERM_RUN := $(STATEDIR)/fix-permissions.run +image/fix_permissions := $(STATEDIR)/ptx_image_fix_permissions # # only run if make goal is "world", i.e. don't run during images_world # ifeq ($(MAKECMDGOALS)-$(PTXCONF_FIX_PERMISSIONS)-$(PTXDIST_QUIET),world-y-) -world: $(PTX_FIXPERM_RUN) +world: $(image/fix_permissions) endif -$(PTX_FIXPERM_RUN): $(STATEDIR)/world.targetinstall +$(image/fix_permissions): $(STATEDIR)/world.targetinstall @$(call image/env) \ ptxd_make_image_fix_permissions diff --git a/scripts/lib/ptxd_make_image_fix_permissions.sh b/scripts/lib/ptxd_make_image_fix_permissions.sh index 33a6914f5..66225bcd8 100644 --- a/scripts/lib/ptxd_make_image_fix_permissions.sh +++ b/scripts/lib/ptxd_make_image_fix_permissions.sh @@ -83,16 +83,19 @@ ptxd_make_image_fix_permissions_check() { export -f ptxd_make_image_fix_permissions_check +# +# ptxd_make_image_fix_permissions - create device nodes in nfsroots +# ptxd_make_image_fix_permissions() { - ptxd_make_image_init || return + ptxd_make_image_init && - local fixscript - fixscript="$(mktemp "${PTXDIST_TEMPDIR}/fixpermissions.XXXXXXXXXX")" || ptxd_bailout "failed to create tempfile" + local fixscript="${PTXDIST_TEMPDIR}/${FUNCNAME}" && + touch "${fixscript}" && chmod +x "${fixscript}" && # get permission files local -a ptxd_reply_ipkg_file ptxd_reply_perm_files && - ptxd_get_ipkg_files && + ptxd_get_ipkg_files || return set -- "${ptx_nfsroot}" "${ptx_nfsroot_dbg}" @@ -119,18 +122,7 @@ In order to create them root privileges are required. EOF read -t 5 -p "(Please press enter to start 'sudo' to gain root privileges.)" - if [ ${?} -eq 0 ]; then - sudo "${fixscript}" || { - cat <&2 < Date: Thu, 15 Jul 2010 14:31:32 +0200 Subject: [ptxd_make_image_prepare_work_dir] provide function to prepare the image work dir Signed-off-by: Marc Kleine-Budde --- scripts/lib/ptxd_make_image_prepare_work_dir.sh | 74 +++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 scripts/lib/ptxd_make_image_prepare_work_dir.sh (limited to 'scripts') diff --git a/scripts/lib/ptxd_make_image_prepare_work_dir.sh b/scripts/lib/ptxd_make_image_prepare_work_dir.sh new file mode 100644 index 000000000..055494e02 --- /dev/null +++ b/scripts/lib/ptxd_make_image_prepare_work_dir.sh @@ -0,0 +1,74 @@ +#!/bin/bash +# +# Copyright (C) 2010 by Marc Kleine-Budde +# +# 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. +# + + +# +# ptxd_make_image_extract_ipkg_files - extract ipkg for later image generation +# +# in: +# - $image_work_dir directory where ipkg are extracted +# - $image_permissions name of file that should contain all permissions +# - $image_pkgs_selected_target space seperated list of selected +# packages +# - $PTXDIST_IPKG_ARCH_STRING ARCH variable for ipkg files +# - $PTXCONF_IPKG_IPKG_CONF_URL the URL to use in /etc/ipkg.conf +# +# out: +# - $image_permissions file containing all permissions +# +ptxd_make_image_extract_ipkg_files() { + # FIXME: consolidate "ptxd_install_setup_src" + local src="/etc/ipkg.conf" + local ipkg_conf="${PTXDIST_TEMPDIR}/${FUNCNAME}_ipkg.conf" + local -a list ptxd_reply + list=( \ + "${PTXDIST_WORKSPACE}/projectroot${PTXDIST_PLATFORMSUFFIX}${src}" \ + "${PTXDIST_WORKSPACE}/projectroot${src}${PTXDIST_PLATFORMSUFFIX}" \ + "${PTXDIST_WORKSPACE}/projectroot${src}" \ + "${PTXDIST_TOPDIR}/generic${src}" \ + ) + + if ! ptxd_get_path "${list[@]}"; then + local IFS=" +" + ptxd_bailout " +unable to find '${src}' + +These location have been searched: +${list[*]} +" + fi + + rm -rf "${image_work_dir}" && + mkdir -p "${image_work_dir}" && + + ARCH="${PTXDIST_IPKG_ARCH_STRING}" \ + SRC="${PTXCONF_IPKG_IPKG_CONF_URL}" \ + ptxd_replace_magic "${ptxd_reply}" > "${ipkg_conf}" && + + DESTDIR="${image_work_dir}" \ + fakeroot -- ipkg-cl -f "${ipkg_conf}" -o "${image_work_dir}" \ + install "${ptxd_reply_ipkg_files[@]}" && + if ! cat "${ptxd_reply_perm_files[@]}" > "${image_permissions}"; then + echo "${PTXDIST_LOG_PROMPT}error: failed read permission files" >&2 + return 1 + fi + + return +} +export -f ptxd_make_image_extract_ipkg_files + + +ptxd_make_image_prepare_work_dir() { + ptxd_make_image_init && + ptxd_get_ipkg_files && + ptxd_make_image_extract_ipkg_files +} +export -f ptxd_make_image_prepare_work_dir -- cgit v1.2.3