xmms: bump PR
[openembedded.git] / classes / rootfs_ipk.bbclass
blob0303c54cc6c57ef2ab074446ebea9e0d87c86f66
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_sysroot"
9 do_rootfs[lockfiles] = "${DEPLOY_DIR_IPK}.lock"
11 IPKG_TMP_DIR = "${IMAGE_ROOTFS}-tmp"
12 IPKG_ARGS = "-f ${IPKGCONF_TARGET} -o ${IMAGE_ROOTFS} -t ${IPKG_TMP_DIR} ${@base_conditional("PACKAGE_INSTALL_NO_DEPS", "1", "-nodeps", "", d)}"
14 PACKAGE_INSTALL_NO_DEPS ?= "0"
16 # What support to provide for online management of packages at run time?
17 #  full -> traditional system, opkg is installed with all metadata
18 #  add -> opkg is installed with basic conf files but no status database; can add new packages at runtime but not modify existing ones
19 #  none -> opkg not installed at all, no metadata or config files provided
20 ONLINE_PACKAGE_MANAGEMENT ?= "full"
22 # Which packages to not install on the basis of a recommendation
23 BAD_RECOMMENDATIONS ?= ""
25 IPKG_VARIANT ?= "opkg"
27 RDEPENDS_append = " ${@base_conditional("ONLINE_PACKAGE_MANAGEMENT", "none", "", "${IPKG_VARIANT} opkg-collateral", d)}"
28 PACKAGE_INSTALL_append = " ${@base_conditional("ONLINE_PACKAGE_MANAGEMENT", "none", "", "${IPKG_VARIANT} opkg-collateral", d)}"
30 fakeroot rootfs_ipk_do_rootfs () {
31         set -x
33         package_generate_ipkg_conf
35         mkdir -p ${T}
36         mkdir -p ${IPKG_TMP_DIR}
37         mkdir -p ${IMAGE_ROOTFS}${libdir}/opkg/
39         STATUS=${IMAGE_ROOTFS}${libdir}/opkg/status
40         # prime the status file with bits that we don't want
41         for i in ${BAD_RECOMMENDATIONS}; do
42                 echo "Package: $i" >> $STATUS
43                 echo "Architecture: ${TARGET_ARCH}" >> $STATUS
44                 echo "Status: deinstall ok not-installed" >> $STATUS
45                 echo >> $STATUS
46         done
48         opkg-cl ${IPKG_ARGS} update
50         # Uclibc builds don't provide this stuff...
51         if [ x${TARGET_OS} = "xlinux" ] || [ x${TARGET_OS} = "xlinux-gnueabi" ] ; then 
52                 if [ ! -z "${LINGUAS_INSTALL}" ]; then
53                         opkg-cl ${IPKG_ARGS} install glibc-localedata-i18n
54                         for i in ${LINGUAS_INSTALL}; do
55                                 opkg-cl ${IPKG_ARGS} install $i 
56                         done
57                 fi
58         fi
59         if [ ! -z "${PACKAGE_INSTALL}" ]; then
60                 opkg-cl ${IPKG_ARGS} install ${PACKAGE_INSTALL}
61         fi
63         export D=${IMAGE_ROOTFS}
64         export OFFLINE_ROOT=${IMAGE_ROOTFS}
65         export IPKG_OFFLINE_ROOT=${IMAGE_ROOTFS}
66         export OPKG_OFFLINE_ROOT=${IPKG_OFFLINE_ROOT}
67         
68         if [ "${ONLINE_PACKAGE_MANAGEMENT}" != "none" ]; then
69                 mkdir -p ${IMAGE_ROOTFS}${sysconfdir}/opkg/
70                 grep "^arch" ${IPKGCONF_TARGET} >${IMAGE_ROOTFS}${sysconfdir}/opkg/arch.conf
71         fi
73         for i in ${IMAGE_ROOTFS}${libdir}/opkg/info/*.preinst; do
74                 if [ -f $i ] && ! sh -e $i; then
75                         opkg-cl ${IPKG_ARGS} flag unpacked `basename $i .preinst`
76                 fi
77         done
78         for i in ${IMAGE_ROOTFS}${libdir}/opkg/info/*.postinst; do
79                 if [ -f $i ] && ! sh -e $i configure; then
80                         opkg-cl ${IPKG_ARGS} flag unpacked `basename $i .postinst`
81                 fi
82         done
84         install -d ${IMAGE_ROOTFS}/${sysconfdir}
85         echo ${BUILDNAME} > ${IMAGE_ROOTFS}/${sysconfdir}/version
86         
87         ${ROOTFS_POSTPROCESS_COMMAND}
89         if [ "${ONLINE_PACKAGE_MANAGEMENT}" != "none" ]; then
90                 if [ "${ONLINE_PACKAGE_MANAGEMENT}" == "add" ]; then
91                         rm -f ${IMAGE_ROOTFS}${libdir}/opkg/status
92                         rm -f ${IMAGE_ROOTFS}${libdir}/opkg/*/*
93                 else
94                         rm -f ${IMAGE_ROOTFS}${libdir}/opkg/lists/*
95                 fi
96         
97                 # Keep these lines until package manager selection is implemented
98                 ln -s opkg ${IMAGE_ROOTFS}${sysconfdir}/ipkg
99                 ln -s opkg ${IMAGE_ROOTFS}${libdir}/ipkg
100         else
101                 rm -rf ${IMAGE_ROOTFS}${libdir}/opkg
102                 rm -rf ${IMAGE_ROOTFS}/usr/lib/opkg
103         fi
104         
105         log_check rootfs        
106         rm -rf ${IPKG_TMP_DIR}
109 rootfs_ipk_log_check() {
110         target="$1"
111         lf_path="$2"
113         lf_txt="`cat $lf_path`"
114         for keyword_die in "Cannot find package" "Cannot satisfy the following dependencies" \
115             "exit 1" ERR Fail
116         do                              
117                 if (echo "$lf_txt" | grep -v log_check | grep -w "$keyword_die") >/dev/null 2>&1
118                 then
119                         echo "log_check: There were error messages in the logfile"
120                         printf "log_check: Matched keyword: [$keyword_die]\n"
121                         echo "$lf_txt" | grep -v log_check | grep -i "$keyword_die" -C1
122                         echo ""
123                         do_exit=1                               
124                 fi
125         done
126         test "$do_exit" = 1 && exit 1
127         true
130 remove_packaging_data_files() {
131         rm -rf ${IMAGE_ROOTFS}${libdir}/opkg/