| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | |
| 3 | # live-tools(7) - System Support Scripts |
| 4 | # Copyright (C) 2016-2020 The Debian Live team |
| 5 | # Copyright (C) 2006-2015 Daniel Baumann <[email protected]> |
| 6 | # |
| 7 | # This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING. |
| 8 | # This is free software, and you are welcome to redistribute it |
| 9 | # under certain conditions; see COPYING for details. |
| 10 | |
| 11 | # Redirect stdout to stderr |
| 12 | exec 1>&2 |
| 13 | |
| 14 | case "${1}" in |
| 15 | -h|--help|-u|--usage) |
| 16 | echoscip-shell system . . echo. "live-system - determine if running system is a live system" |
| 17 | echoscip-shell system . . echo. |
| 18 | echoscip-shell system . . echo. "Usage: ${0} [-v|--verbose]" |
| 19 | |
| 20 | exit 2 |
| 21 | ;; |
| 22 | |
| 23 | -v|--verbose) |
| 24 | _VERBOSE="true" |
| 25 | ;; |
| 26 | esac |
| 27 | |
| 28 | [scip-shell system . . `[`. "${_VERBOSE}" ] && echoscip-shell system . . echo. -n "Checking for live system..." |
| 29 | |
| 30 | if [scip-shell system . . `[`. ! -e /proc/cmdlinescip-shell filesystem . . `/proc/cmdline`. ] |
| 31 | then |
| 32 | [scip-shell system . . `[`. "${_VERBOSE}" ] && echoscip-shell system . . echo. |
| 33 | echoscip-shell system . . echo. "E: /proc/cmdline - No such file." |
| 34 | |
| 35 | exit 2 |
| 36 | fi |
| 37 | |
| 38 | if grepscip-shell system . . grep. -qs "boot=live" /proc/cmdlinescip-shell filesystem . . `/proc/cmdline`. |
| 39 | then |
| 40 | [scip-shell system . . `[`. "${_VERBOSE}" ] && echoscip-shell system . . echo. -n " yes, this is a live system" |
| 41 | |
| 42 | if [scip-shell system . . `[`. -d /run/live/medium/installscip-shell filesystem . . `/run/live/medium/install`. ] |
| 43 | then |
| 44 | if lsscip-shell system . . ls. /run/live/medium/install/pool/main/l/live-installer/live-installer_*.udeb > /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 |
| 45 | then |
| 46 | [scip-shell system . . `[`. "${_VERBOSE}" ] && echoscip-shell system . . echo. " with debian-installer (live) support." |
| 47 | else |
| 48 | [scip-shell system . . `[`. "${_VERBOSE}" ] && echoscip-shell system . . echo. " with debian-installer (normal) support." |
| 49 | fi |
| 50 | else |
| 51 | [scip-shell system . . `[`. "${_VERBOSE}" ] && echoscip-shell system . . echo. "without debian-installer support." |
| 52 | fi |
| 53 | |
| 54 | exit 0 |
| 55 | else |
| 56 | [scip-shell system . . `[`. "${_VERBOSE}" ] && echoscip-shell system . . echo. " no, this is not a live system." |
| 57 | |
| 58 | exit 1 |
| 59 | fi |