From e5d7414c3363b2281b54086320e7e0349ecbd738 Mon Sep 17 00:00:00 2001
From: Shunsuke Kimura <pbrehpuum@gmail.com>
Date: Sat, 22 Mar 2025 21:23:44 +0900
Subject: [PATCH] kata-deploy: Return exit code for invalid argument

It hangs when invalid arguments are specified.

```bash
kata-deploy-6sr2p:/# /opt/kata-artifacts/scripts/kata-deploy.sh xxx
Action:
* xxx
...
Usage: /opt/kata-artifacts/scripts/kata-deploy.sh [install/cleanup/reset]
ERROR: invalid arguments
...
^C <- hang
```

I changed it to behave the same as when there are no arguments.

```bash
kata-deploy-6sr2p:/# /opt/kata-artifacts/scripts/kata-deploy.sh
Usage: /opt/kata-artifacts/scripts/kata-deploy.sh [install/cleanup/reset]
ERROR: invalid arguments
kata-deploy-6sr2p:/# echo $?
1
```

Fixes: #11068

Signed-off-by: Shunsuke Kimura <pbrehpuum@gmail.com>
---
 tools/packaging/kata-deploy/scripts/kata-deploy.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/packaging/kata-deploy/scripts/kata-deploy.sh b/tools/packaging/kata-deploy/scripts/kata-deploy.sh
index 3a35f59723..33c47de187 100755
--- a/tools/packaging/kata-deploy/scripts/kata-deploy.sh
+++ b/tools/packaging/kata-deploy/scripts/kata-deploy.sh
@@ -909,8 +909,8 @@ function main() {
 			reset_runtime $runtime
 			;;
 		*)
-			echo invalid arguments
 			print_usage
+			die "invalid arguments"
 			;;
 		esac
 	fi