File: systems.sh

package info (click to toggle)
snapd 2.74.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 81,428 kB
  • sloc: sh: 16,966; ansic: 16,788; python: 11,332; makefile: 1,897; exp: 190; awk: 58; xml: 22
file content (43 lines) | stat: -rw-r--r-- 929 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
#!/bin/bash

get_snap_for_system(){
    local snap=$1

    case "$SPREAD_SYSTEM" in
        ubuntu-core-18-*)
            echo "${snap}-core18"
            ;;
        ubuntu-core-20-*)
            echo "${snap}-core20"
            ;;
        ubuntu-core-22-*)
            echo "${snap}-core22"
            ;;
        *)
            echo "$snap"
            ;;
    esac
}

get_core_for_system(){
    case "$SPREAD_SYSTEM" in
        ubuntu-core-18-*)
            echo "core18"
            ;;
        ubuntu-core-20-*)
            echo "core20"
            ;;
        ubuntu-core-22-*)
            echo "core22"
            ;;
        *)
            echo "core"
            ;;
    esac
}

is_cgroupv2() {
    cgroups_val="$(stat -f -c '%T' /sys/fs/cgroup)"
    # The hexadecimal number 0x63677270 corresponds to the magic constant CGROUP2_SUPER_MAGIC
    test "$cgroups_val" = "cgroup2fs" || [[ "$cgroups_val" == *0x63677270* ]]
}