v5 updates
This commit is contained in:
parent
4227e1697f
commit
60bc819ba7
@ -5,5 +5,5 @@
|
|||||||
|
|
||||||
DEPENDENCIES+=(ffmpeg)
|
DEPENDENCIES+=(ffmpeg)
|
||||||
|
|
||||||
use ffmpeg/get-audio-clip-from-video.module.zsh --group media
|
use ffmpeg/get-audio-clip-from-video --group media
|
||||||
use ffmpeg/get-video-length-seconds.module.zsh --group media
|
use ffmpeg/get-video-length-seconds --group media
|
||||||
|
@ -71,7 +71,8 @@ ${scwryptsmodule}.get-ssh-args() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
ARGS+=($(remote.config.query-connection .session.$REMOTE_NAME.$TYPE.args))
|
ARGS+=($(remote.config.query-connection .sessions.$REMOTE_NAME.$TYPE.args))
|
||||||
|
echo.debug "REMOTE_NAME : ${REMOTE_NAME}\nARGS : ${ARGS}\nSESSION : .session.$REMOTE_NAME.$TYPE.args"
|
||||||
|
|
||||||
[[ $USE_TTY =~ true ]] && ARGS+=(-t)
|
[[ $USE_TTY =~ true ]] && ARGS+=(-t)
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ MAIN() {
|
|||||||
-n | --name )
|
-n | --name )
|
||||||
((_S+=1))
|
((_S+=1))
|
||||||
REMOTE_NAME=$2
|
REMOTE_NAME=$2
|
||||||
CONNECTION_STRING=$(remote.config.get-connection-string $REMOTE_NAME)
|
CONNECTION_STRING=$(remote.config.get-connection-string ${REMOTE_NAME})
|
||||||
;;
|
;;
|
||||||
-s | --connection_string )
|
-s | --connection_string )
|
||||||
((_S+=1))
|
((_S+=1))
|
||||||
@ -43,8 +43,8 @@ MAIN() {
|
|||||||
-t | --maximum-timout )
|
-t | --maximum-timout )
|
||||||
((_S+=1))
|
((_S+=1))
|
||||||
TIMEOUT_SECONDS=$2
|
TIMEOUT_SECONDS=$2
|
||||||
[[ $TIMEOUT_SECONDS -gt 0 ]] \
|
[[ ${TIMEOUT_SECONDS} -gt 0 ]] \
|
||||||
|| echo.error "invalid timeout seconds '$TIMEOUT_SECONDS'"
|
|| echo.error "invalid timeout seconds '${TIMEOUT_SECONDS}'"
|
||||||
;;
|
;;
|
||||||
-c | --command )
|
-c | --command )
|
||||||
((_S+=1))
|
((_S+=1))
|
||||||
@ -53,7 +53,7 @@ MAIN() {
|
|||||||
--use-bastion )
|
--use-bastion )
|
||||||
((_S+=1))
|
((_S+=1))
|
||||||
USE_BASTION=$2
|
USE_BASTION=$2
|
||||||
case $USE_BASTION in
|
case ${USE_BASTION} in
|
||||||
true | false ) ;;
|
true | false ) ;;
|
||||||
* ) echo.error "invalid setting for '--use-bastion' (must be 'true' or 'false')" ;;
|
* ) echo.error "invalid setting for '--use-bastion' (must be 'true' or 'false')" ;;
|
||||||
esac
|
esac
|
||||||
@ -66,14 +66,14 @@ MAIN() {
|
|||||||
|| shift $#
|
|| shift $#
|
||||||
done
|
done
|
||||||
|
|
||||||
[ $CONNECTION_STRING ] \
|
[ ${CONNECTION_STRING} ] \
|
||||||
|| echo.error "unable to determine connection string"
|
|| echo.error "unable to determine connection string"
|
||||||
|
|
||||||
|
|
||||||
[ $USE_BASTION ] || {
|
[ ${USE_BASTION} ] || {
|
||||||
USE_BASTION=$(\
|
USE_BASTION=$(\
|
||||||
remote.config.query-connection-with-fallback \
|
remote.config.query-connection-with-fallback \
|
||||||
".sessions.$REMOTE_NAME.bastion.preferred" \
|
".sessions.${REMOTE_NAME}.bastion.preferred" \
|
||||||
'false' \
|
'false' \
|
||||||
;
|
;
|
||||||
)
|
)
|
||||||
@ -85,48 +85,56 @@ MAIN() {
|
|||||||
##########################################
|
##########################################
|
||||||
|
|
||||||
local BASTION_HOST
|
local BASTION_HOST
|
||||||
[[ $USE_BASTION =~ true ]] && {
|
[[ ${USE_BASTION} =~ true ]] && {
|
||||||
BASTION_HOST=$(\
|
BASTION_HOST=$(\
|
||||||
remote.config.query-connection-with-fallback \
|
remote.config.query-connection-with-fallback \
|
||||||
".sessions.$REMOTE_NAME.bastion.session" \
|
".sessions.${REMOTE_NAME}.bastion.session" \
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
[[ $USE_BASTION =~ true ]] && {
|
[[ ${USE_BASTION} =~ true ]] && {
|
||||||
[ $BASTION_HOST ] \
|
[ ${BASTION_HOST} ] \
|
||||||
|| echo.error "cannot connect to $REMOTE_NAME; no configured bastion host" \
|
|| echo.error "cannot connect to ${REMOTE_NAME}; no configured bastion host" \
|
||||||
|| return 1
|
|| return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
case $CONNECTION_STRING in
|
case ${CONNECTION_STRING} in
|
||||||
localhost | $USER@localhost )
|
( localhost | $USER@localhost )
|
||||||
CONNECTION_TEST() { return 0; } # current user on local machine can always connect
|
CONNECTION_TEST() { return 0; } # current user on local machine can always connect
|
||||||
;;
|
;;
|
||||||
* )
|
* )
|
||||||
[[ $USE_BASTION =~ true ]] && {
|
case ${USE_BASTION} in
|
||||||
echo.debug "MAIN -n $BASTION_HOST -c \"$(remote.bastion.get-passthrough-prefix) remote test -- -n $REMOTE_NAME -c \"$COMMAND\"\""
|
( true )
|
||||||
BASTION_TARGET="$REMOTE_NAME" MAIN -n $BASTION_HOST -c "$(remote.bastion.get-passthrough-prefix) remote test -- -n $REMOTE_NAME -c \"$COMMAND\""
|
CONNECTION_TEST() {
|
||||||
return $?
|
echo.debug "MAIN -n ${BASTION_HOST} -c \"$(remote.bastion.get-passthrough-prefix) remote test -- -n ${REMOTE_NAME} -c \"${COMMAND}\"\""
|
||||||
}
|
BASTION_TARGET="${REMOTE_NAME}" MAIN -n ${BASTION_HOST} -c "$(remote.bastion.get-passthrough-prefix) remote test -- -n ${REMOTE_NAME} -c \"${COMMAND}\""
|
||||||
|
return $?
|
||||||
CONNECTION_TEST() {
|
|
||||||
[ $REMOTE_NAME ] && {
|
|
||||||
[[ $(remote.config.query-connection .sessions.$REMOTE_NAME.enabled) =~ false ]] && {
|
|
||||||
return 1
|
|
||||||
}
|
}
|
||||||
}
|
;;
|
||||||
local REMOTE_ARGS=()
|
|
||||||
REMOTE_ARGS+=($(remote.config.get-ssh-args --type ssh $REMOTE_NAME))
|
( * )
|
||||||
REMOTE_ARGS+=(-o BatchMode=yes)
|
CONNECTION_TEST() {
|
||||||
echo.debug "attempting\ntimeout $TIMEOUT_SECONDS ssh $REMOTE_ARGS $CONNECTION_STRING "'\'"\"$COMMAND"'\'"\"" >&2
|
local REMOTE_ARGS=()
|
||||||
timeout --foreground $TIMEOUT_SECONDS ssh ${REMOTE_ARGS[@]} "$CONNECTION_STRING" "$COMMAND" >&2
|
REMOTE_ARGS+=($(remote.config.get-ssh-args --type ssh ${REMOTE_NAME}))
|
||||||
}
|
REMOTE_ARGS+=(-o BatchMode=yes)
|
||||||
|
echo.debug "attempting\ntimeout ${TIMEOUT_SECONDS} ssh ${REMOTE_ARGS} ${CONNECTION_STRING} "'\'"\"${COMMAND}"'\'"\"" >&2
|
||||||
|
timeout --foreground ${TIMEOUT_SECONDS} ssh ${REMOTE_ARGS[@]} "${CONNECTION_STRING}" "${COMMAND}" >&2
|
||||||
|
}
|
||||||
|
;;
|
||||||
|
esac
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
[ $REMOTE_NAME ] || REMOTE_NAME=explicit
|
[ ${REMOTE_NAME} ] && {
|
||||||
echo.status "testing connection $CONNECTION_STRING ($REMOTE_NAME$([ $BASTION_TARGET ] && echo " -> $BASTION_TARGET"))" \
|
[[ $(remote.config.query-connection .sessions.${REMOTE_NAME}.enabled) =~ false ]] && {
|
||||||
|
echo.error "automatic connection to ${REMOTE_NAME} is disabled"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ ${REMOTE_NAME} ] || REMOTE_NAME=explicit
|
||||||
|
echo.status "testing connection ${CONNECTION_STRING} (${REMOTE_NAME}$([ ${BASTION_TARGET} ] && echo " -> ${BASTION_TARGET}"))" \
|
||||||
&& CONNECTION_TEST \
|
&& CONNECTION_TEST \
|
||||||
&& echo.success "successfully connected to '$CONNECTION_STRING' ($REMOTE_NAME)" \
|
&& echo.success "successfully connected to '${CONNECTION_STRING}' (${REMOTE_NAME})" \
|
||||||
|| echo.error "connection to '$CONNECTION_STRING ($REMOTE_NAME)' failed" \
|
|| echo.error "connection to '${CONNECTION_STRING} (${REMOTE_NAME})' failed" \
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user