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 ipkg-utils-native:do_populate_staging"
9 do_rootfs[recrdeptask] += "do_package_write_ipk"
11 IPKG_ARGS = "-f ${IPKGCONF_TARGET} -o ${IMAGE_ROOTFS} ${@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 DISTRO_EXTRA_RDEPENDS += "${@base_conditional("ONLINE_PACKAGE_MANAGEMENT", "none", "", "opkg opkg-collateral", d)}"
26 fakeroot rootfs_ipk_do_rootfs () {
29 package_update_index_ipk
30 package_generate_ipkg_conf
33 mkdir -p ${IMAGE_ROOTFS}${libdir}/opkg/
35 STATUS=${IMAGE_ROOTFS}${libdir}/opkg/status
36 # prime the status file with bits that we don't want
37 for i in ${BAD_RECOMMENDATIONS}; do
38 echo "Package: $i" >> $STATUS
39 echo "Architecture: ${TARGET_ARCH}" >> $STATUS
40 echo "Status: deinstall ok not-installed" >> $STATUS
44 opkg-cl ${IPKG_ARGS} update
46 # Uclibc builds don't provide this stuff...
47 if [ x${TARGET_OS} = "xlinux" ] || [ x${TARGET_OS} = "xlinux-gnueabi" ] ; then
48 if [ ! -z "${LINGUAS_INSTALL}" ]; then
49 opkg-cl ${IPKG_ARGS} install glibc-localedata-i18n
50 for i in ${LINGUAS_INSTALL}; do
51 opkg-cl ${IPKG_ARGS} install $i
55 if [ ! -z "${PACKAGE_INSTALL}" ]; then
56 opkg-cl ${IPKG_ARGS} install ${PACKAGE_INSTALL}
59 export D=${IMAGE_ROOTFS}
60 export OFFLINE_ROOT=${IMAGE_ROOTFS}
61 export IPKG_OFFLINE_ROOT=${IMAGE_ROOTFS}
62 export OPKG_OFFLINE_ROOT=${IPKG_OFFLINE_ROOT}
64 mkdir -p ${IMAGE_ROOTFS}${sysconfdir}/opkg/
66 if [ "${ONLINE_PACKAGE_MANAGEMENT}" != "none" ]; then
67 grep "^arch" ${IPKGCONF_TARGET} >${IMAGE_ROOTFS}${sysconfdir}/opkg/arch.conf
70 for i in ${IMAGE_ROOTFS}${libdir}/opkg/info/*.preinst; do
71 if [ -f $i ] && ! sh $i; then
72 opkg-cl ${IPKG_ARGS} flag unpacked `basename $i .preinst`
75 for i in ${IMAGE_ROOTFS}${libdir}/opkg/info/*.postinst; do
76 if [ -f $i ] && ! sh $i configure; then
77 opkg-cl ${IPKG_ARGS} flag unpacked `basename $i .postinst`
81 install -d ${IMAGE_ROOTFS}/${sysconfdir}
82 echo ${BUILDNAME} > ${IMAGE_ROOTFS}/${sysconfdir}/version
84 if [ "${ONLINE_PACKAGE_MANAGEMENT}" != "none" ]; then
85 if [ "${ONLINE_PACKAGE_MANAGEMENT}" = "add" ]; then
86 rm -f ${IMAGE_ROOTFS}${libdir}/opkg/status
87 rm -f ${IMAGE_ROOTFS}${libdir}/opkg/*/*
89 rm -f ${IMAGE_ROOTFS}${libdir}/opkg/lists/*
92 # Keep these lines until package manager selection is implemented
93 ln -s opkg ${IMAGE_ROOTFS}${sysconfdir}/ipkg
94 ln -s opkg ${IMAGE_ROOTFS}${libdir}/ipkg
96 rm -rf ${IMAGE_ROOTFS}${libdir}/opkg
99 ${ROOTFS_POSTPROCESS_COMMAND}
104 rootfs_ipk_log_check() {
108 lf_txt="`cat $lf_path`"
109 for keyword_die in "Cannot find package" "exit 1" ERR Fail
111 if (echo "$lf_txt" | grep -v log_check | grep "$keyword_die") >/dev/null 2>&1
113 echo "log_check: There were error messages in the logfile"
114 printf "log_check: Matched keyword: [$keyword_die]\n"
115 echo "$lf_txt" | grep -v log_check | grep -i "$keyword_die" -C1
120 test "$do_exit" = 1 && exit 1
124 remove_packaging_data_files() {
125 rm -rf ${IMAGE_ROOTFS}${libdir}/opkg/