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