Gentoo Archives: gentoo-commits

From: William Hubbs <williamh@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/openrc:master commit in: sh/, conf.d/, /, runlevels/, init.d/
Date: Thu, 01 Dec 2016 18:15:33
Message-Id: 1480615494.e0ac661419042cb39c1ccf93df2981504d1e6339.williamh@OpenRC
1 commit: e0ac661419042cb39c1ccf93df2981504d1e6339
2 Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
3 AuthorDate: Tue Nov 15 00:12:06 2016 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Thu Dec 1 18:04:54 2016 +0000
6 URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=e0ac6614
7
8 split tmpfiles processing into opentmpfiles
9
10 The openntmpfiles package is designed so that it can be used on systems
11 independently of whether openrc is used.
12
13 NEWS.md | 8 +
14 conf.d/Makefile | 3 +-
15 conf.d/tmpfiles | 3 -
16 init.d/.gitignore | 2 -
17 init.d/Makefile | 6 +-
18 init.d/tmpfiles.dev.in | 20 ---
19 init.d/tmpfiles.setup.in | 19 --
20 runlevels/Makefile | 3 +-
21 sh/.gitignore | 1 -
22 sh/Makefile | 4 +-
23 sh/tmpfiles.sh.in | 457 -----------------------------------------------
24 11 files changed, 15 insertions(+), 511 deletions(-)
25
26 diff --git a/NEWS.md b/NEWS.md
27 index 931d0ab..6027aa0 100644
28 --- a/NEWS.md
29 +++ b/NEWS.md
30 @@ -3,6 +3,14 @@
31 This file will contain a list of notable changes for each release. Note
32 the information in this file is in reverse order.
33
34 +## OpenRC-0.23
35 +
36 +The tmpfiles.d processing code, which was part of previous versions of
37 +OpenRC, has been separated into its own package [1]. If you need to
38 +process systemd style tmpfiles.d files, please install this package.
39 +
40 +[1] https://github.com/openrc/opentmpfiles
41 +
42 ## OpenRC-0.22
43
44 In previous versions of OpenRC, configuration information was processed
45
46 diff --git a/conf.d/Makefile b/conf.d/Makefile
47 index a18ca74..6c7962b 100644
48 --- a/conf.d/Makefile
49 +++ b/conf.d/Makefile
50 @@ -1,8 +1,7 @@
51 include ../mk/net.mk
52
53 DIR= ${CONFDIR}
54 -CONF= bootmisc fsck hostname localmount netmount swap urandom tmpfiles \
55 - ${CONF-${OS}}
56 +CONF= bootmisc fsck hostname localmount netmount swap urandom ${CONF-${OS}}
57
58 ifeq (${MKNET},yes)
59 CONF+= network staticroute
60
61 diff --git a/conf.d/tmpfiles b/conf.d/tmpfiles
62 deleted file mode 100644
63 index c3f208f..0000000
64 --- a/conf.d/tmpfiles
65 +++ /dev/null
66 @@ -1,3 +0,0 @@
67 -# Extra options for tmpfiles.sh
68 -#tmpfiles_opts="--verbose"
69 -tmpfiles_opts=""
70
71 diff --git a/init.d/.gitignore b/init.d/.gitignore
72 index 98748c7..b8cbb48 100644
73 --- a/init.d/.gitignore
74 +++ b/init.d/.gitignore
75 @@ -45,5 +45,3 @@ syslogd
76 termencoding
77 ttys
78 wscons
79 -tmpfiles.dev
80 -tmpfiles.setup
81
82 diff --git a/init.d/Makefile b/init.d/Makefile
83 index bec4eaf..75c88ad 100644
84 --- a/init.d/Makefile
85 +++ b/init.d/Makefile
86 @@ -2,8 +2,8 @@ include ../mk/net.mk
87
88 DIR= ${INITDIR}
89 SRCS= bootmisc.in fsck.in hostname.in local.in localmount.in loopback.in \
90 - netmount.in osclock.in root.in savecache.in swap.in tmpfiles.setup.in \
91 - swclock.in sysctl.in runsvdir.in urandom.in s6-svscan.in ${SRCS-${OS}}
92 + netmount.in osclock.in root.in savecache.in swap.in swclock.in \
93 + sysctl.in runsvdir.in urandom.in s6-svscan.in ${SRCS-${OS}}
94 BIN= ${OBJS}
95
96 # Are we installing our network scripts?
97 @@ -23,7 +23,7 @@ SRCS-FreeBSD+= adjkerntz.in devd.in dumpon.in encswap.in ipfw.in \
98
99 SRCS-Linux= binfmt.in devfs.in dmesg.in hwclock.in consolefont.in keymaps.in \
100 killprocs.in modules.in modules-load.in mount-ro.in mtab.in numlock.in \
101 - procfs.in net-online.in sysfs.in termencoding.in tmpfiles.dev.in
102 + procfs.in net-online.in sysfs.in termencoding.in
103
104 # Generic BSD scripts
105 SRCS-NetBSD= hostid.in moused.in newsyslog.in pf.in rarpd.in rc-enabled.in \
106
107 diff --git a/init.d/tmpfiles.dev.in b/init.d/tmpfiles.dev.in
108 deleted file mode 100644
109 index c70a29e..0000000
110 --- a/init.d/tmpfiles.dev.in
111 +++ /dev/null
112 @@ -1,20 +0,0 @@
113 -#!@SBINDIR@/openrc-run
114 -# Copyright 1999-2012 Gentoo Foundation
115 -# Released under the 2-clause BSD license.
116 -
117 -description="Set up tmpfiles.d entries"
118 -
119 -depend()
120 -{
121 - use dev-mount
122 - before dev
123 - keyword -prefix -vserver
124 -}
125 -
126 -start()
127 -{
128 - ebegin "Setting up tmpfiles.d entries for /dev"
129 - @LIBEXECDIR@/sh/tmpfiles.sh --prefix=/dev --create --boot ${tmpfiles_opts}
130 - eend $?
131 - return 0
132 -}
133
134 diff --git a/init.d/tmpfiles.setup.in b/init.d/tmpfiles.setup.in
135 deleted file mode 100644
136 index 5872fea..0000000
137 --- a/init.d/tmpfiles.setup.in
138 +++ /dev/null
139 @@ -1,19 +0,0 @@
140 -#!@SBINDIR@/openrc-run
141 -# Copyright 1999-2012 Gentoo Foundation
142 -# Released under the 2-clause BSD license.
143 -
144 -description="Set up tmpfiles.d entries"
145 -
146 -depend()
147 -{
148 - need localmount
149 -}
150 -
151 -start()
152 -{
153 - ebegin "Setting up tmpfiles.d entries"
154 - @LIBEXECDIR@/sh/tmpfiles.sh --exclude-prefix=/dev --create --remove --boot \
155 - ${tmpfiles_opts}
156 - eend $?
157 - return 0
158 -}
159
160 diff --git a/runlevels/Makefile b/runlevels/Makefile
161 index 6abd8c5..103577a 100644
162 --- a/runlevels/Makefile
163 +++ b/runlevels/Makefile
164 @@ -37,9 +37,8 @@ BOOT-FreeBSD+= hostid modules newsyslog savecore syslogd
165 BOOT-FreeBSD+= adjkerntz dumpon syscons
166
167 BOOT-Linux+= binfmt hwclock keymaps modules mtab procfs termencoding \
168 - tmpfiles.setup
169 SHUTDOWN-Linux= killprocs mount-ro
170 -SYSINIT-Linux= devfs dmesg sysfs tmpfiles.dev
171 +SYSINIT-Linux= devfs dmesg sysfs
172
173 # Generic BSD stuff
174 BOOT-NetBSD+= hostid newsyslog savecore syslogd
175
176 diff --git a/sh/.gitignore b/sh/.gitignore
177 index f814f4a..8a00710 100644
178 --- a/sh/.gitignore
179 +++ b/sh/.gitignore
180 @@ -6,6 +6,5 @@ cgroup-release-agent.sh
181 init.sh
182 init-early.sh
183 rc-cgroup.sh
184 -tmpfiles.sh
185 migrate-to-run.sh
186 binfmt.sh
187
188 diff --git a/sh/Makefile b/sh/Makefile
189 index 1af23ec..4d7148f 100644
190 --- a/sh/Makefile
191 +++ b/sh/Makefile
192 @@ -1,9 +1,9 @@
193 DIR= ${LIBEXECDIR}/sh
194 SRCS= init.sh.in functions.sh.in gendepends.sh.in \
195 - openrc-run.sh.in rc-functions.sh.in tmpfiles.sh.in ${SRCS-${OS}}
196 + openrc-run.sh.in rc-functions.sh.in ${SRCS-${OS}}
197 INC= rc-mount.sh functions.sh rc-functions.sh runit.sh s6.sh \
198 start-stop-daemon.sh supervise-daemon.sh
199 -BIN= gendepends.sh init.sh openrc-run.sh tmpfiles.sh ${BIN-${OS}}
200 +BIN= gendepends.sh init.sh openrc-run.sh ${BIN-${OS}}
201
202 INSTALLAFTER= _installafter
203
204
205 diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
206 deleted file mode 100644
207 index 87545ed..0000000
208 --- a/sh/tmpfiles.sh.in
209 +++ /dev/null
210 @@ -1,457 +0,0 @@
211 -#!/bin/sh
212 -# This is a reimplementation of the systemd tmpfiles.d code
213 -# Control creation, deletion, and cleaning of volatile and temporary files
214 -#
215 -# Copyright (c) 2012 Gentoo Foundation
216 -# Released under the 2-clause BSD license.
217 -#
218 -# This instance is a pure-POSIX sh version, written by Robin H Johnson
219 -# <robbat2@g.o>, based on the Arch Linux version as of 2012/01/01:
220 -# http://projects.archlinux.org/initscripts.git/tree/arch-tmpfiles
221 -#
222 -# See the tmpfiles.d manpage as well:
223 -# https://www.freedesktop.org/software/systemd/man/tmpfiles.d.html
224 -# This script should match the old manpage
225 -# http://0pointer.de/public/systemd-man/tmpfiles.d.html
226 -# as of 2012/03/12 and also implements some more recent features
227 -#
228 -
229 -DRYRUN=0
230 -CHECKPATH="@LIBEXECDIR@/bin/checkpath"
231 -
232 -checkprefix() {
233 - n=$1
234 - shift
235 - for x in $@; do
236 - case $n in
237 - ${x}*) return 0 ;;
238 - esac
239 - done
240 - return 1
241 -}
242 -
243 -warninvalid() {
244 - printf "tmpfiles: ignoring invalid entry on line %d of \`%s'\n" "$LINENUM" "$FILE"
245 - error=$(( error+1 ))
246 -} >&2
247 -
248 -invalid_option() {
249 - printf "tmpfiles: invalid option '%s'\n" "$1" >&2
250 - exit 1
251 -}
252 -
253 -dryrun_or_real() {
254 - local dryrun=
255 - [ $DRYRUN -eq 1 ] && dryrun=echo
256 - $dryrun "$@"
257 -}
258 -
259 -_chattr() {
260 - local attr="$2"
261 - case $attr in
262 - [+-=]*) : ;;
263 - '') return ;;
264 - *) attr="+$attr" ;;
265 - esac
266 - local IFS=
267 - dryrun_or_real chattr $1 "$attr" -- $3
268 -}
269 -
270 -relabel() {
271 - local path
272 - local paths=$1 mode=$2 uid=$3 gid=$4
273 -
274 - for path in ${paths}; do
275 - if [ -e "$path" ]; then
276 - [ -x /sbin/restorecon ] && dryrun_or_real restorecon $CHOPTS "$path"
277 - [ $uid != '-' ] && dryrun_or_real chown $CHOPTS "$uid" "$path"
278 - [ $gid != '-' ] && dryrun_or_real chgrp $CHOPTS "$gid" "$path"
279 - [ $mode != '-' ] && dryrun_or_real chmod $CHOPTS "$mode" "$path"
280 - fi
281 - done
282 -}
283 -
284 -splitpath() {
285 - local path=$1
286 - while [ -n "$path" ]; do
287 - echo $path
288 - path=${path%/*}
289 - done
290 -}
291 -
292 -_restorecon() {
293 - local path=$1
294 - if [ -x /sbin/restorecon ]; then
295 - dryrun_or_real restorecon -F $(splitpath "$path")
296 - fi
297 -}
298 -
299 -_b() {
300 - # Create a block device node if it doesn't exist yet
301 - local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
302 - if [ ! -e "$path" ]; then
303 - dryrun_or_real mknod -m $mode $path b ${arg%:*} ${arg#*:}
304 - _restorecon "$path"
305 - dryrun_or_real chown $uid:$gid $path
306 - fi
307 -}
308 -
309 -_c() {
310 - # Create a character device node if it doesn't exist yet
311 - local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
312 - if [ ! -e "$path" ]; then
313 - dryrun_or_real mknod -m $mode $path c ${arg%:*} ${arg#*:}
314 - _restorecon "$path"
315 - dryrun_or_real chown $uid:$gid $path
316 - fi
317 -}
318 -
319 -_C() {
320 - # recursively copy a file or directory
321 - local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
322 - if [ ! -e "$path" ]; then
323 - dryrun_or_real cp -r "$arg" "$path"
324 - _restorecon "$path"
325 - [ $uid != '-' ] && dryrun_or_real chown "$uid" "$path"
326 - [ $gid != '-' ] && dryrun_or_real chgrp "$gid" "$path"
327 - [ $mode != '-' ] && dryrun_or_real chmod "$mode" "$path"
328 - fi
329 -}
330 -
331 -_f() {
332 - # Create a file if it doesn't exist yet
333 - local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
334 -
335 - [ $CREATE -gt 0 ] || return 0
336 -
337 - if [ ! -e "$path" ]; then
338 - dryrun_or_real $CHECKPATH -fq -m "$mode" -o "$uid:$gid" "$path"
339 - [ -z "$arg" ] || _w "$@"
340 - fi
341 -}
342 -
343 -_F() {
344 - # Create or truncate a file
345 - local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
346 -
347 - [ $CREATE -gt 0 ] || return 0
348 -
349 - dryrun_or_real $CHECKPATH -Fq -m "$mode" -o "$uid:$gid" "$path"
350 - [ -z "$arg" ] || _w "$@"
351 -}
352 -
353 -_d() {
354 - # Create a directory if it doesn't exist yet
355 - local path=$1 mode=$2 uid=$3 gid=$4
356 -
357 - [ $CREATE -gt 0 ] || return 0
358 -
359 - if [ ! -d "$path" ]; then
360 - dryrun_or_real mkdir -p "$path" 2>/dev/null
361 - _restorecon "$path"
362 - dryrun_or_real $CHECKPATH -dq -m "$mode" -o "$uid:$gid" "$path"
363 - fi
364 -}
365 -
366 -_D() {
367 - # Create or empty a directory
368 - local path=$1 mode=$2 uid=$3 gid=$4
369 -
370 - if [ -d "$path" ] && [ $REMOVE -gt 0 ]; then
371 - dryrun_or_real find "$path" -mindepth 1 -maxdepth 1 -xdev -exec rm -rf {} +
372 - _restorecon "$path"
373 - fi
374 -
375 - if [ $CREATE -gt 0 ]; then
376 - dryrun_or_real mkdir -p "$path" 2>/dev/null
377 - _restorecon "$path"
378 - dryrun_or_real $CHECKPATH -Dq -m "$mode" -o "$uid:$gid" "$path"
379 - fi
380 -}
381 -
382 -_v() {
383 - # Create a subvolume if the path does not exist yet and the file system
384 - # supports this (btrfs). Otherwise create a normal directory.
385 - # TODO: Implement btrfs subvol creation.
386 - _d "$@"
387 -}
388 -
389 -_q() {
390 - # Similar to _v. However, make sure that the subvolume will be assigned
391 - # to the same higher-level quota groups as the subvolume it has
392 - # been created in.
393 - # TODO: Implement btrfs subvol creation.
394 - _d "$@"
395 -}
396 -
397 -_Q() {
398 - # Similar to q. However, instead of copying the higher-level quota
399 - # group assignments from the parent as-is, the lowest quota group
400 - # of the parent subvolume is determined that is not the
401 - # leaf quota group.
402 - # TODO: Implement btrfs subvol creation.
403 - _d "$@"
404 -}
405 -
406 -_h() {
407 - # Set file/directory attributes. Lines of this type accept
408 - # shell-style globs in place of normal path names.
409 - # The format of the argument field matches chattr
410 - _chattr '' "$6" "$1"
411 -}
412 -
413 -_H() {
414 - # Recursively set file/directory attributes. Lines of this type accept
415 - # shell-syle globs in place of normal path names.
416 - # Does not follow symlinks
417 - _chattr -R "$6" "$1"
418 -}
419 -
420 -_L() {
421 - # Create a symlink if it doesn't exist yet
422 - local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
423 - [ ! -e "$path" ] && dryrun_or_real ln -s "$arg" "$path"
424 - _restorecon "$path"
425 -}
426 -
427 -_p() {
428 - # Create a named pipe (FIFO) if it doesn't exist yet
429 - local path=$1 mode=$2 uid=$3 gid=$4
430 -
431 - [ $CREATE -gt 0 ] || return 0
432 -
433 - if [ ! -p "$path" ]; then
434 - dryrun_or_real $CHECKPATH -pq -m $mode -o "$uid:$gid" "$path"
435 - fi
436 -}
437 -
438 -_x() {
439 - # Ignore a path during cleaning. Use this type to exclude paths from clean-up as
440 - # controlled with the Age parameter. Note that lines of this type do not
441 - # influence the effect of r or R lines. Lines of this type accept shell-style
442 - # globs in place of of normal path names.
443 - :
444 - # XXX: we don't implement this
445 -}
446 -
447 -_X() {
448 - # Ignore a path during cleanup. Use this type to prevent path
449 - # removal as controled with the age parameter. Note that if path is
450 - # a directory, the content of the directory is not excluded from
451 - # clean-up, only the directory itself.
452 - # Lines of this type accept shell-style globs in place of normal path names.
453 - :
454 - # XXX: we don't implement this
455 -}
456 -
457 -_r() {
458 - # Remove a file or directory if it exists. This may not be used to remove
459 - # non-empty directories, use R for that. Lines of this type accept shell-style
460 - # globs in place of normal path names.
461 - local path
462 - local paths=$1
463 -
464 - [ $REMOVE -gt 0 ] || return 0
465 -
466 - for path in ${paths}; do
467 - if [ -f "$path" ]; then
468 - dryrun_or_real rm -f "$path"
469 - elif [ -d "$path" ]; then
470 - dryrun_or_real rmdir "$path"
471 - fi
472 - done
473 -}
474 -
475 -_R() {
476 - # Recursively remove a path and all its subdirectories (if it is a directory).
477 - # Lines of this type accept shell-style globs in place of normal path names.
478 - local path
479 - local paths=$1
480 -
481 - [ $REMOVE -gt 0 ] || return 0
482 -
483 - for path in ${paths}; do
484 - [ -d "$path" ] && dryrun_or_real rm -rf --one-file-system "$path"
485 - done
486 -}
487 -
488 -_w() {
489 - # Write the argument parameter to a file, if it exists.
490 - local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
491 - if [ -f "$path" ]; then
492 - if [ $DRYRUN -eq 1 ]; then
493 - echo "echo \"$arg\" >>\"$path\""
494 - else
495 - echo "$arg" >>"$path"
496 - fi
497 - fi
498 -}
499 -
500 -_z() {
501 - # Set ownership, access mode and relabel security context of a file or
502 - # directory if it exists. Lines of this type accept shell-style globs in
503 - # place of normal path names.
504 - [ $CREATE -gt 0 ] || return 0
505 -
506 - relabel "$@"
507 -}
508 -
509 -_Z() {
510 - # Recursively set ownership, access mode and relabel security context of a
511 - # path and all its subdirectories (if it is a directory). Lines of this type
512 - # accept shell-style globs in place of normal path names.
513 - [ $CREATE -gt 0 ] || return 0
514 -
515 - CHOPTS=-R relabel "$@"
516 -}
517 -
518 -BOOT=0 CREATE=0 REMOVE=0 CLEAN=0 VERBOSE=0 DRYRUN=0 error=0 LINENO=0
519 -EXCLUDE=
520 -PREFIX=
521 -FILES=
522 -
523 -while [ $# -gt 0 ]; do
524 - case $1 in
525 - --boot) BOOT=1 ;;
526 - --create) CREATE=1 ;;
527 - --remove) REMOVE=1 ;;
528 - --clean) CLEAN=1 ;; # TODO: Not implemented
529 - --verbose) VERBOSE=1 ;;
530 - --dryrun|--dry-run) DRYRUN=1 ;;
531 - --exclude-prefix=*) EXCLUDE="${EXCLUDE}${1##--exclude-prefix=} " ;;
532 - --prefix=*) PREFIX="${PREFIX}${1##--prefix=} " ;;
533 - -*) invalid_option "$1" ;;
534 - *) FILES="${FILES} $1"
535 - esac
536 - shift
537 -done
538 -
539 -if [ $(( CLEAN )) -eq 1 ] ; then
540 - printf '%s clean mode is not implemented\n' "${0##*/}"
541 - exit 1
542 -fi
543 -
544 -if [ "$CREATE$REMOVE" = '00' ]; then
545 - printf 'usage: %s [--exclude-prefix=path] [--prefix=path] [--boot] [--create] [--remove] [--clean] [--verbose] [--dry-run]\n' "${0##*/}"
546 - exit 1
547 -fi
548 -
549 -# XXX: The harcoding of /usr/lib/ is an explicit choice by upstream
550 -tmpfiles_dirs='/usr/lib/tmpfiles.d /run/tmpfiles.d /etc/tmpfiles.d'
551 -tmpfiles_basenames=''
552 -
553 -if [ -z "${FILES}" ]; then
554 - # Build a list of sorted unique basenames
555 - # directories declared later in the tmpfiles_d array will override earlier
556 - # directories, on a per file basename basis.
557 - # `/etc/tmpfiles.d/foo.conf' supersedes `/usr/lib/tmpfiles.d/foo.conf'.
558 - # `/run/tmpfiles/foo.conf' will always be read after `/etc/tmpfiles.d/bar.conf'
559 - for d in ${tmpfiles_dirs} ; do
560 - [ -d $d ] && for f in ${d}/*.conf ; do
561 - case "${f##*/}" in
562 - systemd.conf|systemd-*.conf) continue;;
563 - esac
564 - [ -f $f ] && tmpfiles_basenames="${tmpfiles_basenames}\n${f##*/}"
565 - done # for f in ${d}
566 - done # for d in ${tmpfiles_dirs}
567 - FILES="$(printf "${tmpfiles_basenames}\n" | sort -u )"
568 -fi
569 -
570 -tmpfiles_d=''
571 -
572 -for b in ${FILES} ; do
573 - if [ "${b##*/}" != "${b}" ]; then
574 - # The user specified a path on the command line
575 - # Just pass it through unaltered
576 - tmpfiles_d="${tmpfiles_d} ${b}"
577 - else
578 - real_f=''
579 - for d in $tmpfiles_dirs ; do
580 - f=${d}/${b}
581 - [ -f "${f}" ] && real_f=$f
582 - done
583 - [ -f "${real_f}" ] && tmpfiles_d="${tmpfiles_d} ${real_f}"
584 - fi
585 -done
586 -
587 -error=0
588 -
589 -# loop through the gathered fragments, sorted globally by filename.
590 -# `/run/tmpfiles/foo.conf' will always be read after `/etc/tmpfiles.d/bar.conf'
591 -FILE=
592 -for FILE in $tmpfiles_d ; do
593 - LINENUM=0
594 -
595 - ### FILE FORMAT ###
596 - # XXX: We ignore the 'Age' parameter
597 - # 1 2 3 4 5 6 7
598 - # Cmd Path Mode UID GID Age Argument
599 - # d /run/user 0755 root root 10d -
600 - # Mode, UID, GID, Age, Argument may be omitted!
601 - # If Cmd ends with !, the line is only processed if --boot is passed
602 -
603 - # XXX: Upstream says whitespace is NOT permitted in the Path argument.
604 - # But IS allowed when globs are expanded for the x/r/R/z/Z types.
605 - while read cmd path mode uid gid age arg; do
606 - LINENUM=$(( LINENUM+1 ))
607 - FORCE=0
608 -
609 - # Unless we have both command and path, skip this line.
610 - if [ -z "$cmd" -o -z "$path" ]; then
611 - continue
612 - fi
613 -
614 - case $cmd in
615 - \#*) continue ;;
616 - esac
617 -
618 - while [ ${#cmd} -gt 1 ]; do
619 - case $cmd in
620 - *!) cmd=${cmd%!}; [ "$BOOT" -eq "1" ] || continue 2 ;;
621 - *+) cmd=${cmd%+}; FORCE=1; ;;
622 - *) warninvalid ; continue 2 ;;
623 - esac
624 - done
625 -
626 - # whine about invalid entries
627 - case $cmd in
628 - f|F|w|d|D|v|p|L|c|C|b|x|X|r|R|z|Z|q|Q|h|H) ;;
629 - *) warninvalid ; continue ;;
630 - esac
631 -
632 - # fall back on defaults when parameters are passed as '-'
633 - if [ "$mode" = '-' -o "$mode" = '' ]; then
634 - case "$cmd" in
635 - p|f|F) mode=0644 ;;
636 - d|D|v) mode=0755 ;;
637 - C|z|Z|x|r|R|L) ;;
638 - esac
639 - fi
640 -
641 - [ "$uid" = '-' -o "$uid" = '' ] && uid=0
642 - [ "$gid" = '-' -o "$gid" = '' ] && gid=0
643 - [ "$age" = '-' -o "$age" = '' ] && age=0
644 - [ "$arg" = '-' -o "$arg" = '' ] && arg=''
645 - set -- "$path" "$mode" "$uid" "$gid" "$age" "$arg"
646 -
647 - [ -n "$EXCLUDE" ] && checkprefix $path $EXCLUDE && continue
648 - [ -n "$PREFIX" ] && ! checkprefix $path $PREFIX && continue
649 -
650 - if [ $FORCE -gt 0 ]; then
651 - case $cmd in
652 - p|L|c|b) [ -f "$path" ] && dryrun_or_real rm -f "$path"
653 - esac
654 - fi
655 -
656 - [ "$VERBOSE" -eq "1" ] && echo _$cmd "$@"
657 - _$cmd "$@"
658 - rc=$?
659 - if [ "${DRYRUN}" -eq "0" ]; then
660 - [ $rc -ne 0 ] && error=$((error + 1))
661 - fi
662 - done <$FILE
663 -done
664 -
665 -exit $error
666 -
667 -# vim: set ts=2 sw=2 sts=2 noet ft=sh: