File: TMPFILES

package info (click to toggle)
cruft-ng 0.9.78
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,904 kB
  • sloc: cpp: 1,748; sh: 816; python: 262; makefile: 97; ansic: 82; perl: 75
file content (48 lines) | stat: -rwxr-xr-x 1,352 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh
set -e

# this is useful even when systemd is not the init system
# because these declarative configs are shipped anyway

find "$CRUFT_ROOT/usr/lib/tmpfiles.d/" -maxdepth 1 -type f -printf "%f\n"  | while read -r definition
do
    package="${definition%.*}"
    case "$package" in
        debian)
           package="base-files"
           ;;
        lighttpd.tmpfile)
           # there is ../rules/lighttpd
           continue
           ;;
        journal-nocow|legacy|var)
           continue
           ;;
        systemd-nologin|systemd-pstore|systemd-tmp|provision)
           package="systemd"
           ;;
    esac

    grep -v ^# < "/usr/lib/tmpfiles.d/${definition}" | sed 's/%./*/g' | while read -r _action path _extra
    do
        case "$path" in
             /etc/*)
                  echo "$path"
                  ;;
             /var/*)
                  echo "$path"
                  ;;
        esac
    done | sort -u | while read -r path
    do
        [ "$package" != "$last_package" ] && echo "$package"
        # we purposefully want the shell to glob these paths
        #
        # false positives like "/var/log/journal/*/system.journal"
        # are not a problem, they will never match a real file
        #
        # shellcheck disable=SC2086
        echo $path
        last_package="$package"
    done
done