Browse Source

update _toolchain

fix _uploadcam
pull/16/head
gorgone 5 years ago
parent
commit
9aed888284
  1. 576
      support/functions/_toolchain
  2. 13
      support/functions/_uploadcam

576
support/functions/_toolchain

@ -1,29 +1,32 @@
#!/bin/bash #!/bin/bash
_toolchain_build_menu(){ _toolchain_build_menu(){
[ "$loadprofile" == "yes" ] && load_config; [ "$loadprofile" == "yes" ] && load_config
selected=$( selected=$(
"$gui" "$st_" "$bt_" "$title_" --no-cancel --title " -[ $txt_bmenu_title ]- " --menu "_________________________________________________________ \n $txt_bmenu_user = $(whoami)\n Toolchain = $_toolchainname\n $txt_bmenu_comp = $_compiler""gcc\n $txt_bmenu_debu = CPU-Threads($(CPUS)) SVN($(REVISION)) SCRIPT($SIMPLEVERSION)\n $txt_bmenu_use = $(echo $USESTRING| sed -e 's/^[ \t]*//')\n _________________________________________________________ \n" 22 65 10 BUILD "$txt_bmenu_build" CONFIGURE "$txt_bmenu_config" UPDATE "$txt_bmenu_update" BACKUP "$txt_bmenu_backup" LOAD_PROFILE "$txt_bmenu_profile" SAVE_PROFILE "$txt_bmenus_profile" SHOW_BUILDLOG "$txt_bmenu_log" EDIT_CONF_DIR "Oscam config PATH" BACK "$txt_bmenu_back" EXIT "$txt_firstmenu_exit"); "$gui" "$st_" "$bt_" "$title_" --no-cancel --title " -[ $txt_bmenu_title ]- " --menu "_________________________________________________________ \n $txt_bmenu_user = $(whoami)\n Toolchain = $_toolchainname\n $txt_bmenu_comp = $_compiler""gcc\n $txt_bmenu_debu = CPU-Threads($(CPUS)) SVN($(REVISION)) SCRIPT($SIMPLEVERSION)\n $txt_bmenu_use = $(echo $USESTRING| sed -e 's/^[ \t]*//')\n _________________________________________________________ \n" 22 65 10 BUILD "$txt_bmenu_build" CONFIGURE "$txt_bmenu_config" UPDATE "$txt_bmenu_update" BACKUP "$txt_bmenu_backup" LOAD_PROFILE "$txt_bmenu_profile" SAVE_PROFILE "$txt_bmenus_profile" SHOW_BUILDLOG "$txt_bmenu_log" EDIT_CONF_DIR "Oscam config PATH" BACK "$txt_bmenu_back" EXIT "$txt_firstmenu_exit")
[ $? = 255 ] && _toolchain_build_menu; [ $? = 255 ] && _toolchain_build_menu
case $selected in case $selected in
BUILD) BUILD)
_gui_build;; _gui_build;;
CONFIGURE) CONFIGURE)
_toolchain_config_menu;; _toolchain_config_menu;;
UPDATE) UPDATE)
tcupdate "$_toolchainname" "" "" "2"; tcupdate "$_toolchainname" "" "" "2"
_toolchain_build_menu;; _toolchain_build_menu;;
BACKUP) BACKUP)
tcupdate "-b" "$_toolchainname" "" "" "1"; tcupdate "-b" "$_toolchainname" "" "" "1"
_toolchain_build_menu;; _toolchain_build_menu;;
EDIT_CONF_DIR) EDIT_CONF_DIR)
_gtedit; _gtedit
_toolchain_build_menu;; _toolchain_build_menu;;
SHOW_BUILDLOG) SHOW_BUILDLOG)
_sz; _sz;
if [ -f "$workdir/lastbuild.log" ];then if [ -f "$workdir/lastbuild.log" ]
"$gui" "$st_" "$bt_" "$title_" --textbox "$workdir/lastbuild.log" "$_lines" "$_cols"; then
fi; "$gui" "$st_" "$bt_" "$title_" --textbox "$workdir/lastbuild.log" "$_lines" "$_cols"
fi
_toolchain_build_menu;; _toolchain_build_menu;;
LOAD_PROFILE) LOAD_PROFILE)
_load_profile;; _load_profile;;
@ -32,295 +35,388 @@ _toolchain_build_menu(){
BACK) BACK)
_toolchain_main_menu;; _toolchain_main_menu;;
EXIT) EXIT)
bye; bye
exit;; exit;;
esac; esac
_toolchain_build_menu;
}; _toolchain_build_menu
}
_toolchain_config_menu(){ _toolchain_config_menu(){
[ "$loadprofile" == "yes" ] && load_config; [ "$loadprofile" == "yes" ] && load_config
selected=$( selected=$(
"$gui" "$st_" "$bt_" "$title_" --no-cancel --title " -[ $txt_config_menu ]- " --menu " ADDONS :\n $(e_addons)\n\n PROTOCOLS :\n $(e_protocols)\n\n READERS :\n $(e_readers)\n\n CARD_READERS :\n $(e_card_readers)\n\n USE VARIABLES :\n $(echo $USESTRING| sed -e 's/^[ \t]*//')\n\n" 29 75 6 BACK "$txt_back_build" OSCAM_MODULE "$txt_module_configure" OSCAM_EXTRA "$txt_oscam_extra" BUILD_EXTRA "$txt_build_extra" SELECT_STAPI "select stapi" RESET "$txt_build_reset"); "$gui" "$st_" "$bt_" "$title_" --no-cancel --title " -[ $txt_config_menu ]- " --menu " ADDONS :\n $(e_addons)\n\n PROTOCOLS :\n $(e_protocols)\n\n READERS :\n $(e_readers)\n\n CARD_READERS :\n $(e_card_readers)\n\n USE VARIABLES :\n $(echo $USESTRING| sed -e 's/^[ \t]*//')\n\n" 29 75 6 BACK "$txt_back_build" OSCAM_MODULE "$txt_module_configure" OSCAM_EXTRA "$txt_oscam_extra" BUILD_EXTRA "$txt_build_extra" SELECT_STAPI "select stapi" RESET "$txt_build_reset")
[ $? = 255 ] && _toolchain_config_menu; [ $? = 255 ] && _toolchain_config_menu
case $selected in case $selected in
BACK) BACK)
save_config; save_config
_toolchain_build_menu;; _toolchain_build_menu;;
OSCAM_EXTRA) OSCAM_EXTRA)
_oscam_extra_menu;; _oscam_extra_menu;;
BUILD_EXTRA) BUILD_EXTRA)
_build_extra_menu;; _build_extra_menu;;
OSCAM_MODULE) OSCAM_MODULE)
eval "$svndir/config.sh -g" 2>/dev/null; eval "$svndir/config.sh -g" 2>/dev/null
save_config;; save_config;;
SELECT_STAPI) SELECT_STAPI)
_stapi_select;; _stapi_select;;
RESET) RESET)
_reset_config; _reset_config
load_config; load_config
_toolchain_config_menu;; _toolchain_config_menu;;
esac; esac
_toolchain_config_menu;
}; _toolchain_config_menu
}
_toolchain_main_menu(){ _toolchain_main_menu(){
_fill_tc_array; _fill_tc_array
IFS="#"; IFS="#"
COUNT=0; COUNT=0
MENU_OPTIONS="BACK#$txt_back_main#"; MENU_OPTIONS="BACK#$txt_back_main#"
counter; counter
if [ "$systype" == "ok" ];then
MENU_OPTIONS+="ADD#$txt_menu_builder2#"; if [ "$systype" == "ok" ]
counter; then
MENU_OPTIONS+="CREATE#$txt_menu_builder5#"; MENU_OPTIONS+="ADD#$txt_menu_builder2#"
counter; counter
[ "$tcempty" == "0" ] && MENU_OPTIONS+="REMOVE#$txt_menu_builder3#" && counter; MENU_OPTIONS+="CREATE#$txt_menu_builder5#"
fi; counter
MENU_OPTIONS+="native#$txt_menu_builder4 $(hostname)-$(uname -m)#"; [ "$tcempty" == "0" ] && MENU_OPTIONS+="REMOVE#$txt_menu_builder3#" && counter
counter; fi
if [ "$systype" == "ok" ];then
if [ "$tcempty" == "0" ];then MENU_OPTIONS+="native#$txt_menu_builder4 $(hostname)-$(uname -m)#"
for i in "${INST_TCLIST[@]}";do counter
if [ ! "$i" == "native" ];then
source "$tccfgdir/$i"; if [ "$tcempty" == "0" ]
MENU_OPTIONS+="$_toolchainname#$_description#"; then
counter; for i in "${INST_TCLIST[@]}"
fi; do
done; if [ ! "$i" == "native" ]
fi; then
fi; source "$tccfgdir/$i"
MENU_OPTIONS+="EXIT#$txt_firstmenu_exit#"; if [ "$systype" == "ok" ]
counter; then
MENU_OPTIONS+="$_toolchainname#$_description#"
counter
elif [ "$_self_build" == "yes" ]
then
MENU_OPTIONS+="$_toolchainname#$_description#"
counter
fi
fi
done
fi
MENU_OPTIONS+="EXIT#$txt_firstmenu_exit#"
counter
out=$( out=$(
"$gui" "$st_" "$nc_" "$bt_" "$title_" --help-button --help-label INFO --title "-[ Toolchain $txt_menu ]-" --menu "$txt_main_revision$(REVISION)" "${COUNT+8}" 75 0 ${MENU_OPTIONS}); "$gui" "$st_" "$nc_" "$bt_" "$title_" --help-button --help-label INFO --title "-[ Toolchain $txt_menu ]-" --menu "$txt_main_revision$(REVISION)" "${COUNT+8}" 75 0 ${MENU_OPTIONS})
IFS=$OIFS; IFS=$OIFS
first=$(echo "$out" | awk '{printf $1}'); first=$(echo "$out" | awk '{printf $1}')
tc_info=$(echo "$out" | awk '{printf $2}';); tc_info=$(echo "$out" | awk '{printf $2}';)
case $first in case $first in
EXIT) EXIT)
bye;; bye;;
BACK) BACK)
_select_menu;; _select_menu;;
ADD) ADD)
_toolchain_add_menu;; _toolchain_add_menu;;
CREATE) CREATE)
tcupdate "-c" "" "" "1"; tcupdate "-c" "" "" "1"
_toolchain_main_menu;; _toolchain_main_menu;;
REMOVE) REMOVE)
_toolchain_remove_menu;; _toolchain_remove_menu;;
HELP) HELP)
if [ -f "$tccfgdir/$tc_info" ];then if [ -f "$tccfgdir/$tc_info" ]
source "$tccfgdir/$tc_info"; then
"$gui" "$st_" "$nc_" "$bt_" "$title_" "$ib_" "$_tc_info" $((_tc_infolines + 5)) 65; source "$tccfgdir/$tc_info"
sleep 5; "$gui" "$st_" "$nc_" "$bt_" "$title_" "$ib_" "$_tc_info" $((_tc_infolines + 5)) 65
fi; sleep 5
_toolchain_main_menu;; fi
_toolchain_main_menu;;
*) *)
[ -f "$tccfgdir/$first" ] && stapi_allowed="" && source "$tccfgdir/$first" || exit; [ -f "$tccfgdir/$first" ] && stapi_allowed="" && source "$tccfgdir/$first" || exit
loadprofile="yes"; loadprofile="yes"
_toolchain_build_menu "$first";; _toolchain_build_menu "$first";;
esac; esac
}; }
get_toolchain_config(){ get_toolchain_config(){
get_toolchain_list; get_toolchain_list
for ((i=0;i<${#toolchain_list[@]};i++));do for ((i=0;i<${#toolchain_list[@]};i++))
[ "${toolchain_list[$i]}" == "$1" ] && source "$sdir/toolchain.cfgs/$1"; do
done; [ "${toolchain_list[$i]}" == "$1" ] && source "$sdir/toolchain.cfgs/$1"
}; done
}
_load_toolchain(){ _load_toolchain(){
[ ! -z "$1" ] && source "$tccfgdir/$1"; [ ! -z "$1" ] && source "$tccfgdir/$1"
dln="$(decode "$_t1e")$(decode "$_toolchainfilename")"; dln="$(decode "$_t1e")$(decode "$_toolchainfilename")"
tc_dl="$dldir/$dln"; tc_dl="$dldir/$dln"
[ -f "$dln" ] && rm -rf "$dln"; [ -f "$dln" ] && rm -rf "$dln"
clear; clear
echo -e "$c_l"; printf "$c_l"
ologo; ologo
_nl; _nl
echo -e "$p_l load only"; printf "$p_l load only"
_nl; _nl
echo -e "$w_l Toolchain :$y_l $dln"; printf "$w_l Toolchain :$y_l $dln"
echo -en "$w_l download :$g_l "; printf "$w_l download :$g_l "
_pget; _pget
}; }
get_toolchain_list(){ get_toolchain_list(){
[ -d "$sdir/toolchain.cfgs" ] && cd "$sdir/toolchain.cfgs" || echo "please fix $sdir/toolchain.cfgs"; [ -d "$sdir/toolchain.cfgs" ] && cd "$sdir/toolchain.cfgs" || printf " please fix $sdir/toolchain.cfgs"
toolchain_list=(); toolchain_list=()
toolchain_list+=('native'); toolchain_list+=('native')
toolchain_list+=(*); toolchain_list+=(*)
cd "$workdir"; cd "$workdir"
}; }
_console_extract_toolchain(){ _console_extract_toolchain(){
[ -d "$tcdir/$_toolchainname" ] && rm -rf "$tcdir/$_toolchainname"; [ -d "$tcdir/$_toolchainname" ] && rm -rf "$tcdir/$_toolchainname"
mkdir "$tcdir/$_toolchainname"; mkdir "$tcdir/$_toolchainname"
cd "$tcdir/$_toolchainname"; cd "$tcdir/$_toolchainname"
xz -d "$tc_dl" -c | tar -x; xz -d "$tc_dl" -c | tar -x
echo -en "$txt_done!$w_l"; tput cup 10 23
}; printf "$txt_done! $w_l\n"
}
_toolchain_check(){ _toolchain_check(){
clear; clear
echo -e "$w_l"; printf "$w_l"
s3logo; s3logo
headervars=( crypto.h pcsclite.h libusb.h pthread.h ); headervars=( crypto.h pcsclite.h libusb.h pthread.h )
[ -f "$tccfgdir/$1" ] && source "$tccfgdir/$1"; [ -f "$tccfgdir/$1" ] && source "$tccfgdir/$1"
if [ -d "$tcdir/$1/bin" ];then
cd "$tcdir/$1/bin"; if [ -d "$tcdir/$1/bin" ]
then
cd "$tcdir/$1/bin"
else else
echo -e "$r_l $txt_error:$y_l $1$w_l Toolchain $txt_n_installed""$rs_"; printf "$r_l $txt_error:$y_l $1$w_l Toolchain $txt_n_installed""$rs_"
_nl; _nl
exit; exit
fi; fi
echo -e "$w_l Compiler Info -----> $C$1$w_l\n ====================\n"; printf "$w_l Compiler Info -----> $C$1$w_l\n ====================\n"
if [ -z "$sysroot" ] && [ ! "$1" == "native" ];then
compilername="$_compiler""gcc"; if [ -z "$sysroot" ] && [ ! "$1" == "native" ]
[ ${#_realcompiler} -gt 4 ] && compilername="$_realcompiler"; then
version=$("./$compilername" -dumpversion); compilername="$_compiler""gcc"
machine=$("./$compilername" -dumpmachine); [ ${#_realcompiler} -gt 4 ] && compilername="$_realcompiler"
sr=$("./$compilername" -print-sysroot 2>/dev/null); version=$("./$compilername" -dumpversion)
sysroot=${sr#"$tcdir/$1/bin/../"}; machine=$("./$compilername" -dumpmachine)
echo -e "$w_l GCC Version :$y_l $version"; sr=$("./$compilername" -print-sysroot 2>/dev/null)
echo -e "$w_l GCC Binary :$y_l $machine""-gcc"; sysroot=${sr#"$tcdir/$1/bin/../"}
echo -e "$w_l GCC Sysroot :$y_l $sysroot"; printf "$w_l GCC Version :$y_l $version\n"
[ -z "$sysroot" ] && sysroot="$r_l$txt_too_old"; printf "$w_l GCC Binary :$y_l $machine""-gcc\n"
cd "$sr"; printf "$w_l GCC Sysroot :$y_l $sysroot\n"
for e in "${headervars[@]}";do [ -z "$sysroot" ] && sysroot="$r_l$txt_too_old\n"
temp=$(find * |grep -m1 "$e"); cd "$sr"
[ ${#temp} -gt 8 ] && echo -e "$w_l Header File :$y_l $e$g_l\t$txt_found" || echo -e "$w_l Header File :$y_l $e$r_l\t($txt_not_found)"; for e in "${headervars[@]}"
done; do
temp=$(find * |grep -m1 "$e")
[ ${#temp} -gt 8 ] && printf "$w_l Header File :$y_l $e$g_l\t$txt_found\n" || printf "$w_l Header File :$y_l $e$r_l\t($txt_not_found)\n"
done
fi fi
if [ "$1" == "native" ];then
echo -e "$w_l GCC Version :$y_l $(gcc --version |head -n 1 )"; if [ "$1" == "native" ]
echo -e "$w_l GCC Binary :$y_l $(gcc -dumpmachine )"; then
printf "$w_l GCC Version :$y_l $(gcc --version |head -n 1 )"
printf "$w_l GCC Binary :$y_l $(gcc -dumpmachine )"
fi fi
echo -e "\n$w_l Sysroot config ----> $C$_sysroot$w_l\n ====================\n";
[ "$1" == "native" ] && cd "$_sysroot" || cd "$tcdir/$1/$_sysroot"; printf "\n$w_l Sysroot config ----> $C$_sysroot$w_l\n ====================\n"
for e in "${headervars[@]}";do
temp=$(find * |grep -m1 "$e"); [ "$1" == "native" ] && cd "$_sysroot" || cd "$tcdir/$1/$_sysroot"
[ ${#temp} -gt 8 ] && echo -e "$w_l Header File :$y_l $e$g_l\t$txt_found" || echo -e "$w_l Header File :$y_l $e$r_l\t($txt_not_found)";
done; for e in "${headervars[@]}"
pkg=$(find * |grep -m1 "pkgconfig"); do
if [ ${#pkg} -gt 0 ];then temp=$(find * |grep -m1 "$e")
[ "$1" == "native" ] && cd "$_sysroot/$pkg" || cd "$tcdir/$1/$_sysroot/$pkg"; [ ${#temp} -gt 8 ] && printf "$w_l Header File :$y_l $e$g_l\t$txt_found\n" || printf "$w_l Header File :$y_l $e$r_l\t($txt_not_found)\n"
echo -e "\n$w_l Library config ----> $C$_sysroot/$pkg$w_l\n ====================\n"; done
for f in *.pc;do
content=$(cat "$f") && na=$(echo "$content" | grep 'Name:' | sed -e "s/Name: //g") && ver=$(echo "$content" | grep 'Version:' | sed -e "s/Version: //g"); pkg=$(find * |grep -m1 "pkgconfig")
sp1=$(printf '%*s' $((20-${#f})) | tr ' ' ' ') && sp2=$(printf '%*s' $((20-${#na})) | tr ' ' ' '); if [ ${#pkg} -gt 0 ]
[ ${#content} -gt 0 ] && echo -e "$w_l Library Config :$y_l "$f"$sp1$g_l$txt_found\t$p_l$na$sp2$ver" || echo -e "$w_l Library Config :$y_l "$f"$sp1$r_l($txt_not_found)"; then
done; [ "$1" == "native" ] && cd "$_sysroot/$pkg" || cd "$tcdir/$1/$_sysroot/$pkg"
printf "\n$w_l Library config ----> $C$_sysroot/$pkg$w_l\n ====================\n"
for f in *.pc
do
content=$(cat "$f") && na=$(echo "$content" | grep 'Name:' | sed -e "s/Name: //g") && ver=$(echo "$content" | grep 'Version:' | sed -e "s/Version: //g")
sp1=$(printf '%*s' $((20-${#f})) | tr ' ' ' ') && sp2=$(printf '%*s' $((20-${#na})) | tr ' ' ' ')
[ ${#content} -gt 0 ] && printf "$w_l Library Config :$y_l "$f"$sp1$g_l$txt_found\t$p_l$na$sp2$ver\n" || printf "$w_l Library Config :$y_l "$f"$sp1$r_l($txt_not_found)\n"
done
else else
echo -e "\n$w_l Library config ----> $C no libraries found in pkgconfig$w_l\n ====================\n"; printf "\n$w_l Library config ----> $C no libraries found in pkgconfig$w_l\n ====================\n"
fi fi
echo -e $re_;
exit; printf $re_
}; exit
}
_toolchain_repair(){ _toolchain_repair(){
clear; clear
echo -e "$w_l\n"; printf "$w_l\n"
s3logo; s3logo
cd $dldir;zzusatz=0;szusatz=0; cd $dldir
[ -f "$tccfgdir/$1" ] && source "$tccfgdir/$1"; zzusatz=0
fn=$(echo $_md5sum |awk '{ printf $2 }'); szusatz=0
if [ ${#_md5sum} -lt 1 ];then [ -f "$tccfgdir/$1" ] && source "$tccfgdir/$1"
echo -e $w_l" md5sum in $Y$1$w_l config $R$txt_not_found$W\n\n";
exit; fn=$(echo $_md5sum |awk '{ printf $2 }')
fi;
if [ -f $fn ];then if [ ${#_md5sum} -lt 1 ]
md5file=$(mktemp); then
echo $_md5sum > $md5file; printf $w_l" md5sum in $Y$1$w_l config $R$txt_not_found$W\n\n"
answer=$(md5sum -c $md5file 2>&1); exit
if [ "$answer" == "$fn: OK" ];then fi
echo -en $w_l" Toolchain md5 check :$g_l";
echo -en $answer |awk '{{print " " $2;}}'; if [ -f $fn ]
echo -en $w_l;tc_dl="$dldir/$fn"; then
echo -en $w_l" Toolchain repair :$g_l" md5file=$(mktemp)
_console_extract_toolchain; printf "$_md5sum\n" > $md5file
echo -e "\n"$W; answer=$(md5sum -c $md5file 2>&1)
if [ "$answer" == "$fn: OK" ]
then
printf $w_l" Toolchain md5 check :$g_l ok\n"
printf $w_l
tc_dl="$dldir/$fn"
printf $w_l" Toolchain repair :$y_l $txt_wait$g_l"
_console_extract_toolchain
tput cup 10 0
printf $w_l" Toolchain repair :$g_l ok \n\n"
else else
echo -en $w_l"\n Toolchain md5 check :$r_l"; printf $w_l" Toolchain md5 check :$r_l fail\n"
echo -en $answer |awk '{{print " " $2;}}' |head -1; zzusatz=-1
echo -en $W;sleep 1;zzusatz=1;szusatz=8; szusatz=8
echo -en $w_l" Toolchain download :$g_l"; printf $w_l" Toolchain download :$g_l\n"
dln=$fn;_pget; sleep 1; dln=$fn
echo -en $w_l" Toolchain repair :$g_l"; _pget
_console_extract_toolchain;echo -e $W"\n"; tput cup 10 22
exit; printf $w_l":$g_l ok \n"
printf $w_l" Toolchain repair :$y_l $txt_wait$g_l"
_console_extract_toolchain
tput cup 10 23
printf "$g_l ok \n"
tput cup 11 23
printf "$g_l ok \n"
_nl
exit
fi fi
else else
echo -e $w_l" Toolchain Filename :$y_l $fn"; printf $w_l" Toolchain Filename :$y_l $fn\n"
echo -en $w_l" Toolchain download :$g_l "; printf $w_l" Toolchain download :$g_l"
zzusatz=-1;szusatz=7; zzusatz=-1
dln=$fn;_pget; sleep 1; szusatz=7
echo -en $w_l" Toolchain repair :$g_l"; dln=$fn
_console_extract_toolchain;echo -e $W"\n"; _pget
exit; tput cup 10 22
printf "$g_l ok \n"
sleep 1
printf $w_l" Toolchain repair :$y_l $txt_wait$g_l"
zzusatz=2
szusatz=7
_console_extract_toolchain
tput cup 10 22
printf "$g_l ok \n"
tput cup 11 22
printf "$g_l ok \n"
_nl
exit
fi fi
}; }
_toolchain_add_menu(){ _toolchain_add_menu(){
_fill_tc_array; _fill_tc_array
_init_menu; _init_menu
for i in "${MISS_TCLIST[@]}";do
if [ ! "$i" == "native" ];then for i in "${MISS_TCLIST[@]}"
source "$tccfgdir/$i"; do
MENU_OPTIONS+="$_toolchainname#$_description#"; if [ ! "$i" == "native" ]
counter; then
fi; source "$tccfgdir/$i"
done; MENU_OPTIONS+="$_toolchainname#$_description#"
MENU_OPTIONS+="EXIT#$txt_menu_builder1#"; counter
counter; fi
done
MENU_OPTIONS+="EXIT#$txt_menu_builder1#"
counter
out=$( out=$(
"$gui" "$st_" "$nc_" "$bt_" "$title_" --help-button --help-label INFO --title "-[ $txt_add_menu ]-" --menu "$txt_main_revision$(REVISION)" "${COUNT+8}" 75 0 ${MENU_OPTIONS[@]}); "$gui" "$st_" "$nc_" "$bt_" "$title_" --help-button --help-label INFO --title "-[ $txt_add_menu ]-" --menu "$txt_main_revision$(REVISION)" "${COUNT+8}" 75 0 ${MENU_OPTIONS[@]})
IFS=$OIFS; IFS=$OIFS
first=$(echo "$out" | awk '{printf $1}'); first=$(echo "$out" | awk '{printf $1}')
case $first in case $first in
EXIT) EXIT)
bye;; bye;;
BACK) BACK)
_toolchain_main_menu;; _toolchain_main_menu;;
*) *)
_toolchain_gui_install; _toolchain_gui_install
_toolchain_main_menu;; _toolchain_main_menu;;
esac; esac
}; }
_toolchain_remove_menu(){ _toolchain_remove_menu(){
_fill_tc_array; _fill_tc_array
_init_menu; _init_menu
if [ "$tcempty" == "0" ];then if [ "$tcempty" == "0" ]
for i in "${INST_TCLIST[@]}";do then
if [ ! "$i" == "native" ];then for i in "${INST_TCLIST[@]}"
source "$tccfgdir/$i"; do
MENU_OPTIONS+="$_toolchainname#$_description#"; if [ ! "$i" == "native" ]
counter; then
fi; source "$tccfgdir/$i"
done; MENU_OPTIONS+="$_toolchainname#$_description#"
fi; counter
MENU_OPTIONS+="EXIT#$txt_menu_builder1#"; fi
counter; done
fi
MENU_OPTIONS+="EXIT#$txt_menu_builder1#"
counter
out=$( out=$(
"$gui" "$st_" "$nc_" "$bt_" "$title_" --title "-[ $txt_remove_menu ]-" --menu "$txt_main_revision$(REVISION)" "${COUNT+8}" 75 0 ${MENU_OPTIONS}); "$gui" "$st_" "$nc_" "$bt_" "$title_" --title "-[ $txt_remove_menu ]-" --menu "$txt_main_revision$(REVISION)" "${COUNT+8}" 75 0 ${MENU_OPTIONS})
IFS=$OIFS; IFS=$OIFS
first=$(echo "$out" | awk '{printf $1}'); first=$(echo "$out" | awk '{printf $1}')
case $first in case $first in
EXIT) EXIT)
bye;; bye;;
BACK) BACK)
_toolchain_main_menu;; _toolchain_main_menu;;
*) *)
[ -d "$tcdir/$first" ] && rm -rf "$tcdir/$first"; [ -d "$tcdir/$first" ] && rm -rf "$tcdir/$first"
_toolchain_main_menu;; _toolchain_main_menu;;
esac; esac
}; }
_toolchain_gui_install(){ _toolchain_gui_install(){
[ -d "$tcdir/$first" ] && rm -rf "$tcdir/$first" && echo "$txt_delete $tcdir/$first"; [ -d "$tcdir/$first" ] && rm -rf "$tcdir/$first" && printf "$txt_delete $tcdir/$first"
mkdir "$tcdir/$first"; mkdir "$tcdir/$first"
cd "$tcdir/$first"; cd "$tcdir/$first"
source "$tccfgdir/$first"; source "$tccfgdir/$first"
tcname="$(decode "$_t1e$_toolchainfilename")"; tcname="$(decode "$_t1e$_toolchainfilename")"
stcname="$(decode "$_toolchainfilename")"; stcname="$(decode "$_toolchainfilename")"
if [ -f "$dldir/$tcname" ];then
(xz -d "$dldir/$tcname" -c| tar -xv) |"$gui" "$st_" --title " -[ $txt_extracting ]- " "$pb_" 20 74; if [ -f "$dldir/$tcname" ]
then
(xz -d "$dldir/$tcname" -c| tar -xv) |"$gui" "$st_" --title " -[ $txt_extracting ]- " "$pb_" 20 74
else else
cd "$dldir"; cd "$dldir"
wget "$(decode "$_u1e")/$tcname" 2>&1 | stdbuf -o0 awk '/[.] +[0-9][0-9]?[0-9]?%/ { print substr($0,63,3) }' | "$gui" "$st_" "$bt_" "$title_" --title " -[ download ]- " --gauge " $txt_loading $stcname $txt_wait" 6 74; wget "$(decode "$_u1e")/$tcname" 2>&1 | stdbuf -o0 awk '/[.] +[0-9][0-9]?[0-9]?%/ { print substr($0,63,3) }' | "$gui" "$st_" "$bt_" "$title_" --title " -[ download ]- " --gauge " $txt_loading $stcname $txt_wait" 6 74
cd "$tcdir/$first"; cd "$tcdir/$first"
(xz -d "$dldir/$tcname" -c |tar -xv) |"$gui" "$st_" --title " -[ $txt_extracting ]- " "$pb_" 20 74; (xz -d "$dldir/$tcname" -c |tar -xv) |"$gui" "$st_" --title " -[ $txt_extracting ]- " "$pb_" 20 74
fi; fi
}; }

13
support/functions/_uploadcam

@ -24,26 +24,26 @@ upload_cam(){
#output date from cam #output date from cam
if [ -f "$bdir/$buildcamname" ] if [ -f "$bdir/$buildcamname" ]
then then
printf "$w_l CAMNAME : $y_l$buildcamname" printf "$w_l CAMNAME : $y_l$buildcamname\n"
printf "$w_l FILEDATE: "$( printf "$w_l FILEDATE: "$(
stat -c %y "$bdir/$buildcamname" |awk '{print $1" "; printf substr($2,1,8)}' stat -c %y "$bdir/$buildcamname" |awk '{print $1" "; printf substr($2,1,8)}'
) )
printf "$w_l" printf "$w_l"
else else
printf "\n matching \$CAM not found in $bdir$re_" printf "\n matching \$CAM not found in $bdir$re_\n"
exit exit
fi fi
printf "$p_l\n $txt_LOAD > $w_l$txt_to IP:$b_l$ip$w_l port:$b_l$port" printf "$p_l\n UPLOAD > $w_l$txt_to IP:$b_l$ip$w_l port:$b_l$port\n"
sshpass -p "$password" scp -P "$port" "$bdir/$buildcamname" "$loginname@$ip":/tmp sshpass -p "$password" scp -P "$port" "$bdir/$buildcamname" "$loginname@$ip":/tmp
#replace target cam #replace target cam
if [ "$replace_target" == "y" ] if [ "$replace_target" == "y" ]
then then
printf "$p_l REPLACE > $y_l$targetcam$re_" printf "$p_l REPLACE > $y_l$targetcam$re_\n"
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;"
printf "$g_l$txt_done!$re_" printf " $g_l$txt_done!$re_\n"
fi fi
#stop target cam #stop target cam
@ -55,8 +55,9 @@ upload_cam(){
#remote command (example restart cam) #remote command (example restart cam)
if [ ! "$remote_command" == "none" ] if [ ! "$remote_command" == "none" ]
then then
printf "$w_l SSH COMMANDS $remote_command $y_l$txt_wait" printf "$w_l SSH COMMANDS $remote_command $y_l$txt_wait\n\n"
# 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;"
_nl
fi fi
} }

Loading…
Cancel
Save