4 changed files with 391 additions and 295 deletions
@ -1,195 +1,246 @@ |
|||||
#!/bin/bash |
#!/bin/bash |
||||
|
|
||||
checkout(){ |
checkout(){ |
||||
echo -en "$c_l"; |
echo -en "$c_l" |
||||
fc1="$(mktemp)"; |
fc1="$(mktemp)" |
||||
clear; |
clear |
||||
ologo; |
ologo |
||||
i=0; |
i=0 |
||||
COUNT=0; |
COUNT=0 |
||||
if [ -d "$svndir" ];then |
|
||||
rm -rf "$svndir"; |
if [ -d "$svndir" ] |
||||
echo -e "$p_l\n $txt_delete $txt_existing oscam-svn $re_\n"; |
then |
||||
|
rm -rf "$svndir" |
||||
|
printf "$p_l\n $txt_delete $txt_existing oscam-svn $re_\n" |
||||
else |
else |
||||
echo -e "$p_l\n $txt_no oscam-svn $txt_found\n$re_"; |
printf "$p_l\n $txt_no oscam-svn $txt_found\n$re_" |
||||
fi; |
fi |
||||
echo -e "$w_l SVN TrunkURL : $g_l$trunkurl$re_"; |
|
||||
[ ! -z "$1" ] && [ $(($1)) -gt 6999 ] && opt_="-r$1" && mac_="($txt_selected)" || opt_=''; |
printf "$w_l SVN TrunkURL : $g_l$trunkurl$re_" |
||||
echo -en "$w_l SVN FileCount : "; |
[ ! -z "$1" ] && [ $(($1)) -gt 6999 ] && opt_="-r$1" && mac_="($txt_selected)" || opt_='' |
||||
svn info -R "$trunkurl" |grep '^URL' |uniq |wc -l >"$fc1"; |
|
||||
n=$(cat "$fc1"); |
printf "$w_l SVN FileCount : " |
||||
echo -e "$g_l""$txt_found $n"; |
svn info -R "$trunkurl" |grep '^URL' |uniq |wc -l >"$fc1" |
||||
echo -en "$w_l SVN checkout : "; |
n=$(cat "$fc1") |
||||
while read line filename;do |
printf "$g_l""$txt_found $n" |
||||
counter=$(( 100*(++i)/n)); |
printf "$w_l SVN checkout : " |
||||
tput cup 11 18; |
|
||||
[ "$counter" -lt "100" ] && echo -en "$g_l""$counter%$re_" || echo -en "$g_l""100%$re_"; |
while read line filename |
||||
done < <( svn co "$trunkurl" $opt_ "$svndir" |sed "s|$svndir/||g"); |
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; |
tput cup 11 18; |
||||
echo -en "$g_l""100%$re_"; |
printf "$g_l""100%$re_" |
||||
if [ -f "$svndir/config.sh" ];then |
|
||||
|
if [ -f "$svndir/config.sh" ] |
||||
|
then |
||||
tput cup 12 2; |
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"; |
printf "$w_l""SVN Revision : $y_l""$("$svndir/config.sh" -r) $b_l$mac_$re_\n$w_l SVN UserPath : $y_l""$svndir" |
||||
fi; |
fi |
||||
[ -f "$svndir/config.h" ]&& reset_="$("$svndir/config.sh" -R)"; |
|
||||
rm -rf "$fc1"; |
[ -f "$svndir/config.h" ]&& reset_="$("$svndir/config.sh" -R)" |
||||
_nl; |
rm -rf "$fc1" |
||||
[ -f "$workdir/SVN-IS-PATCHED" ] && rm -f "$workdir/SVN-IS-PATCHED"; |
_nl |
||||
[ -f "$workdir/EMU_ON" ] && rm -f "$workdir/EMU_ON"; |
[ -f "$workdir/SVN-IS-PATCHED" ] && rm -f "$workdir/SVN-IS-PATCHED" |
||||
tarsvn; |
[ -f "$workdir/EMU_ON" ] && rm -f "$workdir/EMU_ON" |
||||
}; |
tarsvn |
||||
|
} |
||||
|
|
||||
svnrestore(){ |
svnrestore(){ |
||||
clear; |
clear |
||||
echo -en "$c_l"; |
echo -en "$c_l" |
||||
ologo; |
ologo |
||||
if [ "$1" == "list" ];then |
|
||||
cd "$bsvn"; |
if [ "$1" == "list" ] |
||||
bfiles="$(find . -type f |sed 's|./||' |sed 's|.tar.gz||')"; |
then |
||||
bcount=$(echo "$bfiles" |wc -w); |
cd "$bsvn" |
||||
if [ "$bcount" -gt "0" ];then |
bfiles="$(find . -type f |sed 's|./||' |sed 's|.tar.gz||')" |
||||
echo -e "\n$c_l $bcount$w_l svn backups found\n ____________________$re_\n"; |
bcount=$(echo "$bfiles" |wc -w) |
||||
for b in $bfiles;do |
|
||||
echo -e "$c_l --> $w_l$b"; |
if [ "$bcount" -gt "0" ] |
||||
done; |
then |
||||
_nl; |
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 |
else |
||||
echo -e "\n$r_l $bcount$w_l svn backups found\n ____________________$re_\n"; |
echo -e "\n$r_l $bcount$w_l svn backups found\n ____________________$re_\n" |
||||
fi; |
fi |
||||
exit; |
|
||||
fi; |
exit |
||||
if [ -d "$svndir" ];then |
fi |
||||
rm -rf "$svndir"; |
|
||||
echo -e "$p_l\n $txt_delete $txt_existing oscam-svn $re_\n"; |
if [ -d "$svndir" ] |
||||
|
then |
||||
|
rm -rf "$svndir" |
||||
|
printf "$p_l\n $txt_delete $txt_existing oscam-svn $re_\n" |
||||
else |
else |
||||
echo -e "$p_l\n $txt_no oscam-svn $txt_found\n$re_"; |
printf "$p_l\n $txt_no oscam-svn $txt_found\n$re_" |
||||
fi; |
fi |
||||
untarsvn $1; |
|
||||
[ -f "$svndir/config.h" ]&& echo -en "$w_l"" SVN Revision : $y_l""$("$svndir/config.sh" -r) restored\n\n$re_"; |
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/lastbuild.log" ]&& rm "$workdir/lastbuild.log"; |
||||
[ -L "$workdir/lastpatch.log" ]&& rm "$workdir/lastpatch.log"; |
[ -L "$workdir/lastpatch.log" ]&& rm "$workdir/lastpatch.log"; |
||||
[ -f "$workdir/SVN-IS-PATCHED" ] && rm -f "$workdir/SVN-IS-PATCHED"; |
[ -f "$workdir/SVN-IS-PATCHED" ] && rm -f "$workdir/SVN-IS-PATCHED"; |
||||
[ -f "$workdir/EMU_ON" ] && rm -f "$workdir/EMU_ON"; |
[ -f "$workdir/EMU_ON" ] && rm -f "$workdir/EMU_ON"; |
||||
}; |
} |
||||
|
|
||||
quicksvnrestore(){ |
quicksvnrestore(){ |
||||
untarsvn $1; |
untarsvn $1 |
||||
}; |
} |
||||
|
|
||||
svnup(){ |
svnup(){ |
||||
echo -en "$c_l"; |
printf "$c_l" |
||||
clear; |
clear |
||||
ologo; |
ologo |
||||
i=1; |
i=1 |
||||
if [ -d "$svndir" ];then |
|
||||
echo -en "$p_l\n $txt_update oscam-svn $re_\n"; |
if [ -d "$svndir" ] |
||||
|
then |
||||
|
printf "$p_l\n $txt_update oscam-svn $re_\n" |
||||
else |
else |
||||
checkout; |
checkout |
||||
return; |
return |
||||
fi; |
fi |
||||
echo -en "\n$w_l SVN TrunkURL : $g_l""$trunkurl""$re_"; |
|
||||
svn co "$trunkurl" "$svndir" -q; |
printf "\n$w_l SVN TrunkURL : $g_l""$trunkurl""$re_" |
||||
if [ -f "$svndir/config.sh" ];then |
svn co "$trunkurl" "$svndir" -q |
||||
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_"; |
if [ -f "$svndir/config.sh" ] |
||||
fi; |
then |
||||
if [ -f "$svndir/config.h" ];then |
tput cup 10 2 |
||||
reset_="$("$svndir/config.sh" -R)"; |
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; |
fi |
||||
}; |
|
||||
|
if [ -f "$svndir/config.h" ] |
||||
|
then |
||||
|
reset_="$("$svndir/config.sh" -R)" |
||||
|
fi |
||||
|
} |
||||
|
|
||||
svnpatch(){ |
svnpatch(){ |
||||
if [ ! -f "$workdir/SVN-IS-PATCHED" ];then |
if [ ! -f "$workdir/SVN-IS-PATCHED" ] |
||||
clear; |
then |
||||
echo -e $C; |
clear |
||||
ologo; |
printf $C |
||||
unset patchlist; |
ologo |
||||
cd "$pdir"; |
unset patchlist |
||||
patchlist=(*.patch); |
cd "$pdir" |
||||
if [ "$(ls -A "$pdir"/*.patch 2>/dev/null)" ];then |
patchlist=(*.patch) |
||||
touch "$workdir/SVN-IS-PATCHED"; |
|
||||
for p in "${patchlist[@]}";do |
if [ "$(ls -A "$pdir"/*.patch 2>/dev/null)" ] |
||||
echo -e $WH"\n\n -> $p <-\n"$W; |
then |
||||
sleep 1; |
touch "$workdir/SVN-IS-PATCHED" |
||||
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;"; |
for p in "${patchlist[@]}" |
||||
done; |
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 |
else |
||||
echo -e $WH" $txt_no patch $txt_found"; |
printf $WH" $txt_no patch $txt_found" |
||||
fi; |
fi |
||||
|
|
||||
else |
else |
||||
clear; |
clear |
||||
echo -e $C; |
printf $C |
||||
ologo; |
ologo |
||||
echo -e $WH" already patched"; |
printf $WH" already patched" |
||||
fi; |
fi |
||||
echo -e $W; |
echo -e $W |
||||
}; |
} |
||||
|
|
||||
_dialog_checkout(){ |
_dialog_checkout(){ |
||||
upc="$(mktemp)"; |
upc="$(mktemp)" |
||||
(echo -en " $txt_verify_syscheck "; |
(printf " $txt_verify_syscheck " |
||||
[ "$sanity" == "1" ] && echo -e "ok" && sleep 1; |
[ "$sanity" == "1" ] && printf "ok\n" && sleep 1; |
||||
if [ "${s3cfg_vars[NO_SVN_AUTOUPDATE]}" == "0" ];then |
|
||||
echo -en " $txt_verify_svn "; |
if [ "${s3cfg_vars[NO_SVN_AUTOUPDATE]}" == "0" ] |
||||
if [ -f "$svndir/config.sh" ];then |
then |
||||
echo "ok"; |
printf " $txt_verify_svn " |
||||
sleep 1; |
if [ -f "$svndir/config.sh" ] |
||||
echo -en " $txt_update_svn $txt_wait\n"; |
then |
||||
cd "$svndir"; |
printf "ok\n" |
||||
svn -q update; |
sleep 1 |
||||
echo 1 >"$upc"; |
printf " $txt_update_svn $txt_wait\n" |
||||
sleep 1; |
cd "$svndir" |
||||
fi; |
svn -q update |
||||
fi;) | "$gui" "$st_" "$bt_" "$title_" "$pb_" 5 52; |
echo 1 >"$upc" |
||||
if [ "${s3cfg_vars[NO_SVN_AUTOUPDATE]}" == "0" ];then |
sleep 1 |
||||
upc1=$(cat "$upc" 2>/dev/null); |
fi |
||||
rm -f "$upc"; |
fi;) | "$gui" "$st_" "$bt_" "$title_" "$pb_" 5 52 |
||||
[ ! "$upc1" == "1" ] && _dialog_checkout1; |
|
||||
if [ -f "$svndir/config.sh" ];then |
if [ "${s3cfg_vars[NO_SVN_AUTOUPDATE]}" == "0" ] |
||||
reset_="$("$svndir/config.sh" -R)"; |
then |
||||
fi; |
upc1=$(cat "$upc" 2>/dev/null) |
||||
_get_config_menu; |
rm -f "$upc" |
||||
fi; |
[ ! "$upc1" == "1" ] && _dialog_checkout1 |
||||
if [ -n "$1" ];then |
|
||||
if [ -f "$tccfgdir/$1" ] && [ -f "$svndir/config.sh" ];then |
if [ -f "$svndir/config.sh" ] |
||||
source "$tccfgdir/$1"; |
then |
||||
if [ ! -f "$tcdir/$_toolchainname/bin/$_compiler""gcc" ];then |
reset_="$("$svndir/config.sh" -R)" |
||||
first="$1"; |
fi |
||||
_toolchain_gui_install; |
_get_config_menu |
||||
fi; |
fi |
||||
loadprofile="yes"; |
|
||||
_toolchain_build_menu "$1"; |
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 |
else |
||||
_select_menu; |
_select_menu |
||||
fi; |
fi |
||||
fi; |
fi |
||||
_select_menu; |
_select_menu |
||||
}; |
} |
||||
|
|
||||
_dialog_checkout1(){ |
_dialog_checkout1(){ |
||||
rm -rf "$svndir" 2>/dev/null; |
rm -rf "$svndir" 2>/dev/null |
||||
COUNT=0; |
COUNT=0 |
||||
[ -z "$1" ] && rn=0 || rn="$1"; |
[ -z "$1" ] && rn=0 || rn="$1" |
||||
if [ "$rn" -ge "7000" ];then |
if [ "$rn" -ge "7000" ] |
||||
_rev="-r $rn"; |
then |
||||
sc_text="Revision: $rn"; |
_rev="-r $rn" |
||||
|
sc_text="Revision: $rn" |
||||
else |
else |
||||
_rev=''; |
_rev='' |
||||
sc_text="$txt_latest"; |
sc_text="$txt_latest" |
||||
fi; |
fi |
||||
(echo -en "$txt_prepare_svn $txt_wait";)| "$gui" "$st_" "$bt_" "$title_" "$pb_" 3 55; |
(printf "$txt_prepare_svn $txt_wait";)| "$gui" "$st_" "$bt_" "$title_" "$pb_" 3 55 |
||||
nnn="$(svn info $_rev -R "$trunkurl" |grep "^URL: " |uniq |wc -l)"; |
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) )); |
"$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 <<EOF |
cat <<EOF |
||||
XXX |
XXX |
||||
$PCT |
$PCT |
||||
$line |
$line |
||||
XXX |
XXX |
||||
EOF |
EOF |
||||
done < <(svn co "$trunkurl" "$svndir" $_rev| sed "s@$svndir@@g"| awk '{print $2}'; |
done < <(svn co "$trunkurl" "$svndir" $_rev| sed "s@$svndir@@g"| awk '{print $2}' |
||||
cd "$svndir"; |
cd "$svndir" |
||||
if [ -f "$svndir/config.sh" ];then |
if [ -f "$svndir/config.sh" ] |
||||
reset_="$("$svndir/config.sh" -R)"; |
then |
||||
echo "Revision: $(REVISION) done..."; |
reset_="$("$svndir/config.sh" -R)" |
||||
[ -f "$workdir/SVN-IS-PATCHED" ] && rm -f "$workdir/SVN-IS-PATCHED"; |
printf "Revision: $(REVISION) done..." |
||||
[ -f "$workdir/EMU_ON" ] && rm -f "$workdir/EMU_ON"; |
[ -f "$workdir/SVN-IS-PATCHED" ] && rm -f "$workdir/SVN-IS-PATCHED" |
||||
_get_config_menu; |
[ -f "$workdir/EMU_ON" ] && rm -f "$workdir/EMU_ON" |
||||
fi;)); |
_get_config_menu |
||||
}; |
fi;)) |
||||
|
} |
||||
|
|
||||
REVISION(){ |
REVISION(){ |
||||
[ -d "$svndir" ] && cd "$svndir" && svnversion -n . 2>/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 " |
||||
}; |
} |
||||
|
@ -1,51 +1,75 @@ |
|||||
#!/bin/bash |
#!/bin/bash |
||||
|
|
||||
auto_langset(){ |
auto_langset(){ |
||||
langset="fail"; |
langset="fail" |
||||
cd "$tdir"; |
cd "$tdir" |
||||
langsupport=(*); |
langsupport=(*) |
||||
if [ -f "$configdir/force_lang" ];then |
|
||||
lng1=$(head -n 1 "$configdir/force_lang"); |
if [ -f "$configdir/force_lang" ] |
||||
for lng in "${langsupport[@]}";do |
then |
||||
if [ "$lng" == "$lng1" ];then |
lng1=$(head -n 1 "$configdir/force_lang") |
||||
source "$tdir/$lng"; |
for lng in "${langsupport[@]}" |
||||
langset="ok"; |
do |
||||
return; |
|
||||
fi; |
if [ "$lng" == "$lng1" ] |
||||
done; |
then |
||||
fi; |
source "$tdir/$lng" |
||||
for lng in "${langsupport[@]}";do |
langset="ok" |
||||
if [ "${LANG:0:2}" == "$lng" ];then |
return |
||||
source "$tdir/$lng"; |
fi |
||||
langset="ok"; |
|
||||
return; |
done |
||||
fi; |
fi |
||||
done; |
|
||||
if [ ! "$langset" == "ok" ];then |
for lng in "${langsupport[@]}" |
||||
[ -f "$tdir/en" ] && source "$tdir/en"; |
do |
||||
fi; |
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(){ |
lang_select(){ |
||||
lng="none"; |
lng="none" |
||||
[ -f "$configdir/force_lang" ] && lng=$(head -n 1 "$configdir/force_lang"); |
[ -f "$configdir/force_lang" ] && lng=$(head -n 1 "$configdir/force_lang") |
||||
unset MENU_OPTIONS;COUNT=0; |
|
||||
for e in "${langsupport[@]}";do |
unset MENU_OPTIONS |
||||
if [ "$lng" == "none" ];then |
COUNT=0 |
||||
[ "${LANG:0:2}" == "$e" ] && _stat="on" || _stat="off"; |
|
||||
|
for e in "${langsupport[@]}" |
||||
|
do |
||||
|
|
||||
|
if [ "$lng" == "none" ] |
||||
|
then |
||||
|
[ "${LANG:0:2}" == "$e" ] && _stat="on" || _stat="off" |
||||
else |
else |
||||
[ "$lng" == "$e" ] && _stat="on" || _stat="off"; |
[ "$lng" == "$e" ] && _stat="on" || _stat="off" |
||||
fi; |
fi |
||||
txt=$(head -3 "$tdir/$e" |tail -1); |
|
||||
MENU_OPTIONS+=($e $txt $_stat);counter; |
txt=$(head -3 "$tdir/$e" |tail -1) |
||||
done; |
MENU_OPTIONS+=($e $txt $_stat) |
||||
lng=$("$gui" "$st_" "$bt_" "$title_" --title "-[ lang set ...to edit... ]-" "$rl_" "...langset...to...edit..." "${COUNT+7}" 40 0 "${MENU_OPTIONS[@]}"); |
counter |
||||
if [ ! "${LANG:0:2}" == "$lng" ];then |
done |
||||
for lng1 in "${langsupport[@]}";do |
|
||||
if [ "$lng" == "$lng1" ];then |
lng=$("$gui" "$st_" "$bt_" "$title_" --title "-[ lang set ...to edit... ]-" "$rl_" "...langset...to...edit..." "${COUNT+7}" 40 0 "${MENU_OPTIONS[@]}") |
||||
echo "$lng" >"$configdir/force_lang"; |
if [ ! "${LANG:0:2}" == "$lng" ] |
||||
fi; |
then |
||||
done; |
for lng1 in "${langsupport[@]}" |
||||
|
do |
||||
|
if [ "$lng" == "$lng1" ] |
||||
|
then |
||||
|
echo "$lng" >"$configdir/force_lang" |
||||
|
fi |
||||
|
done |
||||
else |
else |
||||
[ -f "$configdir/force_lang" ] && rm -rf "$configdir/force_lang"; |
[ -f "$configdir/force_lang" ] && rm -rf "$configdir/force_lang" |
||||
fi; |
fi |
||||
}; |
} |
||||
|
@ -1,55 +1,62 @@ |
|||||
#!/bin/bash |
#!/bin/bash |
||||
|
|
||||
upload_cam(){ |
upload_cam(){ |
||||
clear; |
clear |
||||
slogo; |
slogo |
||||
FILENAME=$1; |
FILENAME=$1 |
||||
|
|
||||
if [ ! -f "$profdir/$FILENAME" ];then |
if [ ! -f "$profdir/$FILENAME" ] |
||||
echo -e "$r_l\n $txt_error $FILENAME $txt_upload_cam1 $re_"; |
then |
||||
exit; |
printf "$r_l\n $txt_error $FILENAME $txt_upload_cam1 $re_" |
||||
|
exit |
||||
else |
else |
||||
echo -e "$w_l\n CONFIG : $g_l$FILENAME $txt_upload_cam2 $re_"; |
printf "$w_l\n CONFIG : $g_l$FILENAME $txt_upload_cam2 $re_" |
||||
fi; |
fi |
||||
|
|
||||
#load data from config |
#load data from config |
||||
source "$profdir/$FILENAME"; |
source "$profdir/$FILENAME" |
||||
|
|
||||
#find newest build by date for toolchain |
#find newest build by date for toolchain |
||||
cd "$bdir"; |
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')"; |
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 "$workdir" |
||||
|
|
||||
#output date from cam |
#output date from cam |
||||
if [ -f "$bdir/$buildcamname" ];then |
if [ -f "$bdir/$buildcamname" ] |
||||
echo -e "$w_l CAMNAME : $y_l$buildcamname"; |
then |
||||
echo -en "$w_l FILEDATE: "$( |
printf "$w_l CAMNAME : $y_l$buildcamname" |
||||
stat -c %y "$bdir/$buildcamname" |awk '{print $1" "; printf substr($2,1,8)}'); |
printf "$w_l FILEDATE: "$( |
||||
echo -e "$w_l"; |
stat -c %y "$bdir/$buildcamname" |awk '{print $1" "; printf substr($2,1,8)}' |
||||
|
) |
||||
|
printf "$w_l" |
||||
else |
else |
||||
echo -e "$r_l\n matching \$CAM not found in $bdir$re_"; |
printf "\n matching \$CAM not found in $bdir$re_" |
||||
exit; |
exit |
||||
fi; |
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 "$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 |
#replace target cam |
||||
if [ "$replace_target" == "y" ];then |
if [ "$replace_target" == "y" ] |
||||
echo -en "$p_l REPLACE > $y_l$targetcam$re_"; |
then |
||||
|
printf "$p_l REPLACE > $y_l$targetcam$re_" |
||||
sshpass -p "$password" ssh -p "$port" -o StrictHostKeyChecking=no "$loginname@$ip" \ |
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;"; |
"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_"; |
printf "$g_l$txt_done!$re_" |
||||
fi; |
fi |
||||
|
|
||||
#stop target cam |
#stop target cam |
||||
if [ "$stop_target" == 'y' ];then |
if [ "$stop_target" == 'y' ] |
||||
stop="killall -9 $(basename "$targetcam")"; |
then |
||||
fi; |
stop="killall -9 $(basename "$targetcam")" |
||||
|
fi |
||||
|
|
||||
#remote command (example restart cam) |
#remote command (example restart cam) |
||||
if [ ! "$remote_command" == "none" ];then |
if [ ! "$remote_command" == "none" ] |
||||
echo -e "$w_l SSH COMMANDS $remote_command $y_l$txt_wait"; |
then |
||||
|
printf "$w_l SSH COMMANDS $remote_command $y_l$txt_wait" |
||||
# do remote commands |
# do remote commands |
||||
sshpass -p "$password" ssh -p "$port" -o StrictHostKeyChecking=no "$loginname@$ip" "$remote_command;"; |
sshpass -p "$password" ssh -p "$port" -o StrictHostKeyChecking=no "$loginname@$ip" "$remote_command;" |
||||
fi; |
fi |
||||
}; |
} |
||||
|
Loading…
Reference in new issue