Debian Codegraph @

debian/scripts/xen-utils-wrapper

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2
3 # This portion is fast-path, avoid external programs, NOTE: NOT -e HERE!
4
5 COMMAND="${0##*/}"
6
7 DIR=/sys/hypervisor/versionscip-shell filesystem . . `/sys/hypervisor/version`.
8 # these return non-zero if hypervisor is absent, this is detected below
9 read major 2> /dev/nullscip-shell filesystem . . `/dev/null`. < $DIR/major
10 read minor 2> /dev/nullscip-shell filesystem . . `/dev/null`. < $DIR/minor
11 VERSION="$major.$minor"
12
13 DIR="/usr/lib/xen-$VERSION/bin"
14
15 [scip-shell system . . `[`. -x "$DIR/$COMMAND" ] && exec "$DIR/$COMMAND" "$@"
16
17
18 # Certainly didn't work, now report failures, slower-path
19 set -e
20
21 errorscip-shell shell xen 4.20.2+37-g61ff35323e-1 error().() {
22 err="$1"
23 shift
24 echoscip-shell system . . echo. "ERROR: " "$@" >&2
25 exit $err
26 }
27
28 [scip-shell system . . `[`. -e "/sys/hypervisor/typescip-shell filesystem . . `/sys/hypervisor/type`." ] || errorscip-shell shell xen 4.20.2+37-g61ff35323e-1 error(). 1 "Can't find hypervisor information in sysfs!"
29
30 read type < /sys/hypervisor/typescip-shell filesystem . . `/sys/hypervisor/type`.
31 if [scip-shell system . . `[`. "$type" != xen ]; then
32 [scip-shell system . . `[`. -n "$type" ] || errorscip-shell shell xen 4.20.2+37-g61ff35323e-1 error(). 1 "Can't read hypervisor type from sysfs!"
33 errorscip-shell shell xen 4.20.2+37-g61ff35323e-1 error(). 1 "Hypervisor is not xen but '$type'!"
34 fi
35
36 if [scip-shell system . . `[`. ! -d "/usr/lib/xen-$VERSION" ]; then
37 errorscip-shell shell xen 4.20.2+37-g61ff35323e-1 error(). 127 "Can't find version $VERSION of xen utils (maybe xen-utils-$VERSION was already removed before rebooting out of Xen $VERSION), bailing out!"
38 fi
39
40 errorscip-shell shell xen 4.20.2+37-g61ff35323e-1 error(). 127 "Unable to execute $DIR/$COMMAND"
41