summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
Commit message (Collapse)AuthorAgeFilesLines
* initscripts: Clean up license handling/identifiersRichard Purdie2022-04-011-0/+4
| | | | | | | | | | | The license is clear, add an SPDX license identification headers to the scripts and drop the weird patch, we don't need it. (From OE-Core rev: 540041ac80cfc91df61b45d48f9c9ebbc9b2e71e) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* initscripts: populate-volatile.sh: run create_file synchronouslyMatthias Schiffer2021-07-241-1/+1
| | | | | | | | | | | | | | | | | | | The behavior of running create_file in the background was introduced in d44816bedade ("initscripts: Populate volatile from existing file") without further explanation. Besides its questionable benefit, this causes actual issues: - Not all create_file processes may have finished by the time the initscript exits (or when it moves /etc/volatile.cache.build !) - By making the order of commands nondeterminstic, it could hide dependency issues where it was attempted to create files before their containing directories (From OE-Core rev: 1a4ddb0d3f1289e0b67b6eba9be58374d3d7a80b) Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* initscripts: populate-volatile.sh: do not log to tty0Matthias Schiffer2021-07-241-4/+4
| | | | | | | | | | | | tty0 may not be the intended console for log messages, or it may not exist at all in kernel configurations without CONFIG_VT. Just use the default stdout/stderr instead. (From OE-Core rev: 669e74d358db59768862515fe584aa1edf6cec04) Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* initscripts: Fix populate-volatile.sh bug when file/dir existsAndrei Gherzan2020-07-271-12/+12
| | | | | | | | | | | | | | | The blocks which test for entry exitence (file or directory) use a `A && B || C` syntax. This form is not behaving as a if-then-else block even the code logic assumes that. C may run when A is true which breaks the case where VERBOSE is 'no' but the file/directory exists. Along with fixing these specific issues, this patch fixes the other instances where blocks of form `A && B || C` are used as if-then-else. (From OE-Core rev: 1b9ea22acb66554925720e04cf24100664234574) Signed-off-by: Andrei Gherzan <andrei@gherzan.ro> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* initscripts: Fix various shellcheck warnings in populate-volatile.shAndrei Gherzan2020-07-271-29/+29
| | | | | | | (From OE-Core rev: 0a128a238f63d52aa82f8c63ee2f84ab528b3346) Signed-off-by: Andrei Gherzan <andrei@gherzan.ro> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* initscripts: remove warnings on read-only-rootfs (again)Martin Hundebøll2019-08-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the populate-volatile.sh initscript tests if a configured symlink is already in place, it uses readlink with the '-f' (follow) option: > [ "$(readlink -f $source)" = "$dest" ] If the test fails, it proceeds to delete the exisiting folder/file, and create the configured symlink. However, the '-f' option to readlink makes it follow symlinks pointing at symlinks. If the $dest argument is a symlink, the above test fails, and warnings are printed due to changing a read-only rootfs. This is the case for /tmp, and /etc/resolv.conf: > /tmp -> /var/tmp -> /var/volatile/tmp > /etc/resolv.conf -> /var/run/resolv.conf -> /run/resolv.conf Fix the warnings by removing the '-f' option, so that the test matches the configuration. [ YOCTO #10814 ] (From OE-Core rev: fb028a0a25c02ab56ad262afd8e6e9495a44673d) Signed-off-by: Martin Hundebøll <martin@geanix.com> Signed-off-by: Jacob Kroon <jacob.kroon@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* meta: Use double colon for chown OWNER:GROUPKosta Zertsekel2018-11-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Rationale - excerp from `info chown` ==================================== OWNER‘:’GROUP If the OWNER is followed by a colon and a GROUP (a group name or numeric group ID), with no spaces between them, the group ownership of the files is changed as well (to GROUP). Some older scripts may still use ‘.’ in place of the ‘:’ separator. POSIX 1003.1-2001 (*note Standards conformance::) does not require support for that, but for backward compatibility GNU ‘chown’ supports ‘.’ so long as no ambiguity results. New scripts should avoid the use of ‘.’ because it is not portable, and because it has undesirable results if the entire OWNER‘.’GROUP happens to identify a user whose name contains ‘.’. (From OE-Core rev: 185918234a07cb506d7d7464a49ac33972c7d963) Signed-off-by: Kosta Zertsekel <zertsekel@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* initscripts: populate-volatiles: Speed up processingJoshua Watt2018-10-141-4/+33
| | | | | | | | | | | | | | | | | | | | | | | | Checking the requirements for each volatiles file in the populate-volatiles script can be very slow when there are a large number of volatiles files, easily consuming over 80% of the processing time. These checks don't usually uncover any problems so concatenate all the volatiles files together and process them as one large file for a "fast path" option. This ensures that the penalty for checking the requirements is only incurred once. In the event that checking the requirements for the unified file fails, fall back to the slow process of checking each one individually so that the offending one can be skipped. The core file is handled separately because it is responsible for creating the temp directory used by check_requirements and thus must always run first and without having its requirements checked. [YOCTO #12949] (From OE-Core rev: f380fac8a43a75861f3157777b12a317b985a5e1) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* initscripts: Populate volatile from existing fileDavid Vincent2017-06-061-2/+14
| | | | | | | | | | | | | | | In some cases, it may be useful to populate a volatile file from an existing one, e.g. a file in a read-only rootfs that may be edited in a read-write destination. To provide this behavior, creation of volatile files has been updated to copy a file which has been given in the <linksource> field. If set to none, the current behavior is preserved. (From OE-Core rev: d44816bedadeef420226dc5efb67065cfcda6634) Signed-off-by: David Vincent <freesilicon@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* initscripts: populate-volatile: suppress read-only-rootfs warningsAndré Draszik2016-12-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | rm: can't remove '/etc/resolv.conf': Read-only file system ln: /etc/resolv.conf: File exists /etc/default/volatiles contains an entry: l root root 0644 /etc/resolv.conf /var/run/resolv.conf which causes populate-volatile.sh to execute the following in link_file(): if [ -L \"$2\" ]; then [ \"\$(readlink -f \"$2\")\" != \"\$(readlink -f \"$1\")\" ] && { rm -f \"$2\"; ln -sf \"$1\" \"$2\"; }; elif [ -d \"$2\" ]; then ... At the time the image is created, /etc/resolv.conf is already a symlink to /var/run/resolv.conf, but at boot time when populate-volatiles.sh is run, /var/run/resolv.conf doesn't exist, causing it to try to rm -f and ln -sf which of course fails due to the read-only filesystem. [YOCTO #10814] (From OE-Core rev: 765ee275f5499254b1f09e394c757072bea5f459) Signed-off-by: André Draszik <adraszik@tycoint.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* initscripts: populate-volatile: don't run commands in backgroundMans Rullgard2016-12-221-3/+3
| | | | | | | | | | | If commands are run asynchronously they may be completed out of order causing problems if later entries depend on earlier ones. (From OE-Core rev: bead9e59768209dd70f9cba51d2f1e5925cc284d) Signed-off-by: Mans Rullgard <mans@mansr.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* initscripts: populate-volatile: improve config file parsingMans Rullgard2016-12-131-3/+3
| | | | | | | | | | | This improves the config file parsing to permit blank lines and comments following an entry or preceeded by whitespace. (From OE-Core rev: 415eaacb83b1c6df5210fb423e3e96e530b1dc42) Signed-off-by: Mans Rullgard <mans@mansr.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* initscripts: populate-volatiles.sh: add mount-bind featureJens Rehsack2016-02-141-0/+10
| | | | | | | | | | | | | | | | Add ability to run "mount --bind" to populate-volatiles. Since several programs use realpath to determine several full qualified file names, there is no symlink to be resolved. So when speccing /run/lock - that's the location - not /var/run/lock because of the program is smarter than the operator/distributor. See https://github.com/rehsack/meta-jens/blob/jethro/recipes-core/initscripts/initscripts/volatiles for an example how to use the "b" feature. (From OE-Core rev: ab42fcaf1427a29c31ac2e93965e20849b1b1234) Signed-off-by: Jens Rehsack <sno@netbsd.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* initscripts: update populate-volatile.shKai Kang2014-06-241-4/+6
| | | | | | | | | | | | | | | | | | If a partition such as /tmp mounted on a volatile directory which create by script populate-volatile.sh from initscripts, it will show errors. In /var/log/boot, error message: Thu Jun 19 05:39:09 2014: bootlogd. Thu Jun 19 05:39:10 2014: rm: cannot remove '/tmp': Device or resource busy Check volatile directories and if it is be mounted then don't force make it as a link. (From OE-Core rev: cc4b0936c7a6a1563dc88d62d8c9020791eaa446) Signed-off-by: Kai Kang <kai.kang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* initscripts: avoid pipe with sedMatthieu Crapet2014-05-081-2/+2
| | | | | | | | | | | | | | | Small optimisation in /etc/init.d/populate-volatile.sh. Replace: cat <file> | sed -e xxx By: sed -e xxx <file> (From OE-Core rev: c91739cd08ed5451a0927586a14db54c4c328ad7) Signed-off-by: Matthieu Crapet <Matthieu.Crapet@ingenico.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* initscripts: filter out empty lines from volatiles in check_requirements()Ming Liu2013-09-101-2/+2
| | | | | | | | | | So far the rules of check_requirements() is too strict to lead mismatch when empty lines exist in volatiles. (From OE-Core rev: 71ab9ee58b0ba5e3f5cbf403d1b8fb79fc7f5ed1) Signed-off-by: Ming Liu <ming.liu@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* populate-volatile.sh: use 'cp -a' to avoid potential problemChen Qi2013-08-161-1/+2
| | | | | | | | | | | | Previously, dead links in target directory will not be copied. This is incorrect as dead links are not uncommon in our rootfs. So we use '-a' option instead. (From OE-Core rev: 742440441222e0627abbdd3eb2ee16401e8f4adf) Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* populate-volatile.sh: don't spawn background process at rootfs timeChen Qi2013-08-161-3/+3
| | | | | | | | | | | | | | | | | | | If we're building a read-only rootfs, we'll get the following error now and then. tar: .: file changed as we read it The root cause is that we spawn background process at rootfs time. When the tar command is running, it's possible that files under rootfs are changed by background processes, thus this error. [YOCTO #4937] (From OE-Core rev: 4bd419f95868d5b8707a45cee5f6c5c6a840a65b) Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* populate-volatile.sh: use $ROOT_DIR/var/volatile/tmp as TMPDIRChen Qi2013-08-161-1/+1
| | | | | | | | | | | | | | | | | | It's possible that a 'No such directory' error occurs when doing check_requirement in populate-volatile.sh at rootfs time. This is because the $ROOT_DIR/var/tmp might be a dead link. Use $ROOT_DIR/var/volatile/tmp as the TMPDIR instead to avoid this error. [YOCTO #4883] [YOCTO #4103] (From OE-Core rev: 7c2c36a97bab46c73a3a1fb743ad3ec67a4c072e) Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* populate-volatile.sh: remove repeated leading slashes in TNAMEJonathan Liu2013-05-241-7/+7
| | | | | | | | | | | | | | | | This avoids triple slashes in the generated /etc/volatile.cache to reduce disk usage and in the output when verbose mode is enabled. As all the paths for volatiles start with a slash, we can change TNAME=${ROOT_DIR}/${TNAME} to TNAME=${ROOT_DIR}${TNAME}. To avoid a double slash when ROOT_DIR is /, we strip the extra slash from ROOT_DIR. (From OE-Core rev: af56670f656ec0989aa7fd6cf6037cbc9cd88185) Signed-off-by: Jonathan Liu <net147@gmail.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* populate-volatile.sh: remove trailing whitespacesChen Qi2013-03-071-3/+3
| | | | | | | | | | Remove trailing whitespaces. (From OE-Core rev: 082dca6f73858581863f103b467ff73cebe2c0da) Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* populate-volatile.sh: improve the handling of link config itemsChen Qi2013-03-071-16/+21
| | | | | | | | | | | | | | | | | | | | | | | | Previously, if there's a link config item in the config file like l root root 1777 /tmp /var/tmp and /tmp has existed, the symlink will not be created correctly. Another example is the /run directory. If /run directory has been created by some recipe or script before populate-volatile.sh runs, the symlink of /run to /var/run will not be created correctly. This patch ensures that the system creates symlinks exactly as the config file tells it. [YOCTO #3404] [YOCTO #3406] (From OE-Core rev: a54287d8e3d75a727c8ed5654a822bda256b0849) Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* populate-volatile.sh: add ROOT_DIR variable to support running at rootfs timeChen Qi2013-03-071-17/+45
| | | | | | | | | | | | | | | | | | | | | | | | For populate-volatile.sh script to run correctly both at rootfs time and at system boot time, it needs to be aware of which situation it is now in. We use the ROOT_DIR variable to indicate whether it is run at rootfs time or not. ROOT_DIR being "/" indicates that this script is run at system boot time, otherwise, it is run at rootfs time. Also, we ignore failures when running this script at rootfs time. For example, if ${ROOT_DIR}/var/dir1 is symlink to /var/volatile/dir1, it's possible that the link is a dead link. So if we're going to create some file under ${ROOT_DIR}/var/dir1, it will fail. But the failure does no harm, because this script will always run at system boot time to set up the correct files and directories. [YOCTO #3406] (From OE-Core rev: 45396e3edcce4a33fcbef6456f31811f30c26c63) Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* initiscripts: Fix populate-volatiles.sh whitespaceRichard Purdie2013-02-061-110/+97
| | | | | | (From OE-Core rev: d69935fbef2b5a8b187e58ac5ade0ffb9f95f803) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* initscripts: don't bg mk_dirs in populate-volatileChristopher Larson2012-07-261-2/+2
| | | | | | | | | | | | | | | | If a directory needs to be created to create something else in volatiles, there's no guarantees on ordering due to the backgrounding. We can't guarantee with certainty that the create directory commands are complete before the later ones run. This ensures that we wait for directory creations to complete before we proceed. Chris Hallinan hit an actual failure due to this back in March of last year. (From OE-Core rev: 138c3c26830e48a56ca7cb3e5feca324d13ec89c) Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* initscripts: Create the volatiles cache atomically.James Limbouris2012-03-021-4/+6
| | | | | | | | | | | If a machine loses power while building the volatiles cache, it will continue to operate with an incomplete set of volatiles. Fix this by updating atomically. (From OE-Core rev: a60432ff4588390f5f955a6da234298e958546e6) Signed-off-by: James Limbouris <james@digitalmatter.com.au> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* Major layout change to the packages directoryRichard Purdie2010-08-271-0/+197
Having one monolithic packages directory makes it hard to find things and is generally overwhelming. This commit splits it into several logical sections roughly based on function, recipes.txt gives more information about the classifications used. The opportunity is also used to switch from "packages" to "recipes" as used in OpenEmbedded as the term "packages" can be confusing to people and has many different meanings. Not all recipes have been classified yet, this is just a first pass at separating things out. Some packages are moved to meta-extras as they're no longer actively used or maintained. Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>