Take into account renaming to Tails in some more places.
[tails-test.git] / config / chroot_local-includes / etc / init.d / tails-detect-virtualization
blob314dd231fc345f0251702eb9325b0041a491ce3c
1 #! /bin/sh
2 ### BEGIN INIT INFO
3 # Provides: tails-detect-virtualization
4 # Required-Start: mountkernfs $local_fs
5 # Required-Stop: $local_fs
6 # Default-Start: S
7 # Default-Stop:
8 # Short-Description: Detect if we are running in a virtual machine
9 # Description: Detect if we are running in a virtual machine
10 ### END INIT INFO
12 # Author: amnesia <amnesia@boum.org>
14 # PATH should only include /usr/* if it runs after the mountnfs.sh script
15 PATH=/usr/sbin:/usr/bin:/sbin:/bin
16 DESC="Detecting if we are running in a virtual machine"
17 NAME=tails-detect-virtualization
18 VIRTWHAT=/usr/sbin/virt-what
19 SCRIPTNAME=/etc/init.d/$NAME
21 # Exit if virt-what is not installed
22 [ -x "$VIRTWHAT" ] || exit 0
24 # Load the VERBOSE setting and other rcS variables
25 . /lib/init/vars.sh
27 # Define LSB log_* functions.
28 # Depend on lsb-base (>= 3.2-14) to ensure that this file is present
29 # and status_of_proc is working.
30 . /lib/lsb/init-functions
32 do_start()
34 mkdir -p /var/lib/live
35 /bin/bash "${VIRTWHAT}" > /var/lib/live/detected-virtual-machine
38 case "$1" in
39 start)
40 [ "$VERBOSE" != no ] && log_daemon_msg "$DESC" "$NAME"
41 do_start
42 case "$?" in
43 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
44 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
45 esac
47 restart|reload|stop|force-reload)
51 echo "Usage: $SCRIPTNAME start" >&2
52 exit 3
54 esac