2 # Creates a root filesystem out of IPKs
4 # This rootfs can be mounted via root-nfs or it can be put into an cramfs/jffs etc.
5 # See image.bbclass for a usage of this.
8 do_rootfs[depends] += "opkg-native:do_populate_staging"
10 IPKG_TMP_DIR = "${IMAGE_ROOTFS}-tmp"
11 IPKG_ARGS = "-f ${IPKGCONF_TARGET} -o ${IMAGE_ROOTFS} -t ${IPKG_TMP_DIR} ${@base_conditional("PACKAGE_INSTALL_NO_DEPS", "1", "-nodeps", "", d)}"
13 PACKAGE_INSTALL_NO_DEPS ?= "0"
15 # What support to provide for online management of packages at run time?
16 # full -> traditional system, opkg is installed with all metadata
17 # add -> opkg is installed with basic conf files but no status database; can add new packages at runtime but not modify existing ones
18 # none -> opkg not installed at all, no metadata or config files provided
19 ONLINE_PACKAGE_MANAGEMENT ?= "full"
21 # Which packages to not install on the basis of a recommendation
22 BAD_RECOMMENDATIONS ?= ""
24 IPKG_VARIANT ?= "opkg"
26 RDEPENDS_append = " ${@base_conditional("ONLINE_PACKAGE_MANAGEMENT", "none", "", "${IPKG_VARIANT} opkg-collateral", d)}"
27 PACKAGE_INSTALL_append = " ${@base_conditional("ONLINE_PACKAGE_MANAGEMENT", "none", "", "${IPKG_VARIANT} opkg-collateral", d)}"
29 fakeroot rootfs_ipk_do_rootfs () {
32 package_generate_ipkg_conf
35 mkdir -p ${IPKG_TMP_DIR}
36 mkdir -p ${IMAGE_ROOTFS}${libdir}/opkg/
38 STATUS=${IMAGE_ROOTFS}${libdir}/opkg/status
39 # prime the status file with bits that we don't want
40 for i in ${BAD_RECOMMENDATIONS}; do
41 echo "Package: $i" >> $STATUS
42 echo "Architecture: ${TARGET_ARCH}" >> $STATUS
43 echo "Status: deinstall ok not-installed" >> $STATUS
47 opkg-cl ${IPKG_ARGS} update
49 # Uclibc builds don't provide this stuff...
50 if [ x${TARGET_OS} = "xlinux" ] || [ x${TARGET_OS} = "xlinux-gnueabi" ] ; then
51 if [ ! -z "${LINGUAS_INSTALL}" ]; then
52 opkg-cl ${IPKG_ARGS} install glibc-localedata-i18n
53 for i in ${LINGUAS_INSTALL}; do
54 opkg-cl ${IPKG_ARGS} install $i
58 if [ ! -z "${PACKAGE_INSTALL}" ]; then
59 opkg-cl ${IPKG_ARGS} install ${PACKAGE_INSTALL}
62 export D=${IMAGE_ROOTFS}
63 export OFFLINE_ROOT=${IMAGE_ROOTFS}
64 export IPKG_OFFLINE_ROOT=${IMAGE_ROOTFS}
65 export OPKG_OFFLINE_ROOT=${IPKG_OFFLINE_ROOT}
67 if [ "${ONLINE_PACKAGE_MANAGEMENT}" != "none" ]; then
68 mkdir -p ${IMAGE_ROOTFS}${sysconfdir}/opkg/
69 grep "^arch" ${IPKGCONF_TARGET} >${IMAGE_ROOTFS}${sysconfdir}/opkg/arch.conf
72 for i in ${IMAGE_ROOTFS}${libdir}/opkg/info/*.preinst; do
73 if [ -f $i ] && ! sh $i; then
74 opkg-cl ${IPKG_ARGS} flag unpacked `basename $i .preinst`
77 for i in ${IMAGE_ROOTFS}${libdir}/opkg/info/*.postinst; do
78 if [ -f $i ] && ! sh $i configure; then
79 opkg-cl ${IPKG_ARGS} flag unpacked `basename $i .postinst`
83 install -d ${IMAGE_ROOTFS}/${sysconfdir}
84 echo ${BUILDNAME} > ${IMAGE_ROOTFS}/${sysconfdir}/version
86 ${ROOTFS_POSTPROCESS_COMMAND}
88 if [ "${ONLINE_PACKAGE_MANAGEMENT}" != "none" ]; then
89 if [ "${ONLINE_PACKAGE_MANAGEMENT}" == "add" ]; then
90 rm -f ${IMAGE_ROOTFS}${libdir}/opkg/status
91 rm -f ${IMAGE_ROOTFS}${libdir}/opkg/*/*
93 rm -f ${IMAGE_ROOTFS}${libdir}/opkg/lists/*
96 # Keep these lines until package manager selection is implemented
97 ln -s opkg ${IMAGE_ROOTFS}${sysconfdir}/ipkg
98 ln -s opkg ${IMAGE_ROOTFS}${libdir}/ipkg
100 rm -rf ${IMAGE_ROOTFS}${libdir}/opkg
101 rm -rf ${IMAGE_ROOTFS}/usr/lib/opkg
105 rm -rf ${IPKG_TMP_DIR}
108 rootfs_ipk_log_check() {
112 lf_txt="`cat $lf_path`"
113 for keyword_die in "Cannot find package" "Cannot satisfy the following dependencies" \
116 if (echo "$lf_txt" | grep -v log_check | grep -w "$keyword_die") >/dev/null 2>&1
118 echo "log_check: There were error messages in the logfile"
119 printf "log_check: Matched keyword: [$keyword_die]\n"
120 echo "$lf_txt" | grep -v log_check | grep -i "$keyword_die" -C1
125 test "$do_exit" = 1 && exit 1
129 remove_packaging_data_files() {
130 rm -rf ${IMAGE_ROOTFS}${libdir}/opkg/