Merge branch 'org.openembedded.dev' of git://git.openembedded.net/openembedded into...
[vuplus_openembedded] / packages / openprotium-init / openprotium-init_0.10.bb
1 DESCRIPTION = "OpenProtium initial boot and config"
2 SECTION = "base"
3 PRIORITY = "required"
4 LICENSE = "GPL"
5 DEPENDS = "base-files devio"
6 RDEPENDS = "busybox devio"
7 FILE_PR = "r71"
8
9 SRC_URI = "file://boot/flash \
10            file://boot/disk \
11            file://boot/nfs \
12            file://boot/network \
13            file://boot/udhcpc.script \
14            file://initscripts/fixfstab \
15            file://initscripts/syslog.buffer \
16            file://initscripts/syslog.file \
17            file://initscripts/syslog.network \
18            file://initscripts/rmrecovery \
19            file://initscripts/sysconfsetup \
20            file://initscripts/umountinitrd.sh \
21            file://initscripts/loadmodules.sh \
22            file://initscripts/zleds \
23            file://functions \
24            file://modulefunctions \
25            file://conffiles \
26            file://sysconf \
27            file://turnup \
28            file://reflash \
29            file://links.conf \
30            "
31
32 SBINPROGS = ""
33 USRSBINPROGS = ""
34 CPROGS = "${USRSBINPROGS} ${SBINPROGS}"
35 SCRIPTS = "turnup reflash sysconf"
36 BOOTSCRIPTS = "flash disk nfs network udhcpc.script"
37 INITSCRIPTS = "syslog.buffer syslog.file syslog.network \
38         rmrecovery sysconfsetup umountinitrd.sh \
39         fixfstab loadmodules.sh zleds"
40
41 # This just makes things easier...
42
43 S="${WORKDIR}"
44
45 do_compile() {
46         set -ex
47         for p in ${CPROGS}
48         do
49                 ${CC} ${CFLAGS} -o $p $p.c
50         done
51         set +ex
52 }
53
54 do_install() {
55         set -ex
56
57         # Directories
58         install -d ${D}${sysconfdir} \
59                    ${D}${sysconfdir}/default \
60                    ${D}${sysconfdir}/init.d \
61                    ${D}${sysconfdir}/modutils \
62                    ${D}${sysconfdir}/udev \
63                    ${D}${sbindir} \
64                    ${D}${base_sbindir} \
65                    ${D}/initrd \
66                    ${D}/boot
67
68         # linuxrc
69         rm -f ${D}/linuxrc
70         ln -s boot/flash ${D}/linuxrc
71
72         # C programs
73         for p in ${USRSBINPROGS}
74         do
75                 install -m 0755 $p ${D}${sbindir}/$p
76         done
77         for p in ${SBINPROGS}
78         do
79                 install -m 0755 $p ${D}${base_sbindir}/$p
80         done
81
82         # Shell scripts
83         for p in ${SCRIPTS}
84         do
85                 install -m 0755 $p ${D}${base_sbindir}/$p
86         done
87
88         #
89         # Init scripts
90         install -m 0644 functions ${D}${sysconfdir}/default
91         install -m 0644 modulefunctions ${D}${sysconfdir}/default
92         for s in ${INITSCRIPTS}
93         do
94                 install -m 0755 initscripts/$s ${D}${sysconfdir}/init.d/
95         done
96
97         #
98         # Udev configuration files
99         install -m 0644 links.conf ${D}${sysconfdir}/udev
100
101         #
102         # Boot scripts
103         for p in ${BOOTSCRIPTS}
104         do
105                 install -m 0755 boot/$p ${D}/boot
106         done
107
108         # Configuration files
109         install -m 0644 conffiles ${D}${sysconfdir}/default
110
111         set +ex
112 }
113
114 # If the package is installed on an NSLU2 $D will be empty, in that
115 # case it is normal to run 'start' and 'stop', but because the conf
116 # files installed don't actually start or stop anything this is
117 # unnecessary, so the package postfoo handling is simplified here.
118 #NB: do not use '08' (etc) for the first argument after start/stop,
119 # the value is interpreted as an octal number if there is a leading
120 # zero.
121 pkg_postinst_openprotium-init() {
122         opt=
123         test -n "$D" && opt="-r $D"
124         update-rc.d $opt hwclock.sh             start  8 S . start 45 0 6 .
125         update-rc.d $opt umountinitrd.sh        start  9 S .
126         update-rc.d $opt fixfstab               start 10 S .
127         update-rc.d $opt syslog.buffer          start 11 S . start 49 0 6 .
128         update-rc.d $opt sysconfsetup           start 12 S .
129         update-rc.d $opt loadmodules.sh         start 21 S .
130         update-rc.d $opt syslog.file            start 39 S . start 47 0 6 .
131         update-rc.d $opt syslog.network         start 44 S . start 39 0 6 .
132         update-rc.d $opt rmrecovery             start 99 1 2 3 4 5 .
133         update-rc.d $opt zleds                  start 99 1 2 3 4 5 . stop 5 0 1 2 3 4 5 6 .
134
135 }
136
137 pkg_postrm_openprotium-init() {
138         opt=
139         test -n "$D" && opt="-r $D"
140         for s in ${INITSCRIPTS}
141         do
142                 update-rc.d $opt "$s" remove
143         done
144 }
145
146 FILES_${PN} = "/"
147
148 # It is bad to overwrite /linuxrc as it puts the system back to
149 # a flash boot (and the flash has potentially not been upgraded!)
150 CONFFILES_${PN} = "/linuxrc ${sysconfdir}/default/conffiles"