summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmeta/packages/meta/run-postinsts/run-postinsts26
-rw-r--r--meta/packages/meta/run-postinsts/run-postinsts.awk25
-rw-r--r--meta/packages/meta/run-postinsts_1.0.bb30
3 files changed, 81 insertions, 0 deletions
diff --git a/meta/packages/meta/run-postinsts/run-postinsts b/meta/packages/meta/run-postinsts/run-postinsts
new file mode 100755
index 0000000000..334a39b78b
--- /dev/null
+++ b/meta/packages/meta/run-postinsts/run-postinsts
@@ -0,0 +1,26 @@
1#!/bin/sh
2#
3# Copyright 2007 Openedhand Ltd.
4#
5# Author: Richard Purdie <rpurdie@openedhand.com>
6#
7
8PKGSYSTEM=/usr/lib/ipkg
9STAMP=$PKGSYSTEM/postinsts-done
10STATFILE=$PKGSYSTEM/status
11STATFILE2=$PKGSYSTEM/status2
12
13if [ -e $STAMP ]; then
14 exit 0
15fi
16
17awk -f /usr/share/run-postinsts/run-postinsts.awk $STATFILE > $STATFILE2
18if [ $? = 0 ]; then
19 mv $STATFILE2 $STATFILE
20 touch $STAMP
21 exit 0
22else
23 rm -f $STATFILE2
24 rm -f $STAMP
25 exit 1
26fi
diff --git a/meta/packages/meta/run-postinsts/run-postinsts.awk b/meta/packages/meta/run-postinsts/run-postinsts.awk
new file mode 100644
index 0000000000..1532577b6e
--- /dev/null
+++ b/meta/packages/meta/run-postinsts/run-postinsts.awk
@@ -0,0 +1,25 @@
1#
2# Copyright 2007 Openedhand Ltd.
3#
4# Author: Richard Purdie <rpurdie@openedhand.com>
5#
6# Rather hacky proof of concept
7#
8
9BEGIN {
10 package=""
11}
12/Package:.*/ {
13 package = substr($0, 10)
14}
15/Status:.*unpacked.*/ {
16 print "Configuring: " package > "/dev/stderr"
17 ret = system("/usr/lib/ipkg/info/" package ".postinst 1>&2")
18 if (ret == 0)
19 $0 = gensub("unpacked", "installed", 1)
20 else
21 print "Postinstall failed for " package > "/dev/stderr"
22}
23{
24 print $0
25}
diff --git a/meta/packages/meta/run-postinsts_1.0.bb b/meta/packages/meta/run-postinsts_1.0.bb
new file mode 100644
index 0000000000..b095adc909
--- /dev/null
+++ b/meta/packages/meta/run-postinsts_1.0.bb
@@ -0,0 +1,30 @@
1DESCRIPTION = "Run postinstall scripts on device using awk"
2SECTION = "devel"
3PR = "r0"
4
5SRC_URI = "file://run-postinsts file://run-postinsts.awk"
6
7INITSCRIPT_NAME = "run-postinsts"
8INITSCRIPT_PARAMS = "start 98 S ."
9
10inherit update-rc.d
11
12do_configure() {
13 :
14}
15
16do_compile () {
17 :
18}
19
20do_install() {
21 install -d ${D}${sysconfdir}/init.d/
22 install -m 0755 ${WORKDIR}/run-postinsts ${D}${sysconfdir}/init.d/
23
24 install -d ${D}${datadir}/${PN}/
25 install -m 0644 ${WORKDIR}/run-postinsts.awk ${D}${datadir}/${PN}/
26}
27
28do_stage () {
29 :
30}