diff options
author | Dave Cobbley <david.j.cobbley@linux.intel.com> | 2018-08-14 20:05:37 +0300 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2018-08-23 04:26:31 +0300 |
commit | eb8dc40360f0cfef56fb6947cc817a547d6d9bc6 (patch) | |
tree | de291a73dc37168da6370e2cf16c347d1eba9df8 /poky/meta/recipes-core/initscripts/initscripts-1.0 | |
parent | 9c3cf826d853102535ead04cebc2d6023eff3032 (diff) | |
download | openbmc-eb8dc40360f0cfef56fb6947cc817a547d6d9bc6.tar.xz |
[Subtree] Removing import-layers directory
As part of the move to subtrees, need to bring all the import layers
content to the top level.
Change-Id: I4a163d10898cbc6e11c27f776f60e1a470049d8f
Signed-off-by: Dave Cobbley <david.j.cobbley@linux.intel.com>
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'poky/meta/recipes-core/initscripts/initscripts-1.0')
28 files changed, 1545 insertions, 0 deletions
diff --git a/poky/meta/recipes-core/initscripts/initscripts-1.0/GPLv2.patch b/poky/meta/recipes-core/initscripts/initscripts-1.0/GPLv2.patch new file mode 100644 index 0000000000..1ee8181f12 --- /dev/null +++ b/poky/meta/recipes-core/initscripts/initscripts-1.0/GPLv2.patch @@ -0,0 +1,347 @@ +Upstream-Status: Inappropriate [licensing] + +diff --git a/COPYING b/COPYING +new file mode 100644 +index 0000000..d511905 +--- /dev/null ++++ b/COPYING +@@ -0,0 +1,339 @@ ++ GNU GENERAL PUBLIC LICENSE ++ Version 2, June 1991 ++ ++ Copyright (C) 1989, 1991 Free Software Foundation, Inc., ++ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ Everyone is permitted to copy and distribute verbatim copies ++ of this license document, but changing it is not allowed. ++ ++ Preamble ++ ++ The licenses for most software are designed to take away your ++freedom to share and change it. By contrast, the GNU General Public ++License is intended to guarantee your freedom to share and change free ++software--to make sure the software is free for all its users. This ++General Public License applies to most of the Free Software ++Foundation's software and to any other program whose authors commit to ++using it. (Some other Free Software Foundation software is covered by ++the GNU Lesser General Public License instead.) You can apply it to ++your programs, too. ++ ++ When we speak of free software, we are referring to freedom, not ++price. Our General Public Licenses are designed to make sure that you ++have the freedom to distribute copies of free software (and charge for ++this service if you wish), that you receive source code or can get it ++if you want it, that you can change the software or use pieces of it ++in new free programs; and that you know you can do these things. ++ ++ To protect your rights, we need to make restrictions that forbid ++anyone to deny you these rights or to ask you to surrender the rights. ++These restrictions translate to certain responsibilities for you if you ++distribute copies of the software, or if you modify it. ++ ++ For example, if you distribute copies of such a program, whether ++gratis or for a fee, you must give the recipients all the rights that ++you have. You must make sure that they, too, receive or can get the ++source code. And you must show them these terms so they know their ++rights. ++ ++ We protect your rights with two steps: (1) copyright the software, and ++(2) offer you this license which gives you legal permission to copy, ++distribute and/or modify the software. ++ ++ Also, for each author's protection and ours, we want to make certain ++that everyone understands that there is no warranty for this free ++software. If the software is modified by someone else and passed on, we ++want its recipients to know that what they have is not the original, so ++that any problems introduced by others will not reflect on the original ++authors' reputations. ++ ++ Finally, any free program is threatened constantly by software ++patents. We wish to avoid the danger that redistributors of a free ++program will individually obtain patent licenses, in effect making the ++program proprietary. To prevent this, we have made it clear that any ++patent must be licensed for everyone's free use or not licensed at all. ++ ++ The precise terms and conditions for copying, distribution and ++modification follow. ++ ++ GNU GENERAL PUBLIC LICENSE ++ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION ++ ++ 0. This License applies to any program or other work which contains ++a notice placed by the copyright holder saying it may be distributed ++under the terms of this General Public License. The "Program", below, ++refers to any such program or work, and a "work based on the Program" ++means either the Program or any derivative work under copyright law: ++that is to say, a work containing the Program or a portion of it, ++either verbatim or with modifications and/or translated into another ++language. (Hereinafter, translation is included without limitation in ++the term "modification".) Each licensee is addressed as "you". ++ ++Activities other than copying, distribution and modification are not ++covered by this License; they are outside its scope. The act of ++running the Program is not restricted, and the output from the Program ++is covered only if its contents constitute a work based on the ++Program (independent of having been made by running the Program). ++Whether that is true depends on what the Program does. ++ ++ 1. You may copy and distribute verbatim copies of the Program's ++source code as you receive it, in any medium, provided that you ++conspicuously and appropriately publish on each copy an appropriate ++copyright notice and disclaimer of warranty; keep intact all the ++notices that refer to this License and to the absence of any warranty; ++and give any other recipients of the Program a copy of this License ++along with the Program. ++ ++You may charge a fee for the physical act of transferring a copy, and ++you may at your option offer warranty protection in exchange for a fee. ++ ++ 2. You may modify your copy or copies of the Program or any portion ++of it, thus forming a work based on the Program, and copy and ++distribute such modifications or work under the terms of Section 1 ++above, provided that you also meet all of these conditions: ++ ++ a) You must cause the modified files to carry prominent notices ++ stating that you changed the files and the date of any change. ++ ++ b) You must cause any work that you distribute or publish, that in ++ whole or in part contains or is derived from the Program or any ++ part thereof, to be licensed as a whole at no charge to all third ++ parties under the terms of this License. ++ ++ c) If the modified program normally reads commands interactively ++ when run, you must cause it, when started running for such ++ interactive use in the most ordinary way, to print or display an ++ announcement including an appropriate copyright notice and a ++ notice that there is no warranty (or else, saying that you provide ++ a warranty) and that users may redistribute the program under ++ these conditions, and telling the user how to view a copy of this ++ License. (Exception: if the Program itself is interactive but ++ does not normally print such an announcement, your work based on ++ the Program is not required to print an announcement.) ++ ++These requirements apply to the modified work as a whole. If ++identifiable sections of that work are not derived from the Program, ++and can be reasonably considered independent and separate works in ++themselves, then this License, and its terms, do not apply to those ++sections when you distribute them as separate works. But when you ++distribute the same sections as part of a whole which is a work based ++on the Program, the distribution of the whole must be on the terms of ++this License, whose permissions for other licensees extend to the ++entire whole, and thus to each and every part regardless of who wrote it. ++ ++Thus, it is not the intent of this section to claim rights or contest ++your rights to work written entirely by you; rather, the intent is to ++exercise the right to control the distribution of derivative or ++collective works based on the Program. ++ ++In addition, mere aggregation of another work not based on the Program ++with the Program (or with a work based on the Program) on a volume of ++a storage or distribution medium does not bring the other work under ++the scope of this License. ++ ++ 3. You may copy and distribute the Program (or a work based on it, ++under Section 2) in object code or executable form under the terms of ++Sections 1 and 2 above provided that you also do one of the following: ++ ++ a) Accompany it with the complete corresponding machine-readable ++ source code, which must be distributed under the terms of Sections ++ 1 and 2 above on a medium customarily used for software interchange; or, ++ ++ b) Accompany it with a written offer, valid for at least three ++ years, to give any third party, for a charge no more than your ++ cost of physically performing source distribution, a complete ++ machine-readable copy of the corresponding source code, to be ++ distributed under the terms of Sections 1 and 2 above on a medium ++ customarily used for software interchange; or, ++ ++ c) Accompany it with the information you received as to the offer ++ to distribute corresponding source code. (This alternative is ++ allowed only for noncommercial distribution and only if you ++ received the program in object code or executable form with such ++ an offer, in accord with Subsection b above.) ++ ++The source code for a work means the preferred form of the work for ++making modifications to it. For an executable work, complete source ++code means all the source code for all modules it contains, plus any ++associated interface definition files, plus the scripts used to ++control compilation and installation of the executable. However, as a ++special exception, the source code distributed need not include ++anything that is normally distributed (in either source or binary ++form) with the major components (compiler, kernel, and so on) of the ++operating system on which the executable runs, unless that component ++itself accompanies the executable. ++ ++If distribution of executable or object code is made by offering ++access to copy from a designated place, then offering equivalent ++access to copy the source code from the same place counts as ++distribution of the source code, even though third parties are not ++compelled to copy the source along with the object code. ++ ++ 4. You may not copy, modify, sublicense, or distribute the Program ++except as expressly provided under this License. Any attempt ++otherwise to copy, modify, sublicense or distribute the Program is ++void, and will automatically terminate your rights under this License. ++However, parties who have received copies, or rights, from you under ++this License will not have their licenses terminated so long as such ++parties remain in full compliance. ++ ++ 5. You are not required to accept this License, since you have not ++signed it. However, nothing else grants you permission to modify or ++distribute the Program or its derivative works. These actions are ++prohibited by law if you do not accept this License. Therefore, by ++modifying or distributing the Program (or any work based on the ++Program), you indicate your acceptance of this License to do so, and ++all its terms and conditions for copying, distributing or modifying ++the Program or works based on it. ++ ++ 6. Each time you redistribute the Program (or any work based on the ++Program), the recipient automatically receives a license from the ++original licensor to copy, distribute or modify the Program subject to ++these terms and conditions. You may not impose any further ++restrictions on the recipients' exercise of the rights granted herein. ++You are not responsible for enforcing compliance by third parties to ++this License. ++ ++ 7. If, as a consequence of a court judgment or allegation of patent ++infringement or for any other reason (not limited to patent issues), ++conditions are imposed on you (whether by court order, agreement or ++otherwise) that contradict the conditions of this License, they do not ++excuse you from the conditions of this License. If you cannot ++distribute so as to satisfy simultaneously your obligations under this ++License and any other pertinent obligations, then as a consequence you ++may not distribute the Program at all. For example, if a patent ++license would not permit royalty-free redistribution of the Program by ++all those who receive copies directly or indirectly through you, then ++the only way you could satisfy both it and this License would be to ++refrain entirely from distribution of the Program. ++ ++If any portion of this section is held invalid or unenforceable under ++any particular circumstance, the balance of the section is intended to ++apply and the section as a whole is intended to apply in other ++circumstances. ++ ++It is not the purpose of this section to induce you to infringe any ++patents or other property right claims or to contest validity of any ++such claims; this section has the sole purpose of protecting the ++integrity of the free software distribution system, which is ++implemented by public license practices. Many people have made ++generous contributions to the wide range of software distributed ++through that system in reliance on consistent application of that ++system; it is up to the author/donor to decide if he or she is willing ++to distribute software through any other system and a licensee cannot ++impose that choice. ++ ++This section is intended to make thoroughly clear what is believed to ++be a consequence of the rest of this License. ++ ++ 8. If the distribution and/or use of the Program is restricted in ++certain countries either by patents or by copyrighted interfaces, the ++original copyright holder who places the Program under this License ++may add an explicit geographical distribution limitation excluding ++those countries, so that distribution is permitted only in or among ++countries not thus excluded. In such case, this License incorporates ++the limitation as if written in the body of this License. ++ ++ 9. The Free Software Foundation may publish revised and/or new versions ++of the General Public License from time to time. Such new versions will ++be similar in spirit to the present version, but may differ in detail to ++address new problems or concerns. ++ ++Each version is given a distinguishing version number. If the Program ++specifies a version number of this License which applies to it and "any ++later version", you have the option of following the terms and conditions ++either of that version or of any later version published by the Free ++Software Foundation. If the Program does not specify a version number of ++this License, you may choose any version ever published by the Free Software ++Foundation. ++ ++ 10. If you wish to incorporate parts of the Program into other free ++programs whose distribution conditions are different, write to the author ++to ask for permission. For software which is copyrighted by the Free ++Software Foundation, write to the Free Software Foundation; we sometimes ++make exceptions for this. Our decision will be guided by the two goals ++of preserving the free status of all derivatives of our free software and ++of promoting the sharing and reuse of software generally. ++ ++ NO WARRANTY ++ ++ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY ++FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN ++OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES ++PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED ++OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ++MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS ++TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE ++PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, ++REPAIR OR CORRECTION. ++ ++ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING ++WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR ++REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, ++INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING ++OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED ++TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY ++YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER ++PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE ++POSSIBILITY OF SUCH DAMAGES. ++ ++ END OF TERMS AND CONDITIONS ++ ++ How to Apply These Terms to Your New Programs ++ ++ If you develop a new program, and you want it to be of the greatest ++possible use to the public, the best way to achieve this is to make it ++free software which everyone can redistribute and change under these terms. ++ ++ To do so, attach the following notices to the program. It is safest ++to attach them to the start of each source file to most effectively ++convey the exclusion of warranty; and each file should have at least ++the "copyright" line and a pointer to where the full notice is found. ++ ++ <one line to give the program's name and a brief idea of what it does.> ++ Copyright (C) <year> <name of author> ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 2 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License along ++ with this program; if not, write to the Free Software Foundation, Inc., ++ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ++ ++Also add information on how to contact you by electronic and paper mail. ++ ++If the program is interactive, make it output a short notice like this ++when it starts in an interactive mode: ++ ++ Gnomovision version 69, Copyright (C) year name of author ++ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. ++ This is free software, and you are welcome to redistribute it ++ under certain conditions; type `show c' for details. ++ ++The hypothetical commands `show w' and `show c' should show the appropriate ++parts of the General Public License. Of course, the commands you use may ++be called something other than `show w' and `show c'; they could even be ++mouse-clicks or menu items--whatever suits your program. ++ ++You should also get your employer (if you work as a programmer) or your ++school, if any, to sign a "copyright disclaimer" for the program, if ++necessary. Here is a sample; alter the names: ++ ++ Yoyodyne, Inc., hereby disclaims all copyright interest in the program ++ `Gnomovision' (which makes passes at compilers) written by James Hacker. ++ ++ <signature of Ty Coon>, 1 April 1989 ++ Ty Coon, President of Vice ++ ++This General Public License does not permit incorporating your program into ++proprietary programs. If your program is a subroutine library, you may ++consider it more useful to permit linking proprietary applications with the ++library. If this is what you want to do, use the GNU Lesser General ++Public License instead of this License. diff --git a/poky/meta/recipes-core/initscripts/initscripts-1.0/arm/alignment.sh b/poky/meta/recipes-core/initscripts/initscripts-1.0/arm/alignment.sh new file mode 100644 index 0000000000..b577b9a03a --- /dev/null +++ b/poky/meta/recipes-core/initscripts/initscripts-1.0/arm/alignment.sh @@ -0,0 +1,13 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: alignment +# Required-Start: mountkernfs +# Required-Stop: mountkernfs +# Default-Start: S +# Default-Stop: +### END INIT INFO + +if [ -e /proc/cpu/alignment ]; then + echo "3" > /proc/cpu/alignment +fi + diff --git a/poky/meta/recipes-core/initscripts/initscripts-1.0/banner.sh b/poky/meta/recipes-core/initscripts/initscripts-1.0/banner.sh new file mode 100644 index 0000000000..9e2b091252 --- /dev/null +++ b/poky/meta/recipes-core/initscripts/initscripts-1.0/banner.sh @@ -0,0 +1,24 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: banner +# Required-Start: +# Required-Stop: +# Default-Start: S +# Default-Stop: +### END INIT INFO + +if [ ! -e /dev/tty ]; then + /bin/mknod -m 0666 /dev/tty c 5 0 +fi + +if ( > /dev/tty0 ) 2>/dev/null; then + vtmaster=/dev/tty0 +elif ( > /dev/vc/0 ) 2>/dev/null; then + vtmaster=/dev/vc/0 +elif ( > /dev/console ) 2>/dev/null; then + vtmaster=/dev/console +else + vtmaster=/dev/null +fi +echo > $vtmaster +echo "Please wait: booting..." > $vtmaster diff --git a/poky/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh b/poky/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh new file mode 100755 index 0000000000..df553bc079 --- /dev/null +++ b/poky/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh @@ -0,0 +1,81 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: bootmisc +# Required-Start: $local_fs mountvirtfs +# Required-Stop: $local_fs +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Misc and other. +### END INIT INFO + +. /etc/default/rcS +# +# Put a nologin file in /etc to prevent people from logging in before +# system startup is complete. +# +if test "$DELAYLOGIN" = yes +then + echo "System bootup in progress - please wait" > /etc/nologin + cp /etc/nologin /etc/nologin.boot +fi + +# +# Set pseudo-terminal access permissions. +# +if test -c /dev/ttyp0 +then + chmod 666 /dev/tty[p-za-e][0-9a-f] + chown root:tty /dev/tty[p-za-e][0-9a-f] +fi + +# +# Apply /proc settings if defined +# +SYSCTL_CONF="/etc/sysctl.conf" +if [ -f "${SYSCTL_CONF}" ] +then + if [ -x "/sbin/sysctl" ] + then + # busybox sysctl does not support -q + VERBOSE_REDIR="1>/dev/null" + if [ "${VERBOSE}" != "no" ]; then + VERBOSE_REDIR="1>&1" + fi + eval /sbin/sysctl -p "${SYSCTL_CONF}" $VERBOSE_REDIR + else + echo "To have ${SYSCTL_CONF} applied during boot, install package <procps>." + fi +fi + +# +# Update /etc/motd. +# +if test "$EDITMOTD" != no +then + uname -a > /etc/motd.tmp + sed 1d /etc/motd >> /etc/motd.tmp + mv /etc/motd.tmp /etc/motd +fi + +# +# This is as good a place as any for a sanity check +# +# Set the system clock from hardware clock +# If the timestamp is more recent than the current time, +# use the timestamp instead. +test -x /etc/init.d/hwclock.sh && /etc/init.d/hwclock.sh start +if test -e /etc/timestamp +then + SYSTEMDATE=`date -u +%4Y%2m%2d%2H%2M%2S` + read TIMESTAMP < /etc/timestamp + if [ ${TIMESTAMP} -gt $SYSTEMDATE ]; then + # format the timestamp as date expects it (2m2d2H2M4Y.2S) + TS_YR=${TIMESTAMP%??????????} + TS_SEC=${TIMESTAMP#????????????} + TS_FIRST12=${TIMESTAMP%??} + TS_MIDDLE8=${TS_FIRST12#????} + date -u ${TS_MIDDLE8}${TS_YR}.${TS_SEC} + test -x /etc/init.d/hwclock.sh && /etc/init.d/hwclock.sh stop + fi +fi +: exit 0 diff --git a/poky/meta/recipes-core/initscripts/initscripts-1.0/checkfs.sh b/poky/meta/recipes-core/initscripts/initscripts-1.0/checkfs.sh new file mode 100755 index 0000000000..62869451b7 --- /dev/null +++ b/poky/meta/recipes-core/initscripts/initscripts-1.0/checkfs.sh @@ -0,0 +1,50 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: checkfs +# Required-Start: checkroot +# Required-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Check all other file systems +### END INIT INFO + +. /etc/default/rcS + +# +# Check the rest of the filesystems. +# +if test ! -f /fastboot +then + if test -f /forcefsck + then + force="-f" + else + force="" + fi + if test "$FSCKFIX" = yes + then + fix="-y" + else + fix="-a" + fi + spinner="-C" + case "$TERM" in + dumb|network|unknown|"") spinner="" ;; + esac + test "`uname -m`" = "s390" && spinner="" # This should go away + test "$VERBOSE" != no && echo "Checking all filesystems..." + fsck $spinner -R -A $fix $force + if test "$?" -gt 1 + then + echo + echo "fsck failed. Please repair manually." + echo + echo "CONTROL-D will exit from this shell and continue system startup." + echo + # Start a single user shell on the console + /sbin/sulogin $CONSOLE + fi +fi +rm -f /fastboot /forcefsck + +: exit 0 diff --git a/poky/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh b/poky/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh new file mode 100755 index 0000000000..02f0351fcb --- /dev/null +++ b/poky/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh @@ -0,0 +1,148 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: checkroot +# Required-Start: udev +# Required-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Check to root file system. +### END INIT INFO + +. /etc/default/rcS + +# +# Set SULOGIN in /etc/default/rcS to yes if you want a sulogin to be spawned +# from this script *before anything else* with a timeout, like SCO does. +# +test "$SULOGIN" = yes && sulogin -t 30 $CONSOLE + +# +# Read /etc/fstab. +# +exec 9< /etc/fstab +rootmode=rw +rootopts=rw +rootcheck=$ENABLE_ROOTFS_FSCK +swap_on_md=no +devfs= +while read fs mnt type opts dump pass junk <&9 +do + case "$fs" in + ""|\#*) + continue; + ;; + /dev/md*) + # Swap on md device. + test "$type" = swap && swap_on_md=yes + ;; + /dev/*) + ;; + *) + # Might be a swapfile. + test "$type" = swap && swap_on_md=yes + ;; + esac + test "$type" = devfs && devfs="$fs" + test "$mnt" != / && continue + rootopts="$opts" + test "$pass" = 0 -o "$pass" = "" && rootcheck=no + case "$opts" in + ro|ro,*|*,ro|*,ro,*) + rootmode=ro + ;; + esac +done +exec 0>&9 9>&- + +# Check for conflicting configurations +if [ "$rootmode" = "ro" -a "$ROOTFS_READ_ONLY" = "no" ] || \ + [ "$rootmode" = "rw" -a "$ROOTFS_READ_ONLY" = "yes" ]; then + echo "" + echo "WARN: conflicting configurations in /etc/fstab and /etc/default/rcS" + echo " regarding the writability of rootfs. Please fix one of them." + echo "" +fi + + +# +# Activate the swap device(s) in /etc/fstab. This needs to be done +# before fsck, since fsck can be quite memory-hungry. +# +test "$VERBOSE" != no && echo "Activating swap" +[ -x /sbin/swapon ] && swapon -a + +# +# Check the root filesystem. +# +if test -f /fastboot || test $rootcheck = no +then + test $rootcheck = yes && echo "Fast boot, no filesystem check" +else + # + # Ensure that root is quiescent and read-only before fsck'ing. + # + mount -n -o remount,ro / + if test $? = 0 + then + if test -f /forcefsck + then + force="-f" + else + force="" + fi + if test "$FSCKFIX" = yes + then + fix="-y" + else + fix="-a" + fi + spinner="-C" + case "$TERM" in + dumb|network|unknown|"") spinner="" ;; + esac + test `uname -m` = s390 && spinner="" # This should go away + test "$VERBOSE" != no && echo "Checking root filesystem..." + fsck $spinner $force $fix / + # + # If there was a failure, drop into single-user mode. + # + # NOTE: "failure" is defined as exiting with a return code of + # 2 or larger. A return code of 1 indicates that filesystem + # errors were corrected but that the boot may proceed. + # + if test "$?" -gt 1 + then + # Surprise! Re-directing from a HERE document (as in + # "cat << EOF") won't work, because the root is read-only. + echo + echo "fsck failed. Please repair manually and reboot. Please note" + echo "that the root filesystem is currently mounted read-only. To" + echo "remount it read-write:" + echo + echo " # mount -n -o remount,rw /" + echo + echo "CONTROL-D will exit from this shell and REBOOT the system." + echo + # Start a single user shell on the console + /sbin/sulogin $CONSOLE + reboot -f + fi + else + echo "*** ERROR! Cannot fsck root fs because it is not mounted read-only!" + echo + fi +fi + +# +# If the root filesystem was not marked as read-only in /etc/fstab, +# remount the rootfs rw but do not try to change mtab because it +# is on a ro fs until the remount succeeded. Then clean up old mtabs +# and finally write the new mtab. +# +mount -n -o remount,$rootmode / +if test "$rootmode" = rw +then + ln -sf /proc/mounts /dev/mtab +fi + +: exit 0 diff --git a/poky/meta/recipes-core/initscripts/initscripts-1.0/devpts b/poky/meta/recipes-core/initscripts/initscripts-1.0/devpts new file mode 100644 index 0000000000..4a0978b404 --- /dev/null +++ b/poky/meta/recipes-core/initscripts/initscripts-1.0/devpts @@ -0,0 +1,5 @@ +# GID of the `tty' group +TTYGRP=5 + +# Set to 600 to have `mesg n' be the default +TTYMODE=620 diff --git a/poky/meta/recipes-core/initscripts/initscripts-1.0/devpts.sh b/poky/meta/recipes-core/initscripts/initscripts-1.0/devpts.sh new file mode 100755 index 0000000000..c6043fb1e6 --- /dev/null +++ b/poky/meta/recipes-core/initscripts/initscripts-1.0/devpts.sh @@ -0,0 +1,28 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: devpts +# Required-Start: udev +# Required-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Mount /dev/pts file systems. +### END INIT INFO + +. /etc/default/devpts + +if grep -q devpts /proc/filesystems +then + # + # Create multiplexor device. + # + test -c /dev/ptmx || mknod -m 666 /dev/ptmx c 5 2 + + # + # Mount /dev/pts if needed. + # + if ! grep -q devpts /proc/mounts + then + mkdir -p /dev/pts + mount -t devpts devpts /dev/pts -ogid=${TTYGRP},mode=${TTYMODE} + fi +fi diff --git a/poky/meta/recipes-core/initscripts/initscripts-1.0/dmesg.sh b/poky/meta/recipes-core/initscripts/initscripts-1.0/dmesg.sh new file mode 100755 index 0000000000..2b9eba64cf --- /dev/null +++ b/poky/meta/recipes-core/initscripts/initscripts-1.0/dmesg.sh @@ -0,0 +1,17 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: dmesg +# Required-Start: +# Required-Stop: +# Default-Start: S +# Default-Stop: +### END INIT INFO + +if [ -f /var/log/dmesg ]; then + if LOGPATH=$(which logrotate); then + $LOGPATH -f /etc/logrotate-dmesg.conf + else + mv -f /var/log/dmesg /var/log/dmesg.old + fi +fi +dmesg -s 131072 > /var/log/dmesg diff --git a/poky/meta/recipes-core/initscripts/initscripts-1.0/functions b/poky/meta/recipes-core/initscripts/initscripts-1.0/functions new file mode 100755 index 0000000000..01ad1edd3e --- /dev/null +++ b/poky/meta/recipes-core/initscripts/initscripts-1.0/functions @@ -0,0 +1,91 @@ +# -*-Shell-script-*- +# +# functions This file contains functions to be used by most or all +# shell scripts in the /etc/init.d directory. +# + +NORMAL="\\033[0;39m" # Standard console grey +SUCCESS="\\033[1;32m" # Success is green +WARNING="\\033[1;33m" # Warnings are yellow +FAILURE="\\033[1;31m" # Failures are red +INFO="\\033[1;36m" # Information is light cyan +BRACKET="\\033[1;34m" # Brackets are blue + +# NOTE: The pidofproc () doesn't support the process which is a script unless +# the pidof supports "-x" option. If you want to use it for such a +# process: +# 1) If there is no "pidof -x", replace the "pidof $1" with another +# command like(for core-image-minimal): +# ps | awk '/'"$1"'/ {print $1}' +# Or +# 2) If there is "pidof -x", replace "pidof" with "pidof -x". +# +# pidofproc - print the pid of a process +# $1: the name of the process +pidofproc () { + + # pidof output null when no program is running, so no "2>/dev/null". + pid=`pidof $1` + status=$? + case $status in + 0) + echo $pid + return 0 + ;; + 127) + echo "ERROR: command pidof not found" >&2 + exit 127 + ;; + *) + return $status + ;; + esac +} + +machine_id() { # return the machine ID + awk 'BEGIN { FS=": " } /Hardware/ \ + { gsub(" ", "_", $2); print tolower($2) } ' </proc/cpuinfo +} + +killproc() { # kill the named process(es) + pid=`pidofproc $1` && kill $pid +} + +status() { + local pid + if [ "$#" = 0 ]; then + echo "Usage: status {program}" + return 1 + fi + pid=`pidofproc $1` + if [ -n "$pid" ]; then + echo "$1 (pid $pid) is running..." + return 0 + else + echo "$1 is stopped" + fi + return 3 +} + +success() { + echo -n -e "${BRACKET}[${SUCCESS} OK ${BRACKET}]${NORMAL}" + return 0 +} + +failure() { + local rc=$* + echo -n -e "${BRACKET}[${FAILURE} FAIL ${BRACKET}]${NORMAL}" + return $rc +} + +warning() { + local rc=$* + echo -n -e "${BRACKET}[${WARNING} WARN ${BRACKET}]${NORMAL}" + return $rc +} + +passed() { + local rc=$* + echo -n -e "${BRACKET}[${SUCCESS} PASS ${BRACKET}]${NORMAL}" + return $rc +} diff --git a/poky/meta/recipes-core/initscripts/initscripts-1.0/halt b/poky/meta/recipes-core/initscripts/initscripts-1.0/halt new file mode 100755 index 0000000000..a56f73421b --- /dev/null +++ b/poky/meta/recipes-core/initscripts/initscripts-1.0/halt @@ -0,0 +1,29 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: halt +# Required-Start: +# Required-Stop: +# Default-Start: +# Default-Stop: 0 +# Short-Description: Execute the halt command. +# Description: +### END INIT INFO + +PATH=/sbin:/bin:/usr/sbin:/usr/bin + +# See if we need to cut the power. +if test -x /etc/init.d/ups-monitor +then + /etc/init.d/ups-monitor poweroff +fi + +# Don't shut down drives if we're using RAID. +hddown="-h" +if grep -qs '^md.*active' /proc/mdstat +then + hddown="" +fi + +halt SED_HALTARGS -p $hddown + +: exit 0 diff --git a/poky/meta/recipes-core/initscripts/initscripts-1.0/hostname.sh b/poky/meta/recipes-core/initscripts/initscripts-1.0/hostname.sh new file mode 100755 index 0000000000..95287cc139 --- /dev/null +++ b/poky/meta/recipes-core/initscripts/initscripts-1.0/hostname.sh @@ -0,0 +1,22 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: hostname +# Required-Start: +# Required-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Set hostname based on /etc/hostname +### END INIT INFO +HOSTNAME=$(/bin/hostname) + +hostname -b -F /etc/hostname 2> /dev/null +if [ $? -eq 0 ]; then + exit +fi + +# Busybox hostname doesn't support -b so we need implement it on our own +if [ -f /etc/hostname ];then + hostname `cat /etc/hostname` +elif [ -z "$HOSTNAME" -o "$HOSTNAME" = "(none)" -o ! -z "`echo $HOSTNAME | sed -n '/^[0-9]*\.[0-9].*/p'`" ] ; then + hostname localhost +fi diff --git a/poky/meta/recipes-core/initscripts/initscripts-1.0/logrotate-dmesg.conf b/poky/meta/recipes-core/initscripts/initscripts-1.0/logrotate-dmesg.conf new file mode 100644 index 0000000000..6f46e4216f --- /dev/null +++ b/poky/meta/recipes-core/initscripts/initscripts-1.0/logrotate-dmesg.conf @@ -0,0 +1,9 @@ +# see "man logrotate" for details +# rotate dmesg, and keep 5 versions. + +/var/log/dmesg { + create + rotate 5 + nodateext +} + diff --git a/poky/meta/recipes-core/initscripts/initscripts-1.0/mountall.sh b/poky/meta/recipes-core/initscripts/initscripts-1.0/mountall.sh new file mode 100755 index 0000000000..c719be5d9a --- /dev/null +++ b/poky/meta/recipes-core/initscripts/initscripts-1.0/mountall.sh @@ -0,0 +1,39 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: mountall +# Required-Start: mountvirtfs +# Required-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Mount all filesystems. +# Description: +### END INIT INFO + +. /etc/default/rcS + +# +# Mount local filesystems in /etc/fstab. For some reason, people +# might want to mount "proc" several times, and mount -v complains +# about this. So we mount "proc" filesystems without -v. +# +test "$VERBOSE" != no && echo "Mounting local filesystems..." +mount -at nonfs,nosmbfs,noncpfs 2>/dev/null + +# +# We might have mounted something over /dev, see if /dev/initctl is there. +# +if test ! -p /dev/initctl +then + rm -f /dev/initctl + mknod -m 600 /dev/initctl p +fi +kill -USR1 1 + +# +# Execute swapon command again, in case we want to swap to +# a file on a now mounted filesystem. +# +[ -x /sbin/swapon ] && swapon -a + +: exit 0 + diff --git a/poky/meta/recipes-core/initscripts/initscripts-1.0/mountnfs.sh b/poky/meta/recipes-core/initscripts/initscripts-1.0/mountnfs.sh new file mode 100755 index 0000000000..fe6c19605f --- /dev/null +++ b/poky/meta/recipes-core/initscripts/initscripts-1.0/mountnfs.sh @@ -0,0 +1,88 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: mountnfs +# Required-Start: $local_fs $network $rpcbind +# Required-Stop: +# Default-Start: S +# Default-Stop: +### END INIT INFO + +# +# Run in a subshell because of I/O redirection. +# +test -f /etc/fstab && ( + +# +# Read through fstab line by line. If it is NFS, set the flag +# for mounting NFS filesystems. If any NFS partition is found and it +# not mounted with the nolock option, we start the rpcbind. +# +rpcbind=no +mount_nfs=no +mount_smb=no +mount_ncp=no +mount_cifs=no +while read device mountpt fstype options +do + case "$device" in + ""|\#*) + continue + ;; + esac + + case "$options" in + *noauto*) + continue + ;; + esac + + if test "$fstype" = nfs + then + mount_nfs=yes + case "$options" in + *nolock*) + ;; + *) + rpcbind=yes + ;; + esac + fi + if test "$fstype" = smbfs + then + mount_smb=yes + fi + if test "$fstype" = ncpfs + then + mount_ncp=yes + fi + if test "$fstype" = cifs + then + mount_cifs=yes + fi +done + +exec 0>&1 + +if test "$rpcbind" = yes +then + if test -x /usr/sbin/rpcbind + then + echo -n "Starting rpcbind... " + start-stop-daemon --start --quiet --exec /usr/sbin/rpcbind + sleep 2 + fi +fi + +if test "$mount_nfs" = yes || test "$mount_smb" = yes || test "$mount_ncp" = yes || test "$mount_cifs" = yes +then + echo "Mounting remote filesystems..." + test "$mount_nfs" = yes && mount -a -t nfs + test "$mount_smb" = yes && mount -a -t smbfs + test "$mount_ncp" = yes && mount -a -t ncpfs + test "$mount_cifs" = yes && mount -a -t cifs +fi + +) < /etc/fstab + +: exit 0 + diff --git a/poky/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh b/poky/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh new file mode 100755 index 0000000000..35316ec2ba --- /dev/null +++ b/poky/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh @@ -0,0 +1,244 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: volatile +# Required-Start: $local_fs +# Required-Stop: $local_fs +# Default-Start: S +# Default-Stop: +# Short-Description: Populate the volatile filesystem +### END INIT INFO + +# Get ROOT_DIR +DIRNAME=`dirname $0` +ROOT_DIR=`echo $DIRNAME | sed -ne 's:/etc/.*::p'` + +[ -e ${ROOT_DIR}/etc/default/rcS ] && . ${ROOT_DIR}/etc/default/rcS +# When running populate-volatile.sh at rootfs time, disable cache. +[ -n "$ROOT_DIR" ] && VOLATILE_ENABLE_CACHE=no +# If rootfs is read-only, disable cache. +[ "$ROOTFS_READ_ONLY" = "yes" ] && VOLATILE_ENABLE_CACHE=no + +CFGDIR="${ROOT_DIR}/etc/default/volatiles" +TMPROOT="${ROOT_DIR}/var/volatile/tmp" +COREDEF="00_core" + +[ "${VERBOSE}" != "no" ] && echo "Populating volatile Filesystems." + +create_file() { + EXEC="" + [ -z "$2" ] && { + EXEC=" + touch \"$1\"; + " + } || { + EXEC=" + cp \"$2\" \"$1\"; + " + } + EXEC=" + ${EXEC} + chown ${TUSER}.${TGROUP} $1 || echo \"Failed to set owner -${TUSER}- for -$1-.\" >/dev/tty0 2>&1; + chmod ${TMODE} $1 || echo \"Failed to set mode -${TMODE}- for -$1-.\" >/dev/tty0 2>&1 " + + test "$VOLATILE_ENABLE_CACHE" = yes && echo "$EXEC" >> /etc/volatile.cache.build + + [ -e "$1" ] && { + [ "${VERBOSE}" != "no" ] && echo "Target already exists. Skipping." + } || { + if [ -z "$ROOT_DIR" ]; then + eval $EXEC + else + # Creating some files at rootfs time may fail and should fail, + # but these failures should not be logged to make sure the do_rootfs + # process doesn't fail. This does no harm, as this script will + # run on target to set up the correct files and directories. + eval $EXEC > /dev/null 2>&1 + fi + } +} + +mk_dir() { + EXEC=" + mkdir -p \"$1\"; + chown ${TUSER}.${TGROUP} $1 || echo \"Failed to set owner -${TUSER}- for -$1-.\" >/dev/tty0 2>&1; + chmod ${TMODE} $1 || echo \"Failed to set mode -${TMODE}- for -$1-.\" >/dev/tty0 2>&1 " + + test "$VOLATILE_ENABLE_CACHE" = yes && echo "$EXEC" >> /etc/volatile.cache.build + [ -e "$1" ] && { + [ "${VERBOSE}" != "no" ] && echo "Target already exists. Skipping." + } || { + if [ -z "$ROOT_DIR" ]; then + eval $EXEC + else + # For the same reason with create_file(), failures should + # not be logged. + eval $EXEC > /dev/null 2>&1 + fi + } +} + +link_file() { + EXEC=" + if [ -L \"$2\" ]; then + [ \"\$(readlink -f \"$2\")\" != \"$1\" ] && { rm -f \"$2\"; ln -sf \"$1\" \"$2\"; }; + elif [ -d \"$2\" ]; then + if awk '\$2 == \"$2\" {exit 1}' /proc/mounts; then + cp -a $2/* $1 2>/dev/null; + cp -a $2/.[!.]* $1 2>/dev/null; + rm -rf \"$2\"; + ln -sf \"$1\" \"$2\"; + fi + else + ln -sf \"$1\" \"$2\"; + fi + " + + test "$VOLATILE_ENABLE_CACHE" = yes && echo " $EXEC" >> /etc/volatile.cache.build + + if [ -z "$ROOT_DIR" ]; then + eval $EXEC + else + # For the same reason with create_file(), failures should + # not be logged. + eval $EXEC > /dev/null 2>&1 + fi +} + +check_requirements() { + cleanup() { + rm "${TMP_INTERMED}" + rm "${TMP_DEFINED}" + rm "${TMP_COMBINED}" + } + + CFGFILE="$1" + [ `basename "${CFGFILE}"` = "${COREDEF}" ] && return 0 + + TMP_INTERMED="${TMPROOT}/tmp.$$" + TMP_DEFINED="${TMPROOT}/tmpdefined.$$" + TMP_COMBINED="${TMPROOT}/tmpcombined.$$" + + sed 's@\(^:\)*:.*@\1@' ${ROOT_DIR}/etc/passwd | sort | uniq > "${TMP_DEFINED}" + cat ${CFGFILE} | grep -v "^#" | cut -s -d " " -f 2 > "${TMP_INTERMED}" + cat "${TMP_DEFINED}" "${TMP_INTERMED}" | sort | uniq > "${TMP_COMBINED}" + NR_DEFINED_USERS="`cat "${TMP_DEFINED}" | wc -l`" + NR_COMBINED_USERS="`cat "${TMP_COMBINED}" | wc -l`" + + [ "${NR_DEFINED_USERS}" -ne "${NR_COMBINED_USERS}" ] && { + echo "Undefined users:" + diff "${TMP_DEFINED}" "${TMP_COMBINED}" | grep "^>" + cleanup + return 1 + } + + + sed 's@\(^:\)*:.*@\1@' ${ROOT_DIR}/etc/group | sort | uniq > "${TMP_DEFINED}" + cat ${CFGFILE} | grep -v "^#" | cut -s -d " " -f 3 > "${TMP_INTERMED}" + cat "${TMP_DEFINED}" "${TMP_INTERMED}" | sort | uniq > "${TMP_COMBINED}" + + NR_DEFINED_GROUPS="`cat "${TMP_DEFINED}" | wc -l`" + NR_COMBINED_GROUPS="`cat "${TMP_COMBINED}" | wc -l`" + + [ "${NR_DEFINED_GROUPS}" -ne "${NR_COMBINED_GROUPS}" ] && { + echo "Undefined groups:" + diff "${TMP_DEFINED}" "${TMP_COMBINED}" | grep "^>" + cleanup + return 1 + } + + # Add checks for required directories here + + cleanup + return 0 +} + +apply_cfgfile() { + CFGFILE="$1" + + check_requirements "${CFGFILE}" || { + echo "Skipping ${CFGFILE}" + return 1 + } + + cat ${CFGFILE} | sed 's/#.*//' | \ + while read TTYPE TUSER TGROUP TMODE TNAME TLTARGET; do + test -z "${TLTARGET}" && continue + TNAME=${ROOT_DIR}${TNAME} + [ "${VERBOSE}" != "no" ] && echo "Checking for -${TNAME}-." + + [ "${TTYPE}" = "l" ] && { + TSOURCE="$TLTARGET" + [ "${VERBOSE}" != "no" ] && echo "Creating link -${TNAME}- pointing to -${TSOURCE}-." + link_file "${TSOURCE}" "${TNAME}" + continue + } + + [ "${TTYPE}" = "b" ] && { + TSOURCE="$TLTARGET" + [ "${VERBOSE}" != "no" ] && echo "Creating mount-bind -${TNAME}- from -${TSOURCE}-." + mount --bind "${TSOURCE}" "${TNAME}" + EXEC=" + mount --bind \"${TSOURCE}\" \"${TNAME}\"" + test "$VOLATILE_ENABLE_CACHE" = yes && echo "$EXEC" >> /etc/volatile.cache.build + continue + } + + [ -L "${TNAME}" ] && { + [ "${VERBOSE}" != "no" ] && echo "Found link." + NEWNAME=`ls -l "${TNAME}" | sed -e 's/^.*-> \(.*\)$/\1/'` + echo ${NEWNAME} | grep -v "^/" >/dev/null && { + TNAME="`echo ${TNAME} | sed -e 's@\(.*\)/.*@\1@'`/${NEWNAME}" + [ "${VERBOSE}" != "no" ] && echo "Converted relative linktarget to absolute path -${TNAME}-." + } || { + TNAME="${NEWNAME}" + [ "${VERBOSE}" != "no" ] && echo "Using absolute link target -${TNAME}-." + } + } + + case "${TTYPE}" in + "f") [ "${VERBOSE}" != "no" ] && echo "Creating file -${TNAME}-." + TSOURCE="$TLTARGET" + [ "${TSOURCE}" = "none" ] && TSOURCE="" + create_file "${TNAME}" "${TSOURCE}" & + ;; + "d") [ "${VERBOSE}" != "no" ] && echo "Creating directory -${TNAME}-." + mk_dir "${TNAME}" + # Add check to see if there's an entry in fstab to mount. + ;; + *) [ "${VERBOSE}" != "no" ] && echo "Invalid type -${TTYPE}-." + continue + ;; + esac + done + return 0 +} + +clearcache=0 +exec 9</proc/cmdline +while read line <&9 +do + case "$line" in + *clearcache*) clearcache=1 + ;; + *) continue + ;; + esac +done +exec 9>&- + +if test -e ${ROOT_DIR}/etc/volatile.cache -a "$VOLATILE_ENABLE_CACHE" = "yes" -a "x$1" != "xupdate" -a "x$clearcache" = "x0" +then + sh ${ROOT_DIR}/etc/volatile.cache +else + rm -f ${ROOT_DIR}/etc/volatile.cache ${ROOT_DIR}/etc/volatile.cache.build + for file in `ls -1 "${CFGDIR}" | sort`; do + apply_cfgfile "${CFGDIR}/${file}" + done + + [ -e ${ROOT_DIR}/etc/volatile.cache.build ] && sync && mv ${ROOT_DIR}/etc/volatile.cache.build ${ROOT_DIR}/etc/volatile.cache +fi + +if [ -z "${ROOT_DIR}" ] && [ -f /etc/ld.so.cache ] && [ ! -f /var/run/ld.so.cache ] +then + ln -s /etc/ld.so.cache /var/run/ld.so.cache +fi diff --git a/poky/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh b/poky/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh new file mode 100644 index 0000000000..1a0328d63e --- /dev/null +++ b/poky/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +. /etc/default/rcS + +[ "$ROOTFS_READ_ONLY" = "no" ] && exit 0 + +is_on_read_only_partition () { + DIRECTORY=$1 + dir=`readlink -f $DIRECTORY` + while true; do + if [ ! -d "$dir" ]; then + echo "ERROR: $dir is not a directory" + exit 1 + else + for flag in `awk -v dir=$dir '{ if ($2 == dir) { print "FOUND"; split($4,FLAGS,",") } }; \ + END { for (f in FLAGS) print FLAGS[f] }' < /proc/mounts`; do + [ "$flag" = "FOUND" ] && partition="read-write" + [ "$flag" = "ro" ] && { partition="read-only"; break; } + done + if [ "$dir" = "/" -o -n "$partition" ]; then + break + else + dir=`dirname $dir` + fi + fi + done + [ "$partition" = "read-only" ] && echo "yes" || echo "no" +} + +if [ "$1" = "start" ] ; then + if [ `is_on_read_only_partition /var/lib` = "yes" ]; then + grep -q "tmpfs /var/volatile" /proc/mounts || mount /var/volatile + mkdir -p /var/volatile/lib + cp -a /var/lib/* /var/volatile/lib + mount --bind /var/volatile/lib /var/lib + fi +fi + diff --git a/poky/meta/recipes-core/initscripts/initscripts-1.0/reboot b/poky/meta/recipes-core/initscripts/initscripts-1.0/reboot new file mode 100755 index 0000000000..087d8d5da4 --- /dev/null +++ b/poky/meta/recipes-core/initscripts/initscripts-1.0/reboot @@ -0,0 +1,15 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: reboot +# Required-Start: +# Required-Stop: +# Default-Start: +# Default-Stop: 6 +# Short-Description: Execute the reboot command. +# Description: +### END INIT INFO + +PATH=/sbin:/bin:/usr/sbin:/usr/bin + +echo -n "Rebooting... " +reboot SED_HALTARGS diff --git a/poky/meta/recipes-core/initscripts/initscripts-1.0/rmnologin.sh b/poky/meta/recipes-core/initscripts/initscripts-1.0/rmnologin.sh new file mode 100755 index 0000000000..76de3418ac --- /dev/null +++ b/poky/meta/recipes-core/initscripts/initscripts-1.0/rmnologin.sh @@ -0,0 +1,20 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: rmnologin +# Required-Start: $remote_fs $all +# Required-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: +# Short-Description: Remove /etc/nologin at boot +# Description: This script removes the /etc/nologin file as the +# last step in the boot process, if DELAYLOGIN=yes. +# If DELAYLOGIN=no, /etc/nologin was not created by +# bootmisc earlier in the boot process. +### END INIT INFO + +if test -f /etc/nologin.boot +then + rm -f /etc/nologin /etc/nologin.boot +fi + +: exit 0 diff --git a/poky/meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh b/poky/meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh new file mode 100644 index 0000000000..1632a5f649 --- /dev/null +++ b/poky/meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh @@ -0,0 +1,13 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: save-rtc +# Required-Start: +# Required-Stop: $local_fs hwclock +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Store system clock into file +# Description: +### END INIT INFO + +# Update the timestamp +date -u +%4Y%2m%2d%2H%2M%2S 2>/dev/null > /etc/timestamp diff --git a/poky/meta/recipes-core/initscripts/initscripts-1.0/sendsigs b/poky/meta/recipes-core/initscripts/initscripts-1.0/sendsigs new file mode 100755 index 0000000000..34e1b7714b --- /dev/null +++ b/poky/meta/recipes-core/initscripts/initscripts-1.0/sendsigs @@ -0,0 +1,21 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: sendsigs +# Required-Start: +# Required-Stop: umountnfs +# Default-Start: +# Default-Stop: 0 6 +# Short-Description: Kill all remaining processes. +# Description: +### END INIT INFO + +PATH=/sbin:/bin:/usr/sbin:/usr/bin + +# Kill all processes. +echo "Sending all processes the TERM signal..." +killall5 -15 +sleep 5 +echo "Sending all processes the KILL signal..." +killall5 -9 + +: exit 0 diff --git a/poky/meta/recipes-core/initscripts/initscripts-1.0/single b/poky/meta/recipes-core/initscripts/initscripts-1.0/single new file mode 100755 index 0000000000..da82d178a1 --- /dev/null +++ b/poky/meta/recipes-core/initscripts/initscripts-1.0/single @@ -0,0 +1,24 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: single +# Required-Start: $local_fs $all killprocs +# Required-Stop: +# Default-Start: 1 +# Default-Stop: +# Short-Description: executed by init(8) upon entering runlevel 1 (single). +### END INIT INFO + +PATH="/sbin:/bin:/usr/sbin:/usr/bin" + +# Kill all processes. +echo "Sending all processes the TERM signal..." +killall5 -15 +sleep 5 +echo "Sending all processes the KILL signal..." +killall5 -9 + +# We start update here, since we just killed it. +test -x /sbin/update && update + +echo "Entering single-user mode..." +exec init -t1 S diff --git a/poky/meta/recipes-core/initscripts/initscripts-1.0/sushell b/poky/meta/recipes-core/initscripts/initscripts-1.0/sushell new file mode 100644 index 0000000000..c319d95bf7 --- /dev/null +++ b/poky/meta/recipes-core/initscripts/initscripts-1.0/sushell @@ -0,0 +1,5 @@ +#!/bin/sh + +[ -z "$SUSHELL" ] && SUSHELL=/bin/sh + +exec $SUSHELL diff --git a/poky/meta/recipes-core/initscripts/initscripts-1.0/sysfs.sh b/poky/meta/recipes-core/initscripts/initscripts-1.0/sysfs.sh new file mode 100644 index 0000000000..f5b5b9904b --- /dev/null +++ b/poky/meta/recipes-core/initscripts/initscripts-1.0/sysfs.sh @@ -0,0 +1,31 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: mountvirtfs +# Required-Start: +# Required-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Mount kernel virtual file systems. +# Description: Mount initial set of virtual filesystems the kernel +# provides and that are required by everything. +### END INIT INFO + +if [ -e /proc ] && ! [ -e /proc/mounts ]; then + mount -t proc proc /proc +fi + +if [ -e /sys ] && grep -q sysfs /proc/filesystems && ! [ -e /sys/class ]; then + mount -t sysfs sysfs /sys +fi + +if [ -e /sys/kernel/debug ] && grep -q debugfs /proc/filesystems; then + mount -t debugfs debugfs /sys/kernel/debug +fi + +if [ -e /sys/kernel/config ] && grep -q configfs /proc/filesystems; then + mount -t configfs configfs /sys/kernel/config +fi + +if ! [ -e /dev/zero ] && [ -e /dev ] && grep -q devtmpfs /proc/filesystems; then + mount -n -t devtmpfs devtmpfs /dev +fi diff --git a/poky/meta/recipes-core/initscripts/initscripts-1.0/umountfs b/poky/meta/recipes-core/initscripts/initscripts-1.0/umountfs new file mode 100755 index 0000000000..7fb5c58b3e --- /dev/null +++ b/poky/meta/recipes-core/initscripts/initscripts-1.0/umountfs @@ -0,0 +1,24 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: umountfs +# Required-Start: +# Required-Stop: +# Default-Start: +# Default-Stop: 0 6 +# Short-Description: Turn off swap and unmount all local file systems. +# Description: +### END INIT INFO + +PATH=/sbin:/bin:/usr/sbin:/usr/bin + +echo "Deactivating swap..." +[ -x /sbin/swapoff ] && swapoff -a + +# We leave /proc mounted. +echo "Unmounting local filesystems..." +grep -q /mnt/ram /proc/mounts && mount -o remount,ro /mnt/ram +mount -o remount,ro / + +umount -f -a -r > /dev/null 2>&1 + +: exit 0 diff --git a/poky/meta/recipes-core/initscripts/initscripts-1.0/umountnfs.sh b/poky/meta/recipes-core/initscripts/initscripts-1.0/umountnfs.sh new file mode 100755 index 0000000000..af075407fd --- /dev/null +++ b/poky/meta/recipes-core/initscripts/initscripts-1.0/umountnfs.sh @@ -0,0 +1,33 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: umountnfs +# Required-Start: +# Required-Stop: umountfs +# Should-Stop: $network $portmap +# Default-Start: +# Default-Stop: 0 6 +# Short-Description: Unmount all network filesystems +### END INIT INFO + +PATH=/sbin:/bin:/usr/sbin:/usr/bin + +# Write a reboot record to /var/log/wtmp before unmounting +halt -w + +echo "Unmounting remote filesystems..." + +test -f /etc/fstab && ( + +# +# Read through fstab line by line and unount network file systems +# +while read device mountpt fstype options +do + if test "$fstype" = nfs || test "$fstype" = smbfs || test "$fstype" = ncpfs || test "$fstype" = cifs + then + umount -f $mountpt + fi +done +) < /etc/fstab + +: exit 0 diff --git a/poky/meta/recipes-core/initscripts/initscripts-1.0/urandom b/poky/meta/recipes-core/initscripts/initscripts-1.0/urandom new file mode 100755 index 0000000000..af1625b5fd --- /dev/null +++ b/poky/meta/recipes-core/initscripts/initscripts-1.0/urandom @@ -0,0 +1,49 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: urandom +# Required-Start: $local_fs mountvirtfs +# Required-Stop: $local_fs +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Save and restore the random seed +# Description: Save the random seed on shutdown and restore it on boot, +# to ensure that the seed isn't predicable on startup +# (because the boot process is predictable) +### END INIT INFO + +test -c /dev/urandom || exit 0 + +RANDOM_SEED_FILE=/var/lib/urandom/random-seed + +. /etc/default/rcS +[ -f /etc/default/urandom ] && . /etc/default/urandom + +case "$1" in + start|"") + test "$VERBOSE" != no && echo "Initializing random number generator..." + # Load and then save 512 bytes, which is the size of the entropy + # pool. Also load the current date, in case the seed file is + # empty. + ( date +%s.%N; [ -f "$RANDOM_SEED_FILE" ] && cat "$RANDOM_SEED_FILE" ) \ + >/dev/urandom + rm -f "$RANDOM_SEED_FILE" + umask 077 + dd if=/dev/urandom of=$RANDOM_SEED_FILE count=1 \ + >/dev/null 2>&1 || echo "urandom start: failed." + umask 022 + ;; + stop) + # Carry a random seed from shut-down to start-up; + # see documentation in linux/drivers/char/random.c + test "$VERBOSE" != no && echo "Saving random seed..." + umask 077 + dd if=/dev/urandom of=$RANDOM_SEED_FILE count=1 \ + >/dev/null 2>&1 || echo "urandom stop: failed." + ;; + *) + echo "Usage: urandom {start|stop}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/poky/meta/recipes-core/initscripts/initscripts-1.0/volatiles b/poky/meta/recipes-core/initscripts/initscripts-1.0/volatiles new file mode 100644 index 0000000000..201106645d --- /dev/null +++ b/poky/meta/recipes-core/initscripts/initscripts-1.0/volatiles @@ -0,0 +1,37 @@ +# This configuration file lists filesystem objects that should get verified +# during startup and be created if missing. +# +# Entries have the following format: +# <type> <owner> <group> <mode> <path> <linksource> +# where the items are separated by whitespace ! +# +# The # character introduces a comment lasting until end of line. +# Blank lines are ignored. +# +# <type> : d|f|l : (d)irectory|(f)ile|(l)ink +# +# A linking example: +# l root root 0777 /var/test /tmp/testfile +# f root root 0644 /var/test none +# +# Understanding links: +# When populate-volatile is to verify/create a directory or file, it will first +# check it's existence. If a link is found to exist in the place of the target, +# the path of the target is replaced with the target the link points to. +# Thus, if a link is in the place to be verified, the object will be created +# in the place the link points to instead. +# This explains the order of "link before object" as in the example above, where +# a link will be created at /var/test pointing to /tmp/testfile and due to this +# link the file defined as /var/test will actually be created as /tmp/testfile. +d root root 1777 /run/lock none +d root root 0755 /var/volatile/log none +d root root 1777 /var/volatile/tmp none +l root root 1777 /var/lock /run/lock +l root root 0755 /var/run /run +l root root 1777 /var/tmp /var/volatile/tmp +l root root 1777 /tmp /var/tmp +d root root 0755 /var/lock/subsys none +f root root 0664 /var/log/wtmp none +f root root 0664 /var/run/utmp none +l root root 0644 /etc/resolv.conf /var/run/resolv.conf +f root root 0644 /var/run/resolv.conf none |