Complete Yocto mirror with license table for TQMa6UL (2038-compliance)
- 264 license table entries with exact download URLs (224/264 resolved) - Complete sources/ directory with all BitBake recipes - Build configuration: tqma6ul-multi-mba6ulx, spaetzle (musl) - Full traceability for Softwarefreigabeantrag - GCC 13.4.0, Linux 6.6.102, U-Boot 2023.04, musl 1.2.4 - License distribution: GPL-2.0 (24), MIT (23), GPL-2.0+ (18), BSD-3 (16)
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
From 830abe652428d9d31780c3ace121635ad7b64274 Mon Sep 17 00:00:00 2001
|
||||
From: Eero Aaltonen <eero.aaltonen@vaisala.com>
|
||||
Date: Wed Sep 27 15:50:48 2023 +0300
|
||||
Subject: [PATCH] Add nss-resolve to the Name Service Switch (NSS)
|
||||
|
||||
Add `nss-resolve` so that `systemd-resolved` is used for name
|
||||
resolution with glibc `gethostbyname` calls.
|
||||
|
||||
Upstream-Status: Inappropriate [no upstream, configuration].
|
||||
|
||||
Signed-off-by: Eero Aaltonen <eero.aaltonen@vaisala.com>
|
||||
---
|
||||
nsswitch.conf | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/nsswitch.conf b/nsswitch.conf
|
||||
index 06f03d2..34b165c 100644
|
||||
--- a/nsswitch.conf
|
||||
+++ b/nsswitch.conf
|
||||
@@ -8,7 +8,7 @@ passwd: compat
|
||||
group: compat
|
||||
shadow: compat
|
||||
|
||||
-hosts: files dns
|
||||
+hosts: resolve [!UNAVAIL=return] files dns
|
||||
networks: files
|
||||
|
||||
protocols: db files
|
||||
--
|
||||
2.25.1
|
||||
|
||||
11
sources/poky/meta/recipes-core/base-files/base-files/fstab
Normal file
11
sources/poky/meta/recipes-core/base-files/base-files/fstab
Normal file
@@ -0,0 +1,11 @@
|
||||
# stock fstab - you probably want to override this with a machine specific one
|
||||
|
||||
/dev/root / auto defaults 1 1
|
||||
proc /proc proc defaults 0 0
|
||||
devpts /dev/pts devpts mode=0620,ptmxmode=0666,gid=5 0 0
|
||||
tmpfs /run tmpfs mode=0755,nodev,nosuid,strictatime 0 0
|
||||
tmpfs /var/volatile tmpfs defaults 0 0
|
||||
|
||||
# uncomment this if your device has a SD/MMC/Transflash slot
|
||||
#/dev/mmcblk0p1 /media/card auto defaults,sync,noauto 0 0
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
order hosts,bind
|
||||
multi on
|
||||
@@ -0,0 +1,8 @@
|
||||
127.0.0.1 localhost
|
||||
|
||||
# The following lines are desirable for IPv6 capable hosts
|
||||
::1 localhost ip6-localhost ip6-loopback
|
||||
fe00::0 ip6-localnet
|
||||
ff00::0 ip6-mcastprefix
|
||||
ff02::1 ip6-allnodes
|
||||
ff02::2 ip6-allrouters
|
||||
@@ -0,0 +1,340 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 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 Library 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 Library General
|
||||
Public License instead of this License.
|
||||
@@ -0,0 +1,19 @@
|
||||
# /etc/nsswitch.conf
|
||||
#
|
||||
# Example configuration of GNU Name Service Switch functionality.
|
||||
# If you have the `glibc-doc' and `info' packages installed, try:
|
||||
# `info libc "Name Service Switch"' for information about this file.
|
||||
|
||||
passwd: compat
|
||||
group: compat
|
||||
shadow: compat
|
||||
|
||||
hosts: files dns
|
||||
networks: files
|
||||
|
||||
protocols: db files
|
||||
services: db files
|
||||
ethers: db files
|
||||
rpc: db files
|
||||
|
||||
netgroup: nis
|
||||
74
sources/poky/meta/recipes-core/base-files/base-files/profile
Normal file
74
sources/poky/meta/recipes-core/base-files/base-files/profile
Normal file
@@ -0,0 +1,74 @@
|
||||
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
|
||||
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
|
||||
|
||||
PATH="/usr/local/bin:/usr/bin:/bin"
|
||||
[ "$TERM" ] || TERM="vt100" # Basic terminal capab. For screen etc.
|
||||
|
||||
# Add /sbin & co to $PATH for the root user
|
||||
[ "$HOME" != "ROOTHOME" ] || PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin
|
||||
|
||||
# Set the prompt for bash and ash (no other shells known to be in use here)
|
||||
[ -z "$PS1" ] || PS1='\u@\h:\w\$ '
|
||||
|
||||
# Use the EDITOR not being set as a trigger to call resize later on
|
||||
FIRSTTIMESETUP=0
|
||||
if [ -z "$EDITOR" ] ; then
|
||||
FIRSTTIMESETUP=1
|
||||
fi
|
||||
|
||||
if [ -d /etc/profile.d ]; then
|
||||
for i in /etc/profile.d/*.sh; do
|
||||
if [ -f $i -a -r $i ]; then
|
||||
. $i
|
||||
fi
|
||||
done
|
||||
unset i
|
||||
fi
|
||||
|
||||
if [ -t 0 -a $# -eq 0 ]; then
|
||||
if [ ! -x @BINDIR@/resize ] ; then
|
||||
if [ -n "$BASH_VERSION" ] ; then
|
||||
# Optimized resize funciton for bash
|
||||
resize() {
|
||||
local x y
|
||||
IFS='[;' read -t 2 -p $(printf '\e7\e[r\e[999;999H\e[6n\e8') -sd R _ y x _
|
||||
[ -n "$y" ] && \
|
||||
echo -e "COLUMNS=$x;\nLINES=$y;\nexport COLUMNS LINES;" && \
|
||||
stty cols $x rows $y
|
||||
}
|
||||
else
|
||||
# Portable resize function for ash/bash/dash/ksh
|
||||
# with subshell to avoid local variables
|
||||
resize() {
|
||||
(o=$(stty -g)
|
||||
stty -echo raw min 0 time 2
|
||||
printf '\0337\033[r\033[999;999H\033[6n\0338'
|
||||
if echo R | read -d R x 2> /dev/null; then
|
||||
IFS='[;R' read -t 2 -d R -r z y x _
|
||||
else
|
||||
IFS='[;R' read -r _ y x _
|
||||
fi
|
||||
stty "$o"
|
||||
[ -z "$y" ] && y=${z##*[}&&x=${y##*;}&&y=${y%%;*}
|
||||
[ -n "$y" ] && \
|
||||
echo "COLUMNS=$x;"&&echo "LINES=$y;"&&echo "export COLUMNS LINES;"&& \
|
||||
stty cols $x rows $y)
|
||||
}
|
||||
fi
|
||||
fi
|
||||
# only do this for /dev/tty[A-z] which are typically
|
||||
# serial ports
|
||||
if [ $FIRSTTIMESETUP -eq 1 -a ${SHLVL:-1} -eq 1 ] ; then
|
||||
case $(tty 2>/dev/null) in
|
||||
/dev/tty[A-z]*) resize >/dev/null;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$EDITOR" ]; then
|
||||
EDITOR="vi" # needed for packages like cron, git-commit
|
||||
fi
|
||||
|
||||
export PATH PS1 OPIEDIR QPEDIR QTDIR EDITOR TERM
|
||||
|
||||
umask 022
|
||||
@@ -0,0 +1 @@
|
||||
0
|
||||
@@ -0,0 +1,16 @@
|
||||
# ~/.bashrc: executed by bash(1) for non-login shells.
|
||||
|
||||
export PS1='\h:\w\$ '
|
||||
umask 022
|
||||
|
||||
# You may uncomment the following lines if you want `ls' to be colorized:
|
||||
# export LS_OPTIONS='--color=auto'
|
||||
# eval `dircolors`
|
||||
# alias ls='ls $LS_OPTIONS'
|
||||
# alias ll='ls $LS_OPTIONS -l'
|
||||
# alias l='ls $LS_OPTIONS -lA'
|
||||
#
|
||||
# Some more alias to avoid making mistakes:
|
||||
# alias rm='rm -i'
|
||||
# alias cp='cp -i'
|
||||
# alias mv='mv -i'
|
||||
@@ -0,0 +1,11 @@
|
||||
# ~/.profile: executed by Bourne-compatible login shells.
|
||||
|
||||
if [ -f ~/.bashrc ]; then
|
||||
. ~/.bashrc
|
||||
fi
|
||||
|
||||
# path set by /etc/profile
|
||||
# export PATH
|
||||
|
||||
# Might fail after "su - myuser" when /dev/tty* is not writable by "myuser".
|
||||
mesg n 2>/dev/null
|
||||
@@ -0,0 +1,2 @@
|
||||
# /etc/shells: valid login shells
|
||||
/bin/sh
|
||||
168
sources/poky/meta/recipes-core/base-files/base-files_3.0.14.bb
Normal file
168
sources/poky/meta/recipes-core/base-files/base-files_3.0.14.bb
Normal file
@@ -0,0 +1,168 @@
|
||||
SUMMARY = "Miscellaneous files for the base system"
|
||||
DESCRIPTION = "The base-files package creates the basic system directory structure and provides a small set of key configuration files for the system."
|
||||
SECTION = "base"
|
||||
LICENSE = "GPL-2.0-only"
|
||||
LIC_FILES_CHKSUM = "file://licenses/GPL-2;md5=94d55d512a9ba36caa9b7df079bae19f"
|
||||
# Removed all license related tasks in this recipe as license.bbclass
|
||||
# now deals with this. In order to get accurate licensing on to the image:
|
||||
# Set COPY_LIC_MANIFEST to just copy just the license.manifest to the image
|
||||
# For the manifest and the license text for each package:
|
||||
# Set COPY_LIC_MANIFEST and COPY_LIC_DIRS
|
||||
|
||||
SRC_URI = "file://rotation \
|
||||
file://nsswitch.conf \
|
||||
file://motd \
|
||||
file://hosts \
|
||||
file://host.conf \
|
||||
file://profile \
|
||||
file://shells \
|
||||
file://fstab \
|
||||
file://issue.net \
|
||||
file://issue \
|
||||
file://share/dot.bashrc \
|
||||
file://share/dot.profile \
|
||||
file://licenses/GPL-2 \
|
||||
"
|
||||
SRC_URI:append:libc-glibc = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd systemd-resolved', ' file://0001-add-nss-resolve-to-nsswitch.patch', '', d)}"
|
||||
|
||||
S = "${WORKDIR}"
|
||||
|
||||
INHIBIT_DEFAULT_DEPS = "1"
|
||||
|
||||
docdir:append = "/${P}"
|
||||
dirs1777 = "/tmp ${localstatedir}/volatile/tmp"
|
||||
dirs2775 = ""
|
||||
dirs555 = "/sys /proc"
|
||||
dirs755 = "/boot /dev ${base_bindir} ${base_sbindir} ${base_libdir} \
|
||||
${sysconfdir} ${sysconfdir}/default \
|
||||
${sysconfdir}/skel ${nonarch_base_libdir} /mnt ${ROOT_HOME} /run \
|
||||
${prefix} ${bindir} ${docdir} /usr/games ${includedir} \
|
||||
${libdir} ${sbindir} ${datadir} \
|
||||
${datadir}/common-licenses ${datadir}/dict ${infodir} \
|
||||
${mandir} ${datadir}/misc ${localstatedir} \
|
||||
${localstatedir}/backups ${localstatedir}/lib \
|
||||
${localstatedir}/lib/misc ${localstatedir}/spool \
|
||||
${localstatedir}/volatile \
|
||||
${localstatedir}/${@'volatile/' if oe.types.boolean('${VOLATILE_LOG_DIR}') else ''}log \
|
||||
/home ${prefix}/src ${localstatedir}/local \
|
||||
/media"
|
||||
|
||||
dirs755-lsb = "/srv \
|
||||
${prefix}/local ${prefix}/local/bin ${prefix}/local/games \
|
||||
${prefix}/local/include ${prefix}/local/lib ${prefix}/local/sbin \
|
||||
${prefix}/local/share ${prefix}/local/src \
|
||||
${prefix}/lib/locale"
|
||||
dirs2775-lsb = "/var/mail"
|
||||
|
||||
volatiles = "${@'log' if oe.types.boolean('${VOLATILE_LOG_DIR}') else ''} tmp"
|
||||
conffiles = "${sysconfdir}/debian_version ${sysconfdir}/host.conf \
|
||||
${sysconfdir}/issue /${sysconfdir}/issue.net \
|
||||
${sysconfdir}/nsswitch.conf ${sysconfdir}/profile \
|
||||
${sysconfdir}/default"
|
||||
|
||||
# By default the hostname is the machine name. If the hostname is unset then a
|
||||
# /etc/hostname file isn't written, suitable for environments with dynamic
|
||||
# hostnames.
|
||||
#
|
||||
# The hostname can be changed outside of this recipe by using
|
||||
# hostname:pn-base-files = "my-host-name".
|
||||
hostname = "${MACHINE}"
|
||||
|
||||
BASEFILESISSUEINSTALL ?= "do_install_basefilesissue"
|
||||
|
||||
do_install () {
|
||||
for d in ${dirs555}; do
|
||||
install -m 0555 -d ${D}$d
|
||||
done
|
||||
for d in ${dirs755}; do
|
||||
install -m 0755 -d ${D}$d
|
||||
done
|
||||
for d in ${dirs1777}; do
|
||||
install -m 1777 -d ${D}$d
|
||||
done
|
||||
for d in ${dirs2775}; do
|
||||
install -m 2775 -d ${D}$d
|
||||
done
|
||||
for d in ${volatiles}; do
|
||||
ln -sf volatile/$d ${D}${localstatedir}/$d
|
||||
done
|
||||
|
||||
ln -snf ../run ${D}${localstatedir}/run
|
||||
ln -snf ../run/lock ${D}${localstatedir}/lock
|
||||
|
||||
install -m 0644 ${WORKDIR}/hosts ${D}${sysconfdir}/hosts
|
||||
${BASEFILESISSUEINSTALL}
|
||||
|
||||
rotation=`cat ${WORKDIR}/rotation`
|
||||
if [ "$rotation" != "0" ]; then
|
||||
install -m 0644 ${WORKDIR}/rotation ${D}${sysconfdir}/rotation
|
||||
fi
|
||||
|
||||
install -m 0644 ${WORKDIR}/fstab ${D}${sysconfdir}/fstab
|
||||
install -m 0644 ${WORKDIR}/profile ${D}${sysconfdir}/profile
|
||||
sed -i 's#ROOTHOME#${ROOT_HOME}#' ${D}${sysconfdir}/profile
|
||||
sed -i 's#@BINDIR@#${bindir}#g' ${D}${sysconfdir}/profile
|
||||
install -m 0644 ${WORKDIR}/shells ${D}${sysconfdir}/shells
|
||||
install -m 0755 ${WORKDIR}/share/dot.profile ${D}${sysconfdir}/skel/.profile
|
||||
install -m 0755 ${WORKDIR}/share/dot.bashrc ${D}${sysconfdir}/skel/.bashrc
|
||||
install -m 0644 ${WORKDIR}/host.conf ${D}${sysconfdir}/host.conf
|
||||
install -m 0644 ${WORKDIR}/motd ${D}${sysconfdir}/motd
|
||||
|
||||
ln -sf /proc/mounts ${D}${sysconfdir}/mtab
|
||||
|
||||
# deal with hostname
|
||||
if [ "${hostname}" ]; then
|
||||
echo ${hostname} > ${D}${sysconfdir}/hostname
|
||||
echo "127.0.1.1 ${hostname}" >> ${D}${sysconfdir}/hosts
|
||||
fi
|
||||
|
||||
if ${@bb.utils.contains('DISTRO_FEATURES', 'ipv6', 'false', 'true', d)}; then
|
||||
sed -i '/^::1/s/ localhost//' ${D}${sysconfdir}/hosts
|
||||
fi
|
||||
}
|
||||
|
||||
do_install:append:libc-glibc () {
|
||||
install -m 0644 ${WORKDIR}/nsswitch.conf ${D}${sysconfdir}/nsswitch.conf
|
||||
}
|
||||
|
||||
DISTRO_VERSION[vardepsexclude] += "DATE"
|
||||
do_install_basefilesissue () {
|
||||
install -m 644 ${WORKDIR}/issue* ${D}${sysconfdir}
|
||||
if [ -n "${DISTRO_NAME}" ]; then
|
||||
printf "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue
|
||||
printf "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue.net
|
||||
if [ -n "${DISTRO_VERSION}" ]; then
|
||||
distro_version_nodate="${@d.getVar('DISTRO_VERSION').replace('snapshot-${DATE}','snapshot').replace('${DATE}','')}"
|
||||
printf "%s " $distro_version_nodate >> ${D}${sysconfdir}/issue
|
||||
printf "%s " $distro_version_nodate >> ${D}${sysconfdir}/issue.net
|
||||
fi
|
||||
printf "\\\n \\\l\n" >> ${D}${sysconfdir}/issue
|
||||
echo >> ${D}${sysconfdir}/issue
|
||||
echo "%h" >> ${D}${sysconfdir}/issue.net
|
||||
echo >> ${D}${sysconfdir}/issue.net
|
||||
fi
|
||||
}
|
||||
do_install_basefilesissue[vardepsexclude] += "DATE"
|
||||
|
||||
do_install:append:linuxstdbase() {
|
||||
for d in ${dirs755-lsb}; do
|
||||
install -m 0755 -d ${D}$d
|
||||
done
|
||||
|
||||
for d in ${dirs2775-lsb}; do
|
||||
install -m 2775 -d ${D}$d
|
||||
done
|
||||
}
|
||||
|
||||
SYSROOT_DIRS += "${sysconfdir}/skel"
|
||||
|
||||
PACKAGES = "${PN}-doc ${PN} ${PN}-dev ${PN}-dbg"
|
||||
FILES:${PN} = "/"
|
||||
FILES:${PN}-doc = "${docdir} ${datadir}/common-licenses"
|
||||
|
||||
PACKAGE_ARCH = "${MACHINE_ARCH}"
|
||||
|
||||
CONFFILES:${PN} = "${sysconfdir}/fstab ${@['', '${sysconfdir}/hostname ${sysconfdir}/hosts'][(d.getVar('hostname') != '')]} ${sysconfdir}/shells"
|
||||
CONFFILES:${PN} += "${sysconfdir}/motd ${sysconfdir}/nsswitch.conf ${sysconfdir}/profile"
|
||||
|
||||
INSANE_SKIP:${PN} += "empty-dirs"
|
||||
@@ -0,0 +1,26 @@
|
||||
From 8f3ace87df3aaad85946c22cae240532ea3e73b8 Mon Sep 17 00:00:00 2001
|
||||
From: Saul Wold <sgw@linux.intel.com>
|
||||
Date: Fri, 29 Apr 2022 13:32:27 +0000
|
||||
Subject: [PATCH] Add a shutdown group
|
||||
|
||||
We need to have a shutdown group to allow the shutdown icon to work
|
||||
correctly. Any users that want to use shutdown like the xuser should
|
||||
be added to this group.
|
||||
|
||||
Upstream-Status: Inappropriate [Embedded]
|
||||
Signed-off-by: Saul Wold <sgw@linux.intel.com>
|
||||
---
|
||||
group.master | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/group.master b/group.master
|
||||
index ad1dd2d..1b5e2fb 100644
|
||||
--- a/group.master
|
||||
+++ b/group.master
|
||||
@@ -35,5 +35,6 @@ sasl:*:45:
|
||||
plugdev:*:46:
|
||||
staff:*:50:
|
||||
games:*:60:
|
||||
+shutdown:*:70:
|
||||
users:*:100:
|
||||
nogroup:*:65534:
|
||||
@@ -0,0 +1,30 @@
|
||||
From 9e57771d138ac423d5139b984b8c869122ce4976 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Kiernan <alexk@zuma.ai>
|
||||
Date: Fri, 28 Jul 2023 10:28:57 +0100
|
||||
Subject: [PATCH] base-passwd: Add the sgx group
|
||||
|
||||
To avoid errors from eudev/udev we need an sgx group, but if we add it
|
||||
via groupadd that causes shadow login to be brought into an image, which
|
||||
causes images which have CONFIG_MULTIUSER unset to fail with `setgid:
|
||||
Function not implemented` as shadow's login doesn't implement the
|
||||
heuristics which busybox has to handle this kernel configuration.
|
||||
|
||||
Upstream-Status: Inappropriate [oe-specific]
|
||||
|
||||
Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
|
||||
---
|
||||
group.master | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/group.master b/group.master
|
||||
index d34d2b832d43..e54fd1d2c6dc 100644
|
||||
--- a/group.master
|
||||
+++ b/group.master
|
||||
@@ -34,6 +34,7 @@ video:*:44:
|
||||
sasl:*:45:
|
||||
plugdev:*:46:
|
||||
kvm:*:47:
|
||||
+sgx:*:48:
|
||||
staff:*:50:
|
||||
games:*:60:
|
||||
shutdown:*:70:
|
||||
@@ -0,0 +1,23 @@
|
||||
From 4411fc0df77566d52bee11ec0bad4be30a96e99e Mon Sep 17 00:00:00 2001
|
||||
From: Scott Garman <scott.a.garman@intel.com>
|
||||
Date: Fri, 29 Apr 2022 13:32:27 +0000
|
||||
Subject: [PATCH] Use /bin/sh instead of /bin/bash for the root user
|
||||
|
||||
/bin/bash may not be included in some images such as minimal.
|
||||
|
||||
Upstream-Status: Inappropriate [configuration]
|
||||
Signed-off-by: Scott Garman <scott.a.garman@intel.com>
|
||||
---
|
||||
passwd.master | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/passwd.master b/passwd.master
|
||||
index 7cd4e24..041685a 100644
|
||||
--- a/passwd.master
|
||||
+++ b/passwd.master
|
||||
@@ -1,4 +1,4 @@
|
||||
-root:*:0:0:root:/root:/bin/bash
|
||||
+root:*:0:0:root:/root:/bin/sh
|
||||
daemon:*:1:1:daemon:/usr/sbin:/usr/sbin/nologin
|
||||
bin:*:2:2:bin:/bin:/usr/sbin/nologin
|
||||
sys:*:3:3:sys:/dev:/usr/sbin/nologin
|
||||
@@ -0,0 +1,21 @@
|
||||
From 13a1a284a134d18a454625a5b4485c0d99079ae9 Mon Sep 17 00:00:00 2001
|
||||
From: Scott Garman <scott.a.garman@intel.com>
|
||||
Date: Fri, 29 Apr 2022 13:32:28 +0000
|
||||
Subject: [PATCH] Remove "*" for root since we do not have an /etc/shadow
|
||||
|
||||
Upstream-Status: Inappropriate [configuration]
|
||||
Signed-off-by: Scott Garman <scott.a.garman@intel.com>
|
||||
---
|
||||
passwd.master | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/passwd.master b/passwd.master
|
||||
index 041685a..31a84d4 100644
|
||||
--- a/passwd.master
|
||||
+++ b/passwd.master
|
||||
@@ -1,4 +1,4 @@
|
||||
-root:*:0:0:root:/root:/bin/sh
|
||||
+root::0:0:root:/root:/bin/sh
|
||||
daemon:*:1:1:daemon:/usr/sbin:/usr/sbin/nologin
|
||||
bin:*:2:2:bin:/bin:/usr/sbin/nologin
|
||||
sys:*:3:3:sys:/dev:/usr/sbin/nologin
|
||||
@@ -0,0 +1,23 @@
|
||||
From c5f012750f8102ff54af73ccc2d2b7bfa1f26db4 Mon Sep 17 00:00:00 2001
|
||||
From: Darren Hart <dvhart@linux.intel.com>
|
||||
Date: Fri, 29 Apr 2022 13:32:28 +0000
|
||||
Subject: [PATCH] Add an input group for the /dev/input/* devices
|
||||
|
||||
Upstream-Status: Inappropriate [configuration]
|
||||
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
|
||||
---
|
||||
group.master | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/group.master b/group.master
|
||||
index 1b5e2fb..cea9d60 100644
|
||||
--- a/group.master
|
||||
+++ b/group.master
|
||||
@@ -12,6 +12,7 @@ uucp:*:10:
|
||||
man:*:12:
|
||||
proxy:*:13:
|
||||
kmem:*:15:
|
||||
+input:*:19:
|
||||
dialout:*:20:
|
||||
fax:*:21:
|
||||
voice:*:22:
|
||||
@@ -0,0 +1,23 @@
|
||||
From 6cf19461fb31d7a7a3010629aae9aab49c26a01b Mon Sep 17 00:00:00 2001
|
||||
From: Jacob Kroon <jacob.kroon@gmail.com>
|
||||
Date: Wed, 30 Jan 2019 04:53:48 +0000
|
||||
Subject: [PATCH] Add kvm group
|
||||
|
||||
Upstream-Status: Pending
|
||||
Signed-off-by: Jacob Kroon <jacob.kroon@gmail.com>
|
||||
---
|
||||
group.master | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/group.master b/group.master
|
||||
index cea9d60..5b62284 100644
|
||||
--- a/group.master
|
||||
+++ b/group.master
|
||||
@@ -34,6 +34,7 @@ utmp:*:43:
|
||||
video:*:44:
|
||||
sasl:*:45:
|
||||
plugdev:*:46:
|
||||
+kvm:*:47:
|
||||
staff:*:50:
|
||||
games:*:60:
|
||||
shutdown:*:70:
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
We need to have a wheel group which has some system privileges to consult the
|
||||
systemd journal or manage printers with cups.
|
||||
|
||||
Upstream says the group does not exist by default.
|
||||
|
||||
Upstream-Status: Inappropriate [enable feature]
|
||||
|
||||
Signed-off-by: Louis Rannou <lrannou@baylibre.com>
|
||||
Index: base-passwd-3.5.26/group.master
|
||||
===================================================================
|
||||
--- base-passwd-3.5.29.orig/group.master
|
||||
+++ base-passwd-3.5.29/group.master
|
||||
@@ -38,5 +38,6 @@
|
||||
staff:*:50:
|
||||
games:*:60:
|
||||
shutdown:*:70:
|
||||
+wheel:*:80:
|
||||
users:*:100:
|
||||
nogroup:*:65534:
|
||||
125
sources/poky/meta/recipes-core/base-passwd/base-passwd_3.6.3.bb
Normal file
125
sources/poky/meta/recipes-core/base-passwd/base-passwd_3.6.3.bb
Normal file
@@ -0,0 +1,125 @@
|
||||
SUMMARY = "Base system master password/group files"
|
||||
DESCRIPTION = "The master copies of the user database files (/etc/passwd and /etc/group). The update-passwd tool is also provided to keep the system databases synchronized with these master files."
|
||||
HOMEPAGE = "https://launchpad.net/base-passwd"
|
||||
SECTION = "base"
|
||||
LICENSE = "GPL-2.0-only"
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=eb723b61539feef013de476e68b5c50a"
|
||||
|
||||
SRC_URI = "https://launchpad.net/debian/+archive/primary/+files/${BPN}_${PV}.tar.xz \
|
||||
file://0001-Add-a-shutdown-group.patch \
|
||||
file://0002-Use-bin-sh-instead-of-bin-bash-for-the-root-user.patch \
|
||||
file://0003-Remove-for-root-since-we-do-not-have-an-etc-shadow.patch \
|
||||
file://0004-Add-an-input-group-for-the-dev-input-devices.patch \
|
||||
file://0005-Add-kvm-group.patch \
|
||||
file://0007-Add-wheel-group.patch \
|
||||
file://0001-base-passwd-Add-the-sgx-group.patch \
|
||||
"
|
||||
|
||||
SRC_URI[sha256sum] = "83575327d8318a419caf2d543341215c046044073d1afec2acc0ac4d8095ff39"
|
||||
|
||||
# the package is taken from launchpad; that source is static and goes stale
|
||||
# so we check the latest upstream from a directory that does get updated
|
||||
UPSTREAM_CHECK_URI = "${DEBIAN_MIRROR}/main/b/base-passwd/"
|
||||
|
||||
S = "${WORKDIR}/work"
|
||||
|
||||
PACKAGECONFIG = "${@bb.utils.filter('DISTRO_FEATURES', 'selinux', d)}"
|
||||
PACKAGECONFIG[selinux] = "--enable-selinux, --disable-selinux, libselinux"
|
||||
|
||||
inherit autotools
|
||||
|
||||
EXTRA_OECONF += "--disable-debconf --disable-docs"
|
||||
|
||||
NOLOGIN ?= "${base_sbindir}/nologin"
|
||||
|
||||
do_install () {
|
||||
install -d -m 755 ${D}${sbindir}
|
||||
install -o root -g root -p -m 755 ${B}/update-passwd ${D}${sbindir}/
|
||||
install -d -m 755 ${D}${mandir}/man8 ${D}${mandir}/pl/man8
|
||||
install -p -m 644 ${S}/man/update-passwd.8 ${D}${mandir}/man8/
|
||||
install -p -m 644 ${S}/man/update-passwd.pl.8 \
|
||||
${D}${mandir}/pl/man8/update-passwd.8
|
||||
gzip -9 ${D}${mandir}/man8/* ${D}${mandir}/pl/man8/*
|
||||
install -d -m 755 ${D}${datadir}/base-passwd
|
||||
install -o root -g root -p -m 644 ${S}/passwd.master ${D}${datadir}/base-passwd/
|
||||
sed -i 's#:/root:#:${ROOT_HOME}:#' ${D}${datadir}/base-passwd/passwd.master
|
||||
sed -i 's#/usr/sbin/nologin#${NOLOGIN}#' ${D}${datadir}/base-passwd/passwd.master
|
||||
install -o root -g root -p -m 644 ${S}/group.master ${D}${datadir}/base-passwd/
|
||||
|
||||
install -d -m 755 ${D}${docdir}/${BPN}
|
||||
install -p -m 644 ${S}/debian/changelog ${D}${docdir}/${BPN}/
|
||||
gzip -9 ${D}${docdir}/${BPN}/*
|
||||
install -p -m 644 ${S}/README ${D}${docdir}/${BPN}/
|
||||
install -p -m 644 ${S}/debian/copyright ${D}${docdir}/${BPN}/
|
||||
}
|
||||
|
||||
basepasswd_sysroot_postinst() {
|
||||
#!/bin/sh -e
|
||||
|
||||
# Install passwd.master and group.master to sysconfdir
|
||||
install -d -m 755 ${STAGING_DIR_TARGET}${sysconfdir}
|
||||
for i in passwd group; do
|
||||
install -p -m 644 ${STAGING_DIR_TARGET}${datadir}/base-passwd/\$i.master \
|
||||
${STAGING_DIR_TARGET}${sysconfdir}/\$i
|
||||
done
|
||||
|
||||
# Run any useradd postinsts
|
||||
for script in ${STAGING_DIR_TARGET}${bindir}/postinst-useradd-*; do
|
||||
if [ -f \$script ]; then
|
||||
\$script
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
SYSROOT_DIRS += "${sysconfdir}"
|
||||
SYSROOT_PREPROCESS_FUNCS += "base_passwd_tweaksysroot"
|
||||
|
||||
base_passwd_tweaksysroot () {
|
||||
mkdir -p ${SYSROOT_DESTDIR}${bindir}
|
||||
dest=${SYSROOT_DESTDIR}${bindir}/postinst-${PN}
|
||||
echo "${basepasswd_sysroot_postinst}" > $dest
|
||||
chmod 0755 $dest
|
||||
}
|
||||
|
||||
python populate_packages:prepend() {
|
||||
# Add in the preinst function for ${PN}
|
||||
# We have to do this here as prior to this, passwd/group.master
|
||||
# would be unavailable. We need to create these files at preinst
|
||||
# time before the files from the package may be available, hence
|
||||
# storing the data from the files in the preinst directly.
|
||||
|
||||
f = open(d.expand("${STAGING_DATADIR}/base-passwd/passwd.master"), 'r')
|
||||
passwd = "".join(f.readlines())
|
||||
f.close()
|
||||
f = open(d.expand("${STAGING_DATADIR}/base-passwd/group.master"), 'r')
|
||||
group = "".join(f.readlines())
|
||||
f.close()
|
||||
|
||||
preinst = """#!/bin/sh
|
||||
mkdir -p $D${sysconfdir}
|
||||
if [ ! -e $D${sysconfdir}/passwd ]; then
|
||||
\tcat << 'EOF' > $D${sysconfdir}/passwd
|
||||
""" + passwd + """EOF
|
||||
fi
|
||||
if [ ! -e $D${sysconfdir}/group ]; then
|
||||
\tcat << 'EOF' > $D${sysconfdir}/group
|
||||
""" + group + """EOF
|
||||
fi
|
||||
"""
|
||||
d.setVar(d.expand('pkg_preinst:${PN}'), preinst)
|
||||
}
|
||||
|
||||
addtask do_package after do_populate_sysroot
|
||||
|
||||
ALLOW_EMPTY:${PN} = "1"
|
||||
|
||||
PACKAGES =+ "${PN}-update"
|
||||
FILES:${PN}-update = "${sbindir}/* ${datadir}/${PN}"
|
||||
|
||||
pkg_postinst:${PN}-update () {
|
||||
#!/bin/sh
|
||||
if [ -n "$D" ]; then
|
||||
exit 0
|
||||
fi
|
||||
${sbindir}/update-passwd
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
SUMMARY = "inittab configuration for BusyBox"
|
||||
LICENSE = "GPL-2.0-only"
|
||||
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6"
|
||||
|
||||
SRC_URI = "file://inittab"
|
||||
|
||||
S = "${WORKDIR}"
|
||||
|
||||
INHIBIT_DEFAULT_DEPS = "1"
|
||||
|
||||
do_compile() {
|
||||
:
|
||||
}
|
||||
|
||||
do_install() {
|
||||
install -d ${D}${sysconfdir}
|
||||
install -D -m 0644 ${WORKDIR}/inittab ${D}${sysconfdir}/inittab
|
||||
|
||||
CONSOLES="${SERIAL_CONSOLES}"
|
||||
for s in $CONSOLES
|
||||
do
|
||||
speed=$(echo $s | cut -d\; -f 1)
|
||||
device=$(echo $s | cut -d\; -f 2)
|
||||
label=$(echo $device | sed -e 's/tty//' | tail --bytes=5)
|
||||
|
||||
echo "$device::respawn:${sbindir}/ttyrun $device ${base_sbindir}/getty $speed $device" >> ${D}${sysconfdir}/inittab
|
||||
done
|
||||
|
||||
if [ "${USE_VT}" = "1" ]; then
|
||||
cat <<EOF >>${D}${sysconfdir}/inittab
|
||||
# ${base_sbindir}/getty invocations for the runlevels.
|
||||
#
|
||||
# The "id" field MUST be the same as the last
|
||||
# characters of the device (after "tty").
|
||||
#
|
||||
# Format:
|
||||
# <id>:<runlevels>:<action>:<process>
|
||||
#
|
||||
|
||||
EOF
|
||||
|
||||
for n in ${SYSVINIT_ENABLED_GETTYS}
|
||||
do
|
||||
echo "tty$n:12345:respawn:${base_sbindir}/getty 38400 tty$n" >> ${D}${sysconfdir}/inittab
|
||||
done
|
||||
echo "" >> ${D}${sysconfdir}/inittab
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
|
||||
# SERIAL_CONSOLES is generally defined by the MACHINE .conf.
|
||||
# Set PACKAGE_ARCH appropriately.
|
||||
PACKAGE_ARCH = "${MACHINE_ARCH}"
|
||||
|
||||
FILES:${PN} = "${sysconfdir}/inittab"
|
||||
CONFFILES:${PN} = "${sysconfdir}/inittab"
|
||||
|
||||
RDEPENDS:${PN} = "ttyrun"
|
||||
RCONFLICTS:${PN} = "sysvinit-inittab"
|
||||
|
||||
USE_VT ?= "1"
|
||||
SYSVINIT_ENABLED_GETTYS ?= "1"
|
||||
517
sources/poky/meta/recipes-core/busybox/busybox.inc
Normal file
517
sources/poky/meta/recipes-core/busybox/busybox.inc
Normal file
@@ -0,0 +1,517 @@
|
||||
SUMMARY = "Tiny versions of many common UNIX utilities in a single small executable"
|
||||
DESCRIPTION = "BusyBox combines tiny versions of many common UNIX utilities into a single small executable. It provides minimalist replacements for most of the utilities you usually find in GNU fileutils, shellutils, etc. The utilities in BusyBox generally have fewer options than their full-featured GNU cousins; however, the options that are included provide the expected functionality and behave very much like their GNU counterparts. BusyBox provides a fairly complete POSIX environment for any small or embedded system."
|
||||
HOMEPAGE = "https://www.busybox.net"
|
||||
BUGTRACKER = "https://bugs.busybox.net/"
|
||||
|
||||
DEPENDS += "kern-tools-native virtual/crypt"
|
||||
|
||||
# bzip2 applet in busybox is based on lightly-modified bzip2-1.0.4 source
|
||||
# the GPL is version 2 only
|
||||
LICENSE = "GPL-2.0-only & bzip2-1.0.4"
|
||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=de10de48642ab74318e893a61105afbb \
|
||||
file://archival/libarchive/bz/LICENSE;md5=28e3301eae987e8cfe19988e98383dae"
|
||||
|
||||
SECTION = "base"
|
||||
|
||||
# Whether to split the suid apps into a seperate binary
|
||||
BUSYBOX_SPLIT_SUID ?= "1"
|
||||
|
||||
export EXTRA_CFLAGS = "${CFLAGS}"
|
||||
export EXTRA_LDFLAGS = "${LDFLAGS}"
|
||||
|
||||
EXTRA_OEMAKE = "CC='${CC}' LD='${CCLD}' V=1 ARCH=${TARGET_ARCH} CROSS_COMPILE=${TARGET_PREFIX} SKIP_STRIP=y HOSTCC='${BUILD_CC}' HOSTCPP='${BUILD_CPP}'"
|
||||
|
||||
PACKAGES =+ "${PN}-httpd ${PN}-udhcpd ${PN}-udhcpc ${PN}-syslog ${PN}-mdev ${PN}-hwclock"
|
||||
|
||||
FILES:${PN}-httpd = "${sysconfdir}/init.d/busybox-httpd /srv/www"
|
||||
FILES:${PN}-syslog = "${sysconfdir}/init.d/syslog* ${sysconfdir}/syslog-startup.conf* ${sysconfdir}/syslog.conf* ${systemd_system_unitdir}/syslog.service ${sysconfdir}/default/busybox-syslog"
|
||||
FILES:${PN}-mdev = "${sysconfdir}/init.d/mdev ${sysconfdir}/mdev.conf ${sysconfdir}/mdev/*"
|
||||
FILES:${PN}-udhcpd = "${sysconfdir}/init.d/busybox-udhcpd"
|
||||
FILES:${PN}-udhcpc = "${sysconfdir}/udhcpc.d ${datadir}/udhcpc"
|
||||
FILES:${PN}-hwclock = "${sysconfdir}/init.d/hwclock.sh"
|
||||
|
||||
INITSCRIPT_PACKAGES = "${PN}-httpd ${PN}-syslog ${PN}-udhcpd ${PN}-mdev ${PN}-hwclock"
|
||||
|
||||
INITSCRIPT_NAME:${PN}-httpd = "busybox-httpd"
|
||||
INITSCRIPT_NAME:${PN}-hwclock = "hwclock.sh"
|
||||
INITSCRIPT_PARAMS:${PN}-hwclock = "start 40 S . stop 20 0 1 6 ."
|
||||
INITSCRIPT_NAME:${PN}-mdev = "mdev"
|
||||
INITSCRIPT_PARAMS:${PN}-mdev = "start 04 S ."
|
||||
INITSCRIPT_NAME:${PN}-syslog = "syslog"
|
||||
INITSCRIPT_NAME:${PN}-udhcpd = "busybox-udhcpd"
|
||||
|
||||
SYSTEMD_PACKAGES = "${PN}-syslog"
|
||||
SYSTEMD_SERVICE:${PN}-syslog = "${@bb.utils.contains('SRC_URI', 'file://syslog.cfg', 'busybox-syslog.service', '', d)}"
|
||||
|
||||
RDEPENDS:${PN}-syslog = "busybox"
|
||||
CONFFILES:${PN}-syslog = "${sysconfdir}/syslog-startup.conf"
|
||||
RCONFLICTS:${PN}-syslog = "rsyslog sysklogd syslog-ng"
|
||||
|
||||
CONFFILES:${PN}-mdev = "${sysconfdir}/mdev.conf"
|
||||
|
||||
RRECOMMENDS:${PN} = "${PN}-udhcpc"
|
||||
|
||||
RDEPENDS:${PN} = "${@["", "busybox-inittab"][(d.getVar('VIRTUAL-RUNTIME_init_manager') == 'busybox')]}"
|
||||
|
||||
inherit cml1 systemd update-rc.d ptest
|
||||
|
||||
# busybox's unzip test case needs zip command, which busybox itself does not provide
|
||||
RDEPENDS:${PN}-ptest = "zip"
|
||||
|
||||
# internal helper
|
||||
def busybox_cfg(feature, tokens, cnf, rem):
|
||||
if type(tokens) == type(""):
|
||||
tokens = [tokens]
|
||||
rem.extend(['/^[# ]*' + token + '[ =]/d' for token in tokens])
|
||||
if feature:
|
||||
cnf.extend([token + '=y' for token in tokens])
|
||||
else:
|
||||
cnf.extend(['# ' + token + ' is not set' for token in tokens])
|
||||
|
||||
# Map distro features to config settings
|
||||
def features_to_busybox_settings(d):
|
||||
cnf, rem = ([], [])
|
||||
busybox_cfg(bb.utils.contains('DISTRO_FEATURES', 'ipv6', True, False, d), 'CONFIG_FEATURE_IPV6', cnf, rem)
|
||||
busybox_cfg(True, 'CONFIG_LFS', cnf, rem)
|
||||
busybox_cfg(True, 'CONFIG_FDISK_SUPPORT_LARGE_DISKS', cnf, rem)
|
||||
busybox_cfg(bb.utils.contains('DISTRO_FEATURES', 'nls', True, False, d), 'CONFIG_LOCALE_SUPPORT', cnf, rem)
|
||||
busybox_cfg(bb.utils.contains('DISTRO_FEATURES', 'ipv4', True, False, d), 'CONFIG_FEATURE_IFUPDOWN_IPV4', cnf, rem)
|
||||
busybox_cfg(bb.utils.contains('DISTRO_FEATURES', 'ipv6', True, False, d), 'CONFIG_FEATURE_IFUPDOWN_IPV6', cnf, rem)
|
||||
busybox_cfg(bb.utils.contains_any('DISTRO_FEATURES', 'bluetooth wifi', True, False, d), 'CONFIG_RFKILL', cnf, rem)
|
||||
return "\n".join(cnf), "\n".join(rem)
|
||||
|
||||
# X, Y = ${@features_to_busybox_settings(d)}
|
||||
# unfortunately doesn't seem to work with bitbake, workaround:
|
||||
def features_to_busybox_conf(d):
|
||||
cnf, rem = features_to_busybox_settings(d)
|
||||
return cnf
|
||||
def features_to_busybox_del(d):
|
||||
cnf, rem = features_to_busybox_settings(d)
|
||||
return rem
|
||||
|
||||
configmangle = '/CONFIG_EXTRA_CFLAGS/d; \
|
||||
'
|
||||
OE_FEATURES := "${@features_to_busybox_conf(d)}"
|
||||
OE_DEL := "${@features_to_busybox_del(d)}"
|
||||
DO_IPv4 := "${@bb.utils.contains('DISTRO_FEATURES', 'ipv4', 1, 0, d)}"
|
||||
DO_IPv6 := "${@bb.utils.contains('DISTRO_FEATURES', 'ipv6', 1, 0, d)}"
|
||||
|
||||
python () {
|
||||
if "${OE_DEL}":
|
||||
d.setVar('configmangle:append', "${OE_DEL}" + "\n")
|
||||
if "${OE_FEATURES}":
|
||||
d.setVar('configmangle:append',
|
||||
"/^### DISTRO FEATURES$/a\\\n%s\n\n" %
|
||||
("\\n".join((d.expand("${OE_FEATURES}").split("\n")))))
|
||||
d.setVar('configmangle:append',
|
||||
"/^### CROSS$/a\\\n%s\n" %
|
||||
("\\n".join(["CONFIG_EXTRA_CFLAGS=\"${CFLAGS} ${HOST_CC_ARCH}\""
|
||||
])
|
||||
))
|
||||
}
|
||||
|
||||
do_prepare_config () {
|
||||
export KCONFIG_NOTIMESTAMP=1
|
||||
|
||||
sed -e '/CONFIG_STATIC/d' \
|
||||
< ${WORKDIR}/defconfig > ${S}/.config
|
||||
echo "# CONFIG_STATIC is not set" >> .config
|
||||
for i in 'CROSS' 'DISTRO FEATURES'; do echo "### $i"; done >> \
|
||||
${S}/.config
|
||||
sed -i -e '${configmangle}' ${S}/.config
|
||||
if test ${DO_IPv4} -eq 0 && test ${DO_IPv6} -eq 0; then
|
||||
# disable networking applets
|
||||
mv ${S}/.config ${S}/.config.oe-tmp
|
||||
awk 'BEGIN{net=0}
|
||||
/^# Networking Utilities/{net=1}
|
||||
/^#$/{if(net){net=net+1}}
|
||||
{if(net==2&&$0 !~ /^#/&&$1){print("# "$1" is not set")}else{print}}' \
|
||||
${S}/.config.oe-tmp > ${S}/.config
|
||||
fi
|
||||
sed -i 's/CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="-R -n"/CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="-R -b"/' ${S}/.config
|
||||
if [ -n "${DEBUG_PREFIX_MAP}" ]; then
|
||||
sed -i 's|${DEBUG_PREFIX_MAP}||g' ${S}/.config
|
||||
fi
|
||||
}
|
||||
|
||||
do_configure () {
|
||||
set -x
|
||||
do_prepare_config
|
||||
merge_config.sh -m .config ${@" ".join(find_cfgs(d))}
|
||||
cml1_do_configure
|
||||
|
||||
# Save a copy of .config and autoconf.h.
|
||||
cp .config .config.orig
|
||||
cp include/autoconf.h include/autoconf.h.orig
|
||||
}
|
||||
|
||||
do_compile() {
|
||||
unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
|
||||
export KCONFIG_NOTIMESTAMP=1
|
||||
|
||||
# Ensure we start do_compile with the original .config and autoconf.h.
|
||||
# These files should always have matching timestamps.
|
||||
cp .config.orig .config
|
||||
cp include/autoconf.h.orig include/autoconf.h
|
||||
|
||||
if [ "${BUSYBOX_SPLIT_SUID}" = "1" -a x`grep "CONFIG_FEATURE_INDIVIDUAL=y" .config` = x ]; then
|
||||
# Guard againt interrupted do_compile: clean temporary files.
|
||||
rm -f .config.app.suid .config.app.nosuid .config.disable.apps .config.nonapps
|
||||
|
||||
# split the .config into two parts, and make two busybox binaries
|
||||
oe_runmake busybox.cfg.suid
|
||||
oe_runmake busybox.cfg.nosuid
|
||||
|
||||
# workaround for suid bug 10346
|
||||
if ! grep -q "CONFIG_SH_IS_NONE" busybox.cfg.nosuid; then
|
||||
echo "CONFIG_SH_IS_NONE" >> busybox.cfg.suid
|
||||
fi
|
||||
|
||||
for i in `cat busybox.cfg.suid busybox.cfg.nosuid`; do
|
||||
echo "# $i is not set" >> .config.disable.apps
|
||||
done
|
||||
merge_config.sh -m .config.orig .config.disable.apps
|
||||
cp .config .config.nonapps
|
||||
for s in suid nosuid; do
|
||||
cat busybox.cfg.$s | while read item; do
|
||||
grep -w "$item" .config.orig
|
||||
done > .config.app.$s
|
||||
|
||||
# workaround for suid bug 10346
|
||||
if [ "$s" = "suid" ] ; then
|
||||
sed "s/.*CONFIG_SH_IS_NONE.*$/CONFIG_SH_IS_NONE=y/" -i .config.app.suid
|
||||
fi
|
||||
|
||||
merge_config.sh -m .config.nonapps .config.app.$s
|
||||
oe_runmake busybox_unstripped
|
||||
mv busybox_unstripped busybox.$s
|
||||
oe_runmake busybox.links
|
||||
sort busybox.links > busybox.links.$s
|
||||
rm busybox.links
|
||||
done
|
||||
|
||||
# hard fail if sh is being linked to the suid busybox (detects bug 10346)
|
||||
if grep -q -x "/bin/sh" busybox.links.suid; then
|
||||
bbfatal "busybox suid binary incorrectly provides /bin/sh"
|
||||
fi
|
||||
|
||||
# cleanup
|
||||
rm .config.app.suid .config.app.nosuid .config.disable.apps .config.nonapps
|
||||
else
|
||||
oe_runmake busybox_unstripped
|
||||
cp busybox_unstripped busybox
|
||||
oe_runmake busybox.links
|
||||
fi
|
||||
|
||||
# restore original .config and autoconf.h, because the install process
|
||||
# may check these files
|
||||
cp .config.orig .config
|
||||
cp include/autoconf.h.orig include/autoconf.h
|
||||
}
|
||||
|
||||
do_install () {
|
||||
sed -i "s:^/bin/:BASE_BINDIR/:" busybox.links*
|
||||
sed -i "s:^/sbin/:BASE_SBINDIR/:" busybox.links*
|
||||
sed -i "s:^/usr/bin/:BINDIR/:" busybox.links*
|
||||
sed -i "s:^/usr/sbin/:SBINDIR/:" busybox.links*
|
||||
|
||||
# Move arch/link to BINDIR to match coreutils
|
||||
sed -i "s:^BASE_BINDIR/arch:BINDIR/arch:" busybox.links*
|
||||
sed -i "s:^BASE_BINDIR/link:BINDIR/link:" busybox.links*
|
||||
|
||||
sed -i "s:^BASE_BINDIR/:${base_bindir}/:" busybox.links*
|
||||
sed -i "s:^BASE_SBINDIR/:${base_sbindir}/:" busybox.links*
|
||||
sed -i "s:^BINDIR/:${bindir}/:" busybox.links*
|
||||
sed -i "s:^SBINDIR/:${sbindir}/:" busybox.links*
|
||||
|
||||
install -d ${D}${sysconfdir}/init.d
|
||||
|
||||
if ! grep -q "CONFIG_FEATURE_INDIVIDUAL=y" ${B}/.config; then
|
||||
# Install ${base_bindir}/busybox, and the ${base_bindir}/sh link so the postinst script
|
||||
# can run. Let update-alternatives handle the rest.
|
||||
install -d ${D}${base_bindir}
|
||||
if [ "${BUSYBOX_SPLIT_SUID}" = "1" ]; then
|
||||
install -m 4755 ${B}/busybox.suid ${D}${base_bindir}
|
||||
install -m 0755 ${B}/busybox.nosuid ${D}${base_bindir}
|
||||
install -m 0644 ${S}/busybox.links.suid ${D}${sysconfdir}
|
||||
install -m 0644 ${S}/busybox.links.nosuid ${D}${sysconfdir}
|
||||
if grep -q "CONFIG_SH_IS_ASH=y" ${B}/.config; then
|
||||
ln -sf busybox.nosuid ${D}${base_bindir}/sh
|
||||
fi
|
||||
# Keep a default busybox for people who want to invoke busybox directly.
|
||||
# This is also useful for the on device upgrade. Because we want
|
||||
# to use the busybox command in postinst.
|
||||
ln -sf busybox.nosuid ${D}${base_bindir}/busybox
|
||||
else
|
||||
if grep -q "CONFIG_FEATURE_SUID=y" ${B}/.config; then
|
||||
install -m 4755 ${B}/busybox ${D}${base_bindir}
|
||||
else
|
||||
install -m 0755 ${B}/busybox ${D}${base_bindir}
|
||||
fi
|
||||
install -m 0644 ${S}/busybox.links ${D}${sysconfdir}
|
||||
if grep -q "CONFIG_SH_IS_ASH=y" ${B}/.config; then
|
||||
ln -sf busybox ${D}${base_bindir}/sh
|
||||
fi
|
||||
# We make this symlink here to eliminate the error when upgrading together
|
||||
# with busybox-syslog. Without this symlink, the opkg may think of the
|
||||
# busybox.nosuid as obsolete and remove it, resulting in dead links like
|
||||
# ${base_bindir}/sed -> ${base_bindir}/busybox.nosuid. This will make upgrading busybox-syslog fail.
|
||||
# This symlink will be safely deleted in postinst, thus no negative effect.
|
||||
ln -sf busybox ${D}${base_bindir}/busybox.nosuid
|
||||
fi
|
||||
else
|
||||
install -d ${D}${base_bindir} ${D}${bindir} ${D}${libdir}
|
||||
cat busybox.links | while read FILE; do
|
||||
NAME=`basename "$FILE"`
|
||||
install -m 0755 "0_lib/$NAME" "${D}$FILE.${BPN}"
|
||||
done
|
||||
# add suid bit where needed
|
||||
for i in `grep -E "APPLET.*BB_SUID_((MAYBE|REQUIRE))" include/applets.h | grep -v _BB_SUID_DROP | cut -f 3 -d '(' | cut -f 1 -d ','`; do
|
||||
find ${D} -name $i.${BPN} -exec chmod a+s {} \;
|
||||
done
|
||||
install -m 0755 0_lib/libbusybox.so.${PV} ${D}${libdir}/libbusybox.so.${PV}
|
||||
ln -sf sh.${BPN} ${D}${base_bindir}/sh
|
||||
ln -sf ln.${BPN} ${D}${base_bindir}/ln
|
||||
ln -sf test.${BPN} ${D}${bindir}/test
|
||||
if [ -f ${D}/linuxrc.${BPN} ]; then
|
||||
mv ${D}/linuxrc.${BPN} ${D}/linuxrc
|
||||
fi
|
||||
install -m 0644 ${S}/busybox.links ${D}${sysconfdir}
|
||||
fi
|
||||
|
||||
if grep -q "CONFIG_SYSLOGD=y" ${B}/.config; then
|
||||
install -m 0755 ${WORKDIR}/syslog ${D}${sysconfdir}/init.d/syslog
|
||||
install -m 644 ${WORKDIR}/syslog-startup.conf ${D}${sysconfdir}/syslog-startup.conf
|
||||
install -m 644 ${WORKDIR}/syslog.conf ${D}${sysconfdir}/syslog.conf
|
||||
fi
|
||||
if grep -q "CONFIG_CROND=y" ${B}/.config; then
|
||||
install -m 0755 ${WORKDIR}/busybox-cron ${D}${sysconfdir}/init.d/
|
||||
fi
|
||||
if grep -q "CONFIG_HTTPD=y" ${B}/.config; then
|
||||
install -m 0755 ${WORKDIR}/busybox-httpd ${D}${sysconfdir}/init.d/
|
||||
install -d ${D}/srv/www
|
||||
fi
|
||||
if grep -q "CONFIG_UDHCPD=y" ${B}/.config; then
|
||||
install -m 0755 ${WORKDIR}/busybox-udhcpd ${D}${sysconfdir}/init.d/
|
||||
fi
|
||||
if grep -q "CONFIG_HWCLOCK=y" ${B}/.config; then
|
||||
install -m 0755 ${WORKDIR}/hwclock.sh ${D}${sysconfdir}/init.d/
|
||||
fi
|
||||
if grep -q "CONFIG_UDHCPC=y" ${B}/.config; then
|
||||
install -d ${D}${sysconfdir}/udhcpc.d
|
||||
install -d ${D}${datadir}/udhcpc
|
||||
install -m 0755 ${WORKDIR}/simple.script ${D}${sysconfdir}/udhcpc.d/50default
|
||||
sed -i "s:/SBIN_DIR/:${base_sbindir}/:" ${D}${sysconfdir}/udhcpc.d/50default
|
||||
install -m 0755 ${WORKDIR}/default.script ${D}${datadir}/udhcpc/default.script
|
||||
fi
|
||||
if grep -q "CONFIG_INETD=y" ${B}/.config; then
|
||||
install -m 0755 ${WORKDIR}/inetd ${D}${sysconfdir}/init.d/inetd.${BPN}
|
||||
sed -i "s:/usr/sbin/:${sbindir}/:" ${D}${sysconfdir}/init.d/inetd.${BPN}
|
||||
install -m 0644 ${WORKDIR}/inetd.conf ${D}${sysconfdir}/
|
||||
fi
|
||||
if grep -q "CONFIG_MDEV=y" ${B}/.config; then
|
||||
install -m 0755 ${WORKDIR}/mdev ${D}${sysconfdir}/init.d/mdev
|
||||
if grep "CONFIG_FEATURE_MDEV_CONF=y" ${B}/.config; then
|
||||
install -m 644 ${WORKDIR}/mdev.conf ${D}${sysconfdir}/mdev.conf
|
||||
install -d ${D}${sysconfdir}/mdev
|
||||
install -m 0755 ${WORKDIR}/find-touchscreen.sh ${D}${sysconfdir}/mdev
|
||||
install -m 0755 ${WORKDIR}/mdev-mount.sh ${D}${sysconfdir}/mdev
|
||||
fi
|
||||
fi
|
||||
if grep -q "CONFIG_INIT=y" ${B}/.config && ${@bb.utils.contains('VIRTUAL-RUNTIME_init_manager','busybox','true','false',d)}; then
|
||||
install -D -m 0755 ${WORKDIR}/rcS ${D}${sysconfdir}/init.d/rcS
|
||||
install -D -m 0755 ${WORKDIR}/rcK ${D}${sysconfdir}/init.d/rcK
|
||||
install -D -m 0755 ${WORKDIR}/rcS.default ${D}${sysconfdir}/default/rcS
|
||||
fi
|
||||
|
||||
if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
|
||||
if grep -q "CONFIG_KLOGD=y" ${B}/.config; then
|
||||
install -d ${D}${systemd_system_unitdir}
|
||||
sed 's,@base_sbindir@,${base_sbindir},g' < ${WORKDIR}/busybox-klogd.service.in \
|
||||
> ${D}${systemd_system_unitdir}/busybox-klogd.service
|
||||
fi
|
||||
|
||||
if grep -q "CONFIG_SYSLOGD=y" ${B}/.config; then
|
||||
install -d ${D}${systemd_system_unitdir}
|
||||
sed 's,@base_sbindir@,${base_sbindir},g' < ${WORKDIR}/busybox-syslog.service.in \
|
||||
> ${D}${systemd_system_unitdir}/busybox-syslog.service
|
||||
if [ ! -e ${D}${systemd_system_unitdir}/busybox-klogd.service ] ; then
|
||||
sed -i '/klog/d' ${D}${systemd_system_unitdir}/busybox-syslog.service
|
||||
fi
|
||||
if [ -f ${WORKDIR}/busybox-syslog.default ] ; then
|
||||
install -d ${D}${sysconfdir}/default
|
||||
install -m 0644 ${WORKDIR}/busybox-syslog.default ${D}${sysconfdir}/default/busybox-syslog
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Remove the sysvinit specific configuration file for systemd systems to avoid confusion
|
||||
if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'false', 'true', d)}; then
|
||||
rm -f ${D}${sysconfdir}/syslog-startup.conf
|
||||
fi
|
||||
}
|
||||
|
||||
PTEST_BINDIR = "1"
|
||||
|
||||
do_install_ptest () {
|
||||
cp -r ${B}/testsuite ${D}${PTEST_PATH}/
|
||||
# These access the internet which is not guaranteed to work on machines running the tests
|
||||
rm -rf ${D}${PTEST_PATH}/testsuite/wget
|
||||
sort ${B}/.config > ${D}${PTEST_PATH}/.config
|
||||
ln -s ${base_bindir}/busybox ${D}${PTEST_PATH}/busybox
|
||||
}
|
||||
|
||||
inherit update-alternatives
|
||||
|
||||
ALTERNATIVE_PRIORITY = "50"
|
||||
|
||||
python do_package:prepend () {
|
||||
# We need to load the full set of busybox provides from the /etc/busybox.links
|
||||
# Use this to see the update-alternatives with the right information
|
||||
|
||||
dvar = d.getVar('D')
|
||||
pn = d.getVar('PN')
|
||||
def set_alternative_vars(links, target):
|
||||
links = d.expand(links)
|
||||
target = d.expand(target)
|
||||
f = open('%s%s' % (dvar, links), 'r')
|
||||
for alt_link_name in f:
|
||||
alt_link_name = alt_link_name.strip()
|
||||
alt_name = os.path.basename(alt_link_name)
|
||||
# Match coreutils
|
||||
if alt_name == '[':
|
||||
alt_name = 'lbracket'
|
||||
if alt_name == 'klogd' or alt_name == 'syslogd':
|
||||
d.appendVar('ALTERNATIVE:%s-syslog' % (pn), ' ' + alt_name)
|
||||
else:
|
||||
d.appendVar('ALTERNATIVE:%s' % (pn), ' ' + alt_name)
|
||||
d.setVarFlag('ALTERNATIVE_LINK_NAME', alt_name, alt_link_name)
|
||||
if os.path.exists('%s%s' % (dvar, target)):
|
||||
d.setVarFlag('ALTERNATIVE_TARGET', alt_name, target)
|
||||
f.close()
|
||||
return
|
||||
|
||||
if os.path.exists('%s/etc/busybox.links' % (dvar)):
|
||||
set_alternative_vars("${sysconfdir}/busybox.links", "${base_bindir}/busybox")
|
||||
else:
|
||||
set_alternative_vars("${sysconfdir}/busybox.links.nosuid", "${base_bindir}/busybox.nosuid")
|
||||
set_alternative_vars("${sysconfdir}/busybox.links.suid", "${base_bindir}/busybox.suid")
|
||||
}
|
||||
|
||||
# This part of code is dedicated to the on target upgrade problem. It's known
|
||||
# that if we don't make appropriate symlinks before update-alternatives calls,
|
||||
# there will be errors indicating missing commands such as 'sed'.
|
||||
# These symlinks will later be updated by update-alternatives calls.
|
||||
# The update-alternatives.bbclass' postinst script runs firstly before other
|
||||
# postinst, but this part of code needs run firstly, so add this funtion.
|
||||
python populate_packages_updatealternatives:append() {
|
||||
postinst = """
|
||||
test -n 2 > /dev/null || alias test='busybox test'
|
||||
if test "x$D" = "x"; then
|
||||
# Remove busybox.nosuid if it's a symlink, because this situation indicates
|
||||
# that we're installing or upgrading to a one-binary busybox.
|
||||
if test -h ${base_bindir}/busybox.nosuid; then
|
||||
rm -f ${base_bindir}/busybox.nosuid
|
||||
fi
|
||||
for suffix in "" ".nosuid" ".suid"; do
|
||||
if test -e ${sysconfdir}/busybox.links$suffix; then
|
||||
while read link; do
|
||||
if test ! -e "$link"; then
|
||||
# we can use busybox here because even if we are using splitted busybox
|
||||
# we've made a symlink from /bin/busybox to /bin/busybox.nosuid.
|
||||
busybox rm -f $link
|
||||
busybox ln -s "${base_bindir}/busybox$suffix" $link
|
||||
fi
|
||||
done < ${sysconfdir}/busybox.links$suffix
|
||||
fi
|
||||
done
|
||||
fi
|
||||
if grep -q "^${base_bindir}/bash$" $D${sysconfdir}/busybox.links*; then
|
||||
grep -q "^${base_bindir}/bash$" $D${sysconfdir}/shells || echo ${base_bindir}/bash >> $D${sysconfdir}/shells
|
||||
fi
|
||||
|
||||
"""
|
||||
d.prependVar('pkg_postinst:%s' % pkg, postinst)
|
||||
}
|
||||
|
||||
pkg_postinst:${PN}:prepend () {
|
||||
# Need path to saved utils, but they may have be removed on upgrade of busybox
|
||||
# Only use shell to get paths. Also capture if busybox was saved.
|
||||
BUSYBOX=""
|
||||
if [ "x$D" = "x" ] ; then
|
||||
for busybox_rmdir in /tmp/busyboxrm-*; do
|
||||
if [ "$busybox_rmdir" != '/tmp/busyboxrm-*' ] ; then
|
||||
export PATH=$busybox_rmdir:$PATH
|
||||
if [ -e $busybox_rmdir/busybox* ] ; then
|
||||
BUSYBOX="$busybox_rmdir/busybox*"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_postinst:${PN}:append () {
|
||||
# If busybox exists in the remove directory it is because it was the only shell left.
|
||||
if [ "x$D" = "x" ] ; then
|
||||
if [ "x$BUSYBOX" != "x" ] ; then
|
||||
update-alternatives --remove sh $BUSYBOX
|
||||
rm -f $BUSYBOX
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_prerm:${PN} () {
|
||||
# This is so you can make busybox commit suicide - removing busybox with no other packages
|
||||
# providing its files, this will make update-alternatives work, but the update-rc.d part
|
||||
# for syslog, httpd and/or udhcpd will fail if there is no other package providing sh
|
||||
tmpdir=`mktemp -d /tmp/busyboxrm-XXXXXX`
|
||||
ln -s ${base_bindir}/busybox $tmpdir/[
|
||||
ln -s ${base_bindir}/busybox $tmpdir/test
|
||||
ln -s ${base_bindir}/busybox $tmpdir/head
|
||||
ln -s ${base_bindir}/busybox $tmpdir/sh
|
||||
ln -s ${base_bindir}/busybox $tmpdir/basename
|
||||
ln -s ${base_bindir}/busybox $tmpdir/echo
|
||||
ln -s ${base_bindir}/busybox $tmpdir/mv
|
||||
ln -s ${base_bindir}/busybox $tmpdir/ln
|
||||
ln -s ${base_bindir}/busybox $tmpdir/dirname
|
||||
ln -s ${base_bindir}/busybox $tmpdir/rm
|
||||
ln -s ${base_bindir}/busybox $tmpdir/sed
|
||||
ln -s ${base_bindir}/busybox $tmpdir/sort
|
||||
ln -s ${base_bindir}/busybox $tmpdir/grep
|
||||
ln -s ${base_bindir}/busybox $tmpdir/tail
|
||||
export PATH=$PATH:$tmpdir
|
||||
|
||||
# If busybox is the shell, we need to save it since its the lowest priority shell
|
||||
# Register saved bitbake as the lowest priority shell possible as back up.
|
||||
if [ -n "$(readlink -f /bin/sh | grep busybox)" ] ; then
|
||||
BUSYBOX=$(readlink -f /bin/sh)
|
||||
cp $BUSYBOX $tmpdir/$(basename $BUSYBOX)
|
||||
update-alternatives --install /bin/sh sh $tmpdir/$(basename $BUSYBOX) 1
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_postrm:${PN} () {
|
||||
# Add path to remove dir in case we removed our only grep
|
||||
if [ "x$D" = "x" ] ; then
|
||||
for busybox_rmdir in /tmp/busyboxrm-*; do
|
||||
if [ "$busybox_rmdir" != '/tmp/busyboxrm-*' ] ; then
|
||||
export PATH=$busybox_rmdir:$PATH
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if grep -q "^${base_bindir}/bash$" $D${sysconfdir}/busybox.links* && [ ! -e $D${base_bindir}/bash ]; then
|
||||
printf "$(grep -v "^${base_bindir}/bash$" $D${sysconfdir}/shells)\n" > $D${sysconfdir}/shells
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_prerm:${PN}-syslog () {
|
||||
# remove syslog
|
||||
if test "x$D" = "x"; then
|
||||
if test "$1" = "upgrade" -o "$1" = "remove"; then
|
||||
${sysconfdir}/init.d/syslog stop || :
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
RPROVIDES:${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '/bin/sh /bin/ash', '', d)}"
|
||||
@@ -0,0 +1,197 @@
|
||||
From dedc9380c76834ba64c8b526aef6f461ea4e7f2e Mon Sep 17 00:00:00 2001
|
||||
From: Denys Vlasenko <vda.linux@googlemail.com>
|
||||
Date: Tue, 30 May 2023 16:42:18 +0200
|
||||
Subject: [PATCH 1/2] awk: fix precedence of = relative to ==
|
||||
|
||||
Discovered while adding code to disallow assignments to non-lvalues
|
||||
|
||||
function old new delta
|
||||
parse_expr 936 991 +55
|
||||
.rodata 105243 105247 +4
|
||||
------------------------------------------------------------------------------
|
||||
(add/remove: 0/0 grow/shrink: 2/0 up/down: 59/0) Total: 59 bytes
|
||||
|
||||
CVE: CVE-2023-42364 CVE-2023-42365
|
||||
|
||||
Upstream-Status: Backport [https://git.busybox.net/busybox/commit/?id=0256e00a9d077588bd3a39f5a1ef7e2eaa2911e4]
|
||||
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
||||
(cherry picked from commit 0256e00a9d077588bd3a39f5a1ef7e2eaa2911e4)
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
editors/awk.c | 66 ++++++++++++++++++++++++++++++---------------
|
||||
testsuite/awk.tests | 5 ++++
|
||||
2 files changed, 50 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/editors/awk.c b/editors/awk.c
|
||||
index ec9301e..aff86fe 100644
|
||||
--- a/editors/awk.c
|
||||
+++ b/editors/awk.c
|
||||
@@ -337,7 +337,9 @@ static void debug_parse_print_tc(uint32_t n)
|
||||
#undef P
|
||||
#undef PRIMASK
|
||||
#undef PRIMASK2
|
||||
-#define P(x) (x << 24)
|
||||
+/* Smaller 'x' means _higher_ operator precedence */
|
||||
+#define PRECEDENCE(x) (x << 24)
|
||||
+#define P(x) PRECEDENCE(x)
|
||||
#define PRIMASK 0x7F000000
|
||||
#define PRIMASK2 0x7E000000
|
||||
|
||||
@@ -360,7 +362,7 @@ enum {
|
||||
OC_MOVE = 0x1f00, OC_PGETLINE = 0x2000, OC_REGEXP = 0x2100,
|
||||
OC_REPLACE = 0x2200, OC_RETURN = 0x2300, OC_SPRINTF = 0x2400,
|
||||
OC_TERNARY = 0x2500, OC_UNARY = 0x2600, OC_VAR = 0x2700,
|
||||
- OC_DONE = 0x2800,
|
||||
+ OC_CONST = 0x2800, OC_DONE = 0x2900,
|
||||
|
||||
ST_IF = 0x3000, ST_DO = 0x3100, ST_FOR = 0x3200,
|
||||
ST_WHILE = 0x3300
|
||||
@@ -440,9 +442,9 @@ static const uint32_t tokeninfo[] ALIGN4 = {
|
||||
#define TI_PREINC (OC_UNARY|xV|P(9)|'P')
|
||||
#define TI_PREDEC (OC_UNARY|xV|P(9)|'M')
|
||||
TI_PREINC, TI_PREDEC, OC_FIELD|xV|P(5),
|
||||
- OC_COMPARE|VV|P(39)|5, OC_MOVE|VV|P(74), OC_REPLACE|NV|P(74)|'+', OC_REPLACE|NV|P(74)|'-',
|
||||
- OC_REPLACE|NV|P(74)|'*', OC_REPLACE|NV|P(74)|'/', OC_REPLACE|NV|P(74)|'%', OC_REPLACE|NV|P(74)|'&',
|
||||
- OC_BINARY|NV|P(29)|'+', OC_BINARY|NV|P(29)|'-', OC_REPLACE|NV|P(74)|'&', OC_BINARY|NV|P(15)|'&',
|
||||
+ OC_COMPARE|VV|P(39)|5, OC_MOVE|VV|P(38), OC_REPLACE|NV|P(38)|'+', OC_REPLACE|NV|P(38)|'-',
|
||||
+ OC_REPLACE|NV|P(38)|'*', OC_REPLACE|NV|P(38)|'/', OC_REPLACE|NV|P(38)|'%', OC_REPLACE|NV|P(38)|'&',
|
||||
+ OC_BINARY|NV|P(29)|'+', OC_BINARY|NV|P(29)|'-', OC_REPLACE|NV|P(38)|'&', OC_BINARY|NV|P(15)|'&',
|
||||
OC_BINARY|NV|P(25)|'/', OC_BINARY|NV|P(25)|'%', OC_BINARY|NV|P(15)|'&', OC_BINARY|NV|P(25)|'*',
|
||||
OC_COMPARE|VV|P(39)|4, OC_COMPARE|VV|P(39)|3, OC_COMPARE|VV|P(39)|0, OC_COMPARE|VV|P(39)|1,
|
||||
#define TI_LESS (OC_COMPARE|VV|P(39)|2)
|
||||
@@ -1290,7 +1292,7 @@ static uint32_t next_token(uint32_t expected)
|
||||
save_tclass = tc;
|
||||
save_info = t_info;
|
||||
tc = TC_BINOPX;
|
||||
- t_info = OC_CONCAT | SS | P(35);
|
||||
+ t_info = OC_CONCAT | SS | PRECEDENCE(35);
|
||||
}
|
||||
|
||||
t_tclass = tc;
|
||||
@@ -1350,9 +1352,8 @@ static node *parse_expr(uint32_t term_tc)
|
||||
{
|
||||
node sn;
|
||||
node *cn = &sn;
|
||||
- node *vn, *glptr;
|
||||
+ node *glptr;
|
||||
uint32_t tc, expected_tc;
|
||||
- var *v;
|
||||
|
||||
debug_printf_parse("%s() term_tc(%x):", __func__, term_tc);
|
||||
debug_parse_print_tc(term_tc);
|
||||
@@ -1363,11 +1364,12 @@ static node *parse_expr(uint32_t term_tc)
|
||||
expected_tc = TS_OPERAND | TS_UOPPRE | TC_REGEXP | term_tc;
|
||||
|
||||
while (!((tc = next_token(expected_tc)) & term_tc)) {
|
||||
+ node *vn;
|
||||
|
||||
if (glptr && (t_info == TI_LESS)) {
|
||||
/* input redirection (<) attached to glptr node */
|
||||
debug_printf_parse("%s: input redir\n", __func__);
|
||||
- cn = glptr->l.n = new_node(OC_CONCAT | SS | P(37));
|
||||
+ cn = glptr->l.n = new_node(OC_CONCAT | SS | PRECEDENCE(37));
|
||||
cn->a.n = glptr;
|
||||
expected_tc = TS_OPERAND | TS_UOPPRE;
|
||||
glptr = NULL;
|
||||
@@ -1379,24 +1381,42 @@ static node *parse_expr(uint32_t term_tc)
|
||||
* previous operators with higher priority */
|
||||
vn = cn;
|
||||
while (((t_info & PRIMASK) > (vn->a.n->info & PRIMASK2))
|
||||
- || ((t_info == vn->info) && t_info == TI_COLON)
|
||||
+ || (t_info == vn->info && t_info == TI_COLON)
|
||||
) {
|
||||
vn = vn->a.n;
|
||||
if (!vn->a.n) syntax_error(EMSG_UNEXP_TOKEN);
|
||||
}
|
||||
if (t_info == TI_TERNARY)
|
||||
//TODO: why?
|
||||
- t_info += P(6);
|
||||
+ t_info += PRECEDENCE(6);
|
||||
cn = vn->a.n->r.n = new_node(t_info);
|
||||
cn->a.n = vn->a.n;
|
||||
if (tc & TS_BINOP) {
|
||||
cn->l.n = vn;
|
||||
-//FIXME: this is the place to detect and reject assignments to non-lvalues.
|
||||
-//Currently we allow "assignments" to consts and temporaries, nonsense like this:
|
||||
-// awk 'BEGIN { "qwe" = 1 }'
|
||||
-// awk 'BEGIN { 7 *= 7 }'
|
||||
-// awk 'BEGIN { length("qwe") = 1 }'
|
||||
-// awk 'BEGIN { (1+1) += 3 }'
|
||||
+
|
||||
+ /* Prevent:
|
||||
+ * awk 'BEGIN { "qwe" = 1 }'
|
||||
+ * awk 'BEGIN { 7 *= 7 }'
|
||||
+ * awk 'BEGIN { length("qwe") = 1 }'
|
||||
+ * awk 'BEGIN { (1+1) += 3 }'
|
||||
+ */
|
||||
+ /* Assignment? (including *= and friends) */
|
||||
+ if (((t_info & OPCLSMASK) == OC_MOVE)
|
||||
+ || ((t_info & OPCLSMASK) == OC_REPLACE)
|
||||
+ ) {
|
||||
+ debug_printf_parse("%s: MOVE/REPLACE vn->info:%08x\n", __func__, vn->info);
|
||||
+ /* Left side is a (variable or array element)
|
||||
+ * or function argument
|
||||
+ * or $FIELD ?
|
||||
+ */
|
||||
+ if ((vn->info & OPCLSMASK) != OC_VAR
|
||||
+ && (vn->info & OPCLSMASK) != OC_FNARG
|
||||
+ && (vn->info & OPCLSMASK) != OC_FIELD
|
||||
+ ) {
|
||||
+ syntax_error(EMSG_UNEXP_TOKEN); /* no. bad */
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
expected_tc = TS_OPERAND | TS_UOPPRE | TC_REGEXP;
|
||||
if (t_info == TI_PGETLINE) {
|
||||
/* it's a pipe */
|
||||
@@ -1432,6 +1452,8 @@ static node *parse_expr(uint32_t term_tc)
|
||||
/* one should be very careful with switch on tclass -
|
||||
* only simple tclasses should be used (TC_xyz, not TS_xyz) */
|
||||
switch (tc) {
|
||||
+ var *v;
|
||||
+
|
||||
case TC_VARIABLE:
|
||||
case TC_ARRAY:
|
||||
debug_printf_parse("%s: TC_VARIABLE | TC_ARRAY\n", __func__);
|
||||
@@ -1452,14 +1474,14 @@ static node *parse_expr(uint32_t term_tc)
|
||||
case TC_NUMBER:
|
||||
case TC_STRING:
|
||||
debug_printf_parse("%s: TC_NUMBER | TC_STRING\n", __func__);
|
||||
- cn->info = OC_VAR;
|
||||
+ cn->info = OC_CONST;
|
||||
v = cn->l.v = xzalloc(sizeof(var));
|
||||
- if (tc & TC_NUMBER)
|
||||
+ if (tc & TC_NUMBER) {
|
||||
setvar_i(v, t_double);
|
||||
- else {
|
||||
+ } else {
|
||||
setvar_s(v, t_string);
|
||||
- expected_tc &= ~TC_UOPPOST; /* "str"++ is not allowed */
|
||||
}
|
||||
+ expected_tc &= ~TC_UOPPOST; /* NUM++, "str"++ not allowed */
|
||||
break;
|
||||
|
||||
case TC_REGEXP:
|
||||
@@ -3107,6 +3129,8 @@ static var *evaluate(node *op, var *res)
|
||||
|
||||
/* -- recursive node type -- */
|
||||
|
||||
+ case XC( OC_CONST ):
|
||||
+ debug_printf_eval("CONST ");
|
||||
case XC( OC_VAR ):
|
||||
debug_printf_eval("VAR\n");
|
||||
L.v = op->l.v;
|
||||
diff --git a/testsuite/awk.tests b/testsuite/awk.tests
|
||||
index ddc5104..a78fdcd 100755
|
||||
--- a/testsuite/awk.tests
|
||||
+++ b/testsuite/awk.tests
|
||||
@@ -540,4 +540,9 @@ testing 'awk assign while assign' \
|
||||
│ trim/eff : 57.02%/26, 0.00% │ [cpu000:100%]
|
||||
└────────────────────────────────────────────────────┘^C"
|
||||
|
||||
+testing "awk = has higher precedence than == (despite what gawk manpage claims)" \
|
||||
+ "awk 'BEGIN { v=1; print 2==v; print 2==v=2; print v; print v=3==3; print v}'" \
|
||||
+ '0\n1\n2\n1\n3\n' \
|
||||
+ '' ''
|
||||
+
|
||||
exit $FAILCOUNT
|
||||
@@ -0,0 +1,41 @@
|
||||
From e1a68741067167dc4837e0a26d3d5c318a631fc7 Mon Sep 17 00:00:00 2001
|
||||
From: Ron Yorston <rmy@pobox.com>
|
||||
Date: Fri, 19 Jan 2024 15:41:17 +0000
|
||||
Subject: [PATCH] awk: fix segfault when compiled by clang
|
||||
|
||||
A 32-bit build of BusyBox using clang segfaulted in the test
|
||||
"awk assign while assign". Specifically, on line 7 of the test
|
||||
input where the adjustment of the L.v pointer when the Fields
|
||||
array was reallocated
|
||||
|
||||
L.v += Fields - old_Fields_ptr;
|
||||
|
||||
was out by 4 bytes.
|
||||
|
||||
Rearrange to code so both gcc and clang generate code that works.
|
||||
|
||||
Signed-off-by: Ron Yorston <rmy@pobox.com>
|
||||
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
||||
|
||||
Upstream-Status: Backport [https://git.busybox.net/busybox/commit/?id=5dcc443dba039b305a510c01883e9f34e42656ae]
|
||||
Signed-off-by: Peter Marko <peter.marko@siemens.com>
|
||||
---
|
||||
editors/awk.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/editors/awk.c b/editors/awk.c
|
||||
index aa485c782..0981c6735 100644
|
||||
--- a/editors/awk.c
|
||||
+++ b/editors/awk.c
|
||||
@@ -2935,7 +2935,7 @@ static var *evaluate(node *op, var *res)
|
||||
if (old_Fields_ptr) {
|
||||
//if (old_Fields_ptr != Fields)
|
||||
// debug_printf_eval("L.v moved\n");
|
||||
- L.v += Fields - old_Fields_ptr;
|
||||
+ L.v = Fields + (L.v - old_Fields_ptr);
|
||||
}
|
||||
if (opinfo & OF_STR2) {
|
||||
R.s = getvar_s(R.v);
|
||||
--
|
||||
2.30.2
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
From 8542236894a8d5f7393327117bc7f64787444efc Mon Sep 17 00:00:00 2001
|
||||
From: Valery Ushakov <uwe@stderr.spb.ru>
|
||||
Date: Wed, 24 Jan 2024 22:24:41 +0300
|
||||
Subject: [PATCH] awk.c: fix CVE-2023-42366 (bug #15874)
|
||||
|
||||
Make sure we don't read past the end of the string in next_token()
|
||||
when backslash is the last character in an (invalid) regexp.
|
||||
a fix and issue reported in bugzilla
|
||||
|
||||
https://bugs.busybox.net/show_bug.cgi?id=15874
|
||||
|
||||
Upstream-Status: Submitted [http://lists.busybox.net/pipermail/busybox/2024-May/090766.html]
|
||||
|
||||
CVE: CVE-2023-42366
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
editors/awk.c | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/editors/awk.c b/editors/awk.c
|
||||
index f320d8c..a53b193 100644
|
||||
--- a/editors/awk.c
|
||||
+++ b/editors/awk.c
|
||||
@@ -1168,9 +1168,11 @@ static uint32_t next_token(uint32_t expected)
|
||||
s[-1] = bb_process_escape_sequence((const char **)&pp);
|
||||
if (*p == '\\')
|
||||
*s++ = '\\';
|
||||
- if (pp == p)
|
||||
+ if (pp == p) {
|
||||
+ if (*p == '\0')
|
||||
+ syntax_error(EMSG_UNEXP_EOS);
|
||||
*s++ = *p++;
|
||||
- else
|
||||
+ } else
|
||||
p = pp;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
From 199606e960942c29fd8085be812edd3d3697825c Mon Sep 17 00:00:00 2001
|
||||
From: Colin McAllister <colinmca242@gmail.com>
|
||||
Date: Wed, 17 Jul 2024 07:58:52 -0500
|
||||
Subject: [PATCH 1/1] cut: Fix "-s" flag to omit blank lines
|
||||
|
||||
Using cut with the delimiter flag ("-d") with the "-s" flag to only
|
||||
output lines containing the delimiter will print blank lines. This is
|
||||
deviant behavior from cut provided by GNU Coreutils. Blank lines should
|
||||
be omitted if "-s" is used with "-d".
|
||||
|
||||
This change introduces a somewhat naiive, yet efficient solution, where
|
||||
line length is checked before looping though bytes. If line length is
|
||||
zero and the "-s" flag is used, the code will jump to parsing the next
|
||||
line to avoid printing a newline character.
|
||||
|
||||
In addition, a test to cut.tests has been added to ensure that this
|
||||
regression is fixed and will not happen again in the future.
|
||||
|
||||
Upstream-Status: Submitted [http://lists.busybox.net/pipermail/busybox/2024-July/090834.html]
|
||||
|
||||
Signed-off-by: Colin McAllister <colinmca242@gmail.com>
|
||||
---
|
||||
coreutils/cut.c | 6 ++++++
|
||||
testsuite/cut.tests | 9 +++++++++
|
||||
2 files changed, 15 insertions(+)
|
||||
|
||||
diff --git a/coreutils/cut.c b/coreutils/cut.c
|
||||
index 55bdd9386..b7f986f26 100644
|
||||
--- a/coreutils/cut.c
|
||||
+++ b/coreutils/cut.c
|
||||
@@ -152,6 +152,12 @@ static void cut_file(FILE *file, const char *delim, const char *odelim,
|
||||
unsigned uu = 0, start = 0, end = 0, out = 0;
|
||||
int dcount = 0;
|
||||
|
||||
+ /* Blank line? */
|
||||
+ if (!linelen) {
|
||||
+ if (option_mask32 & CUT_OPT_SUPPRESS_FLGS)
|
||||
+ goto next_line;
|
||||
+ }
|
||||
+
|
||||
/* Loop through bytes, finding next delimiter */
|
||||
for (;;) {
|
||||
/* End of current range? */
|
||||
diff --git a/testsuite/cut.tests b/testsuite/cut.tests
|
||||
index 2458c019c..0b401bc00 100755
|
||||
--- a/testsuite/cut.tests
|
||||
+++ b/testsuite/cut.tests
|
||||
@@ -65,6 +65,15 @@ testing "cut with -d -f( ) -s" "cut -d' ' -f3 -s input && echo yes" "yes\n" "$in
|
||||
testing "cut with -d -f(a) -s" "cut -da -f3 -s input" "n\nsium:Jim\n\ncion:Ed\n" "$input" ""
|
||||
testing "cut with -d -f(a) -s -n" "cut -da -f3 -s -n input" "n\nsium:Jim\n\ncion:Ed\n" "$input" ""
|
||||
|
||||
+input="\
|
||||
+
|
||||
+foo bar baz
|
||||
+
|
||||
+bing bong boop
|
||||
+
|
||||
+"
|
||||
+testing "cut with -d -s omits blank lines" "cut -d' ' -f2 -s input" "bar\nbong\n" "$input" ""
|
||||
+
|
||||
# substitute for awk
|
||||
optional FEATURE_CUT_REGEX
|
||||
testing "cut -DF" "cut -DF 2,7,5" \
|
||||
--
|
||||
2.43.0
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
From 5f6ed003f10ee0bd4a508d5f59129a29f0920dfc Mon Sep 17 00:00:00 2001
|
||||
From: Saul Wold <saul.wold@windriver.com>
|
||||
Date: Thu, 31 Mar 2022 11:21:45 -0700
|
||||
Subject: [PATCH] depmod: Ignore .debug directories
|
||||
|
||||
The .debug/<module>.ko files do not have the correct symbol information
|
||||
since it's split away from the actual <module>.ko file. Just ignore it.
|
||||
|
||||
Upstream-Status: Pending
|
||||
|
||||
Signed-off-by: Saul Wold <saul.wold@windriver.com>
|
||||
---
|
||||
modutils/depmod.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/modutils/depmod.c b/modutils/depmod.c
|
||||
index bb42bbe..aa5a2de 100644
|
||||
--- a/modutils/depmod.c
|
||||
+++ b/modutils/depmod.c
|
||||
@@ -43,6 +43,9 @@ static int FAST_FUNC parse_module(struct recursive_state *state,
|
||||
/* Arbitrary. Was sb->st_size, but that breaks .gz etc */
|
||||
size_t len = (64*1024*1024 - 4096);
|
||||
|
||||
+ if (strstr(fname, ".debug") != NULL)
|
||||
+ return TRUE;
|
||||
+
|
||||
if (strrstr(fname, ".ko") == NULL)
|
||||
return TRUE;
|
||||
|
||||
--
|
||||
2.31.1
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
From c69feb2fdb755d6db34d0eb0a9e9994386c15e3a Mon Sep 17 00:00:00 2001
|
||||
From: Chen Qi <Qi.Chen@windriver.com>
|
||||
Date: Wed, 14 Nov 2018 15:19:57 +0800
|
||||
Subject: [PATCH] du-l-works: fix to use 145 instead of 144
|
||||
|
||||
64 + 64 + 16 = 144
|
||||
144 + size_of_directory >= 145
|
||||
So fix to use 145 instead of 144.
|
||||
|
||||
Upstream-Status: Submitted [http://lists.busybox.net/pipermail/busybox/2018-November/086836.html]
|
||||
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
---
|
||||
testsuite/du/du-l-works | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/testsuite/du/du-l-works b/testsuite/du/du-l-works
|
||||
index af87345..575064a 100644
|
||||
--- a/testsuite/du/du-l-works
|
||||
+++ b/testsuite/du/du-l-works
|
||||
@@ -5,7 +5,7 @@ cd du.testdir
|
||||
dd if=/dev/zero of=file1 bs=1k count=64 2>/dev/null
|
||||
ln file1 file1.1
|
||||
dd if=/dev/zero of=file2 bs=1k count=16 2>/dev/null
|
||||
-test x"`busybox du -l .`" = x"144 ." \
|
||||
+test x"`busybox du -l .`" = x"145 ." \
|
||||
-o x"`busybox du -l .`" = x"146 ." \
|
||||
-o x"`busybox du -l .`" = x"148 ." \
|
||||
-o x"`busybox du -l .`" = x"152 ." \
|
||||
--
|
||||
2.7.4
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
From 0c8da1bead8ffaf270b4b723ead2c517371405d7 Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Sun, 3 Apr 2022 12:14:33 +0000
|
||||
Subject: [PATCH 1/2] libbb: sockaddr2str: ensure only printable characters are
|
||||
returned for the hostname part
|
||||
|
||||
CVE: CVE-2022-28391
|
||||
Upstream-Status: Submitted [https://bugs.busybox.net/show_bug.cgi?id=15001]
|
||||
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Signed-off-by: Steve Sakoman <steve@sakoman.com>
|
||||
---
|
||||
libbb/xconnect.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libbb/xconnect.c b/libbb/xconnect.c
|
||||
index 0e0b247b8..02c061e67 100644
|
||||
--- a/libbb/xconnect.c
|
||||
+++ b/libbb/xconnect.c
|
||||
@@ -497,8 +497,9 @@ static char* FAST_FUNC sockaddr2str(const struct sockaddr *sa, int flags)
|
||||
);
|
||||
if (rc)
|
||||
return NULL;
|
||||
+ /* ensure host contains only printable characters */
|
||||
if (flags & IGNORE_PORT)
|
||||
- return xstrdup(host);
|
||||
+ return xstrdup(printable_string(host));
|
||||
#if ENABLE_FEATURE_IPV6
|
||||
if (sa->sa_family == AF_INET6) {
|
||||
if (strchr(host, ':')) /* heh, it's not a resolved hostname */
|
||||
@@ -509,7 +510,7 @@ static char* FAST_FUNC sockaddr2str(const struct sockaddr *sa, int flags)
|
||||
#endif
|
||||
/* For now we don't support anything else, so it has to be INET */
|
||||
/*if (sa->sa_family == AF_INET)*/
|
||||
- return xasprintf("%s:%s", host, serv);
|
||||
+ return xasprintf("%s:%s", printable_string(host), serv);
|
||||
/*return xstrdup(host);*/
|
||||
}
|
||||
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
From 3bee0460d74bad88eca6592e63ca926961b43b67 Mon Sep 17 00:00:00 2001
|
||||
From: Yi Zhao <yi.zhao@windriver.com>
|
||||
Date: Fri, 6 Mar 2020 16:09:26 +0800
|
||||
Subject: [PATCH] sysctl: ignore EIO of stable_secret below
|
||||
/proc/sys/net/ipv6/conf
|
||||
|
||||
Avoid confusing messages caused by EIO on reading
|
||||
/proc/sys/net/ipv6/conf/*/stable_secret if those are not set yet.
|
||||
Make it behave the same as procps(>=3.3.13).
|
||||
|
||||
Upstream-Status: Submitted [busybox@busybox.net mailing list]
|
||||
|
||||
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
|
||||
---
|
||||
procps/sysctl.c | 9 ++++++++-
|
||||
1 file changed, 8 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/procps/sysctl.c b/procps/sysctl.c
|
||||
index 6d77185ca..42c51cc91 100644
|
||||
--- a/procps/sysctl.c
|
||||
+++ b/procps/sysctl.c
|
||||
@@ -202,7 +202,14 @@ static int sysctl_act_on_setting(char *setting)
|
||||
value = cptr = xmalloc_read(fd, NULL);
|
||||
close(fd);
|
||||
if (value == NULL) {
|
||||
- bb_perror_msg("error reading key '%s'", outname);
|
||||
+ switch (errno) {
|
||||
+ case EIO:
|
||||
+ /* Ignore stable_secret below /proc/sys/net/ipv6/conf */
|
||||
+ break;
|
||||
+ default:
|
||||
+ bb_perror_msg("error reading key '%s'", outname);
|
||||
+ break;
|
||||
+ }
|
||||
retval = EXIT_FAILURE;
|
||||
goto end;
|
||||
}
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
From 85f164ec427fecbae24140b3c93acbbe2ba1c817 Mon Sep 17 00:00:00 2001
|
||||
From: Chen Qi <Qi.Chen@windriver.com>
|
||||
Date: Tue, 13 Nov 2018 11:27:01 +0800
|
||||
Subject: [PATCH] testsuite: check uudecode before using it
|
||||
|
||||
The unzip and tar test cases use uudecode command, so also
|
||||
check it via optional function.
|
||||
|
||||
Upstream-Status: Submitted [http://lists.busybox.net/pipermail/busybox/2018-November/086833.html]
|
||||
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
---
|
||||
testsuite/tar.tests | 2 +-
|
||||
testsuite/unzip.tests | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/testsuite/tar.tests b/testsuite/tar.tests
|
||||
index d71a349..8c88567 100755
|
||||
--- a/testsuite/tar.tests
|
||||
+++ b/testsuite/tar.tests
|
||||
@@ -339,7 +339,7 @@ cd .. || exit 1; rm -rf tar.tempdir 2>/d
|
||||
fi
|
||||
|
||||
mkdir tar.tempdir && cd tar.tempdir || exit 1
|
||||
-optional FEATURE_SEAMLESS_BZ2 FEATURE_TAR_AUTODETECT LS
|
||||
+optional FEATURE_SEAMLESS_BZ2 FEATURE_TAR_AUTODETECT LS UUDECODE
|
||||
testing "tar Symlink attack: create symlink and then write through it" '\
|
||||
exec 2>&1
|
||||
uudecode -o input && tar xvf input; echo $?
|
||||
diff --git a/testsuite/unzip.tests b/testsuite/unzip.tests
|
||||
index af53de9..3b45ece 100755
|
||||
--- a/testsuite/unzip.tests
|
||||
+++ b/testsuite/unzip.tests
|
||||
@@ -31,7 +31,7 @@ rmdir foo
|
||||
rm foo.zip
|
||||
|
||||
# File containing some damaged encrypted stream
|
||||
-optional FEATURE_UNZIP_CDF CONFIG_UNICODE_SUPPORT
|
||||
+optional FEATURE_UNZIP_CDF CONFIG_UNICODE_SUPPORT UUDECODE
|
||||
testing "unzip (bad archive)" "uudecode; unzip bad.zip 2>&1; echo \$?" \
|
||||
"Archive: bad.zip
|
||||
inflating: ]3j½r«I??K-%Ix
|
||||
--
|
||||
2.7.4
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
From 03acf460990dfcf6e52b298301b348b9504460a8 Mon Sep 17 00:00:00 2001
|
||||
From: Chen Qi <Qi.Chen@windriver.com>
|
||||
Date: Tue, 13 Nov 2018 13:51:42 +0800
|
||||
Subject: [PATCH] testsuite: use www.example.org for wget test cases
|
||||
|
||||
Use example.org instead of google.com to make sure it's
|
||||
always reachible.
|
||||
|
||||
Upstream-Status: Submitted [http://lists.busybox.net/pipermail/busybox/2018-November/086835.html]
|
||||
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
---
|
||||
testsuite/wget/wget--O-overrides--P | 2 +-
|
||||
testsuite/wget/wget-handles-empty-path | 2 +-
|
||||
testsuite/wget/wget-retrieves-google-index | 2 +-
|
||||
testsuite/wget/wget-supports--P | 2 +-
|
||||
4 files changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/testsuite/wget/wget--O-overrides--P b/testsuite/wget/wget--O-overrides--P
|
||||
index 40a3a96..490d743 100644
|
||||
--- a/testsuite/wget/wget--O-overrides--P
|
||||
+++ b/testsuite/wget/wget--O-overrides--P
|
||||
@@ -1,5 +1,5 @@
|
||||
test x"$SKIP_INTERNET_TESTS" != x"" && exit
|
||||
|
||||
mkdir foo
|
||||
-busybox wget -q -O index.html -P foo http://www.google.com/
|
||||
+busybox wget -q -O index.html -P foo http://www.example.org/
|
||||
test -s index.html
|
||||
diff --git a/testsuite/wget/wget-handles-empty-path b/testsuite/wget/wget-handles-empty-path
|
||||
index 01d60bd..1802db6 100644
|
||||
--- a/testsuite/wget/wget-handles-empty-path
|
||||
+++ b/testsuite/wget/wget-handles-empty-path
|
||||
@@ -1,3 +1,3 @@
|
||||
test x"$SKIP_INTERNET_TESTS" != x"" && exit
|
||||
|
||||
-busybox wget http://www.google.com
|
||||
+busybox wget http://www.example.org
|
||||
diff --git a/testsuite/wget/wget-retrieves-google-index b/testsuite/wget/wget-retrieves-google-index
|
||||
index f9dbb8b..fc801d4 100644
|
||||
--- a/testsuite/wget/wget-retrieves-google-index
|
||||
+++ b/testsuite/wget/wget-retrieves-google-index
|
||||
@@ -1,4 +1,4 @@
|
||||
test x"$SKIP_INTERNET_TESTS" != x"" && exit
|
||||
|
||||
-busybox wget -q -O foo http://www.google.com/
|
||||
+busybox wget -q -O foo http://www.example.org/
|
||||
test -s foo
|
||||
diff --git a/testsuite/wget/wget-supports--P b/testsuite/wget/wget-supports--P
|
||||
index bfe4ac4..4ff2fe0 100644
|
||||
--- a/testsuite/wget/wget-supports--P
|
||||
+++ b/testsuite/wget/wget-supports--P
|
||||
@@ -1,5 +1,5 @@
|
||||
test x"$SKIP_INTERNET_TESTS" != x"" && exit
|
||||
|
||||
mkdir foo
|
||||
-busybox wget -q -P foo http://www.google.com/
|
||||
+busybox wget -q -P foo http://www.example.org/
|
||||
test -s foo/index.html
|
||||
--
|
||||
2.7.4
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
From c3bfdac8e0e9a21d524ad72036953f68d2193e52 Mon Sep 17 00:00:00 2001
|
||||
From: Natanael Copa <ncopa@alpinelinux.org>
|
||||
Date: Tue, 21 May 2024 14:46:08 +0200
|
||||
Subject: [PATCH 2/2] awk: fix ternary operator and precedence of =
|
||||
|
||||
Adjust the = precedence test to match behavior of gawk, mawk and
|
||||
FreeBSD. awk 'BEGIN {print v=3==3; print v}' should print two '1'.
|
||||
|
||||
To fix this, and to unbreak the ternary conditional operator, we restore
|
||||
the precedence of = in the token list, but override this with a lower
|
||||
priority when the assignment is on the right side of a compare.
|
||||
|
||||
This fixes commit 0256e00a9d07 (awk: fix precedence of = relative to ==) [1]
|
||||
|
||||
CVE: CVE-2023-42364 CVE-2023-42365
|
||||
|
||||
Upstream-Status: Submitted [http://lists.busybox.net/pipermail/busybox/2024-May/090766.html]
|
||||
|
||||
[1] https://bugs.busybox.net/show_bug.cgi?id=15871#c6
|
||||
|
||||
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
|
||||
(cherry picked from commit 1714301c405ef03b39605c85c23f22a190cddd95)
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
editors/awk.c | 18 ++++++++++++++----
|
||||
testsuite/awk.tests | 9 +++++++--
|
||||
2 files changed, 21 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/editors/awk.c b/editors/awk.c
|
||||
index aff86fe..f320d8c 100644
|
||||
--- a/editors/awk.c
|
||||
+++ b/editors/awk.c
|
||||
@@ -442,9 +442,10 @@ static const uint32_t tokeninfo[] ALIGN4 = {
|
||||
#define TI_PREINC (OC_UNARY|xV|P(9)|'P')
|
||||
#define TI_PREDEC (OC_UNARY|xV|P(9)|'M')
|
||||
TI_PREINC, TI_PREDEC, OC_FIELD|xV|P(5),
|
||||
- OC_COMPARE|VV|P(39)|5, OC_MOVE|VV|P(38), OC_REPLACE|NV|P(38)|'+', OC_REPLACE|NV|P(38)|'-',
|
||||
- OC_REPLACE|NV|P(38)|'*', OC_REPLACE|NV|P(38)|'/', OC_REPLACE|NV|P(38)|'%', OC_REPLACE|NV|P(38)|'&',
|
||||
- OC_BINARY|NV|P(29)|'+', OC_BINARY|NV|P(29)|'-', OC_REPLACE|NV|P(38)|'&', OC_BINARY|NV|P(15)|'&',
|
||||
+#define TI_ASSIGN (OC_MOVE|VV|P(74))
|
||||
+ OC_COMPARE|VV|P(39)|5, TI_ASSIGN, OC_REPLACE|NV|P(74)|'+', OC_REPLACE|NV|P(74)|'-',
|
||||
+ OC_REPLACE|NV|P(74)|'*', OC_REPLACE|NV|P(74)|'/', OC_REPLACE|NV|P(74)|'%', OC_REPLACE|NV|P(74)|'&',
|
||||
+ OC_BINARY|NV|P(29)|'+', OC_BINARY|NV|P(29)|'-', OC_REPLACE|NV|P(74)|'&', OC_BINARY|NV|P(15)|'&',
|
||||
OC_BINARY|NV|P(25)|'/', OC_BINARY|NV|P(25)|'%', OC_BINARY|NV|P(15)|'&', OC_BINARY|NV|P(25)|'*',
|
||||
OC_COMPARE|VV|P(39)|4, OC_COMPARE|VV|P(39)|3, OC_COMPARE|VV|P(39)|0, OC_COMPARE|VV|P(39)|1,
|
||||
#define TI_LESS (OC_COMPARE|VV|P(39)|2)
|
||||
@@ -1376,11 +1377,19 @@ static node *parse_expr(uint32_t term_tc)
|
||||
continue;
|
||||
}
|
||||
if (tc & (TS_BINOP | TC_UOPPOST)) {
|
||||
+ int prio;
|
||||
debug_printf_parse("%s: TS_BINOP | TC_UOPPOST tc:%x\n", __func__, tc);
|
||||
/* for binary and postfix-unary operators, jump back over
|
||||
* previous operators with higher priority */
|
||||
vn = cn;
|
||||
- while (((t_info & PRIMASK) > (vn->a.n->info & PRIMASK2))
|
||||
+ /* Let assignment get higher priority when used on right
|
||||
+ * side in compare. i.e: 2==v=3 */
|
||||
+ if (t_info == TI_ASSIGN && (vn->a.n->info & OPCLSMASK) == OC_COMPARE) {
|
||||
+ prio = PRECEDENCE(38);
|
||||
+ } else {
|
||||
+ prio = (t_info & PRIMASK);
|
||||
+ }
|
||||
+ while ((prio > (vn->a.n->info & PRIMASK2))
|
||||
|| (t_info == vn->info && t_info == TI_COLON)
|
||||
) {
|
||||
vn = vn->a.n;
|
||||
@@ -1412,6 +1421,7 @@ static node *parse_expr(uint32_t term_tc)
|
||||
if ((vn->info & OPCLSMASK) != OC_VAR
|
||||
&& (vn->info & OPCLSMASK) != OC_FNARG
|
||||
&& (vn->info & OPCLSMASK) != OC_FIELD
|
||||
+ && (vn->info & OPCLSMASK) != OC_COMPARE
|
||||
) {
|
||||
syntax_error(EMSG_UNEXP_TOKEN); /* no. bad */
|
||||
}
|
||||
diff --git a/testsuite/awk.tests b/testsuite/awk.tests
|
||||
index a78fdcd..d2706de 100755
|
||||
--- a/testsuite/awk.tests
|
||||
+++ b/testsuite/awk.tests
|
||||
@@ -540,9 +540,14 @@ testing 'awk assign while assign' \
|
||||
│ trim/eff : 57.02%/26, 0.00% │ [cpu000:100%]
|
||||
└────────────────────────────────────────────────────┘^C"
|
||||
|
||||
-testing "awk = has higher precedence than == (despite what gawk manpage claims)" \
|
||||
+testing "awk = has higher precedence than == on right side" \
|
||||
"awk 'BEGIN { v=1; print 2==v; print 2==v=2; print v; print v=3==3; print v}'" \
|
||||
- '0\n1\n2\n1\n3\n' \
|
||||
+ '0\n1\n2\n1\n1\n' \
|
||||
+ '' ''
|
||||
+
|
||||
+testing 'awk ternary precedence' \
|
||||
+ "awk 'BEGIN { a = 0 ? \"yes\": \"no\"; print a }'" \
|
||||
+ 'no\n' \
|
||||
'' ''
|
||||
|
||||
exit $FAILCOUNT
|
||||
@@ -0,0 +1,69 @@
|
||||
From 812b407e545b70b16cf32aade135b5c32eaf674f Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Sun, 3 Apr 2022 12:16:45 +0000
|
||||
Subject: [PATCH 2/2] nslookup: sanitize all printed strings with
|
||||
printable_string
|
||||
|
||||
Otherwise, terminal sequences can be injected, which enables various terminal injection
|
||||
attacks from DNS results.
|
||||
|
||||
CVE: CVE-2022-28391
|
||||
Upstream-Status: Submitted [https://bugs.busybox.net/show_bug.cgi?id=15001]
|
||||
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Signed-off-by: Steve Sakoman <steve@sakoman.com>
|
||||
---
|
||||
networking/nslookup.c | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/networking/nslookup.c b/networking/nslookup.c
|
||||
index 6da97baf4..4bdcde1b8 100644
|
||||
--- a/networking/nslookup.c
|
||||
+++ b/networking/nslookup.c
|
||||
@@ -407,7 +407,7 @@ static NOINLINE int parse_reply(const unsigned char *msg, size_t len)
|
||||
//printf("Unable to uncompress domain: %s\n", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
- printf(format, ns_rr_name(rr), dname);
|
||||
+ printf(format, ns_rr_name(rr), printable_string(dname));
|
||||
break;
|
||||
|
||||
case ns_t_mx:
|
||||
@@ -422,7 +422,7 @@ static NOINLINE int parse_reply(const unsigned char *msg, size_t len)
|
||||
//printf("Cannot uncompress MX domain: %s\n", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
- printf("%s\tmail exchanger = %d %s\n", ns_rr_name(rr), n, dname);
|
||||
+ printf("%s\tmail exchanger = %d %s\n", ns_rr_name(rr), n, printable_string(dname));
|
||||
break;
|
||||
|
||||
case ns_t_txt:
|
||||
@@ -434,7 +434,7 @@ static NOINLINE int parse_reply(const unsigned char *msg, size_t len)
|
||||
if (n > 0) {
|
||||
memset(dname, 0, sizeof(dname));
|
||||
memcpy(dname, ns_rr_rdata(rr) + 1, n);
|
||||
- printf("%s\ttext = \"%s\"\n", ns_rr_name(rr), dname);
|
||||
+ printf("%s\ttext = \"%s\"\n", ns_rr_name(rr), printable_string(dname));
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -454,7 +454,7 @@ static NOINLINE int parse_reply(const unsigned char *msg, size_t len)
|
||||
}
|
||||
|
||||
printf("%s\tservice = %u %u %u %s\n", ns_rr_name(rr),
|
||||
- ns_get16(cp), ns_get16(cp + 2), ns_get16(cp + 4), dname);
|
||||
+ ns_get16(cp), ns_get16(cp + 2), ns_get16(cp + 4), printable_string(dname));
|
||||
break;
|
||||
|
||||
case ns_t_soa:
|
||||
@@ -483,7 +483,7 @@ static NOINLINE int parse_reply(const unsigned char *msg, size_t len)
|
||||
return -1;
|
||||
}
|
||||
|
||||
- printf("\tmail addr = %s\n", dname);
|
||||
+ printf("\tmail addr = %s\n", printable_string(dname));
|
||||
cp += n;
|
||||
|
||||
printf("\tserial = %lu\n", ns_get32(cp));
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@@ -0,0 +1,151 @@
|
||||
From 5dcc443dba039b305a510c01883e9f34e42656ae Mon Sep 17 00:00:00 2001
|
||||
From: Denys Vlasenko <vda.linux@googlemail.com>
|
||||
Date: Fri, 26 May 2023 19:36:58 +0200
|
||||
Subject: [PATCH] awk: fix use-after-realloc (CVE-2021-42380), closes 15601
|
||||
|
||||
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
||||
|
||||
CVE: CVE-2021-42380
|
||||
Upstream-Status: Backport [https://git.busybox.net/busybox/commit/?id=5dcc443dba039b305a510c01883e9f34e42656ae]
|
||||
Signed-off-by: Peter Marko <peter.marko@siemens.com>
|
||||
---
|
||||
editors/awk.c | 26 ++++++++++++++++-----
|
||||
testsuite/awk.tests | 55 +++++++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 75 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/editors/awk.c b/editors/awk.c
|
||||
index 728ee8685..2af823808 100644
|
||||
--- a/editors/awk.c
|
||||
+++ b/editors/awk.c
|
||||
@@ -555,7 +555,7 @@ struct globals {
|
||||
const char *g_progname;
|
||||
int g_lineno;
|
||||
int nfields;
|
||||
- int maxfields; /* used in fsrealloc() only */
|
||||
+ unsigned maxfields;
|
||||
var *Fields;
|
||||
char *g_pos;
|
||||
char g_saved_ch;
|
||||
@@ -1931,9 +1931,9 @@ static void fsrealloc(int size)
|
||||
{
|
||||
int i, newsize;
|
||||
|
||||
- if (size >= maxfields) {
|
||||
- /* Sanity cap, easier than catering for overflows */
|
||||
- if (size > 0xffffff)
|
||||
+ if ((unsigned)size >= maxfields) {
|
||||
+ /* Sanity cap, easier than catering for over/underflows */
|
||||
+ if ((unsigned)size > 0xffffff)
|
||||
bb_die_memory_exhausted();
|
||||
|
||||
i = maxfields;
|
||||
@@ -2891,6 +2891,7 @@ static var *evaluate(node *op, var *res)
|
||||
uint32_t opinfo;
|
||||
int opn;
|
||||
node *op1;
|
||||
+ var *old_Fields_ptr;
|
||||
|
||||
opinfo = op->info;
|
||||
opn = (opinfo & OPNMASK);
|
||||
@@ -2899,10 +2900,16 @@ static var *evaluate(node *op, var *res)
|
||||
debug_printf_eval("opinfo:%08x opn:%08x\n", opinfo, opn);
|
||||
|
||||
/* execute inevitable things */
|
||||
+ old_Fields_ptr = NULL;
|
||||
if (opinfo & OF_RES1) {
|
||||
if ((opinfo & OF_REQUIRED) && !op1)
|
||||
syntax_error(EMSG_TOO_FEW_ARGS);
|
||||
L.v = evaluate(op1, TMPVAR0);
|
||||
+ /* Does L.v point to $n variable? */
|
||||
+ if ((size_t)(L.v - Fields) < maxfields) {
|
||||
+ /* yes, remember where Fields[] is */
|
||||
+ old_Fields_ptr = Fields;
|
||||
+ }
|
||||
if (opinfo & OF_STR1) {
|
||||
L.s = getvar_s(L.v);
|
||||
debug_printf_eval("L.s:'%s'\n", L.s);
|
||||
@@ -2921,8 +2928,15 @@ static var *evaluate(node *op, var *res)
|
||||
*/
|
||||
if (opinfo & OF_RES2) {
|
||||
R.v = evaluate(op->r.n, TMPVAR1);
|
||||
- //TODO: L.v may be invalid now, set L.v to NULL to catch bugs?
|
||||
- //L.v = NULL;
|
||||
+ /* Seen in $5=$$5=$0:
|
||||
+ * Evaluation of R.v ($$5=$0 expression)
|
||||
+ * made L.v ($5) invalid. It's detected here.
|
||||
+ */
|
||||
+ if (old_Fields_ptr) {
|
||||
+ //if (old_Fields_ptr != Fields)
|
||||
+ // debug_printf_eval("L.v moved\n");
|
||||
+ L.v += Fields - old_Fields_ptr;
|
||||
+ }
|
||||
if (opinfo & OF_STR2) {
|
||||
R.s = getvar_s(R.v);
|
||||
debug_printf_eval("R.s:'%s'\n", R.s);
|
||||
diff --git a/testsuite/awk.tests b/testsuite/awk.tests
|
||||
index bbf0fbff1..ddc51047b 100755
|
||||
--- a/testsuite/awk.tests
|
||||
+++ b/testsuite/awk.tests
|
||||
@@ -485,4 +485,59 @@ testing 'awk assign while test' \
|
||||
"" \
|
||||
"foo"
|
||||
|
||||
+# User-supplied bug (SEGV) example, was causing use-after-realloc
|
||||
+testing 'awk assign while assign' \
|
||||
+ "awk '\$5=\$\$5=\$0'; echo \$?" \
|
||||
+ "\
|
||||
+─ process timing ────────────────────────────────────┬─ ─ process timing ────────────────────────────────────┬─ overall results ────┐ results ────┐
|
||||
+│ run time : │ run time : 0 days, 0 hrs, 0 min, 56 sec │ cycles done : 0 │ days, 0 hrs, 0 min, 56 sec │ cycles done : 0 │
|
||||
+│ last new find │ last new find : 0 days, 0 hrs, 0 min, 1 sec │ corpus count : 208 │ 0 days, 0 hrs, 0 min, 1 sec │ corpus count : 208 │
|
||||
+│last saved crash : │last saved crash : none seen yet │saved crashes : 0 │ seen yet │saved crashes : 0 │
|
||||
+│ last saved hang │ last saved hang : none seen yet │ saved hangs : 0 │ none seen yet │ saved hangs : 0 │
|
||||
+├─ cycle progress ─────────────────────┬─ ├─ cycle progress ─────────────────────┬─ map coverage┴──────────────────────┤ coverage┴──────────────────────┤
|
||||
+│ now processing : │ now processing : 184.1 (88.5%) │ map density : 0.30% / 0.52% │ (88.5%) │ map density : 0.30% / 0.52% │ │ now processing : 184.1 (88.5%) │ map density : 0.30% / 0.52% │
|
||||
+│ runs timed out │ runs timed out : 0 (0.00%) │ count coverage : 2.18 bits/tuple │ 0 (0.00%) │ count coverage : 2.18 bits/tuple │
|
||||
+├─ stage progress ─────────────────────┼─ ├─ stage progress ─────────────────────┼─ findings in depth ─────────────────┤ in depth ─────────────────┤
|
||||
+│ now trying : │ now trying : havoc │ favored items : 43 (20.67%) │ │ favored items : 43 (20.67%) │
|
||||
+│ stage execs : │ stage execs : 11.2k/131k (8.51%) │ new edges on : 52 (25.00%) │ (8.51%) │ new edges on │ stage execs : 11.2k/131k (8.51%) │ new edges on : 52 (25.00%) │ 52 (25.00%) │
|
||||
+│ total execs : │ total execs : 179k │ total crashes : 0 (0 saved) │ │ total crashes : 0 (0 saved) │ │ total execs : 179k │ total crashes : 0 (0 saved) │
|
||||
+│ exec speed : │ exec speed : 3143/sec │ total tmouts : 0 (0 saved) │ │ total tmouts : 0 (0 saved) │ │ exec speed : 3143/sec │ total tmouts : 0 (0 saved) │
|
||||
+├─ fuzzing strategy yields ├─ fuzzing strategy yields ────────────┴─────────────┬─ item geometry ───────┤ item geometry ───────┤
|
||||
+│ bit flips : │ bit flips : 11/648, 4/638, 5/618 │ levels : 4 │ 4/638, 5/618 │ levels : │ bit flips : 11/648, 4/638, 5/618 │ levels : 4 │ │
|
||||
+│ byte flips : │ byte flips : 0/81, 0/71, 0/52 │ pending : 199 │ 0/71, 0/52 │ pending : 199 │
|
||||
+│ arithmetics : 11/4494, │ arithmetics : 11/4494, 0/1153, 0/0 │ pend fav : 35 │ 0/0 │ pend fav : 35 │
|
||||
+│ known ints : 1/448, 0/1986, 0/2288 │ own finds : 207 │ known ints : │ known ints : 1/448, 0/1986, 0/2288 │ own finds : 207 │ 0/1986, 0/2288 │ own finds : 207 │
|
||||
+│ dictionary : 0/0, │ dictionary : 0/0, 0/0, 0/0, 0/0 │ imported : 0 │ 0/0, 0/0 │ imported : 0 │
|
||||
+│havoc/splice : 142/146k, 23/7616 │havoc/splice : 142/146k, 23/7616 │ stability : 100.00% │ stability : 100.00% │
|
||||
+│py/custom/rq : unused, unused, │py/custom/rq : unused, unused, unused, unused ├───────────────────────┘ unused ├───────────────────────┘
|
||||
+│ trim/eff : 57.02%/26, │ trim/eff : 57.02%/26, 0.00% │ [cpu000:100%] │ [cpu000:100%]
|
||||
+└────────────────────────────────────────────────────┘^C └────────────────────────────────────────────────────┘^C
|
||||
+0
|
||||
+" \
|
||||
+ "" \
|
||||
+ "\
|
||||
+─ process timing ────────────────────────────────────┬─ overall results ────┐
|
||||
+│ run time : 0 days, 0 hrs, 0 min, 56 sec │ cycles done : 0 │
|
||||
+│ last new find : 0 days, 0 hrs, 0 min, 1 sec │ corpus count : 208 │
|
||||
+│last saved crash : none seen yet │saved crashes : 0 │
|
||||
+│ last saved hang : none seen yet │ saved hangs : 0 │
|
||||
+├─ cycle progress ─────────────────────┬─ map coverage┴──────────────────────┤
|
||||
+│ now processing : 184.1 (88.5%) │ map density : 0.30% / 0.52% │
|
||||
+│ runs timed out : 0 (0.00%) │ count coverage : 2.18 bits/tuple │
|
||||
+├─ stage progress ─────────────────────┼─ findings in depth ─────────────────┤
|
||||
+│ now trying : havoc │ favored items : 43 (20.67%) │
|
||||
+│ stage execs : 11.2k/131k (8.51%) │ new edges on : 52 (25.00%) │
|
||||
+│ total execs : 179k │ total crashes : 0 (0 saved) │
|
||||
+│ exec speed : 3143/sec │ total tmouts : 0 (0 saved) │
|
||||
+├─ fuzzing strategy yields ────────────┴─────────────┬─ item geometry ───────┤
|
||||
+│ bit flips : 11/648, 4/638, 5/618 │ levels : 4 │
|
||||
+│ byte flips : 0/81, 0/71, 0/52 │ pending : 199 │
|
||||
+│ arithmetics : 11/4494, 0/1153, 0/0 │ pend fav : 35 │
|
||||
+│ known ints : 1/448, 0/1986, 0/2288 │ own finds : 207 │
|
||||
+│ dictionary : 0/0, 0/0, 0/0, 0/0 │ imported : 0 │
|
||||
+│havoc/splice : 142/146k, 23/7616 │ stability : 100.00% │
|
||||
+│py/custom/rq : unused, unused, unused, unused ├───────────────────────┘
|
||||
+│ trim/eff : 57.02%/26, 0.00% │ [cpu000:100%]
|
||||
+└────────────────────────────────────────────────────┘^C"
|
||||
+
|
||||
exit $FAILCOUNT
|
||||
--
|
||||
2.30.2
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
From ca2afcbf42017d998ce3d6726f5ff5072a3fa853 Mon Sep 17 00:00:00 2001
|
||||
From: Octavio Galland <octavio.galland@canonical.com>
|
||||
Date: Tue, 13 Aug 2024 10:42:58 -0300
|
||||
Subject: shell: avoid segfault on ${0::0/0~09J}. Closes 15216
|
||||
|
||||
CVE: CVE-2022-48174
|
||||
Upstream-Status: Backport
|
||||
Signed-off-by: Victor Giraud <vgiraud.opensource@witekio.com>
|
||||
|
||||
---
|
||||
shell/math.c | 39 +++++++++++++++++++++++++++++++++++----
|
||||
1 file changed, 35 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/shell/math.c b/shell/math.c
|
||||
index 76d22c9b..727c2946 100644
|
||||
--- a/shell/math.c
|
||||
+++ b/shell/math.c
|
||||
@@ -577,6 +577,28 @@ static arith_t strto_arith_t(const char *nptr, char **endptr)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
+//TODO: much better estimation than expr_len/2? Such as:
|
||||
+//static unsigned estimate_nums_and_names(const char *expr)
|
||||
+//{
|
||||
+// unsigned count = 0;
|
||||
+// while (*(expr = skip_whitespace(expr)) != '\0') {
|
||||
+// const char *p;
|
||||
+// if (isdigit(*expr)) {
|
||||
+// while (isdigit(*++expr))
|
||||
+// continue;
|
||||
+// count++;
|
||||
+// continue;
|
||||
+// }
|
||||
+// p = endofname(expr);
|
||||
+// if (p != expr) {
|
||||
+// expr = p;
|
||||
+// count++;
|
||||
+// continue;
|
||||
+// }
|
||||
+// }
|
||||
+// return count;
|
||||
+//}
|
||||
+
|
||||
static arith_t
|
||||
evaluate_string(arith_state_t *math_state, const char *expr)
|
||||
{
|
||||
@@ -584,10 +606,12 @@ evaluate_string(arith_state_t *math_state, const char *expr)
|
||||
const char *errmsg;
|
||||
const char *start_expr = expr = skip_whitespace(expr);
|
||||
unsigned expr_len = strlen(expr) + 2;
|
||||
- /* Stack of integers */
|
||||
- /* The proof that there can be no more than strlen(startbuf)/2+1
|
||||
- * integers in any given correct or incorrect expression
|
||||
- * is left as an exercise to the reader. */
|
||||
+ /* Stack of integers/names */
|
||||
+ /* There can be no more than strlen(startbuf)/2+1
|
||||
+ * integers/names in any given correct or incorrect expression.
|
||||
+ * (modulo "09v09v09v09v09v" case,
|
||||
+ * but we have code to detect that early)
|
||||
+ */
|
||||
var_or_num_t *const numstack = alloca((expr_len / 2) * sizeof(numstack[0]));
|
||||
var_or_num_t *numstackptr = numstack;
|
||||
/* Stack of operator tokens */
|
||||
@@ -652,6 +676,13 @@ evaluate_string(arith_state_t *math_state, const char *expr)
|
||||
numstackptr->var = NULL;
|
||||
errno = 0;
|
||||
numstackptr->val = strto_arith_t(expr, (char**) &expr);
|
||||
+ /* A number can't be followed by another number, or a variable name.
|
||||
+ * We'd catch this later anyway, but this would require numstack[]
|
||||
+ * to be twice as deep to handle strings where _every_ char is
|
||||
+ * a new number or name. Example: 09v09v09v09v09v09v09v09v09v
|
||||
+ */
|
||||
+ if (isalnum(*expr) || *expr == '_')
|
||||
+ goto err;
|
||||
//bb_error_msg("val:%lld", numstackptr->val);
|
||||
if (errno)
|
||||
numstackptr->val = 0; /* bash compat */
|
||||
--
|
||||
cgit v1.2.3
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
From 9a8796436b9b0641e13480811902ea2ac57881d3 Mon Sep 17 00:00:00 2001
|
||||
From: Denys Vlasenko <vda.linux@googlemail.com>
|
||||
Date: Wed, 2 Oct 2024 10:12:05 +0200
|
||||
Subject: [PATCH] archival: disallow path traversals (CVE-2023-39810)
|
||||
|
||||
Create new configure option for archival/libarchive based extractions to
|
||||
disallow path traversals.
|
||||
As this is a paranoid option and might introduce backward
|
||||
incompatibility, default it to no.
|
||||
|
||||
Fixes: CVE-2023-39810
|
||||
|
||||
Based on the patch by Peter Kaestle <peter.kaestle@nokia.com>
|
||||
|
||||
function old new delta
|
||||
data_extract_all 921 945 +24
|
||||
strip_unsafe_prefix 101 102 +1
|
||||
------------------------------------------------------------------------------
|
||||
(add/remove: 0/0 grow/shrink: 2/0 up/down: 25/0) Total: 25 bytes
|
||||
|
||||
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
||||
|
||||
CVE: CVE-2023-39810
|
||||
Upstream-Status: Backport [https://git.busybox.net/busybox/commit/?id=9a8796436b9b0641e13480811902ea2ac57881d3]
|
||||
Signed-off-by: Peter Marko <peter.marko@siemens.com>
|
||||
---
|
||||
archival/Config.src | 11 +++++++++++
|
||||
archival/libarchive/data_extract_all.c | 8 ++++++++
|
||||
archival/libarchive/unsafe_prefix.c | 6 +++++-
|
||||
scripts/kconfig/lxdialog/check-lxdialog.sh | 2 +-
|
||||
testsuite/cpio.tests | 23 ++++++++++++++++++++++
|
||||
5 files changed, 48 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/archival/Config.src b/archival/Config.src
|
||||
index 6f4f30c43..cbcd7217c 100644
|
||||
--- a/archival/Config.src
|
||||
+++ b/archival/Config.src
|
||||
@@ -35,4 +35,15 @@ config FEATURE_LZMA_FAST
|
||||
This option reduces decompression time by about 25% at the cost of
|
||||
a 1K bigger binary.
|
||||
|
||||
+config FEATURE_PATH_TRAVERSAL_PROTECTION
|
||||
+ bool "Prevent extraction of filenames with /../ path component"
|
||||
+ default n
|
||||
+ help
|
||||
+ busybox tar and unzip remove "PREFIX/../" (if it exists)
|
||||
+ from extracted names.
|
||||
+ This option enables this behavior for all other unpacking applets,
|
||||
+ such as cpio, ar, rpm.
|
||||
+ GNU cpio 2.15 has NO such sanity check.
|
||||
+# try other archivers and document their behavior?
|
||||
+
|
||||
endmenu
|
||||
diff --git a/archival/libarchive/data_extract_all.c b/archival/libarchive/data_extract_all.c
|
||||
index 049c2c156..8a69711c1 100644
|
||||
--- a/archival/libarchive/data_extract_all.c
|
||||
+++ b/archival/libarchive/data_extract_all.c
|
||||
@@ -65,6 +65,14 @@ void FAST_FUNC data_extract_all(archive_handle_t *archive_handle)
|
||||
} while (--n != 0);
|
||||
}
|
||||
#endif
|
||||
+#if ENABLE_FEATURE_PATH_TRAVERSAL_PROTECTION
|
||||
+ /* Strip leading "/" and up to last "/../" path component */
|
||||
+ dst_name = (char *)strip_unsafe_prefix(dst_name);
|
||||
+#endif
|
||||
+// ^^^ This may be a problem if some applets do need to extract absolute names.
|
||||
+// (Probably will need to invent ARCHIVE_ALLOW_UNSAFE_NAME flag).
|
||||
+// You might think that rpm needs it, but in my tests rpm's internal cpio
|
||||
+// archive has names like "./usr/bin/FOO", not "/usr/bin/FOO".
|
||||
|
||||
if (archive_handle->ah_flags & ARCHIVE_CREATE_LEADING_DIRS) {
|
||||
char *slash = strrchr(dst_name, '/');
|
||||
diff --git a/archival/libarchive/unsafe_prefix.c b/archival/libarchive/unsafe_prefix.c
|
||||
index 33e487bf9..667081195 100644
|
||||
--- a/archival/libarchive/unsafe_prefix.c
|
||||
+++ b/archival/libarchive/unsafe_prefix.c
|
||||
@@ -14,7 +14,11 @@ const char* FAST_FUNC strip_unsafe_prefix(const char *str)
|
||||
cp++;
|
||||
continue;
|
||||
}
|
||||
- if (is_prefixed_with(cp, "/../"+1)) {
|
||||
+ /* We are called lots of times.
|
||||
+ * is_prefixed_with(cp, "../") is slower than open-coding it,
|
||||
+ * with minimal code growth (~few bytes).
|
||||
+ */
|
||||
+ if (cp[0] == '.' && cp[1] == '.' && cp[2] == '/') {
|
||||
cp += 3;
|
||||
continue;
|
||||
}
|
||||
diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh
|
||||
index 5075ebf2d..910ca1f7c 100755
|
||||
--- a/scripts/kconfig/lxdialog/check-lxdialog.sh
|
||||
+++ b/scripts/kconfig/lxdialog/check-lxdialog.sh
|
||||
@@ -55,7 +55,7 @@ trap "rm -f $tmp" 0 1 2 3 15
|
||||
check() {
|
||||
$cc -x c - -o $tmp 2>/dev/null <<'EOF'
|
||||
#include CURSES_LOC
|
||||
-main() {}
|
||||
+int main() { return 0; }
|
||||
EOF
|
||||
if [ $? != 0 ]; then
|
||||
echo " *** Unable to find the ncurses libraries or the" 1>&2
|
||||
diff --git a/testsuite/cpio.tests b/testsuite/cpio.tests
|
||||
index 85e746589..a4462c53e 100755
|
||||
--- a/testsuite/cpio.tests
|
||||
+++ b/testsuite/cpio.tests
|
||||
@@ -154,6 +154,29 @@ testing "cpio -R with extract" \
|
||||
" "" ""
|
||||
SKIP=
|
||||
|
||||
+# Create an archive containing a file with "../dont_write" filename.
|
||||
+# See that it will not be allowed to unpack.
|
||||
+# NB: GNU cpio 2.15 DOES NOT do such checks.
|
||||
+optional FEATURE_PATH_TRAVERSAL_PROTECTION
|
||||
+rm -rf cpio.testdir
|
||||
+mkdir -p cpio.testdir/prepare/inner
|
||||
+echo "file outside of destination was written" > cpio.testdir/prepare/dont_write
|
||||
+echo "data" > cpio.testdir/prepare/inner/to_extract
|
||||
+mkdir -p cpio.testdir/extract
|
||||
+testing "cpio extract file outside of destination" "\
|
||||
+(cd cpio.testdir/prepare/inner && echo -e '../dont_write\nto_extract' | cpio -o -H newc) | (cd cpio.testdir/extract && cpio -vi 2>&1)
|
||||
+echo \$?
|
||||
+ls cpio.testdir/dont_write 2>&1" \
|
||||
+"\
|
||||
+cpio: removing leading '../' from member names
|
||||
+../dont_write
|
||||
+to_extract
|
||||
+1 blocks
|
||||
+0
|
||||
+ls: cpio.testdir/dont_write: No such file or directory
|
||||
+" "" ""
|
||||
+SKIP=
|
||||
+
|
||||
# Clean up
|
||||
rm -rf cpio.testdir cpio.testdir2 2>/dev/null
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
From fb08d43d44d1fea1f741fafb9aa7e1958a5f69aa Mon Sep 17 00:00:00 2001
|
||||
From: Natanael Copa <ncopa@alpinelinux.org>
|
||||
Date: Mon, 20 May 2024 17:55:28 +0200
|
||||
Subject: [PATCH] awk: fix use after free (CVE-2023-42363)
|
||||
|
||||
function old new delta
|
||||
evaluate 3377 3385 +8
|
||||
|
||||
Fixes https://bugs.busybox.net/show_bug.cgi?id=15865
|
||||
|
||||
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
|
||||
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
||||
|
||||
CVE: CVE-2023-42363
|
||||
Upstream-Status: Backport [https://git.busybox.net/busybox/commit/?id=fb08d43d44d1fea1f741fafb9aa7e1958a5f69aa]
|
||||
Signed-off-by: Peter Marko <peter.marko@siemens.com>
|
||||
---
|
||||
editors/awk.c | 21 +++++++++++++--------
|
||||
1 file changed, 13 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/editors/awk.c b/editors/awk.c
|
||||
index 0981c6735..ff6d6350b 100644
|
||||
--- a/editors/awk.c
|
||||
+++ b/editors/awk.c
|
||||
@@ -2910,19 +2910,14 @@ static var *evaluate(node *op, var *res)
|
||||
/* yes, remember where Fields[] is */
|
||||
old_Fields_ptr = Fields;
|
||||
}
|
||||
- if (opinfo & OF_STR1) {
|
||||
- L.s = getvar_s(L.v);
|
||||
- debug_printf_eval("L.s:'%s'\n", L.s);
|
||||
- }
|
||||
if (opinfo & OF_NUM1) {
|
||||
L_d = getvar_i(L.v);
|
||||
debug_printf_eval("L_d:%f\n", L_d);
|
||||
}
|
||||
}
|
||||
- /* NB: Must get string/numeric values of L (done above)
|
||||
- * _before_ evaluate()'ing R.v: if both L and R are $NNNs,
|
||||
- * and right one is large, then L.v points to Fields[NNN1],
|
||||
- * second evaluate() reallocates and moves (!) Fields[],
|
||||
+ /* NB: if both L and R are $NNNs, and right one is large,
|
||||
+ * then at this pint L.v points to Fields[NNN1], second
|
||||
+ * evaluate() below reallocates and moves (!) Fields[],
|
||||
* R.v points to Fields[NNN2] but L.v now points to freed mem!
|
||||
* (Seen trying to evaluate "$444 $44444")
|
||||
*/
|
||||
@@ -2942,6 +2937,16 @@ static var *evaluate(node *op, var *res)
|
||||
debug_printf_eval("R.s:'%s'\n", R.s);
|
||||
}
|
||||
}
|
||||
+ /* Get L.s _after_ R.v is evaluated: it may have realloc'd L.v
|
||||
+ * so we must get the string after "old_Fields_ptr" correction
|
||||
+ * above. Testcase: x = (v = "abc", gsub("b", "X", v));
|
||||
+ */
|
||||
+ if (opinfo & OF_RES1) {
|
||||
+ if (opinfo & OF_STR1) {
|
||||
+ L.s = getvar_s(L.v);
|
||||
+ debug_printf_eval("L.s:'%s'\n", L.s);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
debug_printf_eval("switch(0x%x)\n", XC(opinfo & OPCLSMASK));
|
||||
switch (XC(opinfo & OPCLSMASK)) {
|
||||
--
|
||||
2.30.2
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
From: Jason Wessel <jason.wessel@windriver.com>
|
||||
Date: Sun, 3 Mar 2013 12:31:40 -0600
|
||||
Subject: [PATCH] menuconfig,check-lxdiaglog.sh: Allow specification of ncurses location
|
||||
|
||||
Upstream-Status: Submitted
|
||||
|
||||
[ based on: https://lkml.org/lkml/2013/3/3/103 ]
|
||||
|
||||
This patch syncs up with the way the menuconfig ncurses / curses
|
||||
is detected and the HOST_EXTRACFLAGS works in the Linux kernel
|
||||
and it allows the menuconfig to work with a sysroot version
|
||||
of the curses libraries.
|
||||
|
||||
---
|
||||
|
||||
In some cross build environments such as the Yocto Project build
|
||||
environment it provides an ncurses library that is compiled
|
||||
differently than the host's version. This causes display corruption
|
||||
problems when the host's curses includes are used instead of the
|
||||
includes from the provided compiler are overridden. There is a second
|
||||
case where there is no curses libraries at all on the host system and
|
||||
menuconfig will just fail entirely.
|
||||
|
||||
The solution is simply to allow an override variable in
|
||||
check-lxdialog.sh for environments such as the Yocto Project. Adding
|
||||
a CROSS_CURSES_LIB and CROSS_CURSES_INC solves the issue and allowing
|
||||
compiling and linking against the right headers and libraries.
|
||||
|
||||
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
|
||||
cc: Michal Marek <mmarek@suse.cz>
|
||||
cc: linux-kbuild@vger.kernel.org
|
||||
---
|
||||
scripts/kconfig/lxdialog/Makefile | 2 +-
|
||||
scripts/kconfig/lxdialog/check-lxdialog.sh | 8 ++++++++
|
||||
2 files changed, 9 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/scripts/kconfig/lxdialog/check-lxdialog.sh
|
||||
+++ b/scripts/kconfig/lxdialog/check-lxdialog.sh
|
||||
@@ -4,6 +4,10 @@
|
||||
# What library to link
|
||||
ldflags()
|
||||
{
|
||||
+ if [ x"$CROSS_CURSES_LIB" != x ]; then
|
||||
+ echo "$CROSS_CURSES_LIB"
|
||||
+ exit
|
||||
+ fi
|
||||
pkg-config --libs ncursesw 2>/dev/null && exit
|
||||
pkg-config --libs ncurses 2>/dev/null && exit
|
||||
for ext in so a dll.a dylib ; do
|
||||
@@ -21,6 +25,10 @@
|
||||
# Where is ncurses.h?
|
||||
ccflags()
|
||||
{
|
||||
+ if [ x"$CROSS_CURSES_INC" != x ]; then
|
||||
+ echo "$CROSS_CURSES_INC"
|
||||
+ exit
|
||||
+ fi
|
||||
if pkg-config --cflags ncursesw 2>/dev/null; then
|
||||
echo '-DCURSES_LOC="<ncurses.h>" -DNCURSES_WIDECHAR=1'
|
||||
elif pkg-config --cflags ncurses 2>/dev/null; then
|
||||
--- a/scripts/kconfig/lxdialog/Makefile
|
||||
+++ b/scripts/kconfig/lxdialog/Makefile
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
# Use reursively expanded variables so we do not call gcc unless
|
||||
# we really need to do so. (Do not call gcc as part of make mrproper)
|
||||
-HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
|
||||
+HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
|
||||
HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
|
||||
|
||||
HOST_EXTRACFLAGS += -DLOCALE
|
||||
@@ -0,0 +1,87 @@
|
||||
From 53626cd06a3ef05ed847daea802ef0aa9661caa7 Mon Sep 17 00:00:00 2001
|
||||
From: Anders Darander <anders@chargestorm.se>
|
||||
Date: Thu, 3 Nov 2011 08:51:31 +0100
|
||||
Subject: [PATCH] busybox-udhcpc-no_deconfig.patch
|
||||
|
||||
Upstream-Status: Pending
|
||||
|
||||
Add a new option -D to the udhcpc client that allows for
|
||||
dhcp renewal to occur without having to down the interface
|
||||
in the process.
|
||||
|
||||
Signed-off-by: Greg Moffatt <greg.moffatt@windriver.com>
|
||||
|
||||
Updated to latest Busybox 1.17.3
|
||||
|
||||
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
||||
|
||||
Updated to Busybox 1.18.4
|
||||
option spec is changed
|
||||
|
||||
Signed-off-by: Qing He <qing.he@intel.com>
|
||||
|
||||
Updated to Busybox 1.19.3
|
||||
|
||||
Signed-off-by: Anders Darander <anders@chargestorm.se>
|
||||
|
||||
Fixed options -b, -a and -P.
|
||||
|
||||
Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
|
||||
---
|
||||
networking/udhcp/dhcpc.c | 29 ++++++++++++++++------
|
||||
1 file changed, 21 insertions(+), 8 deletions(-)
|
||||
|
||||
Index: busybox-1.34.0/networking/udhcp/dhcpc.c
|
||||
===================================================================
|
||||
--- busybox-1.34.0.orig/networking/udhcp/dhcpc.c
|
||||
+++ busybox-1.34.0/networking/udhcp/dhcpc.c
|
||||
@@ -48,6 +48,8 @@
|
||||
};
|
||||
#endif
|
||||
|
||||
+/* option whether to down the interface when reconfiguring */
|
||||
+static int allow_deconfig = 1;
|
||||
|
||||
/* "struct client_data_t client_data" is in bb_common_bufsiz1 */
|
||||
|
||||
@@ -100,8 +102,10 @@
|
||||
OPT_x = 1 << 16,
|
||||
OPT_f = 1 << 17,
|
||||
OPT_B = 1 << 18,
|
||||
+ OPT_D = 1 << 19,
|
||||
/* The rest has variable bit positions, need to be clever */
|
||||
OPTBIT_B = 18,
|
||||
+ OPTBIT_D = 19,
|
||||
USE_FOR_MMU( OPTBIT_b,)
|
||||
IF_FEATURE_UDHCPC_ARPING(OPTBIT_a,)
|
||||
IF_FEATURE_UDHCP_PORT( OPTBIT_P,)
|
||||
@@ -587,7 +591,8 @@
|
||||
|
||||
static void d4_run_script_deconfig(void)
|
||||
{
|
||||
- d4_run_script(NULL, "deconfig");
|
||||
+ if (allow_deconfig)
|
||||
+ d4_run_script(NULL, "deconfig");
|
||||
}
|
||||
|
||||
/*** Sending/receiving packets ***/
|
||||
@@ -1244,7 +1249,7 @@
|
||||
/* Parse command line */
|
||||
opt = getopt32long(argv, "^"
|
||||
/* O,x: list; -T,-t,-A take numeric param */
|
||||
- "CV:F:i:np:qRr:s:T:+t:+SA:+O:*ox:*fB"
|
||||
+ "CV:F:i:np:qRr:s:T:+t:+SA:+O:*ox:*fBD"
|
||||
USE_FOR_MMU("b")
|
||||
IF_FEATURE_UDHCPC_ARPING("a::")
|
||||
IF_FEATURE_UDHCP_PORT("P:")
|
||||
@@ -1361,6 +1366,10 @@
|
||||
logmode |= LOGMODE_SYSLOG;
|
||||
}
|
||||
|
||||
+ if (opt & OPT_D) {
|
||||
+ allow_deconfig = 0;
|
||||
+ }
|
||||
+
|
||||
/* Create pidfile */
|
||||
write_pidfile(client_data.pidfile);
|
||||
/* Goes to stdout (unless NOMMU) and possibly syslog */
|
||||
1223
sources/poky/meta/recipes-core/busybox/busybox/defconfig
Normal file
1223
sources/poky/meta/recipes-core/busybox/busybox/defconfig
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,40 @@
|
||||
From a35e79002d36cca3c272ba5625aec86d6b7a38a8 Mon Sep 17 00:00:00 2001
|
||||
From: Saul Wold <sgw@linux.intel.com>
|
||||
Date: Tue, 9 Apr 2013 23:25:54 -0700
|
||||
Subject: [PATCH] busybox: fail on no media
|
||||
|
||||
Upstream-Status: Denied
|
||||
[https://www.mail-archive.com/busybox@busybox.net/msg22354.html]
|
||||
|
||||
The current behaviour of busybox is to try all fstype when automounting
|
||||
even when no media exists. The util-linux mount command bails when no
|
||||
media exists, so change the behaviour of busybox to do the same.
|
||||
|
||||
It could also be argued that the KERN_INFO message from btrfs could be
|
||||
removed, but that would be harder to accomplish.
|
||||
|
||||
Signed-off-by: Saul Wold <sgw@linux.intel.com>
|
||||
|
||||
---
|
||||
util-linux/mount.c | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/util-linux/mount.c b/util-linux/mount.c
|
||||
index 4e65b6b..9d7a566 100644
|
||||
--- a/util-linux/mount.c
|
||||
+++ b/util-linux/mount.c
|
||||
@@ -746,6 +746,14 @@ static int mount_it_now(struct mntent *mp, unsigned long vfsflags, char *filtero
|
||||
errno = errno_save;
|
||||
}
|
||||
|
||||
+ /*
|
||||
+ * Break if there is no media, no point retrying for all
|
||||
+ * fs types since there is no media available
|
||||
+ */
|
||||
+ if (rc == -1 && errno == ENOMEDIUM) {
|
||||
+ bb_perror_msg_and_die("mounting %s on %s failed", mp->mnt_fsname, mp->mnt_dir);
|
||||
+ }
|
||||
+
|
||||
// Should we retry read-only mount?
|
||||
if (vfsflags & MS_RDONLY)
|
||||
break; // no, already was tried
|
||||
@@ -0,0 +1,3 @@
|
||||
CONFIG_GETOPT=y
|
||||
CONFIG_LONG_OPTS=y
|
||||
CONFIG_FEATURE_GETOPT_LONG=y
|
||||
8
sources/poky/meta/recipes-core/busybox/busybox/init.cfg
Normal file
8
sources/poky/meta/recipes-core/busybox/busybox/init.cfg
Normal file
@@ -0,0 +1,8 @@
|
||||
CONFIG_INIT=y
|
||||
CONFIG_RUNLEVEL=y
|
||||
CONFIG_FEATURE_USE_INITTAB=y
|
||||
CONFIG_HALT=y
|
||||
CONFIG_POWEROFF=y
|
||||
CONFIG_FEATURE_KILL_DELAY=0
|
||||
CONFIG_TELINIT_PATH=""
|
||||
CONFIG_INIT_TERMINAL_TYPE=""
|
||||
@@ -0,0 +1,13 @@
|
||||
CONFIG_FEATURE_SHADOWPASSWDS=y
|
||||
CONFIG_ADDUSER=y
|
||||
CONFIG_FEATURE_ADDUSER_LONG_OPTIONS=y
|
||||
CONFIG_ADDGROUP=y
|
||||
CONFIG_FEATURE_ADDGROUP_LONG_OPTIONS=y
|
||||
CONFIG_DELUSER=y
|
||||
CONFIG_DELGROUP=y
|
||||
CONFIG_GETTY=y
|
||||
CONFIG_LOGIN=y
|
||||
CONFIG_PASSWD=y
|
||||
CONFIG_SU=y
|
||||
CONFIG_SULOGIN=y
|
||||
CONFIG_VLOCK=y
|
||||
15
sources/poky/meta/recipes-core/busybox/busybox/longopts.cfg
Normal file
15
sources/poky/meta/recipes-core/busybox/busybox/longopts.cfg
Normal file
@@ -0,0 +1,15 @@
|
||||
CONFIG_FEATURE_GUNZIP_LONG_OPTIONS=y
|
||||
CONFIG_FEATURE_GZIP_LONG_OPTIONS=y
|
||||
CONFIG_FEATURE_TAR_LONG_OPTIONS=y
|
||||
CONFIG_FEATURE_CHOWN_LONG_OPTIONS=y
|
||||
CONFIG_FEATURE_CP_LONG_OPTIONS=y
|
||||
CONFIG_FEATURE_INSTALL_LONG_OPTIONS=y
|
||||
CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS=y
|
||||
CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS=y
|
||||
CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS=y
|
||||
CONFIG_FEATURE_DIFF_LONG_OPTIONS=y
|
||||
CONFIG_FEATURE_BC_LONG_OPTIONS=y
|
||||
CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS=y
|
||||
CONFIG_FEATURE_IPCALC_LONG_OPTIONS=y
|
||||
CONFIG_FEATURE_NSLOOKUP_LONG_OPTIONS=y
|
||||
CONFIG_FEATURE_WGET_LONG_OPTIONS=y
|
||||
@@ -0,0 +1,34 @@
|
||||
There is a potential race when building libbb, as some header files
|
||||
needed by libbb are not generated yet (or are being modified) at the time
|
||||
libbb is compiled.
|
||||
This patch avoids this scenario by building libbb as the last directory.
|
||||
|
||||
Upstream-Status: Submitted
|
||||
Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
|
||||
|
||||
Index: busybox-1.24.1/Makefile
|
||||
===================================================================
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 5cfc763..69f3831 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -738,9 +738,18 @@ $(sort $(busybox-all)): $(busybox-dirs) ;
|
||||
# Error messages still appears in the original language
|
||||
|
||||
PHONY += $(busybox-dirs)
|
||||
-$(busybox-dirs): prepare scripts
|
||||
+
|
||||
+libbb-dir = $(filter libbb,$(busybox-dirs))
|
||||
+busybox-dirs1 = $(filter-out libbb,$(busybox-dirs))
|
||||
+
|
||||
+$(busybox-dirs1): prepare scripts
|
||||
$(Q)$(MAKE) $(build)=$@
|
||||
|
||||
+ifneq ($(libbb-dir),)
|
||||
+$(libbb-dir): | $(busybox-dirs1)
|
||||
+ $(Q)$(MAKE) $(build)=$@
|
||||
+endif
|
||||
+
|
||||
# Build the kernel release string
|
||||
# The KERNELRELEASE is stored in a file named .kernelrelease
|
||||
# to be used when executing for example make install or make modules_install
|
||||
13
sources/poky/meta/recipes-core/busybox/busybox/mdev.cfg
Normal file
13
sources/poky/meta/recipes-core/busybox/busybox/mdev.cfg
Normal file
@@ -0,0 +1,13 @@
|
||||
CONFIG_MDEV=y
|
||||
CONFIG_FEATURE_MDEV_CONF=y
|
||||
CONFIG_FEATURE_MDEV_RENAME=y
|
||||
CONFIG_FEATURE_MDEV_RENAME_REGEXP=y
|
||||
CONFIG_FEATURE_MDEV_EXEC=y
|
||||
CONFIG_FEATURE_MDEV_LOAD_FIRMWARE=y
|
||||
|
||||
CONFIG_SETSID=y
|
||||
CONFIG_CTTYHACK=y
|
||||
|
||||
CONFIG_FEATURE_SHADOWPASSWDS=y
|
||||
CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y
|
||||
CONFIG_FEATURE_MDEV_DAEMON=y
|
||||
@@ -0,0 +1,11 @@
|
||||
CONFIG_BLKID=y
|
||||
CONFIG_FEATURE_BLKID_TYPE=y
|
||||
CONFIG_FEATURE_MOUNT_LABEL=y
|
||||
CONFIG_FEATURE_SWAPONOFF_LABEL=y
|
||||
CONFIG_VOLUMEID=y
|
||||
CONFIG_FEATURE_VOLUMEID_BTRFS=y
|
||||
CONFIG_FEATURE_VOLUMEID_EXT=y
|
||||
CONFIG_FEATURE_VOLUMEID_F2FS=y
|
||||
CONFIG_FEATURE_VOLUMEID_FAT=y
|
||||
CONFIG_FEATURE_VOLUMEID_SQUASHFS=y
|
||||
CONFIG_FEATURE_VOLUMEID_LINUXSWAP=y
|
||||
10
sources/poky/meta/recipes-core/busybox/busybox/musl.cfg
Normal file
10
sources/poky/meta/recipes-core/busybox/busybox/musl.cfg
Normal file
@@ -0,0 +1,10 @@
|
||||
# CONFIG_EXTRA_COMPAT is not set
|
||||
# CONFIG_SELINUX is not set
|
||||
# CONFIG_FEATURE_HAVE_RPC is not set
|
||||
# CONFIG_WERROR is not set
|
||||
# CONFIG_FEATURE_VI_REGEX_SEARCH is not set
|
||||
# CONFIG_PAM is not set
|
||||
# CONFIG_FEATURE_INETD_RPC is not set
|
||||
# CONFIG_SELINUXENABLED is not set
|
||||
# CONFIG_FEATURE_MOUNT_NFS is not set
|
||||
|
||||
1
sources/poky/meta/recipes-core/busybox/busybox/pgrep.cfg
Normal file
1
sources/poky/meta/recipes-core/busybox/busybox/pgrep.cfg
Normal file
@@ -0,0 +1 @@
|
||||
CONFIG_PGREP=y
|
||||
@@ -0,0 +1,21 @@
|
||||
This adds connmand to the list of know dhcp clients
|
||||
|
||||
Upstream-Status: Inappropriate [OE-Core]
|
||||
|
||||
Signed-off-by: Saul Wold <sgw@linux.intel.com>
|
||||
|
||||
Index: busybox-1.36.0/networking/ifupdown.c
|
||||
===================================================================
|
||||
--- busybox-1.36.0.orig/networking/ifupdown.c
|
||||
+++ busybox-1.36.0/networking/ifupdown.c
|
||||
@@ -628,6 +628,10 @@ struct dhcp_client_t {
|
||||
};
|
||||
|
||||
static const struct dhcp_client_t ext_dhcp_clients[] ALIGN_PTR = {
|
||||
+ { "connmand",
|
||||
+ "true",
|
||||
+ "true",
|
||||
+ },
|
||||
{ "dhcpcd",
|
||||
"dhcpcd[[ -h %hostname%]][[ -i %vendor%]][[ -I %client%]][[ -l %leasetime%]] %iface%",
|
||||
"dhcpcd -k %iface%",
|
||||
@@ -0,0 +1,2 @@
|
||||
CONFIG_RESIZE=y
|
||||
CONFIG_FEATURE_RESIZE_PRINT=y
|
||||
1
sources/poky/meta/recipes-core/busybox/busybox/rev.cfg
Normal file
1
sources/poky/meta/recipes-core/busybox/busybox/rev.cfg
Normal file
@@ -0,0 +1 @@
|
||||
CONFIG_REV=y
|
||||
@@ -0,0 +1,2 @@
|
||||
CONFIG_SHA1SUM=y
|
||||
CONFIG_SHA1_SMALL=3
|
||||
@@ -0,0 +1 @@
|
||||
CONFIG_SHA256SUM=y
|
||||
@@ -0,0 +1,2 @@
|
||||
# CONFIG_SHA256_HWACCEL is not set
|
||||
# CONFIG_SHA1_HWACCEL is not set
|
||||
@@ -0,0 +1,35 @@
|
||||
It's known that the final start-stop-daemon test fails if /bin/false is
|
||||
actually a busybox symlink. Instead of failing, check if false is
|
||||
busybox and adapt the expected output to match.
|
||||
|
||||
Upstream-Status: Submitted [http://lists.busybox.net/pipermail/busybox/2023-August/090416.html]
|
||||
Signed-off-by: Ross Burton <ross.burton@arm.com>
|
||||
|
||||
diff --git a/testsuite/start-stop-daemon.tests b/testsuite/start-stop-daemon.tests
|
||||
index 0757b1288..aa6e9cc41 100755
|
||||
--- a/testsuite/start-stop-daemon.tests
|
||||
+++ b/testsuite/start-stop-daemon.tests
|
||||
@@ -27,10 +27,18 @@ testing "start-stop-daemon without -x and -a" \
|
||||
# but at least it checks that pathname to exec() is correct
|
||||
#
|
||||
# NB: this fails if /bin/false is a busybox symlink:
|
||||
-# busybox looks at argv[0] and says "qwerty: applet not found"
|
||||
-testing "start-stop-daemon with both -x and -a" \
|
||||
- 'start-stop-daemon -S -x /bin/false -a qwerty false 2>&1; echo $?' \
|
||||
- "1\n" \
|
||||
- "" ""
|
||||
+# busybox looks at argv[0] and says "qwerty: applet not found", so
|
||||
+# skip the test if false is busybox.
|
||||
+case $(readlink /bin/false) in
|
||||
+ *busybox*)
|
||||
+ echo "SKIPPED: start-stop-daemon with both -x and -a (need non-busybox false)"
|
||||
+ ;;
|
||||
+ *)
|
||||
+ testing "start-stop-daemon with both -x and -a" \
|
||||
+ 'start-stop-daemon -S -x /bin/false -a qwerty false 2>&1; echo $?' \
|
||||
+ "1\n" \
|
||||
+ "" ""
|
||||
+ ;;
|
||||
+esac
|
||||
|
||||
exit $FAILCOUNT
|
||||
11
sources/poky/meta/recipes-core/busybox/busybox/syslog.cfg
Normal file
11
sources/poky/meta/recipes-core/busybox/busybox/syslog.cfg
Normal file
@@ -0,0 +1,11 @@
|
||||
CONFIG_SYSLOGD=y
|
||||
CONFIG_FEATURE_ROTATE_LOGFILE=y
|
||||
CONFIG_FEATURE_REMOTE_LOG=y
|
||||
CONFIG_FEATURE_SYSLOGD_DUP=y
|
||||
CONFIG_FEATURE_SYSLOGD_CFG=y
|
||||
CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=256
|
||||
CONFIG_FEATURE_IPC_SYSLOG=y
|
||||
CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=64
|
||||
CONFIG_LOGREAD=y
|
||||
CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING=y
|
||||
CONFIG_FEATURE_KMSG_SYSLOG=y
|
||||
10
sources/poky/meta/recipes-core/busybox/busybox/unicode.cfg
Normal file
10
sources/poky/meta/recipes-core/busybox/busybox/unicode.cfg
Normal file
@@ -0,0 +1,10 @@
|
||||
CONFIG_UNICODE_SUPPORT=y
|
||||
# CONFIG_UNICODE_USING_LOCALE is not set
|
||||
CONFIG_FEATURE_CHECK_UNICODE_IN_ENV=y
|
||||
CONFIG_SUBST_WCHAR=63
|
||||
CONFIG_LAST_SUPPORTED_WCHAR=767
|
||||
CONFIG_UNICODE_COMBINING_WCHARS=y
|
||||
CONFIG_UNICODE_WIDE_WCHARS=y
|
||||
# CONFIG_UNICODE_BIDI_SUPPORT is not set
|
||||
# CONFIG_UNICODE_NEUTRAL_TABLE is not set
|
||||
# CONFIG_UNICODE_PRESERVE_BROKEN is not set
|
||||
66
sources/poky/meta/recipes-core/busybox/busybox_1.36.1.bb
Normal file
66
sources/poky/meta/recipes-core/busybox/busybox_1.36.1.bb
Normal file
@@ -0,0 +1,66 @@
|
||||
require busybox.inc
|
||||
|
||||
SRC_URI = "https://busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
|
||||
file://0001-depmod-Ignore-.debug-directories.patch \
|
||||
file://busybox-udhcpc-no_deconfig.patch \
|
||||
file://find-touchscreen.sh \
|
||||
file://busybox-cron \
|
||||
file://busybox-httpd \
|
||||
file://busybox-udhcpd \
|
||||
file://default.script \
|
||||
file://simple.script \
|
||||
file://hwclock.sh \
|
||||
file://syslog \
|
||||
file://syslog-startup.conf \
|
||||
file://syslog.conf \
|
||||
file://busybox-syslog.default \
|
||||
file://mdev \
|
||||
file://mdev.conf \
|
||||
file://mdev-mount.sh \
|
||||
file://defconfig \
|
||||
file://busybox-syslog.service.in \
|
||||
file://busybox-klogd.service.in \
|
||||
file://fail_on_no_media.patch \
|
||||
file://run-ptest \
|
||||
file://inetd.conf \
|
||||
file://inetd \
|
||||
file://login-utilities.cfg \
|
||||
file://recognize_connmand.patch \
|
||||
file://busybox-cross-menuconfig.patch \
|
||||
file://mount-via-label.cfg \
|
||||
file://sha1sum.cfg \
|
||||
file://sha256sum.cfg \
|
||||
file://getopts.cfg \
|
||||
file://longopts.cfg \
|
||||
file://resize.cfg \
|
||||
${@["", "file://init.cfg"][(d.getVar('VIRTUAL-RUNTIME_init_manager') == 'busybox')]} \
|
||||
${@["", "file://rcS.default"][(d.getVar('VIRTUAL-RUNTIME_init_manager') == 'busybox')]} \
|
||||
${@["", "file://mdev.cfg"][(d.getVar('VIRTUAL-RUNTIME_dev_manager') == 'busybox-mdev')]} \
|
||||
file://syslog.cfg \
|
||||
file://unicode.cfg \
|
||||
file://rev.cfg \
|
||||
file://pgrep.cfg \
|
||||
file://rcS \
|
||||
file://rcK \
|
||||
file://makefile-libbb-race.patch \
|
||||
file://0001-testsuite-check-uudecode-before-using-it.patch \
|
||||
file://0001-testsuite-use-www.example.org-for-wget-test-cases.patch \
|
||||
file://0001-du-l-works-fix-to-use-145-instead-of-144.patch \
|
||||
file://0001-sysctl-ignore-EIO-of-stable_secret-below-proc-sys-ne.patch \
|
||||
file://0001-libbb-sockaddr2str-ensure-only-printable-characters-.patch \
|
||||
file://0002-nslookup-sanitize-all-printed-strings-with-printable.patch \
|
||||
file://start-stop-false.patch \
|
||||
file://CVE-2021-42380.patch \
|
||||
file://0001-awk-fix-segfault-when-compiled-by-clang.patch \
|
||||
file://CVE-2023-42363.patch \
|
||||
file://0001-awk-fix-precedence-of-relative-to.patch \
|
||||
file://0002-awk-fix-ternary-operator-and-precedence-of.patch \
|
||||
file://0001-awk.c-fix-CVE-2023-42366-bug-15874.patch \
|
||||
file://0001-cut-Fix-s-flag-to-omit-blank-lines.patch \
|
||||
file://CVE-2022-48174.patch \
|
||||
file://CVE-2023-39810.patch \
|
||||
"
|
||||
SRC_URI:append:libc-musl = " file://musl.cfg "
|
||||
# TODO http://lists.busybox.net/pipermail/busybox/2023-January/090078.html
|
||||
SRC_URI:append:x86 = " file://sha_accel.cfg"
|
||||
SRC_URI[tarball.sha256sum] = "b8cc24c9574d809e7279c3be349795c5d5ceb6fdf19ca709f80cde50e47de314"
|
||||
39
sources/poky/meta/recipes-core/busybox/files/busybox-cron
Executable file
39
sources/poky/meta/recipes-core/busybox/files/busybox-cron
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
DAEMON=/usr/sbin/crond
|
||||
NAME=crond
|
||||
DESC="Busybox Periodic Command Scheduler"
|
||||
ARGS="-c /etc/cron/crontabs"
|
||||
|
||||
test -f $DAEMON || exit 0
|
||||
|
||||
set -e
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "starting $DESC: $NAME... "
|
||||
start-stop-daemon -S -b -n $NAME -a $DAEMON -- $ARGS
|
||||
echo "done."
|
||||
;;
|
||||
stop)
|
||||
echo -n "stopping $DESC: $NAME... "
|
||||
start-stop-daemon -K -n $NAME
|
||||
echo "done."
|
||||
;;
|
||||
restart)
|
||||
echo -n "restarting $DESC: $NAME... "
|
||||
$0 stop
|
||||
$0 start
|
||||
echo "done."
|
||||
;;
|
||||
reload)
|
||||
echo -n "reloading $DESC: $NAME... "
|
||||
killall -HUP $(basename ${DAEMON})
|
||||
echo "done."
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|reload}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
44
sources/poky/meta/recipes-core/busybox/files/busybox-httpd
Executable file
44
sources/poky/meta/recipes-core/busybox/files/busybox-httpd
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/bin/sh
|
||||
DAEMON=/usr/sbin/httpd
|
||||
NAME=httpd
|
||||
DESC="Busybox HTTP Daemon"
|
||||
HTTPROOT="/srv/www"
|
||||
ARGS="-h $HTTPROOT"
|
||||
|
||||
test -f $DAEMON || exit 0
|
||||
|
||||
set -e
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "starting $DESC: $NAME... "
|
||||
if [ ! -d $HTTPROOT ]; then
|
||||
echo "$HTTPROOT is missing."
|
||||
exit 1
|
||||
fi
|
||||
start-stop-daemon -S -b -n $NAME -a $DAEMON -- $ARGS
|
||||
echo "done."
|
||||
;;
|
||||
stop)
|
||||
echo -n "stopping $DESC: $NAME... "
|
||||
start-stop-daemon -K -n $NAME
|
||||
echo "done."
|
||||
;;
|
||||
restart)
|
||||
echo "restarting $DESC: $NAME... "
|
||||
$0 stop
|
||||
$0 start
|
||||
echo "done."
|
||||
;;
|
||||
reload)
|
||||
echo -n "reloading $DESC: $NAME... "
|
||||
killall -HUP $(basename ${DAEMON})
|
||||
echo "done."
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|reload}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=Kernel Logging Service
|
||||
|
||||
[Service]
|
||||
ExecStart=@base_sbindir@/klogd -n
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,25 @@
|
||||
#OPTIONS="-C"
|
||||
# The above option means syslogd will log to 16K shm circular buffer.
|
||||
# You could use `logread' to read it.
|
||||
|
||||
# All available options are:
|
||||
# -O FILE : Log to FILE (default:/var/log/messages)
|
||||
# -l N : Log only messages more urgent than prio N (1-8)
|
||||
# -S : Smaller output
|
||||
# -s SIZE : Max size (KB) before rotation (default:200KB, 0=off)
|
||||
# -b N : N rotated logs to keep (default:1, max=99, 0=purge)
|
||||
# -R HOST[:PORT]: Log to HOST:PORT (default PORT:514)
|
||||
# -L : Log locally and via network
|
||||
# -D : Drop duplicates
|
||||
# -C[size_kb] : Log to shared mem buffer (use logread to read it)
|
||||
# -f FILE : Use FILE as config (default:/etc/syslog.conf)
|
||||
# -m MIN : Minutes between mark lines (default:20, 0=off)
|
||||
# -K : Log to kernel printk buffer (use dmesg to read it)
|
||||
|
||||
# Example 1:
|
||||
# Log to local file /var/log/mylog
|
||||
# OPTIONS="-O /var/log/mylog"
|
||||
#
|
||||
# Example 2:
|
||||
# Log to remote host
|
||||
# OPTIONS="-R 192.168.1.1:601"
|
||||
@@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Description=System Logging Service
|
||||
Wants=busybox-klogd.service
|
||||
|
||||
[Service]
|
||||
EnvironmentFile=-/etc/default/busybox-syslog
|
||||
ExecStart=@base_sbindir@/syslogd -n $OPTIONS
|
||||
Sockets=syslog.socket
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Also=busybox-klogd.service
|
||||
Alias=syslog.service
|
||||
43
sources/poky/meta/recipes-core/busybox/files/busybox-udhcpd
Executable file
43
sources/poky/meta/recipes-core/busybox/files/busybox-udhcpd
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/bin/sh
|
||||
DAEMON=/usr/sbin/udhcpd
|
||||
NAME=udhcpd
|
||||
DESC="Busybox UDHCP Server"
|
||||
ARGS="/etc/udhcpd.conf"
|
||||
|
||||
test -f $DAEMON || exit 1
|
||||
|
||||
set -e
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "starting $DESC: $NAME... "
|
||||
if [ ! -f /etc/udhcpd.conf ]; then
|
||||
echo "error: /etc/udhcpd.conf is missing."
|
||||
exit 1
|
||||
fi
|
||||
/sbin/start-stop-daemon -S -b -n $NAME -a $DAEMON -- $ARGS
|
||||
echo "done."
|
||||
;;
|
||||
stop)
|
||||
echo -n "stopping $DESC: $NAME... "
|
||||
/sbin/start-stop-daemon -K -n $NAME
|
||||
echo "done."
|
||||
;;
|
||||
restart)
|
||||
echo "restarting $DESC: $NAME... "
|
||||
$0 stop
|
||||
$0 start
|
||||
echo "done."
|
||||
;;
|
||||
reload)
|
||||
echo -n "reloading $DESC: $NAME... "
|
||||
killall -HUP $(basename ${DAEMON})
|
||||
echo "done."
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|reload}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
exec run-parts -a "$1" /etc/udhcpc.d
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
if grep -q "input:.*-e0.*,3,.*a0,1,\|ads7846" /sys/class/$MDEV/device/modalias ; then
|
||||
ln -sf /dev/$MDEV /dev/input/touchscreen0
|
||||
fi
|
||||
|
||||
83
sources/poky/meta/recipes-core/busybox/files/hwclock.sh
Normal file
83
sources/poky/meta/recipes-core/busybox/files/hwclock.sh
Normal file
@@ -0,0 +1,83 @@
|
||||
#!/bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: hwclock
|
||||
# Required-Start:
|
||||
# Required-Stop: $local_fs
|
||||
# Default-Start: S
|
||||
# Default-Stop: 0 6
|
||||
# Short-Description: Set system clock
|
||||
# Description: Set system clock to hardware clock, according to the UTC
|
||||
# setting in /etc/default/rcS (see also rcS(5)).
|
||||
### END INIT INFO
|
||||
#
|
||||
# WARNING: If your hardware clock is not in UTC/GMT, this script
|
||||
# must know the local time zone. This information is
|
||||
# stored in /etc/localtime. This might be a problem if
|
||||
# your /etc/localtime is a symlink to something in
|
||||
# /usr/share/zoneinfo AND /usr isn't in the root
|
||||
# partition! The workaround is to define TZ either
|
||||
# in /etc/default/rcS, or in the proper place below.
|
||||
|
||||
[ ! -x /sbin/hwclock ] && exit 0
|
||||
|
||||
[ -f /etc/default/rcS ] && . /etc/default/rcS
|
||||
|
||||
[ "$UTC" = "yes" ] && tz="--utc" || tz="--localtime"
|
||||
case "$1" in
|
||||
start)
|
||||
if [ "$VERBOSE" != no ]
|
||||
then
|
||||
echo "System time was `date`."
|
||||
echo "Setting the System Clock using the Hardware Clock as reference..."
|
||||
fi
|
||||
|
||||
if [ "$HWCLOCKACCESS" != no ]
|
||||
then
|
||||
if [ -z "$TZ" ]
|
||||
then
|
||||
hwclock $tz --hctosys
|
||||
else
|
||||
TZ="$TZ" hwclock $tz --hctosys
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$VERBOSE" != no ]
|
||||
then
|
||||
echo "System Clock set. System local time is now `date`."
|
||||
fi
|
||||
;;
|
||||
stop|restart|reload|force-reload)
|
||||
#
|
||||
# Updates the Hardware Clock with the System Clock time.
|
||||
# This will *override* any changes made to the Hardware Clock.
|
||||
#
|
||||
# WARNING: If you disable this, any changes to the system
|
||||
# clock will not be carried across reboots.
|
||||
#
|
||||
if [ "$VERBOSE" != no ]
|
||||
then
|
||||
echo "Saving the System Clock time to the Hardware Clock..."
|
||||
fi
|
||||
if [ "$HWCLOCKACCESS" != no ]
|
||||
then
|
||||
hwclock $tz --systohc
|
||||
fi
|
||||
if [ "$VERBOSE" != no ]
|
||||
then
|
||||
echo "Hardware Clock updated to `date`."
|
||||
fi
|
||||
exit 0
|
||||
;;
|
||||
show)
|
||||
if [ "$HWCLOCKACCESS" != no ]
|
||||
then
|
||||
hwclock $tz --show
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Usage: hwclock.sh {start|stop|show|reload|restart}" >&2
|
||||
echo " start sets kernel (system) clock from hardware (RTC) clock" >&2
|
||||
echo " stop and reload set hardware (RTC) clock from kernel (system) clock" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
33
sources/poky/meta/recipes-core/busybox/files/inetd
Normal file
33
sources/poky/meta/recipes-core/busybox/files/inetd
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# start/stop inetd super server.
|
||||
|
||||
if ! [ -x /usr/sbin/inetd ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "Starting internet superserver:"
|
||||
echo -n " inetd" ; start-stop-daemon -S -x /usr/sbin/inetd > /dev/null
|
||||
echo "."
|
||||
;;
|
||||
stop)
|
||||
echo -n "Stopping internet superserver:"
|
||||
echo -n " inetd" ; start-stop-daemon -K -x /usr/sbin/inetd > /dev/null
|
||||
echo "."
|
||||
;;
|
||||
restart)
|
||||
echo -n "Restarting internet superserver:"
|
||||
echo -n " inetd "
|
||||
killall -HUP inetd
|
||||
echo "."
|
||||
;;
|
||||
*)
|
||||
echo "Usage: /etc/init.d/inetd {start|stop|restart}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
20
sources/poky/meta/recipes-core/busybox/files/inetd.conf
Normal file
20
sources/poky/meta/recipes-core/busybox/files/inetd.conf
Normal file
@@ -0,0 +1,20 @@
|
||||
# /etc/inetd.conf: see inetd(8) for further informations.
|
||||
#
|
||||
# Internet server configuration database
|
||||
#
|
||||
# If you want to disable an entry so it isn't touched during
|
||||
# package updates just comment it out with a single '#' character.
|
||||
#
|
||||
# <service_name> <sock_type> <proto> <flags> <user> <server_path> <args>
|
||||
#
|
||||
#:INTERNAL: Internal services
|
||||
#echo stream tcp nowait root internal
|
||||
#echo dgram udp wait root internal
|
||||
#chargen stream tcp nowait root internal
|
||||
#chargen dgram udp wait root internal
|
||||
#discard stream tcp nowait root internal
|
||||
#discard dgram udp wait root internal
|
||||
#daytime stream tcp nowait root internal
|
||||
#daytime dgram udp wait root internal
|
||||
#time stream tcp nowait root internal
|
||||
#time dgram udp wait root internal
|
||||
28
sources/poky/meta/recipes-core/busybox/files/inittab
Normal file
28
sources/poky/meta/recipes-core/busybox/files/inittab
Normal file
@@ -0,0 +1,28 @@
|
||||
# This is run first except when booting in single-user mode.
|
||||
|
||||
# Startup the system
|
||||
::sysinit:/bin/mount -t proc proc /proc
|
||||
::sysinit:/bin/mount -t sysfs sysfs /sys
|
||||
::sysinit:/bin/mount -t devtmpfs devtmpfs /dev
|
||||
::sysinit:/bin/mount -o remount,rw /
|
||||
::sysinit:/bin/mkdir -p /dev/pts
|
||||
::sysinit:/bin/mount -t devpts devpts /dev/pts
|
||||
::sysinit:/bin/mount -a
|
||||
::sysinit:/sbin/swapon -a
|
||||
null::sysinit:/bin/ln -sf /proc/self/fd /dev/fd
|
||||
null::sysinit:/bin/ln -sf /proc/self/fd/0 /dev/stdin
|
||||
null::sysinit:/bin/ln -sf /proc/self/fd/1 /dev/stdout
|
||||
null::sysinit:/bin/ln -sf /proc/self/fd/2 /dev/stderr
|
||||
# set hostname
|
||||
null::sysinit:/bin/busybox hostname -F /etc/hostname
|
||||
::sysinit:/etc/init.d/rcS
|
||||
|
||||
# Stuff to do before rebooting
|
||||
#::ctrlaltdel:/sbin/reboot
|
||||
::shutdown:/etc/init.d/rcK
|
||||
::shutdown:/sbin/swapoff -a
|
||||
::shutdown:/bin/umount -a -r
|
||||
|
||||
# Stuff to do when restarting the init process
|
||||
::restart:/sbin/init
|
||||
|
||||
43
sources/poky/meta/recipes-core/busybox/files/mdev
Executable file
43
sources/poky/meta/recipes-core/busybox/files/mdev
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Run the mdev daemon
|
||||
#
|
||||
|
||||
DAEMON="mdev"
|
||||
PIDFILE="/var/run/$DAEMON.pid"
|
||||
|
||||
|
||||
start() {
|
||||
echo -n "Starting $DAEMON... "
|
||||
start-stop-daemon -S -b -m -p $PIDFILE -x /sbin/mdev -- -df
|
||||
[ $? -eq 0 ] && echo "OK" || echo "ERROR"
|
||||
|
||||
# coldplug modules
|
||||
find /sys/ -name modalias -print0 | \
|
||||
xargs -0 sort -u | \
|
||||
tr '\n' '\0' | \
|
||||
xargs -0 modprobe -abq
|
||||
}
|
||||
|
||||
stop() {
|
||||
echo -n "Stopping $DAEMON... "
|
||||
start-stop-daemon -K -p $PIDFILE
|
||||
[ $? -eq 0 ] && echo "OK" || echo "ERROR"
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start|stop|restart)
|
||||
"$1"
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
||||
|
||||
63
sources/poky/meta/recipes-core/busybox/files/mdev-mount.sh
Normal file
63
sources/poky/meta/recipes-core/busybox/files/mdev-mount.sh
Normal file
@@ -0,0 +1,63 @@
|
||||
#!/bin/sh
|
||||
MDEV_AUTOMOUNT=y
|
||||
MDEV_AUTOMOUNT_ROOT=/run/media
|
||||
[ -f /etc/default/mdev ] && . /etc/default/mdev
|
||||
if [ "${MDEV_AUTOMOUNT}" = "n" ] ; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
case "$ACTION" in
|
||||
add|"")
|
||||
ACTION="add"
|
||||
# check if already mounted
|
||||
if grep -q "^/dev/${MDEV} " /proc/mounts ; then
|
||||
# Already mounted
|
||||
exit 0
|
||||
fi
|
||||
DEVBASE=`expr substr $MDEV 1 3`
|
||||
if [ "${DEVBASE}" = "mmc" ] ; then
|
||||
DEVBASE=`expr substr $MDEV 1 7`
|
||||
fi
|
||||
# check for "please don't mount it" file
|
||||
if [ -f "/dev/nomount.${DEVBASE}" ] ; then
|
||||
# blocked
|
||||
exit 0
|
||||
fi
|
||||
# check for full-disk partition
|
||||
if [ "${DEVBASE}" = "${MDEV}" ] ; then
|
||||
if [ -f /sys/block/${DEVBASE}/${DEVBASE}*1/partition ] ; then
|
||||
# Partition detected, just quit
|
||||
exit 0
|
||||
fi
|
||||
if [ ! -f /sys/block/${DEVBASE}/size ] ; then
|
||||
# No size at all
|
||||
exit 0
|
||||
fi
|
||||
if [ "`cat /sys/block/${DEVBASE}/size`" = "0" ] ; then
|
||||
# empty device, bail out
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
# first allow fstab to determine the mountpoint
|
||||
if ! mount /dev/$MDEV > /dev/null 2>&1
|
||||
then
|
||||
MOUNTPOINT="${MDEV_AUTOMOUNT_ROOT}/$MDEV"
|
||||
mkdir -p "$MOUNTPOINT"
|
||||
mount -t auto /dev/$MDEV "$MOUNTPOINT" || rmdir "$MOUNTPOINT"
|
||||
fi
|
||||
;;
|
||||
remove)
|
||||
MOUNTPOINT=`grep "^/dev/$MDEV\s" /proc/mounts | cut -d' ' -f 2`
|
||||
if [ ! -z "$MOUNTPOINT" ]
|
||||
then
|
||||
umount "$MOUNTPOINT"
|
||||
rmdir "$MOUNTPOINT"
|
||||
else
|
||||
umount /dev/$MDEV
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
# Unexpected keyword
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
44
sources/poky/meta/recipes-core/busybox/files/mdev.conf
Normal file
44
sources/poky/meta/recipes-core/busybox/files/mdev.conf
Normal file
@@ -0,0 +1,44 @@
|
||||
$MODALIAS=.* 0:0 660 @modprobe "$MODALIAS"
|
||||
|
||||
console 0:0 0600
|
||||
cpu_dma_latency 0:0 0660
|
||||
fb0:0 44 0660
|
||||
full 0:0 0666
|
||||
initctl 0:0 0600
|
||||
ircomm[0-9].* 0:20 0660
|
||||
kmem 0:15 0640
|
||||
kmsg 0:0 0660
|
||||
log 0:0 0666
|
||||
loop[0-9].* 0:6 0640
|
||||
mem 0:15 0640
|
||||
network_latency 0:0 0660
|
||||
network_throughput 0:0 0660
|
||||
null 0:0 0666
|
||||
port 0:15 0640
|
||||
ptmx 0:5 0666
|
||||
ram[0-9].* 0:6 0640
|
||||
random 0:0 0666
|
||||
sda 0:6 0640
|
||||
tty 0:5 0666
|
||||
tty.* 0:0 0620
|
||||
urandom 0:0 0666
|
||||
usbdev.* 0:0 0660 */etc/mdev/usb.sh
|
||||
vcs.* 0:5 0660
|
||||
zero 0:0 0666
|
||||
|
||||
snd/pcm.* 0:0 0660
|
||||
snd/control.* 0:0 0660
|
||||
snd/timer 0:0 0660
|
||||
snd/seq 0:0 0660
|
||||
snd/mini.* 0:00 0660
|
||||
|
||||
input/event.* 0:0 0660 @/etc/mdev/find-touchscreen.sh
|
||||
input/mice 0:0 0660
|
||||
input/mouse.* 0:0 0660
|
||||
|
||||
tun[0-9]* 0:0 0660 =net/
|
||||
|
||||
[hs]d[a-z][0-9]? 0:0 660 */etc/mdev/mdev-mount.sh
|
||||
mmcblk[0-9]rpmb 0:0 660
|
||||
mmcblk[0-9]boot[0-9] 0:0 660
|
||||
mmcblk[0-9].* 0:0 660 */etc/mdev/mdev-mount.sh
|
||||
26
sources/poky/meta/recipes-core/busybox/files/rcK
Normal file
26
sources/poky/meta/recipes-core/busybox/files/rcK
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Stop all init scripts in /etc/rc6.d
|
||||
# executing them in numerical order.
|
||||
#
|
||||
for i in /etc/rc6.d/K??*; do
|
||||
|
||||
# Ignore dangling symlinks (if any).
|
||||
[ ! -f "$i" ] && continue
|
||||
|
||||
case "$i" in
|
||||
*.sh)
|
||||
# Source shell script for speed.
|
||||
(
|
||||
trap - INT QUIT TSTP
|
||||
set stop
|
||||
. $i
|
||||
)
|
||||
;;
|
||||
*)
|
||||
# No sh extension, so fork subprocess.
|
||||
$i stop
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
27
sources/poky/meta/recipes-core/busybox/files/rcS
Normal file
27
sources/poky/meta/recipes-core/busybox/files/rcS
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Start all init scripts in /etc/rcS.d and /etc/rc5.d
|
||||
# executing them in numerical order.
|
||||
#
|
||||
|
||||
for i in /etc/rcS.d/S??* /etc/rc5.d/S??* ;do
|
||||
|
||||
# Ignore dangling symlinks (if any).
|
||||
[ ! -f "$i" ] && continue
|
||||
|
||||
case "$i" in
|
||||
*.sh)
|
||||
# Source shell script for speed.
|
||||
(
|
||||
trap - INT QUIT TSTP
|
||||
set start
|
||||
. $i
|
||||
)
|
||||
;;
|
||||
*)
|
||||
# No sh extension, so fork subprocess.
|
||||
$i start
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
31
sources/poky/meta/recipes-core/busybox/files/rcS.default
Normal file
31
sources/poky/meta/recipes-core/busybox/files/rcS.default
Normal file
@@ -0,0 +1,31 @@
|
||||
#
|
||||
# Defaults for the boot scripts in /etc/rcS.d
|
||||
#
|
||||
|
||||
# Time files in /tmp are kept in days.
|
||||
TMPTIME=0
|
||||
# Set to yes if you want sulogin to be spawned on bootup
|
||||
SULOGIN=no
|
||||
# Set to no if you want to be able to login over telnet/rlogin
|
||||
# before system startup is complete (as soon as inetd is started)
|
||||
DELAYLOGIN=no
|
||||
# Assume that the BIOS clock is set to UTC time (recommended)
|
||||
UTC=yes
|
||||
# Set VERBOSE to "no" if you would like a more quiet bootup.
|
||||
VERBOSE=no
|
||||
# Set EDITMOTD to "no" if you don't want /etc/motd to be edited automatically
|
||||
EDITMOTD=no
|
||||
# Whether to fsck root on boot
|
||||
ENABLE_ROOTFS_FSCK=no
|
||||
# Set FSCKFIX to "yes" if you want to add "-y" to the fsck at startup.
|
||||
FSCKFIX=yes
|
||||
# Set TICKADJ to the correct tick value for this specific machine
|
||||
#TICKADJ=10000
|
||||
# Enable caching in populate-volatile.sh
|
||||
VOLATILE_ENABLE_CACHE=yes
|
||||
# Indicate whether the rootfs is intended to be read-only or not.
|
||||
# Setting ROOTFS_READ_ONLY to yes and rebooting will give you a read-only rootfs.
|
||||
# Normally you should not change this value.
|
||||
ROOTFS_READ_ONLY=no
|
||||
# Indicate init system type
|
||||
INIT_SYSTEM=busybox
|
||||
9
sources/poky/meta/recipes-core/busybox/files/run-ptest
Normal file
9
sources/poky/meta/recipes-core/busybox/files/run-ptest
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
current_path=$(readlink -f $0)
|
||||
export bindir=$(dirname $current_path)
|
||||
export PATH=$bindir/bin:$PATH
|
||||
export SKIP_KNOWN_BUGS=1
|
||||
|
||||
cd testsuite || exit 1
|
||||
LANG=C.UTF-8 ./runtest -v | sed -r 's/^(SKIPPED|UNTESTED):/SKIP:/'
|
||||
88
sources/poky/meta/recipes-core/busybox/files/simple.script
Normal file
88
sources/poky/meta/recipes-core/busybox/files/simple.script
Normal file
@@ -0,0 +1,88 @@
|
||||
#!/bin/sh
|
||||
|
||||
# udhcpc script edited by Tim Riker <Tim@Rikers.org>
|
||||
|
||||
[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
|
||||
|
||||
RESOLV_CONF="/etc/resolv.conf"
|
||||
[ -n "$subnet" ] && NETMASK="netmask $subnet"
|
||||
|
||||
# return 0 if root is mounted on a network filesystem
|
||||
root_is_nfs() {
|
||||
sed -n 's/^[^ ]* \([^ ]*\) \([^ ]*\) .*$/\1 \2/p' /proc/mounts |
|
||||
grep -q "^/ \(nfs\|smbfs\|ncp\|coda\)$"
|
||||
}
|
||||
|
||||
have_bin_ip=0
|
||||
if [ -x /SBIN_DIR/ip ]; then
|
||||
have_bin_ip=1
|
||||
BROADCAST="broadcast +"
|
||||
fi
|
||||
|
||||
[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
|
||||
|
||||
case "$1" in
|
||||
deconfig)
|
||||
if [ -x /SBIN_DIR/resolvconf ]; then
|
||||
/SBIN_DIR/resolvconf -d "${interface}.udhcpc"
|
||||
fi
|
||||
if ! root_is_nfs ; then
|
||||
if [ $have_bin_ip -eq 1 ]; then
|
||||
/SBIN_DIR/ip -4 addr flush dev $interface
|
||||
/SBIN_DIR/ip link set dev $interface up
|
||||
else
|
||||
/SBIN_DIR/ifconfig $interface 0.0.0.0
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
renew|bound)
|
||||
if [ $have_bin_ip -eq 1 ]; then
|
||||
/SBIN_DIR/ip addr add dev $interface local $ip/$mask $BROADCAST
|
||||
else
|
||||
/SBIN_DIR/ifconfig $interface $ip $BROADCAST $NETMASK
|
||||
fi
|
||||
|
||||
if [ -n "$router" ] ; then
|
||||
if ! root_is_nfs ; then
|
||||
if [ $have_bin_ip -eq 1 ]; then
|
||||
while /SBIN_DIR/ip route del default dev $interface 2>/dev/null ; do
|
||||
:
|
||||
done
|
||||
else
|
||||
while /SBIN_DIR/route del default gw 0.0.0.0 dev $interface 2>/dev/null ; do
|
||||
:
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
metric=10
|
||||
for i in $router ; do
|
||||
if [ $have_bin_ip -eq 1 ]; then
|
||||
/SBIN_DIR/ip route add default via $i metric $metric dev $interface
|
||||
else
|
||||
/SBIN_DIR/route add default gw $i dev $interface metric $metric 2>/dev/null
|
||||
fi
|
||||
metric=$(($metric + 1))
|
||||
done
|
||||
fi
|
||||
|
||||
# Update resolver configuration file
|
||||
R=""
|
||||
[ -n "$domain" ] && R="domain $domain
|
||||
"
|
||||
for i in $dns; do
|
||||
echo "$0: Adding DNS $i"
|
||||
R="${R}nameserver $i
|
||||
"
|
||||
done
|
||||
|
||||
if [ -x /SBIN_DIR/resolvconf ]; then
|
||||
echo -n "$R" | /SBIN_DIR/resolvconf -a "${interface}.udhcpc"
|
||||
else
|
||||
echo -n "$R" > "$RESOLV_CONF"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
99
sources/poky/meta/recipes-core/busybox/files/syslog
Normal file
99
sources/poky/meta/recipes-core/busybox/files/syslog
Normal file
@@ -0,0 +1,99 @@
|
||||
#! /bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: sysklogd
|
||||
# Required-Start: $remote_fs $time
|
||||
# Required-Stop: $remote_fs $time
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: System logger
|
||||
### END INIT INFO
|
||||
|
||||
set -e
|
||||
|
||||
PATH="/bin:/usr/bin:/sbin:/usr/sbin"
|
||||
|
||||
if [ -f /etc/syslog-startup.conf ]; then
|
||||
. /etc/syslog-startup.conf
|
||||
LOG_LOCAL=0
|
||||
LOG_REMOTE=0
|
||||
for D in $DESTINATION; do
|
||||
if [ "$D" = "buffer" ]; then
|
||||
SYSLOG_ARGS="$SYSLOG_ARGS -C$BUFFERSIZE"
|
||||
LOG_LOCAL=1
|
||||
elif [ "$D" = "file" ]; then
|
||||
if [ -n "$LOGFILE" ]; then
|
||||
SYSLOG_ARGS="$SYSLOG_ARGS -O $LOGFILE"
|
||||
fi
|
||||
if [ -n "$ROTATESIZE" ]; then
|
||||
SYSLOG_ARGS="$SYSLOG_ARGS -s $ROTATESIZE"
|
||||
fi
|
||||
if [ -n "$ROTATEGENS" ]; then
|
||||
SYSLOG_ARGS="$SYSLOG_ARGS -b $ROTATEGENS"
|
||||
fi
|
||||
LOG_LOCAL=1
|
||||
elif [ "$D" = "remote" ]; then
|
||||
SYSLOG_ARGS="$SYSLOG_ARGS -R $REMOTE"
|
||||
LOG_REMOTE=1
|
||||
fi
|
||||
done
|
||||
if [ "$LOG_LOCAL" = "1" -a "$LOG_REMOTE" = "1" ]; then
|
||||
SYSLOG_ARGS="$SYSLOG_ARGS -L"
|
||||
fi
|
||||
if [ "$REDUCE" = "yes" ]; then
|
||||
SYSLOG_ARGS="$SYSLOG_ARGS -S"
|
||||
fi
|
||||
if [ "$DROPDUPLICATES" = "yes" ]; then
|
||||
SYSLOG_ARGS="$SYSLOG_ARGS -D"
|
||||
fi
|
||||
if [ -n "$LOGLEVEL" ]; then
|
||||
SYSLOG_ARGS="$SYSLOG_ARGS -l $LOGLEVEL"
|
||||
fi
|
||||
else
|
||||
# default: log to 16K shm circular buffer
|
||||
SYSLOG_ARGS="-C"
|
||||
fi
|
||||
|
||||
waitpid ()
|
||||
{
|
||||
pid=$1
|
||||
# Give pid a chance to exit before we restart with a 5s timeout in 1s intervals
|
||||
if [ -z "$pid" ]; then
|
||||
return
|
||||
fi
|
||||
timeout=5;
|
||||
while [ $timeout -gt 0 ]
|
||||
do
|
||||
timeout=$(( $timeout-1 ))
|
||||
kill -0 $pid 2> /dev/null || break
|
||||
sleep 1
|
||||
done
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "Starting syslogd/klogd: "
|
||||
start-stop-daemon -S -b -n syslogd -a /sbin/syslogd -- -n $SYSLOG_ARGS
|
||||
start-stop-daemon -S -b -n klogd -a /sbin/klogd -- -n
|
||||
echo "done"
|
||||
;;
|
||||
stop)
|
||||
echo -n "Stopping syslogd/klogd: "
|
||||
start-stop-daemon -K -n syslogd
|
||||
start-stop-daemon -K -n klogd
|
||||
echo "done"
|
||||
;;
|
||||
restart)
|
||||
pid1=`pidof syslogd`
|
||||
pid2=`pidof klogd`
|
||||
$0 stop
|
||||
waitpid $pid1
|
||||
waitpid $pid2
|
||||
$0 start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: syslog { start | stop | restart }" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,13 @@
|
||||
# This configuration file is used by the busybox syslog init script,
|
||||
# /etc/init.d/syslog[.busybox] to set syslog configuration at start time.
|
||||
|
||||
DESTINATION=file # log destinations (buffer file remote)
|
||||
LOGFILE=/var/log/messages # where to log (file)
|
||||
REMOTE=loghost:514 # where to log (syslog remote)
|
||||
REDUCE=no # reduce-size logging
|
||||
DROPDUPLICATES=no # whether to drop duplicate log entries
|
||||
#ROTATESIZE=0 # rotate log if grown beyond X [kByte]
|
||||
#ROTATEGENS=3 # keep X generations of rotated logs
|
||||
BUFFERSIZE=64 # size of circular buffer [kByte]
|
||||
FOREGROUND=no # run in foreground (don't use!)
|
||||
#LOGLEVEL=5 # local log level (between 1 and 8)
|
||||
1
sources/poky/meta/recipes-core/busybox/files/syslog.conf
Normal file
1
sources/poky/meta/recipes-core/busybox/files/syslog.conf
Normal file
@@ -0,0 +1 @@
|
||||
# /etc/syslog.conf Configuration file for busybox's syslogd utility
|
||||
@@ -0,0 +1,26 @@
|
||||
Subject: local.mk: fix cross compiling problem
|
||||
|
||||
We meet the following error when cross compiling.
|
||||
| Makefile:3418: *** Recursive variable 'INSTALL' references itself (eventually). Stop.
|
||||
This patch fixes this problem.
|
||||
|
||||
Upstream-Status: Pending
|
||||
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
---
|
||||
src/local.mk | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/local.mk b/src/local.mk
|
||||
index 36dfa4e..c5898cc 100644
|
||||
--- a/src/local.mk
|
||||
+++ b/src/local.mk
|
||||
@@ -649,4 +649,4 @@ cu_install_program = @INSTALL_PROGRAM@
|
||||
else
|
||||
cu_install_program = src/ginstall
|
||||
endif
|
||||
-INSTALL = $(cu_install_program) -c
|
||||
+INSTALL_PROGRAM = $(cu_install_program)
|
||||
--
|
||||
2.1.0
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
From 67c298c36f69b6906840b7584be06b7b5f33f829 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Eggert <eggert@cs.ucla.edu>
|
||||
Date: Tue, 16 Jan 2024 17:21:08 -0800
|
||||
Subject: [PATCH] posixtm: pacify clang 18
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Problem reported by Khem Raj in:
|
||||
https://lists.gnu.org/r/bug-gnulib/2024-01/msg00045.html
|
||||
* lib/posixtm.c (posixtime): Pacify clang 18 by converting bool to int.
|
||||
Arguably this is a bug in draft C2x, since the non-pointer args to
|
||||
ckd_add should promote just like any other expressions do;
|
||||
but that’s not clang’s fault.
|
||||
|
||||
Upstream-Status: Submitted [https://lists.gnu.org/archive/html/bug-gnulib/2024-01/msg00046.html]
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
ChangeLog | 10 ++++++++++
|
||||
lib/posixtm.c | 2 +-
|
||||
2 files changed, 11 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lib/posixtm.c b/lib/posixtm.c
|
||||
index ef9f55f873..a072c7cad0 100644
|
||||
--- a/lib/posixtm.c
|
||||
+++ b/lib/posixtm.c
|
||||
@@ -191,7 +191,7 @@ posixtime (time_t *p, const char *s, unsigned int syntax_bits)
|
||||
| (tm0.tm_min ^ tm1.tm_min)
|
||||
| (tm0.tm_sec ^ tm1.tm_sec)))
|
||||
{
|
||||
- if (ckd_add (&t, t, leapsec))
|
||||
+ if (ckd_add (&t, t, +leapsec))
|
||||
return false;
|
||||
*p = t;
|
||||
return true;
|
||||
--
|
||||
2.43.0
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
From c4c5ed8f4e9cd55a12966d4f520e3a13101637d9 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Eggert <eggert@cs.ucla.edu>
|
||||
Date: Tue, 16 Jan 2024 13:48:32 -0800
|
||||
Subject: [PATCH 1/1] split: do not shrink hold buffer
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=utf8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
* src/split.c (line_bytes_split): Do not shrink hold buffer.
|
||||
If it’s large for this batch it’s likely to be large for the next
|
||||
batch, and for ‘split’ it’s not worth the complexity/CPU hassle to
|
||||
shrink it. Do not assume hold_size can be bufsize.
|
||||
|
||||
CVE: CVE-2024-0684
|
||||
Upstream-Status: Backport [https://github.com/coreutils/coreutils/commit/c4c5ed8f4e9cd55a12966d4f520e3a13101637d9]
|
||||
Signed-off-by: Simone Weiß <simone.p.weiss@posteo.com>
|
||||
---
|
||||
src/split.c | 3 ---
|
||||
1 file changed, 3 deletions(-)
|
||||
|
||||
diff --git a/src/split.c b/src/split.c
|
||||
index 64020c859..037960a59 100644
|
||||
--- a/src/split.c
|
||||
+++ b/src/split.c
|
||||
@@ -809,10 +809,7 @@ line_bytes_split (intmax_t n_bytes, char *buf, idx_t bufsize)
|
||||
{
|
||||
cwrite (n_out == 0, hold, n_hold);
|
||||
n_out += n_hold;
|
||||
- if (n_hold > bufsize)
|
||||
- hold = xirealloc (hold, bufsize);
|
||||
n_hold = 0;
|
||||
- hold_size = bufsize;
|
||||
}
|
||||
|
||||
/* Output to eol if present. */
|
||||
--
|
||||
2.11.4.GIT
|
||||
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
From 8763c305c29d0abb7e2be4695212b42917d054b2 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
|
||||
Date: Tue, 20 May 2025 16:03:44 +0100
|
||||
Subject: [PATCH] sort: fix buffer under-read (CWE-127)
|
||||
|
||||
* src/sort.c (begfield): Check pointer adjustment
|
||||
to avoid Out-of-range pointer offset (CWE-823).
|
||||
(limfield): Likewise.
|
||||
* tests/sort/sort-field-limit.sh: Add a new test,
|
||||
which triggers with ASAN or Valgrind.
|
||||
* tests/local.mk: Reference the new test.
|
||||
* NEWS: Mention bug fix introduced in v7.2 (2009).
|
||||
Fixes https://bugs.gnu.org/78507
|
||||
|
||||
CVE: CVE-2025-5278
|
||||
|
||||
Upstream-Status: Backport [https://cgit.git.savannah.gnu.org/cgit/coreutils.git/commit/?id=8c9602e3a145e9596dc1a63c6ed67865814b6633]
|
||||
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
---
|
||||
src/sort.c | 12 ++++++++++--
|
||||
tests/local.mk | 1 +
|
||||
tests/sort/sort-field-limit.sh | 35 ++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 46 insertions(+), 2 deletions(-)
|
||||
create mode 100755 tests/sort/sort-field-limit.sh
|
||||
|
||||
diff --git a/src/sort.c b/src/sort.c
|
||||
index b10183b6f..7af1a2512 100644
|
||||
--- a/src/sort.c
|
||||
+++ b/src/sort.c
|
||||
@@ -1644,7 +1644,11 @@ begfield (struct line const *line, struct keyfield const *key)
|
||||
++ptr;
|
||||
|
||||
/* Advance PTR by SCHAR (if possible), but no further than LIM. */
|
||||
- ptr = MIN (lim, ptr + schar);
|
||||
+ size_t remaining_bytes = lim - ptr;
|
||||
+ if (schar < remaining_bytes)
|
||||
+ ptr += schar;
|
||||
+ else
|
||||
+ ptr = lim;
|
||||
|
||||
return ptr;
|
||||
}
|
||||
@@ -1746,7 +1750,11 @@ limfield (struct line const *line, struct keyfield const *key)
|
||||
++ptr;
|
||||
|
||||
/* Advance PTR by ECHAR (if possible), but no further than LIM. */
|
||||
- ptr = MIN (lim, ptr + echar);
|
||||
+ size_t remaining_bytes = lim - ptr;
|
||||
+ if (echar < remaining_bytes)
|
||||
+ ptr += echar;
|
||||
+ else
|
||||
+ ptr = lim;
|
||||
}
|
||||
|
||||
return ptr;
|
||||
diff --git a/tests/local.mk b/tests/local.mk
|
||||
index 4da6756ac..642d225fa 100644
|
||||
--- a/tests/local.mk
|
||||
+++ b/tests/local.mk
|
||||
@@ -388,6 +388,7 @@ all_tests = \
|
||||
tests/sort/sort-debug-keys.sh \
|
||||
tests/sort/sort-debug-warn.sh \
|
||||
tests/sort/sort-discrim.sh \
|
||||
+ tests/sort/sort-field-limit.sh \
|
||||
tests/sort/sort-files0-from.pl \
|
||||
tests/sort/sort-float.sh \
|
||||
tests/sort/sort-h-thousands-sep.sh \
|
||||
diff --git a/tests/sort/sort-field-limit.sh b/tests/sort/sort-field-limit.sh
|
||||
new file mode 100755
|
||||
index 000000000..52d8e1d17
|
||||
--- /dev/null
|
||||
+++ b/tests/sort/sort-field-limit.sh
|
||||
@@ -0,0 +1,35 @@
|
||||
+#!/bin/sh
|
||||
+# From 7.2-9.7, this would trigger an out of bounds mem read
|
||||
+
|
||||
+# Copyright (C) 2025 Free Software Foundation, Inc.
|
||||
+
|
||||
+# 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
+
|
||||
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
|
||||
+print_ver_ sort
|
||||
+getlimits_
|
||||
+
|
||||
+# This issue triggers with valgrind or ASAN
|
||||
+valgrind --error-exitcode=1 sort --version 2>/dev/null &&
|
||||
+ VALGRIND='valgrind --error-exitcode=1'
|
||||
+
|
||||
+{ printf '%s\n' aa bb; } > in || framework_failure_
|
||||
+
|
||||
+_POSIX2_VERSION=200809 $VALGRIND sort +0.${SIZE_MAX}R in > out || fail=1
|
||||
+compare in out || fail=1
|
||||
+
|
||||
+_POSIX2_VERSION=200809 $VALGRIND sort +1 -1.${SIZE_MAX}R in > out || fail=1
|
||||
+compare in out || fail=1
|
||||
+
|
||||
+Exit $fail
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
From a26530083a29eeee910bfd606ecc621acecd547a Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Wed, 3 Aug 2011 14:12:30 -0700
|
||||
Subject: [PATCH] coreutils: Fix build on uclibc
|
||||
|
||||
We have problem using hardcoded directories like /usr/local here
|
||||
which will be checked for cross builds. This is a special case which
|
||||
is valid for AIX only. We do not have AIX as one of our supported
|
||||
build host or target. Therefore we get rid of the hardcoded paths
|
||||
and make life easier for cross compilation process.
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
|
||||
Upstream-Status: Inappropriate [Upstream does care for AIX while we may not]
|
||||
|
||||
---
|
||||
m4/getloadavg.m4 | 12 ------------
|
||||
1 file changed, 12 deletions(-)
|
||||
|
||||
diff --git a/m4/getloadavg.m4 b/m4/getloadavg.m4
|
||||
index 8e96965..63782a2 100644
|
||||
--- a/m4/getloadavg.m4
|
||||
+++ b/m4/getloadavg.m4
|
||||
@@ -41,18 +41,6 @@ AC_CHECK_FUNC([getloadavg], [],
|
||||
[LIBS="-lutil $LIBS" gl_func_getloadavg_done=yes])
|
||||
fi
|
||||
|
||||
- if test $gl_func_getloadavg_done = no; then
|
||||
- # There is a commonly available library for RS/6000 AIX.
|
||||
- # Since it is not a standard part of AIX, it might be installed locally.
|
||||
- gl_getloadavg_LIBS=$LIBS
|
||||
- if test $cross_compiling != yes; then
|
||||
- LIBS="-L/usr/local/lib $LIBS"
|
||||
- fi
|
||||
- AC_CHECK_LIB([getloadavg], [getloadavg],
|
||||
- [LIBS="-lgetloadavg $LIBS" gl_func_getloadavg_done=yes],
|
||||
- [LIBS=$gl_getloadavg_LIBS])
|
||||
- fi
|
||||
-
|
||||
# Set up the replacement function if necessary.
|
||||
if test $gl_func_getloadavg_done = no; then
|
||||
HAVE_GETLOADAVG=0
|
||||
17
sources/poky/meta/recipes-core/coreutils/coreutils/run-ptest
Executable file
17
sources/poky/meta/recipes-core/coreutils/coreutils/run-ptest
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
# remove any stale lock files so that the calls to groupadd/useradd don't stop
|
||||
# the ptest if re-using the same image
|
||||
rm -rf /etc/passwd.lock /etc/group.lock /etc/gshadow.lock
|
||||
|
||||
COREUTILSLIB=@libdir@/coreutils
|
||||
LOG="${COREUTILSLIB}/ptest/coreutils_ptest_$(date +%Y%m%d-%H%M%S).log"
|
||||
USERNAME="tester"
|
||||
groupadd ugroup1
|
||||
groupadd ugroup2
|
||||
useradd -G ugroup1,ugroup2 $USERNAME || echo "user $USERNAME already exists"
|
||||
|
||||
su tester -c "cd ${COREUTILSLIB}/ptest && make check-TESTS top_srcdir=. srcdir=." 2>&1 | tee -a ${LOG}
|
||||
userdel $USERNAME
|
||||
groupdel ugroup1
|
||||
groupdel ugroup2
|
||||
222
sources/poky/meta/recipes-core/coreutils/coreutils_9.4.bb
Normal file
222
sources/poky/meta/recipes-core/coreutils/coreutils_9.4.bb
Normal file
@@ -0,0 +1,222 @@
|
||||
SUMMARY = "The basic file, shell and text manipulation utilities"
|
||||
DESCRIPTION = "The GNU Core Utilities provide the basic file, shell and text \
|
||||
manipulation utilities. These are the core utilities which are expected to exist on \
|
||||
every system."
|
||||
HOMEPAGE = "http://www.gnu.org/software/coreutils/"
|
||||
BUGTRACKER = "http://debbugs.gnu.org/coreutils"
|
||||
LICENSE = "GPL-3.0-or-later"
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=1ebbd3e34237af26da5dc08a4e440464 \
|
||||
file://src/ls.c;beginline=1;endline=15;md5=b720a8b317035d66c555fc6d89e3674c \
|
||||
"
|
||||
DEPENDS = "gmp libcap"
|
||||
DEPENDS:class-native = ""
|
||||
|
||||
inherit autotools gettext texinfo
|
||||
|
||||
SRC_URI = "${GNU_MIRROR}/coreutils/${BP}.tar.xz \
|
||||
file://remove-usr-local-lib-from-m4.patch \
|
||||
file://0001-local.mk-fix-cross-compiling-problem.patch \
|
||||
file://0001-posixtm-pacify-clang-18.patch \
|
||||
file://CVE-2024-0684.patch \
|
||||
file://CVE-2025-5278.patch \
|
||||
file://run-ptest \
|
||||
"
|
||||
SRC_URI[sha256sum] = "ea613a4cf44612326e917201bbbcdfbd301de21ffc3b59b6e5c07e040b275e52"
|
||||
|
||||
# http://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=v8.27-101-gf5d7c0842
|
||||
#
|
||||
CVE_STATUS[CVE-2016-2781] = "disputed: runcon is not really a sandbox command, use `runcon ... setsid ...` to avoid this particular issue."
|
||||
|
||||
EXTRA_OECONF:class-target = "--enable-install-program=arch,hostname --libexecdir=${libdir}"
|
||||
EXTRA_OECONF:class-nativesdk = "--enable-install-program=arch,hostname"
|
||||
|
||||
# acl and xattr are not default features
|
||||
#
|
||||
PACKAGECONFIG:class-target ??= "\
|
||||
${@bb.utils.filter('DISTRO_FEATURES', 'acl xattr', d)} \
|
||||
"
|
||||
|
||||
# The lib/oe/path.py requires xattr
|
||||
PACKAGECONFIG:class-native ??= "xattr"
|
||||
|
||||
# oe-core builds need xattr support
|
||||
PACKAGECONFIG:class-nativesdk ??= "xattr"
|
||||
|
||||
# with, without, depends, rdepends
|
||||
#
|
||||
PACKAGECONFIG[acl] = "--enable-acl,--disable-acl,acl,"
|
||||
PACKAGECONFIG[xattr] = "--enable-xattr,--disable-xattr,attr,"
|
||||
PACKAGECONFIG[single-binary] = "--enable-single-binary,--disable-single-binary,,"
|
||||
PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux"
|
||||
PACKAGECONFIG[openssl] = "--with-openssl=yes,--with-openssl=no,openssl"
|
||||
|
||||
# [ df mktemp nice printenv base64 gets a special treatment and is not included in this
|
||||
bindir_progs = "arch basename chcon cksum comm csplit cut dir dircolors dirname du \
|
||||
env expand expr factor fmt fold groups head hostid id install \
|
||||
join link logname md5sum mkfifo nl nohup nproc od paste pathchk \
|
||||
pinky pr printf ptx readlink realpath runcon seq sha1sum sha224sum sha256sum \
|
||||
sha384sum sha512sum shred shuf sort split sum tac tail tee test timeout \
|
||||
tr truncate tsort tty unexpand uniq unlink uptime users vdir wc who whoami yes"
|
||||
|
||||
# hostname gets a special treatment and is not included in this
|
||||
base_bindir_progs = "cat chgrp chmod chown cp date dd echo false hostname kill ln ls mkdir \
|
||||
mknod mv pwd rm rmdir sleep stty sync touch true uname stat"
|
||||
|
||||
sbindir_progs= "chroot"
|
||||
|
||||
# Split stdbuf into its own package, so one can include
|
||||
# coreutils-stdbuf without getting the rest of coreutils, but make
|
||||
# coreutils itself pull in stdbuf, so IMAGE_INSTALL += "coreutils"
|
||||
# always provides all coreutils
|
||||
PACKAGE_BEFORE_PN:class-target += "${@bb.utils.contains('PACKAGECONFIG', 'single-binary', '', 'coreutils-stdbuf', d)}"
|
||||
FILES:coreutils-stdbuf = "${bindir}/stdbuf ${libdir}/coreutils/libstdbuf.so"
|
||||
RDEPENDS:coreutils:class-target += "${@bb.utils.contains('PACKAGECONFIG', 'single-binary', '', 'coreutils-stdbuf', d)}"
|
||||
|
||||
# However, when the single-binary PACKAGECONFIG is used, stdbuf
|
||||
# functionality is built into the single coreutils binary, so there's
|
||||
# no point splitting /usr/bin/stdbuf to its own package. Instead, add
|
||||
# an RPROVIDE so that rdepending on coreutils-stdbuf will work
|
||||
# regardless of whether single-binary is in effect.
|
||||
RPROVIDES:coreutils += "${@bb.utils.contains('PACKAGECONFIG', 'single-binary', 'coreutils-stdbuf', '', d)}"
|
||||
|
||||
# Let aclocal use the relative path for the m4 file rather than the
|
||||
# absolute since coreutils has a lot of m4 files, otherwise there might
|
||||
# be an "Argument list too long" error when it is built in a long/deep
|
||||
# directory.
|
||||
acpaths = "-I ./m4"
|
||||
|
||||
# Deal with a separate builddir failure if src doesn't exist when creating version.c/version.h
|
||||
do_compile:prepend () {
|
||||
mkdir -p ${B}/src
|
||||
}
|
||||
|
||||
do_install:class-native() {
|
||||
autotools_do_install
|
||||
# remove groups to fix conflict with shadow-native
|
||||
rm -f ${D}${STAGING_BINDIR_NATIVE}/groups
|
||||
# The return is a must since native doesn't need the
|
||||
# do_install:append() in the below.
|
||||
return
|
||||
}
|
||||
|
||||
do_install:append() {
|
||||
for i in df mktemp nice printenv base64; do mv ${D}${bindir}/$i ${D}${bindir}/$i.${BPN}; done
|
||||
|
||||
install -d ${D}${base_bindir}
|
||||
[ "${base_bindir}" != "${bindir}" ] && for i in ${base_bindir_progs}; do mv ${D}${bindir}/$i ${D}${base_bindir}/$i.${BPN}; done
|
||||
|
||||
install -d ${D}${sbindir}
|
||||
[ "${sbindir}" != "${bindir}" ] && for i in ${sbindir_progs}; do mv ${D}${bindir}/$i ${D}${sbindir}/$i.${BPN}; done
|
||||
|
||||
# [ requires special handling because [.coreutils will cause the sed stuff
|
||||
# in update-alternatives to fail, therefore use lbracket - the name used
|
||||
# for the actual source file.
|
||||
mv ${D}${bindir}/[ ${D}${bindir}/lbracket.${BPN}
|
||||
}
|
||||
|
||||
inherit update-alternatives
|
||||
|
||||
ALTERNATIVE_PRIORITY = "100"
|
||||
# Make hostname's priority higher than busybox but lower than net-tools
|
||||
ALTERNATIVE_PRIORITY[hostname] = "90"
|
||||
ALTERNATIVE:${PN} = "lbracket ${bindir_progs} ${base_bindir_progs} ${sbindir_progs} base32 base64 nice printenv mktemp df"
|
||||
ALTERNATIVE:${PN}-doc = "base64.1 nice.1 mktemp.1 df.1 groups.1 kill.1 uptime.1 stat.1 hostname.1"
|
||||
|
||||
ALTERNATIVE_LINK_NAME[hostname.1] = "${mandir}/man1/hostname.1"
|
||||
|
||||
ALTERNATIVE_LINK_NAME[base64] = "${base_bindir}/base64"
|
||||
ALTERNATIVE_TARGET[base64] = "${bindir}/base64.${BPN}"
|
||||
ALTERNATIVE_LINK_NAME[base64.1] = "${mandir}/man1/base64.1"
|
||||
|
||||
ALTERNATIVE_LINK_NAME[mktemp] = "${base_bindir}/mktemp"
|
||||
ALTERNATIVE_TARGET[mktemp] = "${bindir}/mktemp.${BPN}"
|
||||
ALTERNATIVE_LINK_NAME[mktemp.1] = "${mandir}/man1/mktemp.1"
|
||||
|
||||
ALTERNATIVE_LINK_NAME[df] = "${base_bindir}/df"
|
||||
ALTERNATIVE_TARGET[df] = "${bindir}/df.${BPN}"
|
||||
ALTERNATIVE_LINK_NAME[df.1] = "${mandir}/man1/df.1"
|
||||
|
||||
ALTERNATIVE_LINK_NAME[nice] = "${base_bindir}/nice"
|
||||
ALTERNATIVE_TARGET[nice] = "${bindir}/nice.${BPN}"
|
||||
ALTERNATIVE_LINK_NAME[nice.1] = "${mandir}/man1/nice.1"
|
||||
|
||||
ALTERNATIVE_LINK_NAME[printenv] = "${base_bindir}/printenv"
|
||||
ALTERNATIVE_TARGET[printenv] = "${bindir}/printenv.${BPN}"
|
||||
|
||||
ALTERNATIVE_LINK_NAME[lbracket] = "${bindir}/["
|
||||
ALTERNATIVE_TARGET[lbracket] = "${bindir}/lbracket.${BPN}"
|
||||
|
||||
ALTERNATIVE_LINK_NAME[groups.1] = "${mandir}/man1/groups.1"
|
||||
ALTERNATIVE_LINK_NAME[uptime.1] = "${mandir}/man1/uptime.1"
|
||||
ALTERNATIVE_LINK_NAME[kill.1] = "${mandir}/man1/kill.1"
|
||||
ALTERNATIVE_LINK_NAME[stat.1] = "${mandir}/man1/stat.1"
|
||||
|
||||
# The statx() requires glibc >= 2.28 and linux kernel >= 4.11, it doesn't work
|
||||
# when glibc >= 2.28 ((Ubuntu 20.04 in docker) and kernel < 4.11 (Host OS
|
||||
# CentOS 7), we can check kernel version and disable it, but that would cause
|
||||
# two different signatures for coreutils-native, so disable it unconditionally
|
||||
# for deterministic build.
|
||||
EXTRA_OECONF:append:class-native = " ac_cv_func_statx=0"
|
||||
|
||||
python __anonymous() {
|
||||
for prog in d.getVar('base_bindir_progs').split():
|
||||
d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_bindir'), prog))
|
||||
|
||||
for prog in d.getVar('sbindir_progs').split():
|
||||
d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('sbindir'), prog))
|
||||
}
|
||||
|
||||
BBCLASSEXTEND = "native nativesdk"
|
||||
|
||||
inherit ptest
|
||||
|
||||
RDEPENDS:${PN}-ptest += "bash findutils gawk make perl perl-modules python3-core sed shadow"
|
||||
|
||||
# -dev automatic dependencies fails as we don't want libmodule-build-perl-dev, its too heavy
|
||||
# may need tweaking if DEPENDS changes
|
||||
# Can't use ${PN}-dev here since flags with overrides and key expansion not supported
|
||||
RRECOMMENDS:coreutils-dev[nodeprrecs] = "1"
|
||||
RRECOMMENDS:${PN}-dev += "acl-dev attr-dev gmp-dev libcap-dev bash-dev findutils-dev gawk-dev shadow-dev"
|
||||
|
||||
do_install_ptest () {
|
||||
install -d ${D}${PTEST_PATH}/tests
|
||||
cp -r ${S}/tests/* ${D}${PTEST_PATH}/tests
|
||||
sed -i 's/ginstall/install/g' `grep -R ginstall ${D}${PTEST_PATH}/tests | awk -F: '{print $1}' | uniq`
|
||||
install -d ${D}${PTEST_PATH}/build-aux
|
||||
install ${S}/build-aux/test-driver ${D}${PTEST_PATH}/build-aux/
|
||||
install -Dm 0644 ${B}/lib/config.h ${D}${PTEST_PATH}/lib/config.h
|
||||
cp ${B}/Makefile ${D}${PTEST_PATH}/
|
||||
cp ${S}/init.cfg ${D}${PTEST_PATH}/
|
||||
cp -r ${B}/src ${D}${PTEST_PATH}/
|
||||
cp -r ${S}/src/*.c ${D}${PTEST_PATH}/src
|
||||
sed -i '/^VPATH/s/= .*$/= ./g' ${D}${PTEST_PATH}/Makefile
|
||||
sed -i '/^PROGRAMS/s/^/#/g' ${D}${PTEST_PATH}/Makefile
|
||||
sed -i '/^Makefile: /s/^.*$/Makefile:/g' ${D}${PTEST_PATH}/Makefile
|
||||
sed -i '/^abs_srcdir/s/= .*$/= \$\{PWD\}/g' ${D}${PTEST_PATH}/Makefile
|
||||
sed -i '/^abs_top_builddir/s/= .*$/= \$\{PWD\}/g' ${D}${PTEST_PATH}/Makefile
|
||||
sed -i '/^abs_top_srcdir/s/= .*$/= \$\{PWD\}/g' ${D}${PTEST_PATH}/Makefile
|
||||
sed -i '/^built_programs/s/ginstall/install/g' ${D}${PTEST_PATH}/Makefile
|
||||
sed -i '/^CC =/s/ --sysroot=.*recipe-sysroot/ /g' ${D}${PTEST_PATH}/Makefile
|
||||
chmod -R 777 ${D}${PTEST_PATH}
|
||||
|
||||
# Disable subcase stty-pairs.sh, it will cause test framework hang
|
||||
sed -i '/stty-pairs.sh/d' ${D}${PTEST_PATH}/Makefile
|
||||
|
||||
# Disable subcase tail-2/assert.sh as it has issues on 32-bit systems
|
||||
sed -i '/assert.sh/d' ${D}${PTEST_PATH}/Makefile
|
||||
|
||||
# Tweak test d_type-check to use python3 instead of python
|
||||
sed -i "1s@.*@#!/usr/bin/python3@" ${D}${PTEST_PATH}/tests/d_type-check
|
||||
install ${B}/src/getlimits ${D}/${bindir}
|
||||
|
||||
# handle multilib
|
||||
sed -i s:@libdir@:${libdir}:g ${D}${PTEST_PATH}/run-ptest
|
||||
}
|
||||
|
||||
do_install_ptest:append:libc-musl () {
|
||||
# these tests fail due to bash on musl systems
|
||||
# xmalloc: cannot allocate 16146 bytes
|
||||
sed -i -e '/tests\/dd\/no-allocate.sh/d' ${D}${PTEST_PATH}/Makefile
|
||||
sed -i -e '/tests\/split\/line-bytes.sh/d' ${D}${PTEST_PATH}/Makefile
|
||||
}
|
||||
FILES:${PN}-ptest += "${bindir}/getlimits"
|
||||
18
sources/poky/meta/recipes-core/dbus-wait/dbus-wait_git.bb
Normal file
18
sources/poky/meta/recipes-core/dbus-wait/dbus-wait_git.bb
Normal file
@@ -0,0 +1,18 @@
|
||||
SUMMARY = "A simple tool to wait for a specific signal over DBus"
|
||||
HOMEPAGE = "http://git.yoctoproject.org/cgit/cgit.cgi/dbus-wait"
|
||||
DESCRIPTION = "${SUMMARY}"
|
||||
SECTION = "base"
|
||||
LICENSE = "GPL-2.0-only"
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
|
||||
|
||||
DEPENDS = "dbus"
|
||||
|
||||
SRCREV = "64bc7c8fae61ded0c4e555aa775911f84c56e438"
|
||||
PV = "0.1+git"
|
||||
|
||||
SRC_URI = "git://git.yoctoproject.org/${BPN};branch=master;protocol=https"
|
||||
UPSTREAM_CHECK_COMMITS = "1"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
inherit autotools pkgconfig
|
||||
@@ -0,0 +1,17 @@
|
||||
Disable compiling examples
|
||||
|
||||
Upstream-Status: Inappropriate [disable feature]
|
||||
|
||||
Signed-off-by: Kevin Tian <kevin.tian@intel.com>
|
||||
Signed-off-by: Scott Garman <scott.a.garman@intel.com>
|
||||
|
||||
Index: dbus-glib-0.108/dbus/Makefile.am
|
||||
===================================================================
|
||||
--- dbus-glib-0.108.orig/dbus/Makefile.am
|
||||
+++ dbus-glib-0.108/dbus/Makefile.am
|
||||
@@ -1,4 +1,4 @@
|
||||
-SUBDIRS = . examples
|
||||
+SUBDIRS = .
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-I$(top_srcdir) \
|
||||
@@ -0,0 +1,57 @@
|
||||
Change Makefile.am to install regression tests for test package purpose.
|
||||
|
||||
Upstream-Status: Inappropriate [test not install is for purpose from upstream]
|
||||
|
||||
Signed-off-by: Yao Zhao <yao.zhao@windriver.com>
|
||||
Signed-off-by: Chong Lu <Chong.Lu@windriver.com>
|
||||
---
|
||||
test/Makefile.am | 3 ++-
|
||||
test/core/Makefile.am | 3 ++-
|
||||
test/interfaces/Makefile.am | 3 ++-
|
||||
3 files changed, 6 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/test/Makefile.am b/test/Makefile.am
|
||||
index 379c8c3..6580927 100644
|
||||
--- a/test/Makefile.am
|
||||
+++ b/test/Makefile.am
|
||||
@@ -48,7 +48,8 @@ TESTS = \
|
||||
$(test_scripts) \
|
||||
$(NULL)
|
||||
|
||||
-noinst_PROGRAMS = \
|
||||
+testdir = $(datadir)/@PACKAGE@/tests
|
||||
+test_PROGRAMS = \
|
||||
$(test_programs) \
|
||||
$(test_related_programs) \
|
||||
$(NULL)
|
||||
diff --git a/test/core/Makefile.am b/test/core/Makefile.am
|
||||
index e4bceb4..54b077d 100644
|
||||
--- a/test/core/Makefile.am
|
||||
+++ b/test/core/Makefile.am
|
||||
@@ -64,7 +64,8 @@ endif
|
||||
|
||||
## we use noinst_PROGRAMS not check_PROGRAMS for TESTS so that we
|
||||
## build even when not doing "make check"
|
||||
-noinst_PROGRAMS = \
|
||||
+testdir = $(datadir)/@PACKAGE@/tests/core
|
||||
+test_PROGRAMS = \
|
||||
test-dbus-glib \
|
||||
test-error-mapping \
|
||||
test-service-glib \
|
||||
diff --git a/test/interfaces/Makefile.am b/test/interfaces/Makefile.am
|
||||
index a94d08d..707dcac 100644
|
||||
--- a/test/interfaces/Makefile.am
|
||||
+++ b/test/interfaces/Makefile.am
|
||||
@@ -57,7 +57,8 @@ if DBUS_BUILD_TESTS
|
||||
|
||||
## we use noinst_PROGRAMS not check_PROGRAMS for TESTS so that we
|
||||
## build even when not doing "make check"
|
||||
-noinst_PROGRAMS = test-service test-client
|
||||
+testdir = $(datadir)/@PACKAGE@/tests/interfaces
|
||||
+test_PROGRAMS = test-service test-client
|
||||
|
||||
test_service_SOURCES = \
|
||||
test-interfaces.c \
|
||||
--
|
||||
1.9.1
|
||||
|
||||
39
sources/poky/meta/recipes-core/dbus/dbus-glib_0.112.bb
Normal file
39
sources/poky/meta/recipes-core/dbus/dbus-glib_0.112.bb
Normal file
@@ -0,0 +1,39 @@
|
||||
SUMMARY = "High level language (GLib) binding for D-Bus"
|
||||
DESCRIPTION = "GLib bindings for the D-Bus message bus that integrate \
|
||||
the D-Bus library with the GLib thread abstraction and main loop."
|
||||
HOMEPAGE = "https://www.freedesktop.org/Software/dbus"
|
||||
LICENSE = "AFL-2.1 | GPL-2.0-or-later"
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=c31c73c1d8f5d06784b2ccd22e42d641 \
|
||||
file://dbus/dbus-glib.h;beginline=7;endline=21;md5=c374833bd817988323f3a8fda0dc7f48"
|
||||
SECTION = "base"
|
||||
|
||||
DEPENDS = "expat glib-2.0 virtual/libintl dbus-glib-native dbus"
|
||||
DEPENDS:class-native = "glib-2.0-native dbus-native"
|
||||
|
||||
SRC_URI = "https://dbus.freedesktop.org/releases/dbus-glib/dbus-glib-${PV}.tar.gz \
|
||||
file://no-examples.patch \
|
||||
file://test-install-makefile.patch \
|
||||
"
|
||||
SRC_URI[md5sum] = "021e6c8a288df02c227e4aafbf7e7527"
|
||||
SRC_URI[sha256sum] = "7d550dccdfcd286e33895501829ed971eeb65c614e73aadb4a08aeef719b143a"
|
||||
|
||||
inherit autotools pkgconfig gettext bash-completion gtk-doc
|
||||
|
||||
#default disable regression tests, some unit test code in non testing code
|
||||
#PACKAGECONFIG:pn-${PN} = "tests" enable regression tests local.conf
|
||||
PACKAGECONFIG ??= ""
|
||||
PACKAGECONFIG[tests] = "--enable-tests,,,"
|
||||
|
||||
EXTRA_OECONF:class-target = "--with-dbus-binding-tool=${STAGING_BINDIR_NATIVE}/dbus-binding-tool"
|
||||
|
||||
PACKAGES += "${PN}-tests"
|
||||
|
||||
FILES:${PN} = "${libdir}/lib*${SOLIBS}"
|
||||
FILES:${PN}-bash-completion += "${libexecdir}/dbus-bash-completion-helper"
|
||||
FILES:${PN}-dev += "${libdir}/dbus-1.0/include ${bindir}/dbus-glib-tool"
|
||||
FILES:${PN}-dev += "${bindir}/dbus-binding-tool"
|
||||
|
||||
RDEPENDS:${PN}-tests += "dbus-x11"
|
||||
FILES:${PN}-tests = "${datadir}/${BPN}/tests"
|
||||
|
||||
BBCLASSEXTEND = "native"
|
||||
123
sources/poky/meta/recipes-core/dbus/dbus/dbus-1.init
Normal file
123
sources/poky/meta/recipes-core/dbus/dbus/dbus-1.init
Normal file
@@ -0,0 +1,123 @@
|
||||
#! /bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: dbus
|
||||
# Required-Start: $remote_fs $syslog
|
||||
# Required-Stop: $remote_fs $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 1
|
||||
# Short-Description: D-Bus systemwide message bus
|
||||
# Description: D-Bus is a simple interprocess messaging system, used
|
||||
# for sending messages between applications.
|
||||
### END INIT INFO
|
||||
#
|
||||
# -*- coding: utf-8 -*-
|
||||
# Debian init.d script for D-BUS
|
||||
# Copyright © 2003 Colin Walters <walters@debian.org>
|
||||
|
||||
# set -e
|
||||
|
||||
# Source function library.
|
||||
. /etc/init.d/functions
|
||||
|
||||
DAEMON=@bindir@/dbus-daemon
|
||||
NAME=dbus
|
||||
DAEMONUSER=messagebus # must match /usr/share/dbus-1/system.conf
|
||||
PIDFILE=/var/run/dbus/pid # must match /usr/share/dbus-1/system.conf
|
||||
UUIDDIR=/var/lib/dbus
|
||||
DESC="system message bus"
|
||||
EVENTDIR=/etc/dbus-1/event.d
|
||||
|
||||
test -x $DAEMON || exit 0
|
||||
|
||||
# Source defaults file; edit that file to configure this script.
|
||||
ENABLED=1
|
||||
PARAMS=""
|
||||
if [ -e /etc/default/dbus ]; then
|
||||
. /etc/default/dbus
|
||||
fi
|
||||
|
||||
test "$ENABLED" != "0" || exit 0
|
||||
|
||||
start_it_up()
|
||||
{
|
||||
mkdir -p "`dirname $PIDFILE`"
|
||||
if [ -e $PIDFILE ]; then
|
||||
PIDDIR=/proc/$(cat $PIDFILE)
|
||||
if [ -d ${PIDDIR} -a "$(readlink -f ${PIDDIR}/exe)" = "${DAEMON}" ]; then
|
||||
echo "$DESC already started; not starting."
|
||||
else
|
||||
echo "Removing stale PID file $PIDFILE."
|
||||
rm -f $PIDFILE
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -d $UUIDDIR ]; then
|
||||
mkdir -p $UUIDDIR
|
||||
chown $DAEMONUSER $UUIDDIR
|
||||
chgrp $DAEMONUSER $UUIDDIR
|
||||
fi
|
||||
|
||||
dbus-uuidgen --ensure
|
||||
|
||||
echo -n "Starting $DESC: "
|
||||
start-stop-daemon -o --start --quiet --pidfile $PIDFILE \
|
||||
--user $DAEMONUSER --exec $DAEMON -- --system $PARAMS
|
||||
echo "$NAME."
|
||||
if [ -d $EVENTDIR ]; then
|
||||
run-parts --arg=start $EVENTDIR
|
||||
fi
|
||||
}
|
||||
|
||||
shut_it_down()
|
||||
{
|
||||
if [ -d $EVENTDIR ]; then
|
||||
# TODO: --reverse when busybox supports it
|
||||
run-parts --arg=stop $EVENTDIR
|
||||
fi
|
||||
echo -n "Stopping $DESC: "
|
||||
start-stop-daemon -o --stop --quiet --pidfile $PIDFILE \
|
||||
--user $DAEMONUSER
|
||||
# We no longer include these arguments so that start-stop-daemon
|
||||
# can do its job even given that we may have been upgraded.
|
||||
# We rely on the pidfile being sanely managed
|
||||
# --exec $DAEMON -- --system $PARAMS
|
||||
echo "$NAME."
|
||||
rm -f $PIDFILE
|
||||
}
|
||||
|
||||
reload_it()
|
||||
{
|
||||
echo -n "Reloading $DESC config: "
|
||||
dbus-send --print-reply --system --type=method_call \
|
||||
--dest=org.freedesktop.DBus \
|
||||
/ org.freedesktop.DBus.ReloadConfig > /dev/null
|
||||
# hopefully this is enough time for dbus to reload it's config file.
|
||||
echo "done."
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start_it_up
|
||||
;;
|
||||
stop)
|
||||
shut_it_down
|
||||
;;
|
||||
status)
|
||||
status $DAEMON
|
||||
exit $?
|
||||
;;
|
||||
reload|force-reload)
|
||||
reload_it
|
||||
;;
|
||||
restart)
|
||||
shut_it_down
|
||||
sleep 1
|
||||
start_it_up
|
||||
;;
|
||||
*)
|
||||
echo "Usage: /etc/init.d/$NAME {start|stop|status|restart|reload|force-reload}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
3
sources/poky/meta/recipes-core/dbus/dbus/run-ptest
Executable file
3
sources/poky/meta/recipes-core/dbus/dbus/run-ptest
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
gnome-desktop-testing-runner dbus
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user