diff --git a/support/functions/_subversion b/support/functions/_subversion index 6303fa9..9803aba 100644 --- a/support/functions/_subversion +++ b/support/functions/_subversion @@ -1,195 +1,246 @@ #!/bin/bash checkout(){ - echo -en "$c_l"; - fc1="$(mktemp)"; - clear; - ologo; - i=0; - COUNT=0; - if [ -d "$svndir" ];then - rm -rf "$svndir"; - echo -e "$p_l\n $txt_delete $txt_existing oscam-svn $re_\n"; + echo -en "$c_l" + fc1="$(mktemp)" + clear + ologo + i=0 + COUNT=0 + + if [ -d "$svndir" ] + then + rm -rf "$svndir" + printf "$p_l\n $txt_delete $txt_existing oscam-svn $re_\n" else - echo -e "$p_l\n $txt_no oscam-svn $txt_found\n$re_"; - fi; - echo -e "$w_l SVN TrunkURL : $g_l$trunkurl$re_"; - [ ! -z "$1" ] && [ $(($1)) -gt 6999 ] && opt_="-r$1" && mac_="($txt_selected)" || opt_=''; - echo -en "$w_l SVN FileCount : "; - svn info -R "$trunkurl" |grep '^URL' |uniq |wc -l >"$fc1"; - n=$(cat "$fc1"); - echo -e "$g_l""$txt_found $n"; - echo -en "$w_l SVN checkout : "; - while read line filename;do - counter=$(( 100*(++i)/n)); - tput cup 11 18; - [ "$counter" -lt "100" ] && echo -en "$g_l""$counter%$re_" || echo -en "$g_l""100%$re_"; - done < <( svn co "$trunkurl" $opt_ "$svndir" |sed "s|$svndir/||g"); + printf "$p_l\n $txt_no oscam-svn $txt_found\n$re_" + fi + + printf "$w_l SVN TrunkURL : $g_l$trunkurl$re_" + [ ! -z "$1" ] && [ $(($1)) -gt 6999 ] && opt_="-r$1" && mac_="($txt_selected)" || opt_='' + + printf "$w_l SVN FileCount : " + svn info -R "$trunkurl" |grep '^URL' |uniq |wc -l >"$fc1" + n=$(cat "$fc1") + printf "$g_l""$txt_found $n" + printf "$w_l SVN checkout : " + + while read line filename + do + counter=$(( 100*(++i)/n)) + tput cup 11 18 + [ "$counter" -lt "100" ] && printf "$g_l""$counter%$re_" || printf "$g_l""100%$re_" + done < <( svn co "$trunkurl" $opt_ "$svndir" |sed "s|$svndir/||g") + tput cup 11 18; - echo -en "$g_l""100%$re_"; - if [ -f "$svndir/config.sh" ];then + printf "$g_l""100%$re_" + + if [ -f "$svndir/config.sh" ] + then tput cup 12 2; - echo -en "$w_l""SVN Revision : $y_l""$("$svndir/config.sh" -r) $b_l$mac_$re_\n$w_l SVN UserPath : $y_l""$svndir"; - fi; - [ -f "$svndir/config.h" ]&& reset_="$("$svndir/config.sh" -R)"; - rm -rf "$fc1"; - _nl; - [ -f "$workdir/SVN-IS-PATCHED" ] && rm -f "$workdir/SVN-IS-PATCHED"; - [ -f "$workdir/EMU_ON" ] && rm -f "$workdir/EMU_ON"; - tarsvn; -}; + printf "$w_l""SVN Revision : $y_l""$("$svndir/config.sh" -r) $b_l$mac_$re_\n$w_l SVN UserPath : $y_l""$svndir" + fi + + [ -f "$svndir/config.h" ]&& reset_="$("$svndir/config.sh" -R)" + rm -rf "$fc1" + _nl + [ -f "$workdir/SVN-IS-PATCHED" ] && rm -f "$workdir/SVN-IS-PATCHED" + [ -f "$workdir/EMU_ON" ] && rm -f "$workdir/EMU_ON" + tarsvn +} + svnrestore(){ - clear; - echo -en "$c_l"; - ologo; - if [ "$1" == "list" ];then - cd "$bsvn"; - bfiles="$(find . -type f |sed 's|./||' |sed 's|.tar.gz||')"; - bcount=$(echo "$bfiles" |wc -w); - if [ "$bcount" -gt "0" ];then - echo -e "\n$c_l $bcount$w_l svn backups found\n ____________________$re_\n"; - for b in $bfiles;do - echo -e "$c_l --> $w_l$b"; - done; - _nl; + clear + echo -en "$c_l" + ologo + + if [ "$1" == "list" ] + then + cd "$bsvn" + bfiles="$(find . -type f |sed 's|./||' |sed 's|.tar.gz||')" + bcount=$(echo "$bfiles" |wc -w) + + if [ "$bcount" -gt "0" ] + then + echo -e "\n$c_l $bcount$w_l svn backups found\n ____________________$re_\n" + for b in $bfiles + do + echo -e "$c_l --> $w_l$b" + done + _nl else - echo -e "\n$r_l $bcount$w_l svn backups found\n ____________________$re_\n"; - fi; - exit; - fi; - if [ -d "$svndir" ];then - rm -rf "$svndir"; - echo -e "$p_l\n $txt_delete $txt_existing oscam-svn $re_\n"; + echo -e "\n$r_l $bcount$w_l svn backups found\n ____________________$re_\n" + fi + + exit + fi + + if [ -d "$svndir" ] + then + rm -rf "$svndir" + printf "$p_l\n $txt_delete $txt_existing oscam-svn $re_\n" else - echo -e "$p_l\n $txt_no oscam-svn $txt_found\n$re_"; - fi; - untarsvn $1; - [ -f "$svndir/config.h" ]&& echo -en "$w_l"" SVN Revision : $y_l""$("$svndir/config.sh" -r) restored\n\n$re_"; + printf "$p_l\n $txt_no oscam-svn $txt_found\n$re_" + fi + + untarsvn $1 + [ -f "$svndir/config.h" ]&& printf "$w_l"" SVN Revision : $y_l""$("$svndir/config.sh" -r) restored\n\n$re_" [ -L "$workdir/lastbuild.log" ]&& rm "$workdir/lastbuild.log"; [ -L "$workdir/lastpatch.log" ]&& rm "$workdir/lastpatch.log"; [ -f "$workdir/SVN-IS-PATCHED" ] && rm -f "$workdir/SVN-IS-PATCHED"; [ -f "$workdir/EMU_ON" ] && rm -f "$workdir/EMU_ON"; -}; +} + quicksvnrestore(){ - untarsvn $1; -}; + untarsvn $1 +} + svnup(){ - echo -en "$c_l"; - clear; - ologo; - i=1; - if [ -d "$svndir" ];then - echo -en "$p_l\n $txt_update oscam-svn $re_\n"; + printf "$c_l" + clear + ologo + i=1 + + if [ -d "$svndir" ] + then + printf "$p_l\n $txt_update oscam-svn $re_\n" else - checkout; - return; - fi; - echo -en "\n$w_l SVN TrunkURL : $g_l""$trunkurl""$re_"; - svn co "$trunkurl" "$svndir" -q; - if [ -f "$svndir/config.sh" ];then - tput cup 10 2; - echo -e "$w_l""SVN Revision : ""$y_l$("$svndir/config.sh" -r) $b_l$mac_$re_\n$w_l SVN UserPath : $y_l""$svndir\n$re_"; - fi; - if [ -f "$svndir/config.h" ];then - reset_="$("$svndir/config.sh" -R)"; - fi; -}; + checkout + return + fi + + printf "\n$w_l SVN TrunkURL : $g_l""$trunkurl""$re_" + svn co "$trunkurl" "$svndir" -q + + if [ -f "$svndir/config.sh" ] + then + tput cup 10 2 + printf "$w_l""SVN Revision : ""$y_l$("$svndir/config.sh" -r) $b_l$mac_$re_\n$w_l SVN UserPath : $y_l""$svndir\n$re_" + fi + + if [ -f "$svndir/config.h" ] + then + reset_="$("$svndir/config.sh" -R)" + fi +} + svnpatch(){ - if [ ! -f "$workdir/SVN-IS-PATCHED" ];then - clear; - echo -e $C; - ologo; - unset patchlist; - cd "$pdir"; - patchlist=(*.patch); - if [ "$(ls -A "$pdir"/*.patch 2>/dev/null)" ];then - touch "$workdir/SVN-IS-PATCHED"; - for p in "${patchlist[@]}";do - echo -e $WH"\n\n -> $p <-\n"$W; - sleep 1; - patch -d$svndir/ -p0 < "$pdir/$p" |sed -e "s/^patching file/$G patching > $WH/g;s/^Hunk/$P Hunk > $Y/g;s/FAILED/$R FAILED/g; ;s/-- saving/$Y -- saving/g;"; - done; + if [ ! -f "$workdir/SVN-IS-PATCHED" ] + then + clear + printf $C + ologo + unset patchlist + cd "$pdir" + patchlist=(*.patch) + + if [ "$(ls -A "$pdir"/*.patch 2>/dev/null)" ] + then + touch "$workdir/SVN-IS-PATCHED" + for p in "${patchlist[@]}" + do + echo -e $WH"\n\n -> $p <-\n"$W + sleep 1 + patch -d$svndir/ -p0 < "$pdir/$p" |sed -e "s/^patching file/$G patching > $WH/g;s/^Hunk/$P Hunk > $Y/g;s/FAILED/$R FAILED/g; ;s/-- saving/$Y -- saving/g;" + done else - echo -e $WH" $txt_no patch $txt_found"; - fi; + printf $WH" $txt_no patch $txt_found" + fi + else - clear; - echo -e $C; - ologo; - echo -e $WH" already patched"; - fi; - echo -e $W; -}; + clear + printf $C + ologo + printf $WH" already patched" + fi + echo -e $W +} + _dialog_checkout(){ - upc="$(mktemp)"; - (echo -en " $txt_verify_syscheck "; - [ "$sanity" == "1" ] && echo -e "ok" && sleep 1; - if [ "${s3cfg_vars[NO_SVN_AUTOUPDATE]}" == "0" ];then - echo -en " $txt_verify_svn "; - if [ -f "$svndir/config.sh" ];then - echo "ok"; - sleep 1; - echo -en " $txt_update_svn $txt_wait\n"; - cd "$svndir"; - svn -q update; - echo 1 >"$upc"; - sleep 1; - fi; - fi;) | "$gui" "$st_" "$bt_" "$title_" "$pb_" 5 52; - if [ "${s3cfg_vars[NO_SVN_AUTOUPDATE]}" == "0" ];then - upc1=$(cat "$upc" 2>/dev/null); - rm -f "$upc"; - [ ! "$upc1" == "1" ] && _dialog_checkout1; - if [ -f "$svndir/config.sh" ];then - reset_="$("$svndir/config.sh" -R)"; - fi; - _get_config_menu; - fi; - if [ -n "$1" ];then - if [ -f "$tccfgdir/$1" ] && [ -f "$svndir/config.sh" ];then - source "$tccfgdir/$1"; - if [ ! -f "$tcdir/$_toolchainname/bin/$_compiler""gcc" ];then - first="$1"; - _toolchain_gui_install; - fi; - loadprofile="yes"; - _toolchain_build_menu "$1"; + upc="$(mktemp)" + (printf " $txt_verify_syscheck " + [ "$sanity" == "1" ] && printf "ok\n" && sleep 1; + + if [ "${s3cfg_vars[NO_SVN_AUTOUPDATE]}" == "0" ] + then + printf " $txt_verify_svn " + if [ -f "$svndir/config.sh" ] + then + printf "ok\n" + sleep 1 + printf " $txt_update_svn $txt_wait\n" + cd "$svndir" + svn -q update + echo 1 >"$upc" + sleep 1 + fi + fi;) | "$gui" "$st_" "$bt_" "$title_" "$pb_" 5 52 + + if [ "${s3cfg_vars[NO_SVN_AUTOUPDATE]}" == "0" ] + then + upc1=$(cat "$upc" 2>/dev/null) + rm -f "$upc" + [ ! "$upc1" == "1" ] && _dialog_checkout1 + + if [ -f "$svndir/config.sh" ] + then + reset_="$("$svndir/config.sh" -R)" + fi + _get_config_menu + fi + + if [ -n "$1" ] + then + if [ -f "$tccfgdir/$1" ] && [ -f "$svndir/config.sh" ] + then + source "$tccfgdir/$1" + if [ ! -f "$tcdir/$_toolchainname/bin/$_compiler""gcc" ] + then + first="$1" + _toolchain_gui_install + fi + loadprofile="yes" + _toolchain_build_menu "$1" else - _select_menu; - fi; - fi; - _select_menu; -}; + _select_menu + fi + fi + _select_menu +} + _dialog_checkout1(){ - rm -rf "$svndir" 2>/dev/null; - COUNT=0; - [ -z "$1" ] && rn=0 || rn="$1"; - if [ "$rn" -ge "7000" ];then - _rev="-r $rn"; - sc_text="Revision: $rn"; + rm -rf "$svndir" 2>/dev/null + COUNT=0 + [ -z "$1" ] && rn=0 || rn="$1" + if [ "$rn" -ge "7000" ] + then + _rev="-r $rn" + sc_text="Revision: $rn" else - _rev=''; - sc_text="$txt_latest"; - fi; - (echo -en "$txt_prepare_svn $txt_wait";)| "$gui" "$st_" "$bt_" "$title_" "$pb_" 3 55; - nnn="$(svn info $_rev -R "$trunkurl" |grep "^URL: " |uniq |wc -l)"; - "$gui" "$st_" "$bt_" "$title_" --title " -[ SVN Checkout $sc_text ]- " --gauge " $txt_wait" 6 75 < <(while read line filename;do ((++i));PCT=$(( 100*i/(nnn+1) )); + _rev='' + sc_text="$txt_latest" + fi + (printf "$txt_prepare_svn $txt_wait";)| "$gui" "$st_" "$bt_" "$title_" "$pb_" 3 55 + nnn="$(svn info $_rev -R "$trunkurl" |grep "^URL: " |uniq |wc -l)" + "$gui" "$st_" "$bt_" "$title_" --title " -[ SVN Checkout $sc_text ]- " --gauge " $txt_wait" 6 75 < <(while read line filename;do ((++i));PCT=$(( 100*i/(nnn+1) )) cat </dev/null| sed 's/[^0-9]//g' || echo " nosvn "; -}; + [ -d "$svndir" ] && cd "$svndir" && svnversion -n . 2>/dev/null| sed 's/[^0-9]//g' || printf " nosvn " +} diff --git a/support/functions/_translation b/support/functions/_translation index b36a7dc..c6af7de 100644 --- a/support/functions/_translation +++ b/support/functions/_translation @@ -1,51 +1,75 @@ #!/bin/bash auto_langset(){ - langset="fail"; - cd "$tdir"; - langsupport=(*); - if [ -f "$configdir/force_lang" ];then - lng1=$(head -n 1 "$configdir/force_lang"); - for lng in "${langsupport[@]}";do - if [ "$lng" == "$lng1" ];then - source "$tdir/$lng"; - langset="ok"; - return; - fi; - done; - fi; - for lng in "${langsupport[@]}";do - if [ "${LANG:0:2}" == "$lng" ];then - source "$tdir/$lng"; - langset="ok"; - return; - fi; - done; - if [ ! "$langset" == "ok" ];then - [ -f "$tdir/en" ] && source "$tdir/en"; - fi; -}; + langset="fail" + cd "$tdir" + langsupport=(*) + + if [ -f "$configdir/force_lang" ] + then + lng1=$(head -n 1 "$configdir/force_lang") + for lng in "${langsupport[@]}" + do + + if [ "$lng" == "$lng1" ] + then + source "$tdir/$lng" + langset="ok" + return + fi + + done + fi + + for lng in "${langsupport[@]}" + do + if [ "${LANG:0:2}" == "$lng" ] + then + source "$tdir/$lng" + langset="ok" + return + fi + done + + if [ ! "$langset" == "ok" ] + then + [ -f "$tdir/en" ] && source "$tdir/en" + fi +} + lang_select(){ - lng="none"; - [ -f "$configdir/force_lang" ] && lng=$(head -n 1 "$configdir/force_lang"); - unset MENU_OPTIONS;COUNT=0; - for e in "${langsupport[@]}";do - if [ "$lng" == "none" ];then - [ "${LANG:0:2}" == "$e" ] && _stat="on" || _stat="off"; + lng="none" + [ -f "$configdir/force_lang" ] && lng=$(head -n 1 "$configdir/force_lang") + + unset MENU_OPTIONS + COUNT=0 + + for e in "${langsupport[@]}" + do + + if [ "$lng" == "none" ] + then + [ "${LANG:0:2}" == "$e" ] && _stat="on" || _stat="off" else - [ "$lng" == "$e" ] && _stat="on" || _stat="off"; - fi; - txt=$(head -3 "$tdir/$e" |tail -1); - MENU_OPTIONS+=($e $txt $_stat);counter; - done; - lng=$("$gui" "$st_" "$bt_" "$title_" --title "-[ lang set ...to edit... ]-" "$rl_" "...langset...to...edit..." "${COUNT+7}" 40 0 "${MENU_OPTIONS[@]}"); - if [ ! "${LANG:0:2}" == "$lng" ];then - for lng1 in "${langsupport[@]}";do - if [ "$lng" == "$lng1" ];then - echo "$lng" >"$configdir/force_lang"; - fi; - done; + [ "$lng" == "$e" ] && _stat="on" || _stat="off" + fi + + txt=$(head -3 "$tdir/$e" |tail -1) + MENU_OPTIONS+=($e $txt $_stat) + counter + done + + lng=$("$gui" "$st_" "$bt_" "$title_" --title "-[ lang set ...to edit... ]-" "$rl_" "...langset...to...edit..." "${COUNT+7}" 40 0 "${MENU_OPTIONS[@]}") + if [ ! "${LANG:0:2}" == "$lng" ] + then + for lng1 in "${langsupport[@]}" + do + if [ "$lng" == "$lng1" ] + then + echo "$lng" >"$configdir/force_lang" + fi + done else - [ -f "$configdir/force_lang" ] && rm -rf "$configdir/force_lang"; - fi; -}; \ No newline at end of file + [ -f "$configdir/force_lang" ] && rm -rf "$configdir/force_lang" + fi +} diff --git a/support/functions/_update b/support/functions/_update index c440305..661a06d 100644 --- a/support/functions/_update +++ b/support/functions/_update @@ -1,70 +1,84 @@ #!/bin/bash update_me(){ - clear;s3logo; - local_revision=0; - online_revision=0; - source "$configdir/urls"; - s3local="$dldir/s3_github"; - echo -en " s3_git CHECK:\n -------------\n"; - if [ -d "$s3local/.svn" ]; then - local_revision=$(gitrevision $s3local); + clear;s3logo + local_revision=0 + online_revision=0 + source "$configdir/urls" + s3local="$dldir/s3_github" + printf " s3_git CHECK:\n -------------\n" + + if [ -d "$s3local/.svn" ] + then + local_revision=$(gitrevision $s3local) fi - online_revision=$(gitrevision $s3url); - if [ ! $local_revision == $online_revision ]; then - echo -en " update s3_git to\n Local Revision: $online_revision\n"; - svn -q checkout "$s3url" "$s3local"; - cd "$s3local"; - echo -en " update all files ...\n\n"; - yes | cp -rf ./s3 "$workdir/s3"; - yes | cp -rf ./support/* "$workdir/support"; + + online_revision=$(gitrevision $s3url) + if [ ! $local_revision == $online_revision ] + then + printf " update s3_git to\n Local Revision: $online_revision\n" + svn -q checkout "$s3url" "$s3local" + cd "$s3local" + printf " update all files ...\n\n" + yes | cp -rf ./s3 "$workdir/s3" + yes | cp -rf ./support/* "$workdir/support" else - echo -en " is up to date\n Online Revision: $online_revision\n\n"; + printf " is up to date\n Online Revision: $online_revision\n\n" fi - sleep 1; + sleep 1 } update_emu(){ - clear;s3logo; - local_revision=0; - online_revision=0; - source "$configdir/urls"; - emulocal="$dldir/emu_github"; - echo -en " emu_git CHECK:\n --------------\n"; - if [ -d "$emulocal/.svn" ]; then - local_revision=$(gitrevision $emulocal); + clear + s3logo + local_revision=0 + online_revision=0 + source "$configdir/urls" + emulocal="$dldir/emu_github" + printf " emu_git CHECK:\n --------------\n" + + if [ -d "$emulocal/.svn" ] + then + local_revision=$(gitrevision $emulocal) fi - online_revision=$(gitrevision $emuurl); - if [ ! $local_revision == $online_revision ]; then - echo -en " update emu_git to\n Local Revision: $online_revision\n"; - svn -q checkout "$emuurl" "$emulocal"; + + online_revision=$(gitrevision $emuurl) + if [ ! $local_revision == $online_revision ] + then + printf " update emu_git to\n Local Revision: $online_revision\n" + svn -q checkout "$emuurl" "$emulocal" else - echo -en " is up to date\n Online Revision: $online_revision\n"; + printf " is up to date\n Online Revision: $online_revision\n" + fi + if [ -f "$emulocal/VERSION" ] + then + printf " EmuVersion: " + grep '\$Version:' "$emulocal/VERSION" |cut -d " " -f 2 + _nl fi - if [ -f "$emulocal/VERSION" ];then - echo -en " EmuVersion: "; - grep '\$Version:' "$emulocal/VERSION" |cut -d " " -f 2; - echo -e "\n"; - fi - sleep 1; + sleep 1 } fix_me(){ - clear;s3logo; - source "$configdir/urls"; - s3local="$dldir/s3_github"; - emulocal="$dldir/emu_github"; - if [ -d "$s3local" ];then - rm -rf $s3local; + clear + s3logo + source "$configdir/urls" + s3local="$dldir/s3_github" + emulocal="$dldir/emu_github" + + if [ -d "$s3local" ] + then + rm -rf $s3local update_me else - update_me; + update_me fi - if [ -d "$emulocal" ];then - rm -rf $emulocal; - update_emu; + + if [ -d "$emulocal" ] + then + rm -rf $emulocal + update_emu else - update_emu; + update_emu fi } - diff --git a/support/functions/_uploadcam b/support/functions/_uploadcam index e998e17..68dfe50 100644 --- a/support/functions/_uploadcam +++ b/support/functions/_uploadcam @@ -1,55 +1,62 @@ #!/bin/bash upload_cam(){ - clear; - slogo; - FILENAME=$1; - - if [ ! -f "$profdir/$FILENAME" ];then - echo -e "$r_l\n $txt_error $FILENAME $txt_upload_cam1 $re_"; - exit; + clear + slogo + FILENAME=$1 + + if [ ! -f "$profdir/$FILENAME" ] + then + printf "$r_l\n $txt_error $FILENAME $txt_upload_cam1 $re_" + exit else - echo -e "$w_l\n CONFIG : $g_l$FILENAME $txt_upload_cam2 $re_"; - fi; + printf "$w_l\n CONFIG : $g_l$FILENAME $txt_upload_cam2 $re_" + fi #load data from config - source "$profdir/$FILENAME"; + source "$profdir/$FILENAME" #find newest build by date for toolchain - cd "$bdir"; - buildcamname="$(find . -type f \( -iname "*$toolchain*" ! -iname "*list_smargo" \) -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" " |sed 's@./@@g')"; - cd "$workdir"; + cd "$bdir" + buildcamname="$(find . -type f \( -iname "*$toolchain*" ! -iname "*list_smargo" \) -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" " |sed 's@./@@g')" + cd "$workdir" #output date from cam - if [ -f "$bdir/$buildcamname" ];then - echo -e "$w_l CAMNAME : $y_l$buildcamname"; - echo -en "$w_l FILEDATE: "$( - stat -c %y "$bdir/$buildcamname" |awk '{print $1" "; printf substr($2,1,8)}'); - echo -e "$w_l"; + if [ -f "$bdir/$buildcamname" ] + then + printf "$w_l CAMNAME : $y_l$buildcamname" + printf "$w_l FILEDATE: "$( + stat -c %y "$bdir/$buildcamname" |awk '{print $1" "; printf substr($2,1,8)}' + ) + printf "$w_l" else - echo -e "$r_l\n matching \$CAM not found in $bdir$re_"; - exit; - fi; - echo -e "$p_l\n $txt_LOAD > $w_l$txt_to IP:$b_l$ip$w_l port:$b_l$port"; - sshpass -p "$password" scp -P "$port" "$bdir/$buildcamname" "$loginname@$ip":/tmp; + printf "\n matching \$CAM not found in $bdir$re_" + exit + fi + + printf "$p_l\n $txt_LOAD > $w_l$txt_to IP:$b_l$ip$w_l port:$b_l$port" + sshpass -p "$password" scp -P "$port" "$bdir/$buildcamname" "$loginname@$ip":/tmp #replace target cam - if [ "$replace_target" == "y" ];then - echo -en "$p_l REPLACE > $y_l$targetcam$re_"; + if [ "$replace_target" == "y" ] + then + printf "$p_l REPLACE > $y_l$targetcam$re_" sshpass -p "$password" ssh -p "$port" -o StrictHostKeyChecking=no "$loginname@$ip" \ - "cd /tmp;if [ -f \"$buildcamname\" ];then if [ -f \"$targetcam\" ];then if [ \"$backup_target\" == \"y\" ]; then cp -pf \"$targetcam\" \"$targetcam.backup\"; fi;mv -f \"$buildcamname\" \"$targetcam\";fi;fi;exit;"; - echo -e "$g_l$txt_done!$re_"; - fi; + "cd /tmp;if [ -f \"$buildcamname\" ];then if [ -f \"$targetcam\" ];then if [ \"$backup_target\" == \"y\" ]; then cp -pf \"$targetcam\" \"$targetcam.backup\"; fi;mv -f \"$buildcamname\" \"$targetcam\";fi;fi;exit;" + printf "$g_l$txt_done!$re_" + fi #stop target cam - if [ "$stop_target" == 'y' ];then - stop="killall -9 $(basename "$targetcam")"; - fi; + if [ "$stop_target" == 'y' ] + then + stop="killall -9 $(basename "$targetcam")" + fi #remote command (example restart cam) - if [ ! "$remote_command" == "none" ];then - echo -e "$w_l SSH COMMANDS $remote_command $y_l$txt_wait"; + if [ ! "$remote_command" == "none" ] + then + printf "$w_l SSH COMMANDS $remote_command $y_l$txt_wait" # do remote commands - sshpass -p "$password" ssh -p "$port" -o StrictHostKeyChecking=no "$loginname@$ip" "$remote_command;"; - fi; -}; \ No newline at end of file + sshpass -p "$password" ssh -p "$port" -o StrictHostKeyChecking=no "$loginname@$ip" "$remote_command;" + fi +}