3 # Provides: tails-detect-virtualization
4 # Required-Start: mountkernfs $local_fs
5 # Required-Stop: $local_fs
8 # Short-Description: Detect if we are running in a virtual machine
9 # Description: Detect if we are running in a virtual machine
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
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
34 mkdir
-p /var
/lib
/live
35 /bin
/bash
"${VIRTWHAT}" > /var
/lib
/live
/detected-virtual-machine
40 [ "$VERBOSE" != no
] && log_daemon_msg
"$DESC" "$NAME"
43 0|
1) [ "$VERBOSE" != no
] && log_end_msg
0 ;;
44 2) [ "$VERBOSE" != no
] && log_end_msg
1 ;;
47 restart|reload|stop|force-reload
)
51 echo "Usage: $SCRIPTNAME start" >&2