diff --git a/build/rootfs/etc/cont-init.d/50-setup-ikvm.sh b/build/rootfs/etc/cont-init.d/50-setup-ikvm.sh index dca8fb8..d5a9a5b 100755 --- a/build/rootfs/etc/cont-init.d/50-setup-ikvm.sh +++ b/build/rootfs/etc/cont-init.d/50-setup-ikvm.sh @@ -1,5 +1,23 @@ #!/bin/sh - +# ipmikvm-tls2020 (part of ossobv/vcutil) // wdoekes/2020 // Public Domain +# +# A wrapper to call the SuperMicro iKVM console bypassing Java browser +# plugins. +# +# Requirements: base64, curl, java +# +# Usage: +# +# $ ipmikvm-tls2020 +# Usage: ipmikvm-tls2020 [-u ADMIN] [-P ADMIN] IP.ADD.RE.SS +# +# $ ipmikvm-tls2020 10.11.12.13 -P otherpassword +# (connects KVM console on IPMI device at 10.11.12.13) +# +# This has been tested with iKVM__V1.69.39.0x0. +# +# See also: ipmikvm +# set -e # Exit immediately if a command exits with a non-zero status set -u # Treat unset variables as an error @@ -19,6 +37,12 @@ get_launch_jnlp() { test -z "$fail" && echo "$launch_jnlp" } +get_arguments() { + launch_jnlp="$1" + echo "$launch_jnlp" | sed -e '//!d;s#.*\([^<]*\).*#\1#' | + sed -e "s/['\"$]//g;s/.*/&/" | sed -e 1,4d +} + get_username() { launch_jnlp="$1" echo "$launch_jnlp" | sed -e '//!d' | @@ -31,6 +55,11 @@ get_password() { sed -e '3!d;s#.*\([^<]*\)#\1#' } +get_app_class() { + echo "$1" | sed -ne 's/.*> /etc/cont-env.d/KVM_JAR_FILE echo $(get_username "$JNLP") >> /etc/cont-env.d/KVM_EPHEMERAL_USERNAME echo $(get_password "$JNLP") >> /etc/cont-env.d/KVM_EPHEMERAL_PASSWORD +echo $(get_app_class "$JNLP") >> /etc/cont-env.d/KVM_JAR_APPCLASS +echo $(get_arguments "$JNLP") >> /etc/cont-env.d/KVM_LAUNCH_ARGUMENTS diff --git a/build/rootfs/startapp.sh b/build/rootfs/startapp.sh index d0dda0d..9adb5da 100755 --- a/build/rootfs/startapp.sh +++ b/build/rootfs/startapp.sh @@ -1,3 +1,3 @@ #!/bin/sh -exec java $JAVA_OPTS -cp "$(cat /etc/cont-env.d/KVM_JAR_FILE)" tw.com.aten.ikvm.KVMMain $KVM_HOST $(cat /etc/cont-env.d/KVM_EPHEMERAL_USERNAME) $(cat /etc/cont-env.d/KVM_EPHEMERAL_PASSWORD) null 63630 623 2 0 1 5900 +exec java $JAVA_OPTS -cp "$(cat /etc/cont-env.d/KVM_JAR_FILE)" $(cat /etc/cont-env.d/KVM_JAR_APPCLASS) $KVM_HOST $(cat /etc/cont-env.d/KVM_EPHEMERAL_USERNAME) $(cat /etc/cont-env.d/KVM_EPHEMERAL_PASSWORD) null $(cat /etc/cont-env.d/KVM_LAUNCH_ARGUMENTS)