diff options
-rw-r--r-- | meta/classes/rootfs_deb.bbclass | 56 | ||||
-rw-r--r-- | meta/classes/rootfs_ipk.bbclass | 88 |
2 files changed, 35 insertions, 109 deletions
diff --git a/meta/classes/rootfs_deb.bbclass b/meta/classes/rootfs_deb.bbclass index 7712911b02..fee7db9ae0 100644 --- a/meta/classes/rootfs_deb.bbclass +++ b/meta/classes/rootfs_deb.bbclass | |||
@@ -1,21 +1,6 @@ | |||
1 | DEPENDS_prepend = "dpkg-native apt-native fakeroot-native " | 1 | DEPENDS_prepend = "dpkg-native apt-native fakeroot-native " |
2 | DEPENDS_append = " ${EXTRA_IMAGEDEPENDS}" | 2 | DEPENDS_append = " ${EXTRA_IMAGEDEPENDS}" |
3 | 3 | ||
4 | PACKAGES = "" | ||
5 | |||
6 | do_rootfs[nostamp] = 1 | ||
7 | do_rootfs[dirs] = ${TOPDIR} | ||
8 | do_build[nostamp] = 1 | ||
9 | |||
10 | ROOTFS_POSTPROCESS_COMMAND ?= "" | ||
11 | |||
12 | PID = "${@os.getpid()}" | ||
13 | |||
14 | # some default locales | ||
15 | IMAGE_LINGUAS ?= "de-de fr-fr en-gb" | ||
16 | |||
17 | LINGUAS_INSTALL = "${@" ".join(map(lambda s: "locale-base-%s" % s, bb.data.getVar('IMAGE_LINGUAS', d, 1).split()))}" | ||
18 | |||
19 | fakeroot rootfs_deb_do_rootfs () { | 4 | fakeroot rootfs_deb_do_rootfs () { |
20 | set +e | 5 | set +e |
21 | mkdir -p ${IMAGE_ROOTFS}/var/dpkg/{info,updates} | 6 | mkdir -p ${IMAGE_ROOTFS}/var/dpkg/{info,updates} |
@@ -101,30 +86,27 @@ fakeroot rootfs_deb_do_rootfs () { | |||
101 | set -e | 86 | set -e |
102 | 87 | ||
103 | ${ROOTFS_POSTPROCESS_COMMAND} | 88 | ${ROOTFS_POSTPROCESS_COMMAND} |
104 | } | ||
105 | 89 | ||
106 | # set '*' as the rootpassword so the images | 90 | log_check rootfs |
107 | # can decide if they want it or not | ||
108 | |||
109 | zap_root_password () { | ||
110 | sed 's%^root:[^:]*:%root:*:%' < ${IMAGE_ROOTFS}/etc/passwd >${IMAGE_ROOTFS}/etc/passwd.new | ||
111 | mv ${IMAGE_ROOTFS}/etc/passwd.new ${IMAGE_ROOTFS}/etc/passwd | ||
112 | } | ||
113 | |||
114 | create_etc_timestamp() { | ||
115 | date +%2m%2d%2H%2M%Y >${IMAGE_ROOTFS}/etc/timestamp | ||
116 | } | 91 | } |
117 | 92 | ||
118 | # Turn any symbolic /sbin/init link into a file | 93 | rootfs_deb_log_check() { |
119 | remove_init_link () { | 94 | target="$1" |
120 | if [ -h ${IMAGE_ROOTFS}/sbin/init ]; then | 95 | lf_path="$2" |
121 | LINKFILE=${IMAGE_ROOTFS}`readlink ${IMAGE_ROOTFS}/sbin/init` | 96 | |
122 | rm ${IMAGE_ROOTFS}/sbin/init | 97 | lf_txt="`cat $lf_path`" |
123 | cp $LINKFILE ${IMAGE_ROOTFS}/sbin/init | 98 | for keyword_die in "E:" |
124 | fi | 99 | do |
100 | if (echo "$lf_txt" | grep -v log_check | grep "$keyword_die") &>/dev/null | ||
101 | then | ||
102 | echo "log_check: There were error messages in the logfile" | ||
103 | echo -e "log_check: Matched keyword: [$keyword_die]\n" | ||
104 | echo "$lf_txt" | grep -v log_check | grep -C 5 -i "$keyword_die" | ||
105 | echo "" | ||
106 | do_exit=1 | ||
107 | fi | ||
108 | done | ||
109 | test "$do_exit" = 1 && exit 1 | ||
110 | true | ||
125 | } | 111 | } |
126 | 112 | ||
127 | # export the zap_root_password, create_etc_timestamp and remote_init_link | ||
128 | EXPORT_FUNCTIONS zap_root_password create_etc_timestamp remove_init_link do_rootfs | ||
129 | |||
130 | addtask rootfs before do_build after do_install | ||
diff --git a/meta/classes/rootfs_ipk.bbclass b/meta/classes/rootfs_ipk.bbclass index f59f2b2137..42c50d35f8 100644 --- a/meta/classes/rootfs_ipk.bbclass +++ b/meta/classes/rootfs_ipk.bbclass | |||
@@ -8,23 +8,8 @@ | |||
8 | DEPENDS_prepend="ipkg-native ipkg-utils-native fakeroot-native " | 8 | DEPENDS_prepend="ipkg-native ipkg-utils-native fakeroot-native " |
9 | DEPENDS_append=" ${EXTRA_IMAGEDEPENDS}" | 9 | DEPENDS_append=" ${EXTRA_IMAGEDEPENDS}" |
10 | 10 | ||
11 | PACKAGES = "" | ||
12 | |||
13 | do_rootfs[nostamp] = "1" | ||
14 | do_rootfs[dirs] = "${TOPDIR}" | ||
15 | do_build[nostamp] = "1" | ||
16 | |||
17 | IPKG_ARGS = "-f ${T}/ipkg.conf -o ${IMAGE_ROOTFS}" | 11 | IPKG_ARGS = "-f ${T}/ipkg.conf -o ${IMAGE_ROOTFS}" |
18 | 12 | ||
19 | ROOTFS_POSTPROCESS_COMMAND ?= "" | ||
20 | |||
21 | PID = "${@os.getpid()}" | ||
22 | |||
23 | # some default locales | ||
24 | IMAGE_LINGUAS ?= "de-de fr-fr en-gb" | ||
25 | |||
26 | LINGUAS_INSTALL = "${@" ".join(map(lambda s: "locale-base-%s" % s, bb.data.getVar('IMAGE_LINGUAS', d, 1).split()))}" | ||
27 | |||
28 | fakeroot rootfs_ipk_do_rootfs () { | 13 | fakeroot rootfs_ipk_do_rootfs () { |
29 | set -x | 14 | set -x |
30 | 15 | ||
@@ -78,64 +63,23 @@ fakeroot rootfs_ipk_do_rootfs () { | |||
78 | log_check rootfs | 63 | log_check rootfs |
79 | } | 64 | } |
80 | 65 | ||
81 | log_check() { | 66 | rootfs_ipk_log_check() { |
82 | set +x | 67 | target="$1" |
83 | for target in $* | 68 | lf_path="$2" |
84 | do | 69 | |
85 | lf_path="${WORKDIR}/temp/log.do_$target.${PID}" | 70 | lf_txt="`cat $lf_path`" |
86 | 71 | for keyword_die in "Cannot find package" "exit 1" ERR Fail | |
87 | echo "log_check: Using $lf_path as logfile" | 72 | do |
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 | 73 | ||
96 | if (echo "$lf_txt" | grep -v log_check | grep "$keyword_die") &>/dev/null | 74 | if (echo "$lf_txt" | grep -v log_check | grep "$keyword_die") &>/dev/null |
97 | then | 75 | then |
98 | echo "log_check: There were error messages in the logfile" | 76 | echo "log_check: There were error messages in the logfile" |
99 | echo -e "log_check: Matched keyword: [$keyword_die]\n" | 77 | echo -e "log_check: Matched keyword: [$keyword_die]\n" |
100 | echo "$lf_txt" | grep -v log_check | grep -C 5 -i "$keyword_die" | 78 | echo "$lf_txt" | grep -v log_check | grep -C 5 -i "$keyword_die" |
101 | echo "" | 79 | echo "" |
102 | do_exit=1 | 80 | 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 | 81 | fi |
109 | echo "Logfile is clean" | ||
110 | done | 82 | done |
111 | 83 | test "$do_exit" = 1 && exit 1 | |
112 | set -x | 84 | true |
113 | |||
114 | } | ||
115 | |||
116 | |||
117 | # set '*' as the rootpassword so the images | ||
118 | # can decide if they want it or not | ||
119 | |||
120 | zap_root_password () { | ||
121 | sed 's%^root:[^:]*:%root:*:%' < ${IMAGE_ROOTFS}/etc/passwd >${IMAGE_ROOTFS}/etc/passwd.new | ||
122 | mv ${IMAGE_ROOTFS}/etc/passwd.new ${IMAGE_ROOTFS}/etc/passwd | ||
123 | } | ||
124 | |||
125 | create_etc_timestamp() { | ||
126 | date +%2m%2d%2H%2M%Y >${IMAGE_ROOTFS}/etc/timestamp | ||
127 | } | ||
128 | |||
129 | # Turn any symbolic /sbin/init link into a file | ||
130 | remove_init_link () { | ||
131 | if [ -h ${IMAGE_ROOTFS}/sbin/init ]; then | ||
132 | LINKFILE=${IMAGE_ROOTFS}`readlink ${IMAGE_ROOTFS}/sbin/init` | ||
133 | rm ${IMAGE_ROOTFS}/sbin/init | ||
134 | cp $LINKFILE ${IMAGE_ROOTFS}/sbin/init | ||
135 | fi | ||
136 | } | 85 | } |
137 | |||
138 | # export the zap_root_password, create_etc_timestamp and remote_init_link | ||
139 | EXPORT_FUNCTIONS zap_root_password create_etc_timestamp remove_init_link do_rootfs | ||
140 | |||
141 | addtask rootfs before do_build after do_install | ||