summaryrefslogtreecommitdiffstats
path: root/scripts/lib
diff options
context:
space:
mode:
authorGeorge McCollister <george.mccollister@gmail.com>2011-05-19 16:03:58 -0500
committerMichael Olbrich <m.olbrich@pengutronix.de>2011-05-20 19:40:29 +0200
commit9180e7e7a51ca8f465013ae8640d16f2e54a8899 (patch)
tree4a4ca8d67d6a18b4427dfb38f7db6525eeebd864 /scripts/lib
parentddc604057b44e875bd8a684b48e05fb983f4a5e5 (diff)
downloadptxdist-9180e7e7a51ca8f465013ae8640d16f2e54a8899.tar.gz
ptxdist-9180e7e7a51ca8f465013ae8640d16f2e54a8899.tar.xz
opkg can now be used instead of ipkg
opkg and opkg-utils can now be used to build .ipk files and generate images from them. No longer default HOST_IPKG_UTILS and HOST_IPKG to yes. HOST_PACKAGE_MANAGEMENT_IPKG will select HOST_IPKG. HOST_IPKG will select HOST_IPKG_UTILS. Added package management selection to hosttools. Changed scripts to use the package management utilities for the selected package management system. Signed-off-by: George McCollister <george.mccollister@gmail.com> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'scripts/lib')
-rw-r--r--scripts/lib/ptxd_make_image_prepare_work_dir.sh19
-rw-r--r--scripts/lib/ptxd_make_opkg_common.sh22
-rw-r--r--scripts/lib/ptxd_make_opkg_finish.sh45
3 files changed, 80 insertions, 6 deletions
diff --git a/scripts/lib/ptxd_make_image_prepare_work_dir.sh b/scripts/lib/ptxd_make_image_prepare_work_dir.sh
index 1715abe72..d8f7b1d31 100644
--- a/scripts/lib/ptxd_make_image_prepare_work_dir.sh
+++ b/scripts/lib/ptxd_make_image_prepare_work_dir.sh
@@ -1,6 +1,7 @@
#!/bin/bash
#
# Copyright (C) 2010 by Marc Kleine-Budde <mkl@pengutronix.de>
+# 2011 by George McCollister <george.mccollister@gmail.com>
#
# See CREDITS for details about who has contributed to this project.
#
@@ -22,11 +23,17 @@
# out:
# - $image_permissions file containing all permissions
#
-ptxd_make_image_extract_ipkg_files() {
+ptxd_make_image_extract_xpkg_files() {
# FIXME: consolidate "ptxd_install_setup_src"
local src="/etc/ipkg.conf"
- local ipkg_conf="${PTXDIST_TEMPDIR}/${FUNCNAME}_ipkg.conf"
+ local xpkg_conf="${PTXDIST_TEMPDIR}/${FUNCNAME}_xpkg.conf"
local -a list ptxd_reply
+ if ptxd_get_ptxconf "PTXCONF_HOST_PACKAGE_MANAGEMENT_OPKG" > /dev/null; then
+ echo "option force_postinstall 1" > "${xpkg_conf}"
+ src="/etc/opkg/opkg.conf"
+ else
+ src="/etc/ipkg.conf"
+ fi
list=( \
"${PTXDIST_WORKSPACE}/projectroot${PTXDIST_PLATFORMSUFFIX}${src}" \
"${PTXDIST_WORKSPACE}/projectroot${src}${PTXDIST_PLATFORMSUFFIX}" \
@@ -50,10 +57,10 @@ ${list[*]}
ARCH="${PTXDIST_IPKG_ARCH_STRING}" \
SRC="" \
- ptxd_replace_magic "${ptxd_reply}" > "${ipkg_conf}" &&
+ ptxd_replace_magic "${ptxd_reply}" >> "${xpkg_conf}" &&
DESTDIR="${image_work_dir}" \
- fakeroot -- ipkg-cl -f "${ipkg_conf}" -o "${image_work_dir}" \
+ fakeroot -- ${image_xpkg_type}-cl -f "${xpkg_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
@@ -62,12 +69,12 @@ ${list[*]}
return
}
-export -f ptxd_make_image_extract_ipkg_files
+export -f ptxd_make_image_extract_xpkg_files
ptxd_make_image_prepare_work_dir() {
ptxd_make_image_init &&
ptxd_get_ipkg_files &&
- ptxd_make_image_extract_ipkg_files
+ ptxd_make_image_extract_xpkg_files
}
export -f ptxd_make_image_prepare_work_dir
diff --git a/scripts/lib/ptxd_make_opkg_common.sh b/scripts/lib/ptxd_make_opkg_common.sh
new file mode 100644
index 000000000..dca858021
--- /dev/null
+++ b/scripts/lib/ptxd_make_opkg_common.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+#
+# Copyright (C) 2009 by Marc Kleine-Budde <mkl@pengutronix.de>
+# 2011 by George McCollister <george.mccollister@gmail.com>
+#
+# 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.
+#
+
+
+#
+# initialize variables needed to package opkgs
+#
+ptxd_make_opkg_init() {
+ pkg_opkg_tmp="${pkg_xpkg_tmp}/opkg"
+ pkg_xpkg_control_dir="${pkg_opkg_tmp}/CONTROL"
+ pkg_xpkg_control="${pkg_xpkg_control_dir}/control"
+ pkg_xpkg_conffiles="${pkg_xpkg_control_dir}/conffiles"
+}
+export -f ptxd_make_opkg_init
diff --git a/scripts/lib/ptxd_make_opkg_finish.sh b/scripts/lib/ptxd_make_opkg_finish.sh
new file mode 100644
index 000000000..97e10340f
--- /dev/null
+++ b/scripts/lib/ptxd_make_opkg_finish.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+#
+# Copyright (C) 2005, 2006, 2007 Robert Schwebel <r.schwebel@pengutronix.de>
+# 2008, 2009, 2010 by Marc Kleine-Budde <mkl@pengutronix.de>
+# 2011 by George McCollister <george.mccollister@gmail.com>
+#
+# 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.
+#
+
+#
+# the actual opkg package creation, will run in fakeroot
+#
+ptxd_make_opkg_finish_impl() {
+ chown -R 0:0 "${pkg_xpkg_tmp}" &&
+ ptxd_make_xpkg_pkg "${pkg_opkg_tmp}" "${pkg_xpkg_cmds}" "${pkg_xpkg_perms}" &&
+ opkg-build ${pkg_opkg_extra_args} "${pkg_opkg_tmp}" "${ptx_pkg_dir}"
+}
+export -f ptxd_make_opkg_finish_impl
+
+
+#
+# create an opkg package
+#
+ptxd_make_opkg_finish() {
+ local dep
+
+ # replace space with ", "
+ dep="${pkg_xpkg_deps[*]}"
+ dep="${dep// /, }"
+
+ sed -i -e "s:@DEPENDS@:${dep}:g" "${pkg_xpkg_control}" || return
+
+ local -a fake_args
+ if [ -f "${pkg_fake_env}" ]; then
+ fake_args=( "-i" "${pkg_fake_env}" )
+ fi
+ fake_args[${#fake_args[@]}]="-u"
+
+ export ${!pkg_*} ${!ptx_*}
+ fakeroot "${fake_args[@]}" -- ptxd_make_opkg_finish_impl
+}
+export -f ptxd_make_opkg_finish