summaryrefslogtreecommitdiffstats
path: root/package/makedevs/makedevs.c
Commit message (Collapse)AuthorAgeFilesLines
* makedevs: allow leading whitespace for capabilitiesRicardo Martincoski2018-08-101-1/+1
| | | | | | | | | | | | | | | | | | Currently makedevs silently ignores extended attributes with leading whitespace, for example those added to a <PACKAGE>_PERMISSIONS following the recommended style from check-package. Makedevs already ignores leading whitespace for normal entries (file permission changes and device files creation). Do the same for extended attributes. Fixes: #11191. Reported-by: Jean-pierre Cartal <jpcartal@free.fr> Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com> Cc: Arnout Vandecappelle <arnout@mind.be> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* makedevs: support optional filesArnout Vandecappelle2017-07-041-1/+4
| | | | | | | | | | | | | | | | | Add the 'F' file type to makedevs, that allows a file to be optional. With this option, the line is just silently skipped if the file doesn't exist (or is not a regular file). This is useful for _PERMISSIONS where the file can be configured out by package-specific configuration that is not directly handled by Buildroot, like busybox. Cc: Clayton Shotwell <clayton.shotwell@rockwellcollins.com> Cc: Matthew Weber <matthew.weber@rockwellcollins.com> Cc: Niranjan Reddy <niranjan.reddy@rockwellcollins.com> Cc: Bryce Ferguson <bryce.ferguson@rockwellcollins.com> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* Revert "makedevs: make device node creation idempotent"Peter Korsgaard2016-11-271-16/+2
| | | | | | This reverts commit c85cd189dc1ded92b78c5968860ff447ec9815ad. Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* makedevs: make device node creation idempotentArnout Vandecappelle2016-11-051-2/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We use makedevs to create device nodes in the target rootfs. However, this can be called several times, e.g. when building several filesystem images or when rebuilding. When makedevs is called the second time, the device node already exists so mknod() errors out. This wasn't noticed before because fakeroot's mknod() wrapper (incorrectly) does _not_ error out when the file exists already. Now we switched from fakeroot to pseudo, the problem becomes apparent. Before creating the device node, check if it already exists and if so, if it has the correct device type and number. Change of mode and ownership is still done. This approach was preferred over removing the target files before creating them, which would be simpler. However, when e.g. a file exists as a normal file and makedevs specifies it as a device node, that really is an error so we should detect it. The other types don't have to be changed. The 'd' (directory) type is already OK because it already only creates directories if they don't exist yet. The 'f' (file mode) and 'r' (recursive) types only operate on files and directories that exist already. Patch also sent upstream to busybox. Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Reported-by: Fabio Estevam <festevam@gmail.com> Tested-by: Fabio Estevam <festevam@gmail.com> Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* makedevs: resync device creation with upstream busyboxArnout Vandecappelle2016-11-051-32/+15
| | | | | | | | | | | | | | | | | | | | | | | In upstream busbyox, the code to create devices has been simplified: the code for a single and for multiple devices is no longer duplicated. Since we are going to change the device creation code next, it's convenient to have only one copy to modify. There are two behavioural changes with this, but they were introduced silently together with other commits in upstream busybox. - When mknod() fails, the chmod was still done. This is pointless so it is no longer done now. - There was a check for mode != -1; however, a mode of -1 would not have worked anyway because all bits would be set for mknod(), which would fail. So this check is redundant. Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Tested-by: Fabio Estevam <festevam@gmail.com> Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* makedevs: add capability supportPhilippe Reynes2016-06-301-2/+70
| | | | | | | | | | | | Add the support of capability to makedevs as extended attribute. Now, it's possible to add a line "|xattr <capability>" after a file description to also add a capability to this file. It's possible to add severals capabilities with severals lines. [Peter: extend doc, reword Config.in, extend error message, use HOST_MAKEDEVS_CFLAGS/LDFLAGS for all flags] Signed-off-by: Philippe Reynes <philippe.reynes@sagemcom.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* package/makedevs: use the rooted /etc/passwd and /etc/groupYann E. MORIN2016-02-011-9/+31
| | | | | | | | | | | | | | | | | | | | | Currently, makedevs will query the host's /etc/passwd and /etc/group to resolve usernames and group names. This is inherently flawed, as we can never guarantee that the UIDs will be the same on the target as on the host, or even whether a particular user does exist on the host. This is because getpwnam() and getgrnam() will forcibly read the system's /etc/passwd and /etc/group, and there is no way to tell them to look anywhere else. However, we can use fgetpwent() and fgetgrent() instead, for which we can pass a FILE* stream to read from to get the entries. This means we must implement the scanning-loop ourselves, but fortunately, that's pretty trivial to do. [Peter: swap errno / return value check, use bb_perror_msg_and_die, code style] Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* package/makedevs: fixing missing return typeAngelo Compagnucci2015-04-131-1/+1
| | | | | | | This patch fixes a missing return type in bb_recursive function. Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* package/makedevs: add recursive optionAngelo Compagnucci2015-04-111-0/+31
| | | | | | | | | | | | This patch adds the option to change owner/permission of a directory recursively. [Thomas: s/folder/directory/, as suggested by Yann.] Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com> Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* Fix makedevs to allow longer path namesJulian Lunz2012-04-081-2/+2
| | | | | | | Makedevs path name is currently limited to 40, changed it to PATH_MAX 4096 from linux/include/linux/limits.h Signed-off-by: Julian Lunz <git@jlunz.de> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* makedevs: remove compiler warning about used-but-setPeter Korsgaard2011-10-091-1/+1
| | | | | | | Closes #4171 Based on patch by Hector Oron <hector.oron@gmail.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* makedevs: minor fix to command's helpJavier Viguera2011-05-251-1/+1
| | | | | Signed-off-by: Javier Viguera <javier.viguera@digi.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* makedevs: don't call /bin/sync after creating nodesPeter Korsgaard2011-03-121-3/+0
| | | | | | | | | | Closes #3475 There's no real reason to sync after creating the device nodes, and it slows down the file system image creating quite a lot on busy systems, so get rid of it. Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* makedevs: fix cases where (start != 0)Thomas De Schampheleire2011-02-231-5/+13
| | | | | | | | | | | The makedevs script did not always generate the requested set of device names / minor number series. * If start != 0, then requesting (count) devices would generate only (count - start) * If start != 0 && increment != 1, then requesting minors starting with (minor) would generate minors starting with (minor + (start * (increment - 1))) This patch fixes the code and updates the usage text with extra examples. Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* makedevs: Add support for 16-bit major/minor numbersMatt Fleming2011-01-141-2/+2
| | | | | | | | Closes #2647 [Peter: Adjust for the real 12bit majors/20bit minors supported by Linux] Signed-off-by: Matt Fleming <matthew.fleming@imgtec.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* makedevs: move to package/Thomas Petazzoni2010-04-191-0/+535
Since target/ doesn't contain any .mk file in subdirectories, also remove the include in target/Makefile.in.
OpenPOWER on IntegriCloud