File: libsystemd-shared.preinst

package info (click to toggle)
systemd 260.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 115,380 kB
  • sloc: ansic: 741,720; xml: 122,315; sh: 36,676; python: 36,497; cpp: 947; makefile: 277; awk: 126; lisp: 13; sed: 1
file content (33 lines) | stat: -rw-r--r-- 935 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
#!/bin/sh
set -e

check_unified_cgroup_v2_hierarchy() {
    for line in $(awk '/cgroup2/{print $2 "," $3}' /proc/mounts); do
       if [ "$line" = "/sys/fs/cgroup,cgroup2" ]; then
           return 0
       fi
    done

    return 1
}

if [ "$1" = install ] || [ "$1" = upgrade ]; then
    if [ -z "$DPKG_ROOT"] && [ -d /run/systemd/system ] && dpkg --compare-versions "$2" lt-nl "258~rc1-1~"; then
        if ! check_unified_cgroup_v2_hierarchy; then
            cat <<EOF 1>&2
******************************************************************************
*
* The systemd package cannot be upgraded to version $3, because this
* system is not running a unified cgroupv2 hierarchy, which is required
* since systemd v258.
*
* Please reboot using a unified cgroupv2 hierarchy, and then try again.
*
******************************************************************************
EOF
            exit 1
        fi
    fi
fi

#DEBHELPER#