gnome-screensaver 2.28.3: fix up configure as well now
[openembedded.git] / classes / rootfs_ipk.bbclass
blob3a73ed88540f6fd813b41de91f224adc00132ad6
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 () {
30         set -x
32         package_generate_ipkg_conf
34         mkdir -p ${T}
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
44                 echo >> $STATUS
45         done
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 
55                         done
56                 fi
57         fi
58         if [ ! -z "${PACKAGE_INSTALL}" ]; then
59                 opkg-cl ${IPKG_ARGS} install ${PACKAGE_INSTALL}
60         fi
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}
66         
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
70         fi
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`
75                 fi
76         done
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`
80                 fi
81         done
83         install -d ${IMAGE_ROOTFS}/${sysconfdir}
84         echo ${BUILDNAME} > ${IMAGE_ROOTFS}/${sysconfdir}/version
85         
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/*/*
92                 else
93                         rm -f ${IMAGE_ROOTFS}${libdir}/opkg/lists/*
94                 fi
95         
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
99         else
100                 rm -rf ${IMAGE_ROOTFS}${libdir}/opkg
101                 rm -rf ${IMAGE_ROOTFS}/usr/lib/opkg
102         fi
103         
104         log_check rootfs        
105         rm -rf ${IPKG_TMP_DIR}
108 rootfs_ipk_log_check() {
109         target="$1"
110         lf_path="$2"
112         lf_txt="`cat $lf_path`"
113         for keyword_die in "Cannot find package" "Cannot satisfy the following dependencies" \
114             "exit 1" ERR Fail
115         do                              
116                 if (echo "$lf_txt" | grep -v log_check | grep -w "$keyword_die") >/dev/null 2>&1
117                 then
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
121                         echo ""
122                         do_exit=1                               
123                 fi
124         done
125         test "$do_exit" = 1 && exit 1
126         true
129 remove_packaging_data_files() {
130         rm -rf ${IMAGE_ROOTFS}${libdir}/opkg/