From 932086bcb78e0d90ca4fffe9bd63b16b30e79601 Mon Sep 17 00:00:00 2001
From: Dirk Engling <erdgeist@erdgeist.org>
Date: Mon, 9 Jun 2014 23:30:46 +0200
Subject: Add the troubleshoot subcommand

---
 ezjail-admin | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/ezjail-admin b/ezjail-admin
index f8bb9a7..449a6e6 100755
--- a/ezjail-admin
+++ b/ezjail-admin
@@ -41,7 +41,7 @@ ezjail_basesystem="base"
 case `uname -p` in amd64) ezjail_dirlist="${ezjail_dirlist} usr/lib32"; ezjail_basesystem="${ezjail_basesystem} lib32";; esac
 
 # Synopsis messages
-ezjail_usage_ezjailadmin="${ezjail_admin} v3.3\nUsage: ${ezjail_admin} [archive|config|console|create|delete|install|list|restore|snapshot|update] {params}"
+ezjail_usage_ezjailadmin="${ezjail_admin} v3.3\nUsage: ${ezjail_admin} [archive|config|console|create|delete|install|list|restore|snapshot|troubleshoot|update] {params}"
 ezjail_usage_install="Usage: ${ezjail_admin} install [-mMpPsS] [-h host] [-r release]"
 ezjail_usage_create="Usage: ${ezjail_admin} create [-xbi] [-f flavour] [-r jailroot] [-s size] [-c bde|eli|zfs] [-C args] [-a archive] [-z parentzfs] jailname jailip"
 ezjail_usage_delete="Usage: ${ezjail_admin} delete [-wf] jailname"
@@ -50,6 +50,7 @@ ezjail_usage_config="Usage: ${ezjail_admin} config [-r run|norun] [-n newname] [
 ezjail_usage_console="Usage: ${ezjail_admin} console [-f] [-e command] jailname"
 ezjail_usage_archive="Usage: ${ezjail_admin} archive [-Af] [-a archive] [-d archivedir] jailname [jailname...]"
 ezjail_usage_restore="Usage: ${ezjail_admin} restore [-f] [-d archivedir] (archive|jailname)..."
+ezjail_usage_troubleshoot="Usage: ${ezjail_admin} troubleshoot [jailname...]"
 ezjail_usage_list="Usage: ${ezjail_admin} list"
 
 ################################
@@ -1622,6 +1623,19 @@ config)
       ;;
     esac
   ;;
+######################## ezjail-admin TROUBLESHOOT ########################
+troubleshoot)
+  shift
+  [ $# -gt 0 ] || && cd ${ezjail_jailcfgs} && set - `ls -A`
+
+  for ezjail; do
+    fetchjailinfo ${ezjail%.norun}
+
+    # Check for existence of jail in our records
+    [ "${ezjail_config}" ] || exerr "Error: Nothing known about jail ${ezjail_name}."
+
+  done
+  ;;
 *)
   exerr "${ezjail_usage_ezjailadmin}"
   ;;
-- 
cgit v1.2.3