aboutsummaryrefslogtreecommitdiffstats
path: root/packages/openslug-init/openslug-init_0.10.bb
blob: ceb04b00667c22f827f95248c1b54280855b1859 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
DESCRIPTION = "Openslug initial network config via sysconf"
SECTION = "console/network"
LICENSE = "GPL"
DEPENDS = "base-files"
PR = "r24"

SRC_URI = "file://linuxrc \
	   file://boot/flash \
	   file://boot/disk \
	   file://boot/nfs \
	   file://boot/ram \
	   file://boot/network \
	   file://boot/udhcpc.script \
	   file://functions \
	   file://rmrecovery \
	   file://sysconfsetup \
	   file://turnup \
	   file://modutils.txt \
	   file://modprobe.conf \
	   file://leds_rs_green \
	   file://leds.h \
	   file://leds.c \
	   file://kern_header.c \
	   file://devio.c \
	   file://update-kernel"

SBINPROGS = "devio leds"
USRSBINPROGS = "kern_header"
CPROGS = "${USRSBINPROGS} ${SBINPROGS}"
SCRIPTS = "turnup update-kernel"
BOOTSCRIPTS = "flash disk nfs ram network udhcpc.script"

# This jsut makes things easier...
S="${WORKDIR}"

do_compile() {
	set -ex
	for p in ${CPROGS}
	do
		${CC} ${CFLAGS} -o $p $p.c
	done
	set +ex
}

do_install() {
	set -ex

	# Directories
        install -d ${D}${sysconfdir} \
                   ${D}${sysconfdir}/default \
                   ${D}${sysconfdir}/init.d \
		   ${D}${sysconfdir}/modutils \
		   ${D}${sbindir} \
		   ${D}${base_sbindir} \
		   ${D}/initrd \
		   ${D}/boot
		  
	# linuxrc
	rm -f ${D}/linuxrc
	ln -s boot/flash ${D}/linuxrc

	# C programs
	for p in ${USRSBINPROGS}
	do
		install -m 0755 $p ${D}${sbindir}/$p
	done
	for p in ${SBINPROGS}
	do
		install -m 0755 $p ${D}${base_sbindir}/$p
	done

	# Shell scripts
	for p in ${SCRIPTS}
	do
		install -m 0755 $p ${D}${sbindir}/$p
	done

	#
	# Init scripts
	install -m 0644 functions ${D}${sysconfdir}/default
	install -m 0755 rmrecovery ${D}${sysconfdir}/init.d/
	install -m 0755 sysconfsetup ${D}${sysconfdir}/init.d/
	install -m 0755 leds_rs_green ${D}${sysconfdir}/init.d/zleds_rs

	#
	# Boot scripts
	for p in ${BOOTSCRIPTS}
	do
		install -m 0755 boot/$p ${D}/boot
	done

	# Configuration files
	#XXinstall -m 0644 modutils.txt ${D}${sysconfdir}/modutils/
	install -m 0644 modprobe.conf ${D}${sysconfdir}/

	set +ex
}

# If the package is installed on an NSLU2 $D will be empty, in that
# case it is normal to run 'start' and 'stop', but because the conf
# files installed don't actually start or stop anything this is
# unnecessary, so the package postfoo handling is simplified here.
pkg_postinst_openslug-init() {
	opt=
	test -n "$D" && opt="-r $D"
	update-rc.d $opt sysconfsetup start 11 S .
	update-rc.d $opt zleds_rs start 99 S 1 2 3 4 5 . stop 05 0 1 2 3 4 5 6 .
}

pkg_postrm_openslug-init() {
	opt=
	test -n "$D" && opt="-r $D"
	update-rc.d $opt sysconfsetup remove
	update-rc.d $opt zleds_rs remove
}

PACKAGES = "${PN}"
FILES_${PN} = "/"

#CONFFILES_${PN} = "${sysconfdir}/modutils/modutils.txt ${sysconfdir}/modprobe.conf"
CONFFILES_${PN} = "${sysconfdir}/modprobe.conf"