Browse Source

update _profiles

pull/16/head
gorgone 5 years ago
parent
commit
9ba4797a0c
  1. 178
      support/functions/_profiles

178
support/functions/_profiles

@ -6,89 +6,114 @@ profiles(){
} }
_list_profiles(){ _list_profiles(){
cd "$profdir"; cd "$profdir"
profiles=(*.profile); profiles=(*.profile)
if [ ${#profiles[@]} -gt 0 ];then if [ ${#profiles[@]} -gt 0 ]
echo -e "$c_l"; then
clear; printf "$c_l"
slogo; clear
echo -e "$y_l\n $txt_profiles $txt_found $txt_for ( ./$(basename "$0") \"tcname\" -p=name.profile )"; slogo
echo -e "$w_l ======================================================\n";i=0; printf "$y_l\n $txt_profiles $txt_found $txt_for ( ./$(basename "$0") \"tcname\" -p=name.profile )\n"
for e in "${profiles[@]}";do echo -e "$w_l ======================================================\n"
((i++)); i=0
echo -e "$w_l ($i) > $e"; for e in "${profiles[@]}"
done; do
fi; ((i++))
echo -e "\n$rs_"; printf "$w_l ($i) > $e\n"
}; done
fi
printf "\n$rs_"
}
_save_profile(){ _save_profile(){
if [ -f "$menudir/$_toolchainname.save" ];then if [ -f "$menudir/$_toolchainname.save" ]
source "$menudir/$_toolchainname.save"; then
input=$("$gui" "$st_" "$bt_" "$title_" --title " -[ $1 Toolchain ]- " $ip_ "\n SAVE PROFILE\n" 0 0 "$_toolchainname"); source "$menudir/$_toolchainname.save"
echo $enabled $usevars | sed -e 's/CARDREADER_//g;s/READER_//g;s/MODULE_//g;s/HAVE_//g;s/WEBIF_//g;s/WITH_//g;s/CS_//g;s/_CHARSETS//g;s/CW_CYCLE_CHECK/CWCC/g;s/SUPPORT//g;' >"$profdir/$input.profile"; input=$("$gui" "$st_" "$bt_" "$title_" --title " -[ $1 Toolchain ]- " $ip_ "\n SAVE PROFILE\n" 0 0 "$_toolchainname")
fi; printf $enabled $usevars | sed -e 's/CARDREADER_//g;s/READER_//g;s/MODULE_//g;s/HAVE_//g;s/WEBIF_//g;s/WITH_//g;s/CS_//g;s/_CHARSETS//g;s/CW_CYCLE_CHECK/CWCC/g;s/SUPPORT//g;' >"$profdir/$input.profile"
}; fi
}
_load_profile(){ _load_profile(){
if [ "$(ls -A "$profdir")" ];then if [ "$(ls -A "$profdir")" ]
ok=0; then
loadprofile="no"; ok=0
loadprofile="no"
USESTRING=; USESTRING=;
_create_module_arrays; _create_module_arrays
unset selection; unset selection
declare -a SELECTION; declare -a SELECTION
cd "$profdir"; cd "$profdir"
p_files=(*.profile); p_files=(*.profile)
i=0; i=0
for e in "${p_files[@]}";do
((i++));SELECTION+=($e '<'); for e in "${p_files[@]}"
done; do
pselect=$("$gui" "$st_" "$bt_" "$title_" --no-cancel --title " -[ $txt_select_profile_title ]- " --menu "\n $txt_select_profile\n\n" 0 0 "$i" "${SELECTION[@]}"); ((i++))
[ $? = 255 ] && loadprofile="yes" && _toolchain_build_menu; SELECTION+=($e '<')
"$gui" "$st_" "$bt_" "$title_" --yesno "\n$txt_confirm_profile_select\n\n$pselect\n\n" 0 0; done
response=$?;
pselect=$("$gui" "$st_" "$bt_" "$title_" --no-cancel --title " -[ $txt_select_profile_title ]- " --menu "\n $txt_select_profile\n\n" 0 0 "$i" "${SELECTION[@]}")
[ $? = 255 ] && loadprofile="yes" && _toolchain_build_menu
"$gui" "$st_" "$bt_" "$title_" --yesno "\n$txt_confirm_profile_select\n\n$pselect\n\n" 0 0
response=$?
case "$response" in case "$response" in
1) 1)
loadprofile="yes"; loadprofile="yes"
_toolchain_build_menu;; _toolchain_build_menu;;
255) 255)
loadprofile="yes"; loadprofile="yes"
_toolchain_build_menu;; _toolchain_build_menu;;
esac; esac
if [ -f "$profdir/$pselect" ];then
profile_vars=$(cat "$profdir/$pselect";); if [ -f "$profdir/$pselect" ]
reset_="$("$svndir/config.sh" -D all)"; then
for e in "${!USE_vars[@]}";do profile_vars=$(cat "$profdir/$pselect";)
reset_="$("$svndir/config.sh" -D all)"
for e in "${!USE_vars[@]}"
do
USE_vars[$e]=; USE_vars[$e]=;
done; done
for e1 in $profile_vars;do
for e2 in "${!USE_vars[@]}";do for e1 in $profile_vars
[ "$e1" == "$e2" ] && USE_vars[$e1]="$e1=1"; do
done; for e2 in "${!USE_vars[@]}"
for sm in "${SHORT_MODULENAMES[@]}";do do
if [ "$e1" == "$sm" ];then [ "$e1" == "$e2" ] && USE_vars[$e1]="$e1=1"
_em_="$_em_ $(get_module_name "$sm")"; done
fi; for sm in "${SHORT_MODULENAMES[@]}"
done; do
done; if [ "$e1" == "$sm" ]
_set_=$("$svndir/config.sh" -E $_em_); then
USESTRING="$(echo "${USE_vars[@]}"| sed 's@USE_@@g' | sed 's@=1@@g'| tr -s ' ')"; _em_="$_em_ $(get_module_name "$sm")"
loadprofile="yes"; fi
fi; done
done
_set_=$("$svndir/config.sh" -E $_em_)
USESTRING="$(echo "${USE_vars[@]}"| sed 's@USE_@@g' | sed 's@=1@@g'| tr -s ' ')"
loadprofile="yes"
fi
else else
$gui --msgbox "\n$txt_no_profile_found \n " 0 0; $gui --msgbox "\n$txt_no_profile_found \n " 0 0
fi; fi
loadprofile="no"; loadprofile="no"
}; }
_create_native_profile(){ _create_native_profile(){
[ ! -d "$tcdir/native/bin" ] && mkdir -p "$tcdir/native/bin";
cd "$tcdir/native/bin"; [ ! -d "$tcdir/native/bin" ] && mkdir -p "$tcdir/native/bin"
g="$(which gcc)"; cd "$tcdir/native/bin"
stripvar="$(which strip)"; g="$(which gcc)"
compiler_link="$($g -dumpmachine)-gcc"; stripvar="$(which strip)"
strip_link="$($g -dumpmachine)-strip"; strip_link="$($g -dumpmachine)-strip"
[ ! -L "$compiler_link" ] && ln -sf "$g" "$compiler_link"; compiler_link="$($g -dumpmachine)-gcc"
[ ! -L "$strip_link" ] && ln -sf "$stripvar" "$strip_link"; [ -L "$compiler_link" ] || ln -sf "$g" "$compiler_link"
cd "$tccfgdir"; [ -L "$strip_link" ] || ln -sf "$stripvar" "$strip_link"
cd "$tccfgdir"
cat << EOF > native cat << EOF > native
_toolchainname="native"; _toolchainname="native";
default_use="USE_UTF8 USE_LIBCRYPTO"; default_use="USE_UTF8 USE_LIBCRYPTO";
@ -101,5 +126,6 @@ _libsearchdir="/lib";
_menuname="native"; _menuname="native";
_sysroot="/usr/include"; _sysroot="/usr/include";
EOF EOF
cd "$workdir"; cd "$workdir"
};
}

Loading…
Cancel
Save