summaryrefslogtreecommitdiffstats
path: root/openembedded/classes/rootfs_ipk.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2005-08-31 10:45:47 +0000
committerRichard Purdie <richard@openedhand.com>2005-08-31 10:45:47 +0000
commit4b46c1f6e891b1ddd5968536440b888661fade3e (patch)
treee0ba2c1f56f61b868bf746da5c4feabb25b800b2 /openembedded/classes/rootfs_ipk.bbclass
downloadpoky-4b46c1f6e891b1ddd5968536440b888661fade3e.tar.gz
Initial population
git-svn-id: https://svn.o-hand.com/repos/poky@1 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'openembedded/classes/rootfs_ipk.bbclass')
-rw-r--r--openembedded/classes/rootfs_ipk.bbclass136
1 files changed, 136 insertions, 0 deletions
diff --git a/openembedded/classes/rootfs_ipk.bbclass b/openembedded/classes/rootfs_ipk.bbclass
new file mode 100644
index 0000000000..062c957359
--- /dev/null
+++ b/openembedded/classes/rootfs_ipk.bbclass
@@ -0,0 +1,136 @@
1#
2# Creates a root filesystem out of IPKs
3#
4# This rootfs can be mounted via root-nfs or it can be put into an cramfs/jffs etc.
5# See image_ipk.oeclass for a usage of this.
6#
7
8DEPENDS_prepend="ipkg-native ipkg-utils-native fakeroot-native "
9DEPENDS_append=" ${EXTRA_IMAGEDEPENDS}"
10
11PACKAGES = ""
12
13do_rootfs[nostamp] = 1
14do_rootfs[dirs] = ${TOPDIR}
15do_build[nostamp] = 1
16
17IPKG_ARGS = "-f ${T}/ipkg.conf -o ${IMAGE_ROOTFS}"
18
19ROOTFS_POSTPROCESS_COMMAND ?= ""
20
21PID = "${@os.getpid()}"
22
23# some default locales
24IMAGE_LINGUAS ?= "de-de fr-fr en-gb"
25
26LINGUAS_INSTALL = "${@" ".join(map(lambda s: "locale-base-%s" % s, bb.data.getVar('IMAGE_LINGUAS', d, 1).split()))}"
27
28real_do_rootfs () {
29 set -x
30
31 mkdir -p ${IMAGE_ROOTFS}/dev
32
33 if [ -z "${DEPLOY_KEEP_PACKAGES}" ]; then
34 rm -f ${DEPLOY_DIR_IPK}/Packages
35 touch ${DEPLOY_DIR_IPK}/Packages
36 ipkg-make-index -r ${DEPLOY_DIR_IPK}/Packages -p ${DEPLOY_DIR_IPK}/Packages -l ${DEPLOY_DIR_IPK}/Packages.filelist -m ${DEPLOY_DIR_IPK}
37 fi
38 mkdir -p ${T}
39 echo "src oe file:${DEPLOY_DIR_IPK}" > ${T}/ipkg.conf
40 ipkgarchs="all any noarch ${TARGET_ARCH} ${IPKG_ARCHS} ${MACHINE}"
41 priority=1
42 for arch in $ipkgarchs; do
43 echo "arch $arch $priority" >> ${T}/ipkg.conf
44 priority=$(expr $priority + 5)
45 done
46 ipkg-cl ${IPKG_ARGS} update
47 if [ ! -z "${LINGUAS_INSTALL}" ]; then
48 ipkg-cl ${IPKG_ARGS} install glibc-localedata-i18n
49 for i in ${LINGUAS_INSTALL}; do
50 ipkg-cl ${IPKG_ARGS} install $i
51 done
52 fi
53 if [ ! -z "${IPKG_INSTALL}" ]; then
54 ipkg-cl ${IPKG_ARGS} install ${IPKG_INSTALL}
55 fi
56
57 export D=${IMAGE_ROOTFS}
58 export IPKG_OFFLINE_ROOT=${IMAGE_ROOTFS}
59 mkdir -p ${IMAGE_ROOTFS}/etc/ipkg/
60 grep "^arch" ${T}/ipkg.conf >${IMAGE_ROOTFS}/etc/ipkg/arch.conf
61
62 for i in ${IMAGE_ROOTFS}${libdir}/ipkg/info/*.preinst; do
63 if [ -f $i ] && ! sh $i; then
64 ipkg-cl ${IPKG_ARGS} flag unpacked `basename $i .preinst`
65 fi
66 done
67 for i in ${IMAGE_ROOTFS}${libdir}/ipkg/info/*.postinst; do
68 if [ -f $i ] && ! sh $i configure; then
69 ipkg-cl ${IPKG_ARGS} flag unpacked `basename $i .postinst`
70 fi
71 done
72
73 install -d ${IMAGE_ROOTFS}/${sysconfdir}
74 echo ${BUILDNAME} > ${IMAGE_ROOTFS}/${sysconfdir}/version
75
76 ${ROOTFS_POSTPROCESS_COMMAND}
77
78 log_check rootfs
79}
80
81log_check() {
82 set +x
83 for target in $*
84 do
85 lf_path="${WORKDIR}/temp/log.do_$target.${PID}"
86
87 echo "log_check: Using $lf_path as logfile"
88
89 if test -e "$lf_path"
90 then
91 lf_txt="`cat $lf_path`"
92
93 for keyword_die in "Cannot find package" "exit 1" ERR Fail
94 do
95
96 if (echo "$lf_txt" | grep -v log_check | grep "$keyword_die") &>/dev/null
97 then
98 echo "log_check: There were error messages in the logfile"
99 echo -e "log_check: Matched keyword: [$keyword_die]\n"
100 echo "$lf_txt" | grep -v log_check | grep -i "$keyword_die"
101 echo ""
102 do_exit=1
103 fi
104 done
105 test "$do_exit" = 1 && exit 1
106 else
107 echo "Cannot find logfile [$lf_path]"
108 fi
109 echo "Logfile is clean"
110 done
111
112 set -x
113
114}
115
116fakeroot do_rootfs () {
117 rm -rf ${IMAGE_ROOTFS}
118 real_do_rootfs
119}
120
121# set '*' as the rootpassword so the images
122# can decide if they want it or not
123
124zap_root_password () {
125 sed 's%^root:[^:]*:%root:*:%' < ${IMAGE_ROOTFS}/etc/passwd >${IMAGE_ROOTFS}/etc/passwd.new
126 mv ${IMAGE_ROOTFS}/etc/passwd.new ${IMAGE_ROOTFS}/etc/passwd
127}
128
129create_etc_timestamp() {
130 date +%2m%2d%2H%2M%Y >${IMAGE_ROOTFS}/etc/timestamp
131}
132
133# export the zap_root_password and create_etc_timestamp
134EXPORT_FUNCTIONS zap_root_password create_etc_timestamp
135
136addtask rootfs before do_build after do_install