summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/initscripts/initscripts-1.0
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/initscripts/initscripts-1.0')
-rw-r--r--meta/recipes-core/initscripts/initscripts-1.0/GPLv2.patch347
-rw-r--r--meta/recipes-core/initscripts/initscripts-1.0/arm/alignment.sh13
-rw-r--r--meta/recipes-core/initscripts/initscripts-1.0/banner.sh24
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh71
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/checkfs.sh50
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/checkroot.sh148
-rw-r--r--meta/recipes-core/initscripts/initscripts-1.0/devpts5
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/devpts.sh28
-rw-r--r--meta/recipes-core/initscripts/initscripts-1.0/dmesg.sh17
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/functions91
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/halt29
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/hostname.sh22
-rw-r--r--meta/recipes-core/initscripts/initscripts-1.0/logrotate-dmesg.conf9
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/mountall.sh39
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/mountnfs.sh88
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh220
-rw-r--r--meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh38
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/reboot15
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/rmnologin.sh20
-rw-r--r--meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh13
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/sendsigs21
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/single24
-rw-r--r--meta/recipes-core/initscripts/initscripts-1.0/sysfs.sh23
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/umountfs24
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/umountnfs.sh33
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/urandom46
-rw-r--r--meta/recipes-core/initscripts/initscripts-1.0/volatiles36
27 files changed, 1494 insertions, 0 deletions
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/GPLv2.patch b/meta/recipes-core/initscripts/initscripts-1.0/GPLv2.patch
new file mode 100644
index 0000000000..1ee8181f12
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/GPLv2.patch
@@ -0,0 +1,347 @@
1Upstream-Status: Inappropriate [licensing]
2
3diff --git a/COPYING b/COPYING
4new file mode 100644
5index 0000000..d511905
6--- /dev/null
7+++ b/COPYING
8@@ -0,0 +1,339 @@
9+ GNU GENERAL PUBLIC LICENSE
10+ Version 2, June 1991
11+
12+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
13+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
14+ Everyone is permitted to copy and distribute verbatim copies
15+ of this license document, but changing it is not allowed.
16+
17+ Preamble
18+
19+ The licenses for most software are designed to take away your
20+freedom to share and change it. By contrast, the GNU General Public
21+License is intended to guarantee your freedom to share and change free
22+software--to make sure the software is free for all its users. This
23+General Public License applies to most of the Free Software
24+Foundation's software and to any other program whose authors commit to
25+using it. (Some other Free Software Foundation software is covered by
26+the GNU Lesser General Public License instead.) You can apply it to
27+your programs, too.
28+
29+ When we speak of free software, we are referring to freedom, not
30+price. Our General Public Licenses are designed to make sure that you
31+have the freedom to distribute copies of free software (and charge for
32+this service if you wish), that you receive source code or can get it
33+if you want it, that you can change the software or use pieces of it
34+in new free programs; and that you know you can do these things.
35+
36+ To protect your rights, we need to make restrictions that forbid
37+anyone to deny you these rights or to ask you to surrender the rights.
38+These restrictions translate to certain responsibilities for you if you
39+distribute copies of the software, or if you modify it.
40+
41+ For example, if you distribute copies of such a program, whether
42+gratis or for a fee, you must give the recipients all the rights that
43+you have. You must make sure that they, too, receive or can get the
44+source code. And you must show them these terms so they know their
45+rights.
46+
47+ We protect your rights with two steps: (1) copyright the software, and
48+(2) offer you this license which gives you legal permission to copy,
49+distribute and/or modify the software.
50+
51+ Also, for each author's protection and ours, we want to make certain
52+that everyone understands that there is no warranty for this free
53+software. If the software is modified by someone else and passed on, we
54+want its recipients to know that what they have is not the original, so
55+that any problems introduced by others will not reflect on the original
56+authors' reputations.
57+
58+ Finally, any free program is threatened constantly by software
59+patents. We wish to avoid the danger that redistributors of a free
60+program will individually obtain patent licenses, in effect making the
61+program proprietary. To prevent this, we have made it clear that any
62+patent must be licensed for everyone's free use or not licensed at all.
63+
64+ The precise terms and conditions for copying, distribution and
65+modification follow.
66+
67+ GNU GENERAL PUBLIC LICENSE
68+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
69+
70+ 0. This License applies to any program or other work which contains
71+a notice placed by the copyright holder saying it may be distributed
72+under the terms of this General Public License. The "Program", below,
73+refers to any such program or work, and a "work based on the Program"
74+means either the Program or any derivative work under copyright law:
75+that is to say, a work containing the Program or a portion of it,
76+either verbatim or with modifications and/or translated into another
77+language. (Hereinafter, translation is included without limitation in
78+the term "modification".) Each licensee is addressed as "you".
79+
80+Activities other than copying, distribution and modification are not
81+covered by this License; they are outside its scope. The act of
82+running the Program is not restricted, and the output from the Program
83+is covered only if its contents constitute a work based on the
84+Program (independent of having been made by running the Program).
85+Whether that is true depends on what the Program does.
86+
87+ 1. You may copy and distribute verbatim copies of the Program's
88+source code as you receive it, in any medium, provided that you
89+conspicuously and appropriately publish on each copy an appropriate
90+copyright notice and disclaimer of warranty; keep intact all the
91+notices that refer to this License and to the absence of any warranty;
92+and give any other recipients of the Program a copy of this License
93+along with the Program.
94+
95+You may charge a fee for the physical act of transferring a copy, and
96+you may at your option offer warranty protection in exchange for a fee.
97+
98+ 2. You may modify your copy or copies of the Program or any portion
99+of it, thus forming a work based on the Program, and copy and
100+distribute such modifications or work under the terms of Section 1
101+above, provided that you also meet all of these conditions:
102+
103+ a) You must cause the modified files to carry prominent notices
104+ stating that you changed the files and the date of any change.
105+
106+ b) You must cause any work that you distribute or publish, that in
107+ whole or in part contains or is derived from the Program or any
108+ part thereof, to be licensed as a whole at no charge to all third
109+ parties under the terms of this License.
110+
111+ c) If the modified program normally reads commands interactively
112+ when run, you must cause it, when started running for such
113+ interactive use in the most ordinary way, to print or display an
114+ announcement including an appropriate copyright notice and a
115+ notice that there is no warranty (or else, saying that you provide
116+ a warranty) and that users may redistribute the program under
117+ these conditions, and telling the user how to view a copy of this
118+ License. (Exception: if the Program itself is interactive but
119+ does not normally print such an announcement, your work based on
120+ the Program is not required to print an announcement.)
121+
122+These requirements apply to the modified work as a whole. If
123+identifiable sections of that work are not derived from the Program,
124+and can be reasonably considered independent and separate works in
125+themselves, then this License, and its terms, do not apply to those
126+sections when you distribute them as separate works. But when you
127+distribute the same sections as part of a whole which is a work based
128+on the Program, the distribution of the whole must be on the terms of
129+this License, whose permissions for other licensees extend to the
130+entire whole, and thus to each and every part regardless of who wrote it.
131+
132+Thus, it is not the intent of this section to claim rights or contest
133+your rights to work written entirely by you; rather, the intent is to
134+exercise the right to control the distribution of derivative or
135+collective works based on the Program.
136+
137+In addition, mere aggregation of another work not based on the Program
138+with the Program (or with a work based on the Program) on a volume of
139+a storage or distribution medium does not bring the other work under
140+the scope of this License.
141+
142+ 3. You may copy and distribute the Program (or a work based on it,
143+under Section 2) in object code or executable form under the terms of
144+Sections 1 and 2 above provided that you also do one of the following:
145+
146+ a) Accompany it with the complete corresponding machine-readable
147+ source code, which must be distributed under the terms of Sections
148+ 1 and 2 above on a medium customarily used for software interchange; or,
149+
150+ b) Accompany it with a written offer, valid for at least three
151+ years, to give any third party, for a charge no more than your
152+ cost of physically performing source distribution, a complete
153+ machine-readable copy of the corresponding source code, to be
154+ distributed under the terms of Sections 1 and 2 above on a medium
155+ customarily used for software interchange; or,
156+
157+ c) Accompany it with the information you received as to the offer
158+ to distribute corresponding source code. (This alternative is
159+ allowed only for noncommercial distribution and only if you
160+ received the program in object code or executable form with such
161+ an offer, in accord with Subsection b above.)
162+
163+The source code for a work means the preferred form of the work for
164+making modifications to it. For an executable work, complete source
165+code means all the source code for all modules it contains, plus any
166+associated interface definition files, plus the scripts used to
167+control compilation and installation of the executable. However, as a
168+special exception, the source code distributed need not include
169+anything that is normally distributed (in either source or binary
170+form) with the major components (compiler, kernel, and so on) of the
171+operating system on which the executable runs, unless that component
172+itself accompanies the executable.
173+
174+If distribution of executable or object code is made by offering
175+access to copy from a designated place, then offering equivalent
176+access to copy the source code from the same place counts as
177+distribution of the source code, even though third parties are not
178+compelled to copy the source along with the object code.
179+
180+ 4. You may not copy, modify, sublicense, or distribute the Program
181+except as expressly provided under this License. Any attempt
182+otherwise to copy, modify, sublicense or distribute the Program is
183+void, and will automatically terminate your rights under this License.
184+However, parties who have received copies, or rights, from you under
185+this License will not have their licenses terminated so long as such
186+parties remain in full compliance.
187+
188+ 5. You are not required to accept this License, since you have not
189+signed it. However, nothing else grants you permission to modify or
190+distribute the Program or its derivative works. These actions are
191+prohibited by law if you do not accept this License. Therefore, by
192+modifying or distributing the Program (or any work based on the
193+Program), you indicate your acceptance of this License to do so, and
194+all its terms and conditions for copying, distributing or modifying
195+the Program or works based on it.
196+
197+ 6. Each time you redistribute the Program (or any work based on the
198+Program), the recipient automatically receives a license from the
199+original licensor to copy, distribute or modify the Program subject to
200+these terms and conditions. You may not impose any further
201+restrictions on the recipients' exercise of the rights granted herein.
202+You are not responsible for enforcing compliance by third parties to
203+this License.
204+
205+ 7. If, as a consequence of a court judgment or allegation of patent
206+infringement or for any other reason (not limited to patent issues),
207+conditions are imposed on you (whether by court order, agreement or
208+otherwise) that contradict the conditions of this License, they do not
209+excuse you from the conditions of this License. If you cannot
210+distribute so as to satisfy simultaneously your obligations under this
211+License and any other pertinent obligations, then as a consequence you
212+may not distribute the Program at all. For example, if a patent
213+license would not permit royalty-free redistribution of the Program by
214+all those who receive copies directly or indirectly through you, then
215+the only way you could satisfy both it and this License would be to
216+refrain entirely from distribution of the Program.
217+
218+If any portion of this section is held invalid or unenforceable under
219+any particular circumstance, the balance of the section is intended to
220+apply and the section as a whole is intended to apply in other
221+circumstances.
222+
223+It is not the purpose of this section to induce you to infringe any
224+patents or other property right claims or to contest validity of any
225+such claims; this section has the sole purpose of protecting the
226+integrity of the free software distribution system, which is
227+implemented by public license practices. Many people have made
228+generous contributions to the wide range of software distributed
229+through that system in reliance on consistent application of that
230+system; it is up to the author/donor to decide if he or she is willing
231+to distribute software through any other system and a licensee cannot
232+impose that choice.
233+
234+This section is intended to make thoroughly clear what is believed to
235+be a consequence of the rest of this License.
236+
237+ 8. If the distribution and/or use of the Program is restricted in
238+certain countries either by patents or by copyrighted interfaces, the
239+original copyright holder who places the Program under this License
240+may add an explicit geographical distribution limitation excluding
241+those countries, so that distribution is permitted only in or among
242+countries not thus excluded. In such case, this License incorporates
243+the limitation as if written in the body of this License.
244+
245+ 9. The Free Software Foundation may publish revised and/or new versions
246+of the General Public License from time to time. Such new versions will
247+be similar in spirit to the present version, but may differ in detail to
248+address new problems or concerns.
249+
250+Each version is given a distinguishing version number. If the Program
251+specifies a version number of this License which applies to it and "any
252+later version", you have the option of following the terms and conditions
253+either of that version or of any later version published by the Free
254+Software Foundation. If the Program does not specify a version number of
255+this License, you may choose any version ever published by the Free Software
256+Foundation.
257+
258+ 10. If you wish to incorporate parts of the Program into other free
259+programs whose distribution conditions are different, write to the author
260+to ask for permission. For software which is copyrighted by the Free
261+Software Foundation, write to the Free Software Foundation; we sometimes
262+make exceptions for this. Our decision will be guided by the two goals
263+of preserving the free status of all derivatives of our free software and
264+of promoting the sharing and reuse of software generally.
265+
266+ NO WARRANTY
267+
268+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
269+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
270+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
271+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
272+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
273+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
274+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
275+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
276+REPAIR OR CORRECTION.
277+
278+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
279+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
280+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
281+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
282+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
283+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
284+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
285+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
286+POSSIBILITY OF SUCH DAMAGES.
287+
288+ END OF TERMS AND CONDITIONS
289+
290+ How to Apply These Terms to Your New Programs
291+
292+ If you develop a new program, and you want it to be of the greatest
293+possible use to the public, the best way to achieve this is to make it
294+free software which everyone can redistribute and change under these terms.
295+
296+ To do so, attach the following notices to the program. It is safest
297+to attach them to the start of each source file to most effectively
298+convey the exclusion of warranty; and each file should have at least
299+the "copyright" line and a pointer to where the full notice is found.
300+
301+ <one line to give the program's name and a brief idea of what it does.>
302+ Copyright (C) <year> <name of author>
303+
304+ This program is free software; you can redistribute it and/or modify
305+ it under the terms of the GNU General Public License as published by
306+ the Free Software Foundation; either version 2 of the License, or
307+ (at your option) any later version.
308+
309+ This program is distributed in the hope that it will be useful,
310+ but WITHOUT ANY WARRANTY; without even the implied warranty of
311+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
312+ GNU General Public License for more details.
313+
314+ You should have received a copy of the GNU General Public License along
315+ with this program; if not, write to the Free Software Foundation, Inc.,
316+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
317+
318+Also add information on how to contact you by electronic and paper mail.
319+
320+If the program is interactive, make it output a short notice like this
321+when it starts in an interactive mode:
322+
323+ Gnomovision version 69, Copyright (C) year name of author
324+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
325+ This is free software, and you are welcome to redistribute it
326+ under certain conditions; type `show c' for details.
327+
328+The hypothetical commands `show w' and `show c' should show the appropriate
329+parts of the General Public License. Of course, the commands you use may
330+be called something other than `show w' and `show c'; they could even be
331+mouse-clicks or menu items--whatever suits your program.
332+
333+You should also get your employer (if you work as a programmer) or your
334+school, if any, to sign a "copyright disclaimer" for the program, if
335+necessary. Here is a sample; alter the names:
336+
337+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
338+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
339+
340+ <signature of Ty Coon>, 1 April 1989
341+ Ty Coon, President of Vice
342+
343+This General Public License does not permit incorporating your program into
344+proprietary programs. If your program is a subroutine library, you may
345+consider it more useful to permit linking proprietary applications with the
346+library. If this is what you want to do, use the GNU Lesser General
347+Public License instead of this License.
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/arm/alignment.sh b/meta/recipes-core/initscripts/initscripts-1.0/arm/alignment.sh
new file mode 100644
index 0000000000..b577b9a03a
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/arm/alignment.sh
@@ -0,0 +1,13 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: alignment
4# Required-Start: mountkernfs
5# Required-Stop: mountkernfs
6# Default-Start: S
7# Default-Stop:
8### END INIT INFO
9
10if [ -e /proc/cpu/alignment ]; then
11 echo "3" > /proc/cpu/alignment
12fi
13
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/banner.sh b/meta/recipes-core/initscripts/initscripts-1.0/banner.sh
new file mode 100644
index 0000000000..9e2b091252
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/banner.sh
@@ -0,0 +1,24 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: banner
4# Required-Start:
5# Required-Stop:
6# Default-Start: S
7# Default-Stop:
8### END INIT INFO
9
10if [ ! -e /dev/tty ]; then
11 /bin/mknod -m 0666 /dev/tty c 5 0
12fi
13
14if ( > /dev/tty0 ) 2>/dev/null; then
15 vtmaster=/dev/tty0
16elif ( > /dev/vc/0 ) 2>/dev/null; then
17 vtmaster=/dev/vc/0
18elif ( > /dev/console ) 2>/dev/null; then
19 vtmaster=/dev/console
20else
21 vtmaster=/dev/null
22fi
23echo > $vtmaster
24echo "Please wait: booting..." > $vtmaster
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh b/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh
new file mode 100755
index 0000000000..3b5a47fcdd
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh
@@ -0,0 +1,71 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: bootmisc
4# Required-Start: $local_fs mountvirtfs
5# Required-Stop: $local_fs
6# Default-Start: S
7# Default-Stop: 0 6
8# Short-Description: Misc and other.
9### END INIT INFO
10
11. /etc/default/rcS
12#
13# Put a nologin file in /etc to prevent people from logging in before
14# system startup is complete.
15#
16if test "$DELAYLOGIN" = yes
17then
18 echo "System bootup in progress - please wait" > /etc/nologin
19 cp /etc/nologin /etc/nologin.boot
20fi
21
22#
23# Set pseudo-terminal access permissions.
24#
25if test -c /dev/ttyp0
26then
27 chmod 666 /dev/tty[p-za-e][0-9a-f]
28 chown root:tty /dev/tty[p-za-e][0-9a-f]
29fi
30
31#
32# Apply /proc settings if defined
33#
34SYSCTL_CONF="/etc/sysctl.conf"
35if [ -f "${SYSCTL_CONF}" ]
36then
37 if [ -x "/sbin/sysctl" ]
38 then
39 /sbin/sysctl -p "${SYSCTL_CONF}"
40 else
41 echo "To have ${SYSCTL_CONF} applied during boot, install package <procps>."
42 fi
43fi
44
45#
46# Update /etc/motd.
47#
48if test "$EDITMOTD" != no
49then
50 uname -a > /etc/motd.tmp
51 sed 1d /etc/motd >> /etc/motd.tmp
52 mv /etc/motd.tmp /etc/motd
53fi
54
55#
56# This is as good a place as any for a sanity check
57#
58# Set the system clock from hardware clock
59# If the timestamp is more recent than the current time,
60# use the timestamp instead.
61test -x /etc/init.d/hwclock.sh && /etc/init.d/hwclock.sh start
62if test -e /etc/timestamp
63then
64 SYSTEMDATE=`date -u +%4Y%2m%2d%2H%2M`
65 read TIMESTAMP < /etc/timestamp
66 if [ ${TIMESTAMP} -gt $SYSTEMDATE ]; then
67 date -u ${TIMESTAMP#????}${TIMESTAMP%????????}
68 test -x /etc/init.d/hwclock.sh && /etc/init.d/hwclock.sh stop
69 fi
70fi
71: exit 0
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/checkfs.sh b/meta/recipes-core/initscripts/initscripts-1.0/checkfs.sh
new file mode 100755
index 0000000000..62869451b7
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/checkfs.sh
@@ -0,0 +1,50 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: checkfs
4# Required-Start: checkroot
5# Required-Stop:
6# Default-Start: S
7# Default-Stop:
8# Short-Description: Check all other file systems
9### END INIT INFO
10
11. /etc/default/rcS
12
13#
14# Check the rest of the filesystems.
15#
16if test ! -f /fastboot
17then
18 if test -f /forcefsck
19 then
20 force="-f"
21 else
22 force=""
23 fi
24 if test "$FSCKFIX" = yes
25 then
26 fix="-y"
27 else
28 fix="-a"
29 fi
30 spinner="-C"
31 case "$TERM" in
32 dumb|network|unknown|"") spinner="" ;;
33 esac
34 test "`uname -m`" = "s390" && spinner="" # This should go away
35 test "$VERBOSE" != no && echo "Checking all filesystems..."
36 fsck $spinner -R -A $fix $force
37 if test "$?" -gt 1
38 then
39 echo
40 echo "fsck failed. Please repair manually."
41 echo
42 echo "CONTROL-D will exit from this shell and continue system startup."
43 echo
44 # Start a single user shell on the console
45 /sbin/sulogin $CONSOLE
46 fi
47fi
48rm -f /fastboot /forcefsck
49
50: exit 0
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh b/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh
new file mode 100755
index 0000000000..dfee2afaad
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh
@@ -0,0 +1,148 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: checkroot
4# Required-Start: udev
5# Required-Stop:
6# Default-Start: S
7# Default-Stop:
8# Short-Description: Check to root file system.
9### END INIT INFO
10
11. /etc/default/rcS
12
13#
14# Set SULOGIN in /etc/default/rcS to yes if you want a sulogin to be spawned
15# from this script *before anything else* with a timeout, like SCO does.
16#
17test "$SULOGIN" = yes && sulogin -t 30 $CONSOLE
18
19#
20# Read /etc/fstab.
21#
22exec 9< /etc/fstab
23rootmode=rw
24rootopts=rw
25rootcheck=$ENABLE_ROOTFS_FSCK
26swap_on_md=no
27devfs=
28while read fs mnt type opts dump pass junk <&9
29do
30 case "$fs" in
31 ""|\#*)
32 continue;
33 ;;
34 /dev/md*)
35 # Swap on md device.
36 test "$type" = swap && swap_on_md=yes
37 ;;
38 /dev/*)
39 ;;
40 *)
41 # Might be a swapfile.
42 test "$type" = swap && swap_on_md=yes
43 ;;
44 esac
45 test "$type" = devfs && devfs="$fs"
46 test "$mnt" != / && continue
47 rootopts="$opts"
48 test "$pass" = 0 -o "$pass" = "" && rootcheck=no
49 case "$opts" in
50 ro|ro,*|*,ro|*,ro,*)
51 rootmode=ro
52 ;;
53 esac
54done
55exec 0>&9 9>&-
56
57# Check for conflicting configurations
58if [ "$rootmode" = "ro" -a "$ROOTFS_READ_ONLY" = "no" ] || \
59 [ "$rootmode" = "rw" -a "$ROOTFS_READ_ONLY" = "yes" ]; then
60 echo ""
61 echo "WARN: conflicting configurations in /etc/fstab and /etc/default/rcS"
62 echo " regarding the writability of rootfs. Please fix one of them."
63 echo ""
64fi
65
66
67#
68# Activate the swap device(s) in /etc/fstab. This needs to be done
69# before fsck, since fsck can be quite memory-hungry.
70#
71test "$VERBOSE" != no && echo "Activating swap"
72swapon -a 2> /dev/null
73
74#
75# Check the root filesystem.
76#
77if test -f /fastboot || test $rootcheck = no
78then
79 test $rootcheck = yes && echo "Fast boot, no filesystem check"
80else
81 #
82 # Ensure that root is quiescent and read-only before fsck'ing.
83 #
84 mount -n -o remount,ro /
85 if test $? = 0
86 then
87 if test -f /forcefsck
88 then
89 force="-f"
90 else
91 force=""
92 fi
93 if test "$FSCKFIX" = yes
94 then
95 fix="-y"
96 else
97 fix="-a"
98 fi
99 spinner="-C"
100 case "$TERM" in
101 dumb|network|unknown|"") spinner="" ;;
102 esac
103 test `uname -m` = s390 && spinner="" # This should go away
104 test "$VERBOSE" != no && echo "Checking root filesystem..."
105 fsck $spinner $force $fix /
106 #
107 # If there was a failure, drop into single-user mode.
108 #
109 # NOTE: "failure" is defined as exiting with a return code of
110 # 2 or larger. A return code of 1 indicates that filesystem
111 # errors were corrected but that the boot may proceed.
112 #
113 if test "$?" -gt 1
114 then
115 # Surprise! Re-directing from a HERE document (as in
116 # "cat << EOF") won't work, because the root is read-only.
117 echo
118 echo "fsck failed. Please repair manually and reboot. Please note"
119 echo "that the root filesystem is currently mounted read-only. To"
120 echo "remount it read-write:"
121 echo
122 echo " # mount -n -o remount,rw /"
123 echo
124 echo "CONTROL-D will exit from this shell and REBOOT the system."
125 echo
126 # Start a single user shell on the console
127 /sbin/sulogin $CONSOLE
128 reboot -f
129 fi
130 else
131 echo "*** ERROR! Cannot fsck root fs because it is not mounted read-only!"
132 echo
133 fi
134fi
135
136#
137# If the root filesystem was not marked as read-only in /etc/fstab,
138# remount the rootfs rw but do not try to change mtab because it
139# is on a ro fs until the remount succeeded. Then clean up old mtabs
140# and finally write the new mtab.
141#
142mount -n -o remount,$rootmode /
143if test "$rootmode" = rw
144then
145 ln -sf /proc/mounts /dev/mtab
146fi
147
148: exit 0
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/devpts b/meta/recipes-core/initscripts/initscripts-1.0/devpts
new file mode 100644
index 0000000000..4a0978b404
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/devpts
@@ -0,0 +1,5 @@
1# GID of the `tty' group
2TTYGRP=5
3
4# Set to 600 to have `mesg n' be the default
5TTYMODE=620
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/devpts.sh b/meta/recipes-core/initscripts/initscripts-1.0/devpts.sh
new file mode 100755
index 0000000000..c6043fb1e6
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/devpts.sh
@@ -0,0 +1,28 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: devpts
4# Required-Start: udev
5# Required-Stop:
6# Default-Start: S
7# Default-Stop:
8# Short-Description: Mount /dev/pts file systems.
9### END INIT INFO
10
11. /etc/default/devpts
12
13if grep -q devpts /proc/filesystems
14then
15 #
16 # Create multiplexor device.
17 #
18 test -c /dev/ptmx || mknod -m 666 /dev/ptmx c 5 2
19
20 #
21 # Mount /dev/pts if needed.
22 #
23 if ! grep -q devpts /proc/mounts
24 then
25 mkdir -p /dev/pts
26 mount -t devpts devpts /dev/pts -ogid=${TTYGRP},mode=${TTYMODE}
27 fi
28fi
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/dmesg.sh b/meta/recipes-core/initscripts/initscripts-1.0/dmesg.sh
new file mode 100644
index 0000000000..a97b0681e1
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/dmesg.sh
@@ -0,0 +1,17 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: dmesg
4# Required-Start:
5# Required-Stop:
6# Default-Start: S
7# Default-Stop:
8### END INIT INFO
9
10if [ -f /var/log/dmesg ]; then
11 if [ -f /usr/sbin/logrotate ]; then
12 logrotate -f /etc/logrotate-dmesg.conf
13 else
14 mv -f /var/log/dmesg /var/log/dmesg.old
15 fi
16fi
17dmesg -s 131072 > /var/log/dmesg
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/functions b/meta/recipes-core/initscripts/initscripts-1.0/functions
new file mode 100755
index 0000000000..01ad1edd3e
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/functions
@@ -0,0 +1,91 @@
1# -*-Shell-script-*-
2#
3# functions This file contains functions to be used by most or all
4# shell scripts in the /etc/init.d directory.
5#
6
7NORMAL="\\033[0;39m" # Standard console grey
8SUCCESS="\\033[1;32m" # Success is green
9WARNING="\\033[1;33m" # Warnings are yellow
10FAILURE="\\033[1;31m" # Failures are red
11INFO="\\033[1;36m" # Information is light cyan
12BRACKET="\\033[1;34m" # Brackets are blue
13
14# NOTE: The pidofproc () doesn't support the process which is a script unless
15# the pidof supports "-x" option. If you want to use it for such a
16# process:
17# 1) If there is no "pidof -x", replace the "pidof $1" with another
18# command like(for core-image-minimal):
19# ps | awk '/'"$1"'/ {print $1}'
20# Or
21# 2) If there is "pidof -x", replace "pidof" with "pidof -x".
22#
23# pidofproc - print the pid of a process
24# $1: the name of the process
25pidofproc () {
26
27 # pidof output null when no program is running, so no "2>/dev/null".
28 pid=`pidof $1`
29 status=$?
30 case $status in
31 0)
32 echo $pid
33 return 0
34 ;;
35 127)
36 echo "ERROR: command pidof not found" >&2
37 exit 127
38 ;;
39 *)
40 return $status
41 ;;
42 esac
43}
44
45machine_id() { # return the machine ID
46 awk 'BEGIN { FS=": " } /Hardware/ \
47 { gsub(" ", "_", $2); print tolower($2) } ' </proc/cpuinfo
48}
49
50killproc() { # kill the named process(es)
51 pid=`pidofproc $1` && kill $pid
52}
53
54status() {
55 local pid
56 if [ "$#" = 0 ]; then
57 echo "Usage: status {program}"
58 return 1
59 fi
60 pid=`pidofproc $1`
61 if [ -n "$pid" ]; then
62 echo "$1 (pid $pid) is running..."
63 return 0
64 else
65 echo "$1 is stopped"
66 fi
67 return 3
68}
69
70success() {
71 echo -n -e "${BRACKET}[${SUCCESS} OK ${BRACKET}]${NORMAL}"
72 return 0
73}
74
75failure() {
76 local rc=$*
77 echo -n -e "${BRACKET}[${FAILURE} FAIL ${BRACKET}]${NORMAL}"
78 return $rc
79}
80
81warning() {
82 local rc=$*
83 echo -n -e "${BRACKET}[${WARNING} WARN ${BRACKET}]${NORMAL}"
84 return $rc
85}
86
87passed() {
88 local rc=$*
89 echo -n -e "${BRACKET}[${SUCCESS} PASS ${BRACKET}]${NORMAL}"
90 return $rc
91}
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/halt b/meta/recipes-core/initscripts/initscripts-1.0/halt
new file mode 100755
index 0000000000..a56f73421b
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/halt
@@ -0,0 +1,29 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: halt
4# Required-Start:
5# Required-Stop:
6# Default-Start:
7# Default-Stop: 0
8# Short-Description: Execute the halt command.
9# Description:
10### END INIT INFO
11
12PATH=/sbin:/bin:/usr/sbin:/usr/bin
13
14# See if we need to cut the power.
15if test -x /etc/init.d/ups-monitor
16then
17 /etc/init.d/ups-monitor poweroff
18fi
19
20# Don't shut down drives if we're using RAID.
21hddown="-h"
22if grep -qs '^md.*active' /proc/mdstat
23then
24 hddown=""
25fi
26
27halt SED_HALTARGS -p $hddown
28
29: exit 0
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/hostname.sh b/meta/recipes-core/initscripts/initscripts-1.0/hostname.sh
new file mode 100755
index 0000000000..78fb91c409
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/hostname.sh
@@ -0,0 +1,22 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: hostname
4# Required-Start:
5# Required-Stop:
6# Default-Start: S
7# Default-Stop:
8# Short-Description: Set hostname based on /etc/hostname
9### END INIT INFO
10HOSTNAME=$(/bin/hostname)
11
12hostname -b -F /etc/hostname 2> /dev/null
13if [ $? -eq 0 ]; then
14 exit
15fi
16
17# Busybox hostname doesn't support -b so we need implement it on our own
18if [ -f /etc/hostname ];then
19 hostname -F /etc/hostname
20elif [ -z "$HOSTNAME" -o "$HOSTNAME" = "(none)" -o ! -z "`echo $HOSTNAME | sed -n '/^[0-9]*\.[0-9].*/p'`" ] ; then
21 hostname localhost
22fi
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/logrotate-dmesg.conf b/meta/recipes-core/initscripts/initscripts-1.0/logrotate-dmesg.conf
new file mode 100644
index 0000000000..6f46e4216f
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/logrotate-dmesg.conf
@@ -0,0 +1,9 @@
1# see "man logrotate" for details
2# rotate dmesg, and keep 5 versions.
3
4/var/log/dmesg {
5 create
6 rotate 5
7 nodateext
8}
9
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/mountall.sh b/meta/recipes-core/initscripts/initscripts-1.0/mountall.sh
new file mode 100755
index 0000000000..94bae420c0
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/mountall.sh
@@ -0,0 +1,39 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: mountall
4# Required-Start: mountvirtfs
5# Required-Stop:
6# Default-Start: S
7# Default-Stop:
8# Short-Description: Mount all filesystems.
9# Description:
10### END INIT INFO
11
12. /etc/default/rcS
13
14#
15# Mount local filesystems in /etc/fstab. For some reason, people
16# might want to mount "proc" several times, and mount -v complains
17# about this. So we mount "proc" filesystems without -v.
18#
19test "$VERBOSE" != no && echo "Mounting local filesystems..."
20mount -at nonfs,nosmbfs,noncpfs 2>/dev/null
21
22#
23# We might have mounted something over /dev, see if /dev/initctl is there.
24#
25if test ! -p /dev/initctl
26then
27 rm -f /dev/initctl
28 mknod -m 600 /dev/initctl p
29fi
30kill -USR1 1
31
32#
33# Execute swapon command again, in case we want to swap to
34# a file on a now mounted filesystem.
35#
36swapon -a 2> /dev/null
37
38: exit 0
39
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/mountnfs.sh b/meta/recipes-core/initscripts/initscripts-1.0/mountnfs.sh
new file mode 100755
index 0000000000..fe6c19605f
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/mountnfs.sh
@@ -0,0 +1,88 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: mountnfs
4# Required-Start: $local_fs $network $rpcbind
5# Required-Stop:
6# Default-Start: S
7# Default-Stop:
8### END INIT INFO
9
10#
11# Run in a subshell because of I/O redirection.
12#
13test -f /etc/fstab && (
14
15#
16# Read through fstab line by line. If it is NFS, set the flag
17# for mounting NFS filesystems. If any NFS partition is found and it
18# not mounted with the nolock option, we start the rpcbind.
19#
20rpcbind=no
21mount_nfs=no
22mount_smb=no
23mount_ncp=no
24mount_cifs=no
25while read device mountpt fstype options
26do
27 case "$device" in
28 ""|\#*)
29 continue
30 ;;
31 esac
32
33 case "$options" in
34 *noauto*)
35 continue
36 ;;
37 esac
38
39 if test "$fstype" = nfs
40 then
41 mount_nfs=yes
42 case "$options" in
43 *nolock*)
44 ;;
45 *)
46 rpcbind=yes
47 ;;
48 esac
49 fi
50 if test "$fstype" = smbfs
51 then
52 mount_smb=yes
53 fi
54 if test "$fstype" = ncpfs
55 then
56 mount_ncp=yes
57 fi
58 if test "$fstype" = cifs
59 then
60 mount_cifs=yes
61 fi
62done
63
64exec 0>&1
65
66if test "$rpcbind" = yes
67then
68 if test -x /usr/sbin/rpcbind
69 then
70 echo -n "Starting rpcbind... "
71 start-stop-daemon --start --quiet --exec /usr/sbin/rpcbind
72 sleep 2
73 fi
74fi
75
76if test "$mount_nfs" = yes || test "$mount_smb" = yes || test "$mount_ncp" = yes || test "$mount_cifs" = yes
77then
78 echo "Mounting remote filesystems..."
79 test "$mount_nfs" = yes && mount -a -t nfs
80 test "$mount_smb" = yes && mount -a -t smbfs
81 test "$mount_ncp" = yes && mount -a -t ncpfs
82 test "$mount_cifs" = yes && mount -a -t cifs
83fi
84
85) < /etc/fstab
86
87: exit 0
88
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh b/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
new file mode 100755
index 0000000000..6ffe1f2171
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
@@ -0,0 +1,220 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: volatile
4# Required-Start: $local_fs
5# Required-Stop: $local_fs
6# Default-Start: S
7# Default-Stop:
8# Short-Description: Populate the volatile filesystem
9### END INIT INFO
10
11# Get ROOT_DIR
12DIRNAME=`dirname $0`
13ROOT_DIR=`echo $DIRNAME | sed -ne 's:/etc/.*::p'`
14
15[ -e ${ROOT_DIR}/etc/default/rcS ] && . ${ROOT_DIR}/etc/default/rcS
16# When running populate-volatile.sh at rootfs time, disable cache.
17[ -n "$ROOT_DIR" ] && VOLATILE_ENABLE_CACHE=no
18# If rootfs is read-only, disable cache.
19[ "$ROOTFS_READ_ONLY" = "yes" ] && VOLATILE_ENABLE_CACHE=no
20
21CFGDIR="${ROOT_DIR}/etc/default/volatiles"
22TMPROOT="${ROOT_DIR}/var/volatile/tmp"
23COREDEF="00_core"
24
25[ "${VERBOSE}" != "no" ] && echo "Populating volatile Filesystems."
26
27create_file() {
28 EXEC="
29 touch \"$1\";
30 chown ${TUSER}.${TGROUP} $1 || echo \"Failed to set owner -${TUSER}- for -$1-.\" >/dev/tty0 2>&1;
31 chmod ${TMODE} $1 || echo \"Failed to set mode -${TMODE}- for -$1-.\" >/dev/tty0 2>&1 "
32
33 test "$VOLATILE_ENABLE_CACHE" = yes && echo "$EXEC" >> /etc/volatile.cache.build
34
35 [ -e "$1" ] && {
36 [ "${VERBOSE}" != "no" ] && echo "Target already exists. Skipping."
37 } || {
38 if [ -z "$ROOT_DIR" ]; then
39 eval $EXEC &
40 else
41 # Creating some files at rootfs time may fail and should fail,
42 # but these failures should not be logged to make sure the do_rootfs
43 # process doesn't fail. This does no harm, as this script will
44 # run on target to set up the correct files and directories.
45 eval $EXEC > /dev/null 2>&1
46 fi
47 }
48}
49
50mk_dir() {
51 EXEC="
52 mkdir -p \"$1\";
53 chown ${TUSER}.${TGROUP} $1 || echo \"Failed to set owner -${TUSER}- for -$1-.\" >/dev/tty0 2>&1;
54 chmod ${TMODE} $1 || echo \"Failed to set mode -${TMODE}- for -$1-.\" >/dev/tty0 2>&1 "
55
56 test "$VOLATILE_ENABLE_CACHE" = yes && echo "$EXEC" >> /etc/volatile.cache.build
57 [ -e "$1" ] && {
58 [ "${VERBOSE}" != "no" ] && echo "Target already exists. Skipping."
59 } || {
60 if [ -z "$ROOT_DIR" ]; then
61 eval $EXEC
62 else
63 # For the same reason with create_file(), failures should
64 # not be logged.
65 eval $EXEC > /dev/null 2>&1
66 fi
67 }
68}
69
70link_file() {
71 EXEC="
72 if [ -L \"$2\" ]; then
73 [ \"\$(readlink -f \"$2\")\" != \"\$(readlink -f \"$1\")\" ] && { rm -f \"$2\"; ln -sf \"$1\" \"$2\"; };
74 elif [ -d \"$2\" ]; then
75 cp -a $2/* $1 2>/dev/null;
76 cp -a $2/.[!.]* $1 2>/dev/null;
77 rm -rf \"$2\";
78 ln -sf \"$1\" \"$2\";
79 else
80 ln -sf \"$1\" \"$2\";
81 fi
82 "
83
84 test "$VOLATILE_ENABLE_CACHE" = yes && echo " $EXEC" >> /etc/volatile.cache.build
85
86 if [ -z "$ROOT_DIR" ]; then
87 eval $EXEC &
88 else
89 # For the same reason with create_file(), failures should
90 # not be logged.
91 eval $EXEC > /dev/null 2>&1
92 fi
93}
94
95check_requirements() {
96 cleanup() {
97 rm "${TMP_INTERMED}"
98 rm "${TMP_DEFINED}"
99 rm "${TMP_COMBINED}"
100 }
101
102 CFGFILE="$1"
103 [ `basename "${CFGFILE}"` = "${COREDEF}" ] && return 0
104
105 TMP_INTERMED="${TMPROOT}/tmp.$$"
106 TMP_DEFINED="${TMPROOT}/tmpdefined.$$"
107 TMP_COMBINED="${TMPROOT}/tmpcombined.$$"
108
109 cat ${ROOT_DIR}/etc/passwd | sed 's@\(^:\)*:.*@\1@' | sort | uniq > "${TMP_DEFINED}"
110 cat ${CFGFILE} | grep -v "^#" | cut -s -d " " -f 2 > "${TMP_INTERMED}"
111 cat "${TMP_DEFINED}" "${TMP_INTERMED}" | sort | uniq > "${TMP_COMBINED}"
112 NR_DEFINED_USERS="`cat "${TMP_DEFINED}" | wc -l`"
113 NR_COMBINED_USERS="`cat "${TMP_COMBINED}" | wc -l`"
114
115 [ "${NR_DEFINED_USERS}" -ne "${NR_COMBINED_USERS}" ] && {
116 echo "Undefined users:"
117 diff "${TMP_DEFINED}" "${TMP_COMBINED}" | grep "^>"
118 cleanup
119 return 1
120 }
121
122
123 cat ${ROOT_DIR}/etc/group | sed 's@\(^:\)*:.*@\1@' | sort | uniq > "${TMP_DEFINED}"
124 cat ${CFGFILE} | grep -v "^#" | cut -s -d " " -f 3 > "${TMP_INTERMED}"
125 cat "${TMP_DEFINED}" "${TMP_INTERMED}" | sort | uniq > "${TMP_COMBINED}"
126
127 NR_DEFINED_GROUPS="`cat "${TMP_DEFINED}" | wc -l`"
128 NR_COMBINED_GROUPS="`cat "${TMP_COMBINED}" | wc -l`"
129
130 [ "${NR_DEFINED_GROUPS}" -ne "${NR_COMBINED_GROUPS}" ] && {
131 echo "Undefined groups:"
132 diff "${TMP_DEFINED}" "${TMP_COMBINED}" | grep "^>"
133 cleanup
134 return 1
135 }
136
137 # Add checks for required directories here
138
139 cleanup
140 return 0
141}
142
143apply_cfgfile() {
144 CFGFILE="$1"
145
146 check_requirements "${CFGFILE}" || {
147 echo "Skipping ${CFGFILE}"
148 return 1
149 }
150
151 cat ${CFGFILE} | grep -v "^#" | \
152 while read LINE; do
153 eval `echo "$LINE" | sed -n "s/\(.*\)\ \(.*\) \(.*\)\ \(.*\)\ \(.*\)\ \(.*\)/TTYPE=\1 ; TUSER=\2; TGROUP=\3; TMODE=\4; TNAME=\5 TLTARGET=\6/p"`
154 TNAME=${ROOT_DIR}${TNAME}
155 [ "${VERBOSE}" != "no" ] && echo "Checking for -${TNAME}-."
156
157 [ "${TTYPE}" = "l" ] && {
158 TSOURCE="$TLTARGET"
159 [ "${VERBOSE}" != "no" ] && echo "Creating link -${TNAME}- pointing to -${TSOURCE}-."
160 link_file "${TSOURCE}" "${TNAME}"
161 continue
162 }
163
164 [ -L "${TNAME}" ] && {
165 [ "${VERBOSE}" != "no" ] && echo "Found link."
166 NEWNAME=`ls -l "${TNAME}" | sed -e 's/^.*-> \(.*\)$/\1/'`
167 echo ${NEWNAME} | grep -v "^/" >/dev/null && {
168 TNAME="`echo ${TNAME} | sed -e 's@\(.*\)/.*@\1@'`/${NEWNAME}"
169 [ "${VERBOSE}" != "no" ] && echo "Converted relative linktarget to absolute path -${TNAME}-."
170 } || {
171 TNAME="${NEWNAME}"
172 [ "${VERBOSE}" != "no" ] && echo "Using absolute link target -${TNAME}-."
173 }
174 }
175
176 case "${TTYPE}" in
177 "f") [ "${VERBOSE}" != "no" ] && echo "Creating file -${TNAME}-."
178 create_file "${TNAME}" &
179 ;;
180 "d") [ "${VERBOSE}" != "no" ] && echo "Creating directory -${TNAME}-."
181 mk_dir "${TNAME}"
182 # Add check to see if there's an entry in fstab to mount.
183 ;;
184 *) [ "${VERBOSE}" != "no" ] && echo "Invalid type -${TTYPE}-."
185 continue
186 ;;
187 esac
188 done
189 return 0
190}
191
192clearcache=0
193exec 9</proc/cmdline
194while read line <&9
195do
196 case "$line" in
197 *clearcache*) clearcache=1
198 ;;
199 *) continue
200 ;;
201 esac
202done
203exec 9>&-
204
205if test -e ${ROOT_DIR}/etc/volatile.cache -a "$VOLATILE_ENABLE_CACHE" = "yes" -a "x$1" != "xupdate" -a "x$clearcache" = "x0"
206then
207 sh ${ROOT_DIR}/etc/volatile.cache
208else
209 rm -f ${ROOT_DIR}/etc/volatile.cache ${ROOT_DIR}/etc/volatile.cache.build
210 for file in `ls -1 "${CFGDIR}" | sort`; do
211 apply_cfgfile "${CFGDIR}/${file}"
212 done
213
214 [ -e ${ROOT_DIR}/etc/volatile.cache.build ] && sync && mv ${ROOT_DIR}/etc/volatile.cache.build ${ROOT_DIR}/etc/volatile.cache
215fi
216
217if [ -z "${ROOT_DIR}" ] && [ -f /etc/ld.so.cache ] && [ ! -f /var/run/ld.so.cache ]
218then
219 ln -s /etc/ld.so.cache /var/run/ld.so.cache
220fi
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh b/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh
new file mode 100644
index 0000000000..1a0328d63e
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh
@@ -0,0 +1,38 @@
1#!/bin/sh
2
3. /etc/default/rcS
4
5[ "$ROOTFS_READ_ONLY" = "no" ] && exit 0
6
7is_on_read_only_partition () {
8 DIRECTORY=$1
9 dir=`readlink -f $DIRECTORY`
10 while true; do
11 if [ ! -d "$dir" ]; then
12 echo "ERROR: $dir is not a directory"
13 exit 1
14 else
15 for flag in `awk -v dir=$dir '{ if ($2 == dir) { print "FOUND"; split($4,FLAGS,",") } }; \
16 END { for (f in FLAGS) print FLAGS[f] }' < /proc/mounts`; do
17 [ "$flag" = "FOUND" ] && partition="read-write"
18 [ "$flag" = "ro" ] && { partition="read-only"; break; }
19 done
20 if [ "$dir" = "/" -o -n "$partition" ]; then
21 break
22 else
23 dir=`dirname $dir`
24 fi
25 fi
26 done
27 [ "$partition" = "read-only" ] && echo "yes" || echo "no"
28}
29
30if [ "$1" = "start" ] ; then
31 if [ `is_on_read_only_partition /var/lib` = "yes" ]; then
32 grep -q "tmpfs /var/volatile" /proc/mounts || mount /var/volatile
33 mkdir -p /var/volatile/lib
34 cp -a /var/lib/* /var/volatile/lib
35 mount --bind /var/volatile/lib /var/lib
36 fi
37fi
38
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/reboot b/meta/recipes-core/initscripts/initscripts-1.0/reboot
new file mode 100755
index 0000000000..087d8d5da4
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/reboot
@@ -0,0 +1,15 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: reboot
4# Required-Start:
5# Required-Stop:
6# Default-Start:
7# Default-Stop: 6
8# Short-Description: Execute the reboot command.
9# Description:
10### END INIT INFO
11
12PATH=/sbin:/bin:/usr/sbin:/usr/bin
13
14echo -n "Rebooting... "
15reboot SED_HALTARGS
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/rmnologin.sh b/meta/recipes-core/initscripts/initscripts-1.0/rmnologin.sh
new file mode 100755
index 0000000000..76de3418ac
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/rmnologin.sh
@@ -0,0 +1,20 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: rmnologin
4# Required-Start: $remote_fs $all
5# Required-Stop:
6# Default-Start: 2 3 4 5
7# Default-Stop:
8# Short-Description: Remove /etc/nologin at boot
9# Description: This script removes the /etc/nologin file as the
10# last step in the boot process, if DELAYLOGIN=yes.
11# If DELAYLOGIN=no, /etc/nologin was not created by
12# bootmisc earlier in the boot process.
13### END INIT INFO
14
15if test -f /etc/nologin.boot
16then
17 rm -f /etc/nologin /etc/nologin.boot
18fi
19
20: exit 0
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh b/meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh
new file mode 100644
index 0000000000..1f804e2374
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh
@@ -0,0 +1,13 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: save-rtc
4# Required-Start:
5# Required-Stop: $local_fs hwclock
6# Default-Start: S
7# Default-Stop: 0 6
8# Short-Description: Store system clock into file
9# Description:
10### END INIT INFO
11
12# Update the timestamp
13date -u +%4Y%2m%2d%2H%2M > /etc/timestamp
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/sendsigs b/meta/recipes-core/initscripts/initscripts-1.0/sendsigs
new file mode 100755
index 0000000000..34e1b7714b
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/sendsigs
@@ -0,0 +1,21 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: sendsigs
4# Required-Start:
5# Required-Stop: umountnfs
6# Default-Start:
7# Default-Stop: 0 6
8# Short-Description: Kill all remaining processes.
9# Description:
10### END INIT INFO
11
12PATH=/sbin:/bin:/usr/sbin:/usr/bin
13
14# Kill all processes.
15echo "Sending all processes the TERM signal..."
16killall5 -15
17sleep 5
18echo "Sending all processes the KILL signal..."
19killall5 -9
20
21: exit 0
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/single b/meta/recipes-core/initscripts/initscripts-1.0/single
new file mode 100755
index 0000000000..da82d178a1
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/single
@@ -0,0 +1,24 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: single
4# Required-Start: $local_fs $all killprocs
5# Required-Stop:
6# Default-Start: 1
7# Default-Stop:
8# Short-Description: executed by init(8) upon entering runlevel 1 (single).
9### END INIT INFO
10
11PATH="/sbin:/bin:/usr/sbin:/usr/bin"
12
13# Kill all processes.
14echo "Sending all processes the TERM signal..."
15killall5 -15
16sleep 5
17echo "Sending all processes the KILL signal..."
18killall5 -9
19
20# We start update here, since we just killed it.
21test -x /sbin/update && update
22
23echo "Entering single-user mode..."
24exec init -t1 S
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/sysfs.sh b/meta/recipes-core/initscripts/initscripts-1.0/sysfs.sh
new file mode 100644
index 0000000000..0cfe76e230
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/sysfs.sh
@@ -0,0 +1,23 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: mountvirtfs
4# Required-Start:
5# Required-Stop:
6# Default-Start: S
7# Default-Stop:
8# Short-Description: Mount kernel virtual file systems.
9# Description: Mount initial set of virtual filesystems the kernel
10# provides and that are required by everything.
11### END INIT INFO
12
13if [ -e /proc ] && ! [ -e /proc/mounts ]; then
14 mount -t proc proc /proc
15fi
16
17if [ -e /sys ] && grep -q sysfs /proc/filesystems && ! [ -e /sys/class ]; then
18 mount -t sysfs sysfs /sys
19fi
20
21if [ -e /sys/kernel/debug ] && grep -q debugfs /proc/filesystems; then
22 mount -t debugfs debugfs /sys/kernel/debug
23fi
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/umountfs b/meta/recipes-core/initscripts/initscripts-1.0/umountfs
new file mode 100755
index 0000000000..61324c630b
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/umountfs
@@ -0,0 +1,24 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: umountfs
4# Required-Start:
5# Required-Stop:
6# Default-Start:
7# Default-Stop: 0 6
8# Short-Description: Turn off swap and unmount all local file systems.
9# Description:
10### END INIT INFO
11
12PATH=/sbin:/bin:/usr/sbin:/usr/bin
13
14echo "Deactivating swap..."
15swapoff -a
16
17# We leave /proc mounted.
18echo "Unmounting local filesystems..."
19grep -q /mnt/ram /proc/mounts && mount -o remount,ro /mnt/ram
20mount -o remount,ro /
21
22umount -f -a -r > /dev/null 2>&1
23
24: exit 0
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/umountnfs.sh b/meta/recipes-core/initscripts/initscripts-1.0/umountnfs.sh
new file mode 100755
index 0000000000..af075407fd
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/umountnfs.sh
@@ -0,0 +1,33 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: umountnfs
4# Required-Start:
5# Required-Stop: umountfs
6# Should-Stop: $network $portmap
7# Default-Start:
8# Default-Stop: 0 6
9# Short-Description: Unmount all network filesystems
10### END INIT INFO
11
12PATH=/sbin:/bin:/usr/sbin:/usr/bin
13
14# Write a reboot record to /var/log/wtmp before unmounting
15halt -w
16
17echo "Unmounting remote filesystems..."
18
19test -f /etc/fstab && (
20
21#
22# Read through fstab line by line and unount network file systems
23#
24while read device mountpt fstype options
25do
26 if test "$fstype" = nfs || test "$fstype" = smbfs || test "$fstype" = ncpfs || test "$fstype" = cifs
27 then
28 umount -f $mountpt
29 fi
30done
31) < /etc/fstab
32
33: exit 0
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/urandom b/meta/recipes-core/initscripts/initscripts-1.0/urandom
new file mode 100755
index 0000000000..eb3a7c3359
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/urandom
@@ -0,0 +1,46 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: urandom
4# Required-Start: $local_fs mountvirtfs
5# Required-Stop: $local_fs
6# Default-Start: S
7# Default-Stop: 0 6
8# Short-Description: Save and restore the random seed
9# Description: Save the random seed on shutdown and restore it on boot,
10# to ensure that the seed isn't predicable on startup
11# (because the boot process is predictable)
12### END INIT INFO
13
14test -c /dev/urandom || exit 0
15. /etc/default/rcS
16
17case "$1" in
18 start|"")
19 test "$VERBOSE" != no && echo "Initializing random number generator..."
20 # Load and then save 512 bytes,
21 # which is the size of the entropy pool
22 if test -f /var/lib/urandom/random-seed
23 then
24 cat /var/lib/urandom/random-seed >/dev/urandom
25 fi
26 rm -f /var/lib/urandom/random-seed
27 umask 077
28 dd if=/dev/urandom of=/var/lib/urandom/random-seed count=1 \
29 >/dev/null 2>&1 || echo "urandom start: failed."
30 umask 022
31 ;;
32 stop)
33 # Carry a random seed from shut-down to start-up;
34 # see documentation in linux/drivers/char/random.c
35 test "$VERBOSE" != no && echo "Saving random seed..."
36 umask 077
37 dd if=/dev/urandom of=/var/lib/urandom/random-seed count=1 \
38 >/dev/null 2>&1 || echo "urandom stop: failed."
39 ;;
40 *)
41 echo "Usage: urandom {start|stop}" >&2
42 exit 1
43 ;;
44esac
45
46exit 0
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/volatiles b/meta/recipes-core/initscripts/initscripts-1.0/volatiles
new file mode 100644
index 0000000000..297245d0e4
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/volatiles
@@ -0,0 +1,36 @@
1# This configuration file lists filesystem objects that should get verified
2# during startup and be created if missing.
3#
4# Every line must either be a comment starting with #
5# or a definition of format:
6# <type> <owner> <group> <mode> <path> <linksource>
7# where the items are separated by whitespace !
8#
9# <type> : d|f|l : (d)irectory|(f)ile|(l)ink
10#
11# A linking example:
12# l root root 0777 /var/test /tmp/testfile
13# f root root 0644 /var/test none
14#
15# Understanding links:
16# When populate-volatile is to verify/create a directory or file, it will first
17# check it's existence. If a link is found to exist in the place of the target,
18# the path of the target is replaced with the target the link points to.
19# Thus, if a link is in the place to be verified, the object will be created
20# in the place the link points to instead.
21# This explains the order of "link before object" as in the example above, where
22# a link will be created at /var/test pointing to /tmp/testfile and due to this
23# link the file defined as /var/test will actually be created as /tmp/testfile.
24d root root 1777 /run/lock none
25d root root 0755 /var/volatile/log none
26d root root 1777 /var/volatile/tmp none
27l root root 1777 /var/lock /run/lock
28l root root 0755 /var/log /var/volatile/log
29l root root 0755 /var/run /run
30l root root 1777 /var/tmp /var/volatile/tmp
31l root root 1777 /tmp /var/tmp
32d root root 0755 /var/lock/subsys none
33f root root 0664 /var/log/wtmp none
34f root root 0664 /var/run/utmp none
35l root root 0644 /etc/resolv.conf /var/run/resolv.conf
36f root root 0644 /var/run/resolv.conf none