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