[pve-devel] [PATCH pve-kernel-meta 2/7] proxmox-boot-tool: add status command

Stoiko Ivanov s.ivanov at proxmox.com
Thu Apr 22 13:17:55 CEST 2021


currently simply checking if $ESP_LIST exists, and indicating via
the exit status if proxmox-boot-tool is used for booting the system.

Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
 bin/proxmox-boot-tool | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/bin/proxmox-boot-tool b/bin/proxmox-boot-tool
index 2d625a6..7b06d57 100755
--- a/bin/proxmox-boot-tool
+++ b/bin/proxmox-boot-tool
@@ -283,6 +283,7 @@ usage() {
 	warn "       $0 refresh [--hook <name>]"
 	warn "       $0 kernel <add|remove> <kernel-version>"
 	warn "       $0 kernel list"
+	warn "       $0 status"
 	warn "       $0 help"
 }
 
@@ -312,6 +313,20 @@ help() {
 	echo ""
 	echo "    list kernel versions currently selected for inclusion on ESPs."
 	echo ""
+	echo "USAGE: $0 status [--verbose]"
+	echo ""
+	echo "    Exit with 0 if any ESP is configured, else with 2."
+	echo ""
+}
+
+status() {
+	verbose="$1"
+	if [ ! -e ${ESP_LIST} ]; then
+		if [ -n "$verbose" ]; then
+		    warn "E: $ESP_LIST does not exist."
+		fi
+		exit 2
+	fi
 }
 
 if [ -z "$1" ]; then
@@ -390,6 +405,11 @@ case "$1" in
 			;;
 		esac
 	;;
+	'status')
+		shift
+		status "$1"
+		exit 0
+	;;
 	'help')
 		shift
 		help
-- 
2.20.1






More information about the pve-devel mailing list