| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. -e |
| 2 | |
| 3 | errorscip-shell shell xen 4.20.2+37-g61ff35323e-1 error().() { |
| 4 | echoscip-shell system . . echo. "ERROR: " "$@" >&2 |
| 5 | exit 1 |
| 6 | } |
| 7 | |
| 8 | if [scip-shell system . . `[`. -e "/sys/hypervisor/typescip-shell filesystem . . `/sys/hypervisor/type`." ]; then |
| 9 | read type < /sys/hypervisor/typescip-shell filesystem . . `/sys/hypervisor/type`. |
| 10 | if [scip-shell system . . `[`. "$type" = xen ]; then |
| 11 | DIR=/sys/hypervisor/versionscip-shell filesystem . . `/sys/hypervisor/version`. |
| 12 | read major < $DIR/major |
| 13 | read minor < $DIR/minor |
| 14 | VERSION="$major.$minor" |
| 15 | elif [scip-shell system . . `[`. -z "$type" ]; then |
| 16 | errorscip-shell shell xen 4.20.2+37-g61ff35323e-1 error(). "Can't read hypervisor type from sysfs!" |
| 17 | else |
| 18 | errorscip-shell shell xen 4.20.2+37-g61ff35323e-1 error(). "Hypervisor is not xen but '$type'!" |
| 19 | fi |
| 20 | else |
| 21 | errorscip-shell shell xen 4.20.2+37-g61ff35323e-1 error(). "Can't find hypervisor information in sysfs!" |
| 22 | fi |
| 23 | |
| 24 | echoscip-shell system . . echo. "$VERSION" |