aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xkvmx29
1 files changed, 27 insertions, 2 deletions
diff --git a/kvmx b/kvmx
index ae1a7cd..6aa1ac4 100755
--- a/kvmx
+++ b/kvmx
@@ -202,7 +202,8 @@ function __kvmx_initialize {
if [ ! -e "$image" ] && [ "$ACTION" != "up" ] && [ "$ACTION" != "provision" ] && [ "$ACTION" != "purge" ] \
&& [ "$ACTION" != "destroy" ] && [ "$ACTION" != "install" ] && [ "$ACTION" != "config" ] \
- && [ "$ACTION" != "config_unset" ] && [ "$ACTION" != "create" ] && [ "$ACTION" != "shell" ]; then
+ && [ "$ACTION" != "config_unset" ] && [ "$ACTION" != "create" ] && [ "$ACTION" != "shell" ] \
+ && [ "$ACTION" != "boot" ]; then
echo "$BASENAME: file not found: $image"
exit 1
fi
@@ -1713,6 +1714,22 @@ function kvmx_install {
if [ -z "$media" ]; then
echo "usage: $BASENAME install $VM <installation-media>"
+
+ # Possible places to find existing ISOs
+ local candidates="/var/cache/media/distros /usr/local/share/isos"
+
+ for candidate in $candidates; do
+ if [ -d "$candidate" ]; then
+ results="`find $candidate -not -iwholename '*.git*' -name '*.iso' | sed -e 's/^/\t/'`"
+
+ if [ ! -z "$results" ]; then
+ echo "available images at $candidate:"
+ echo ""
+ echo -n "$results"
+ fi
+ fi
+ done
+
exit 1
elif [ ! -e "$media" ]; then
echo "$BASENAME: file not found: $media"
@@ -1742,6 +1759,11 @@ function kvmx_install {
kvmx_up
}
+# Alias to install
+function kvmx_boot {
+ kvmx_install $*
+}
+
# Serial console
function kvmx_console {
if ! kvmx_running; then
@@ -1806,12 +1828,13 @@ function kvmx_version {
# Shell
function kvmx_shell {
+ local last_exit_code="0"
local restricted="$1"
local restricted_actions=":status:start:stop:poweroff:suspend:resume:console:monitor"
restricted_actions="$restricted_actions:wipe:shred:app_base:version:list_image:kill:"
# While a "quit" command isn't entered, read STDIN
- while read -rep "kvmx:/${USER}@${VM}> " STDIN; do
+ while read -rep "$last_exist_code kvmx:/${USER}@${VM}> " STDIN; do
history -s "$STDIN"
if [ "$STDIN" == "quit" ] || [ "$STDIN" == "exit" ] || [ "$STDIN" == "bye" ]; then
@@ -1829,9 +1852,11 @@ function kvmx_shell {
echo "Allowed commands are only `echo $restricted_actions | tr ':' ' '`"
else
$APP_BASE/kvmx ${STDIN[0]} $VM ${STDIN[@]:1}
+ last_exit_code="$?"
fi
else
$APP_BASE/kvmx ${STDIN[0]} $VM ${STDIN[@]:1}
+ last_exit_code="$?"
fi
fi
done