[arch-projects] [initscripts][PATCH 1/2] arch-tmpfiles: allow passing specific config files
Modify our path collection loop to accept the remaining argv as paths to config files. This overrides the default lookup for config files in /etc, /lib, and /run so that single config files can be parsed at a time (e.g. during package installation). Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- Also makes testing a bit easier... arch-tmpfiles | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch-tmpfiles b/arch-tmpfiles index 3b94885..4b12841 100755 --- a/arch-tmpfiles +++ b/arch-tmpfiles @@ -235,7 +235,7 @@ fi # directories declared later in the tmpfiles_d array will override earlier # directories, on a per file basis. # Example: `/etc/tmpfiles.d/foo.conf' supersedes `/usr/lib/tmpfiles.d/foo.conf'. -for path in "${tmpfiles_d[@]}"; do +for path in "${@:-${tmpfiles_d[@]}}"; do [[ -f $path ]] && fragments[${path##*/}]=${path%/*} done -- 1.7.9.3
The whole point of using numeric IDs is to avoid resolution in the passwd/group databases. If we encounter an ID which is simply numeric, leave it alone. Looks like I broke this in a4558c4c trying to be a bit too clever. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- arch-tmpfiles | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/arch-tmpfiles b/arch-tmpfiles index 4b12841..8d927de 100755 --- a/arch-tmpfiles +++ b/arch-tmpfiles @@ -25,13 +25,19 @@ checkparams() { fi # uid must be numeric or a valid user name - if [[ $uid ]] && ! getent passwd "$uid" >/dev/null; then - return 1 + # don't try to resolve numeric IDs in case they don't exist + if [[ $uid ]]; then + if [[ $uid != +([0-9]) ]] && ! getent passwd "$uid" >/dev/null; then + return 1 + fi fi # gid must be numeric or a valid group name - if [[ $gid ]] && ! getent group "$gid" >/dev/null; then - return 1 + # don't try to resolve numeric IDs in case they don't exist + if [[ $gid ]]; then + if [[ $gid != +([0-9]) ]] && ! getent group "$gid" >/dev/null; then + return 1 + fi fi return 0 -- 1.7.9.3
On Sun, Mar 11, 2012 at 6:17 PM, Dave Reisner <d@falconindy.com> wrote:
The whole point of using numeric IDs is to avoid resolution in the passwd/group databases. If we encounter an ID which is simply numeric, leave it alone.
Looks like I broke this in a4558c4c trying to be a bit too clever.
Thanks. -t
On Sun, Mar 11, 2012 at 6:17 PM, Dave Reisner <d@falconindy.com> wrote:
Modify our path collection loop to accept the remaining argv as paths to config files. This overrides the default lookup for config files in /etc, /lib, and /run so that single config files can be parsed at a time (e.g. during package installation).
Makes sense, I have been wanting this for a long time. Thanks! -t
participants (2)
-
Dave Reisner
-
Tom Gundersen