From 66d877d26735cd868809b85a672c54dfbcb76ad4 Mon Sep 17 00:00:00 2001 From: primardj Date: Mon, 22 Jan 2024 00:44:36 +0000 Subject: [PATCH] applied some corrections --- ssh-local.sh | 26 +++++++++++++------------- vm-start.sh | 6 +++--- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/ssh-local.sh b/ssh-local.sh index 70ea1b1..1cf2be5 100755 --- a/ssh-local.sh +++ b/ssh-local.sh @@ -12,11 +12,11 @@ # and % will delete the parameter at the end. -USER="root" -PORT=10022 -VERSION="1.0" +User="root" +Port=10022 +Version="1.0.1" -HELP_MESSAGE=" +Help_message=" ssh-local [OPTION] [OPTION=VALUE] script which permit to launch ssh to connect to the vm on localhost without letting any traces on this computer. @@ -34,10 +34,10 @@ for (( arg=1; arg<$#; arg++)); do value="$((arg+1))" if [ "${!arg}" == "-u" ] then - USER=${!value} + User=${!value} elif [ "${!arg}" == "-p" ] then - PORT=${!value} + Port=${!value} fi done @@ -47,23 +47,23 @@ done for i in "$@"; do if [ "${i%=*}" == "--user" ] then - USER="${i#*=}" + User="${i#*=}" elif [ "${i%=*}" == "--port" ] then - PORT="${i#*=}" + Port="${i#*=}" elif [ "${i}" == "--version" ] || [ "${i}" == "-v" ] then - echo "Prog ssh-local v.${VERSION}" + echo "Prog ssh-local v.${Version}" exit 0 elif [ "${i}" == "--help" ] || [ "${i}" == "-h" ] then - echo "$HELP_MESSAGE" + echo "$Help_message" exit 0 fi done -echo user=${USER} -echo port=${PORT} +echo try to connect with user=${User} and port=${Port} +echo port=${Port} -ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile=/dev/null" -p ${PORT} ${USER}@localhost +ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile=/dev/null" -p ${Port} ${User}@localhost diff --git a/vm-start.sh b/vm-start.sh index 8047ff8..fd59393 100755 --- a/vm-start.sh +++ b/vm-start.sh @@ -4,7 +4,7 @@ #RESULT_POSSIBLE=("init","start","start_backup","create","backup","restore","suppr") # Constante d'éxecutions. -Version="0.6" +Version="0.6.1" USAGE="vm-start [ NAME COMMAND [PARAMETER] ] [OPTION] Script to manage virtual machine easily. @@ -151,7 +151,7 @@ RESTORE() { read -r entry if [[ $entry =~ ^[yY]$ ]] then - cp ${MAIN_LOCATION}${LOCATION}${VMHOSTNAME}.cow.backup ${MAIN_LOCATION}${LOCATION}${VMHOSTNAME}.cow + cp -i ${MAIN_LOCATION}${LOCATION}${VMHOSTNAME}.cow.backup ${MAIN_LOCATION}${LOCATION}${VMHOSTNAME}.cow echo "Done" fi } @@ -162,7 +162,7 @@ BACKUP() { read -p "Are you sure you want to backup the volume? If you continue the previous backup will be lost (y/N) " -r entry if [[ $entry =~ ^[yY]$ ]] then - cp ${MAIN_LOCATION}${LOCATION}${VMHOSTNAME}.cow ${MAIN_LOCATION}${LOCATION}${VMHOSTNAME}.cow.backup + cp -i ${MAIN_LOCATION}${LOCATION}${VMHOSTNAME}.cow ${MAIN_LOCATION}${LOCATION}${VMHOSTNAME}.cow.backup echo "Done" fi }