You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
140 lines
3.2 KiB
140 lines
3.2 KiB
#!/bin/bash
|
|
|
|
profiles(){
|
|
_list_profiles
|
|
exit
|
|
}
|
|
|
|
_list_profiles(){
|
|
cd "$profdir"
|
|
profiles=(*.profile)
|
|
if [ ${#profiles[@]} -gt 0 ]
|
|
then
|
|
printf "$c_l"
|
|
clear
|
|
slogo
|
|
printf "$y_l\n $txt_profiles $txt_found $txt_for ( ./$(basename "$0") \"tcname\" -p=name.profile )\n"
|
|
echo -e "$w_l ======================================================\n"
|
|
i=0
|
|
for e in "${profiles[@]}"
|
|
do
|
|
((i++))
|
|
printf "$w_l ($i) > $e\n"
|
|
done
|
|
fi
|
|
printf "\n$rs_"
|
|
}
|
|
|
|
_save_profile(){
|
|
if [ -f "$menudir/$_toolchainname.save" ]
|
|
then
|
|
source "$menudir/$_toolchainname.save"
|
|
input=$("$gui" "$st_" "$bt_" "$title_" --title " -[ $1 Toolchain ]- " $ip_ "\n SAVE PROFILE\n" 0 0 "$_toolchainname")
|
|
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"
|
|
fi
|
|
}
|
|
|
|
_load_profile(){
|
|
if [ "$(ls -A "$profdir")" ]
|
|
then
|
|
ok=0
|
|
loadprofile="no"
|
|
USESTRING=;
|
|
_create_module_arrays
|
|
unset selection
|
|
declare -a SELECTION
|
|
cd "$profdir"
|
|
p_files=(*.profile)
|
|
i=0
|
|
|
|
for e in "${p_files[@]}"
|
|
do
|
|
((i++))
|
|
SELECTION+=($e '<')
|
|
done
|
|
|
|
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
|
|
1)
|
|
loadprofile="yes"
|
|
_toolchain_build_menu;;
|
|
255)
|
|
loadprofile="yes"
|
|
_toolchain_build_menu;;
|
|
esac
|
|
|
|
if [ -f "$profdir/$pselect" ]
|
|
then
|
|
profile_vars=$(cat "$profdir/$pselect";)
|
|
reset_="$("$svndir/config.sh" -D all)"
|
|
|
|
for e in "${!USE_vars[@]}"
|
|
do
|
|
USE_vars[$e]=;
|
|
done
|
|
|
|
for e1 in $profile_vars
|
|
do
|
|
for e2 in "${!USE_vars[@]}"
|
|
do
|
|
[ "$e1" == "$e2" ] && USE_vars[$e1]="$e1=1"
|
|
done
|
|
for sm in "${SHORT_MODULENAMES[@]}"
|
|
do
|
|
if [ "$e1" == "$sm" ]
|
|
then
|
|
_em_="$_em_ $(get_module_name "$sm")"
|
|
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
|
|
$gui --msgbox "\n$txt_no_profile_found \n " 0 0
|
|
fi
|
|
loadprofile="no"
|
|
}
|
|
|
|
_create_native_profile(){
|
|
|
|
[ ! -d "$tcdir/native/bin" ] && mkdir -p "$tcdir/native/bin"
|
|
cd "$tcdir/native/bin"
|
|
g="$(type -pf gcc)"
|
|
gpp="$(type -pf g++)"
|
|
stripvar="$(type -pf strip)"
|
|
if [ -f $g ]; then
|
|
compiler_link="$($g -dumpmachine)-gcc"
|
|
[ -L "$compiler_link" ] || ln -sf "$g" "$compiler_link"
|
|
fi
|
|
if [ -f $gpp ]; then
|
|
gpp_link="$($g -dumpmachine)-g++"
|
|
[ -L "$gpp_link" ] || ln -sf "$gpp" "$gpp_link"
|
|
fi
|
|
if [ -f $stripvar ]; then
|
|
strip_link="$($g -dumpmachine)-strip"
|
|
[ -L "$strip_link" ] || ln -sf "$stripvar" "$strip_link"
|
|
fi
|
|
cd "$tccfgdir"
|
|
|
|
cat << EOF > native
|
|
_toolchainname="native";
|
|
default_use="USE_UTF8 USE_LIBCRYPTO";
|
|
_oscamconfdir_default="/usr/local/etc";
|
|
_oscamconfdir_custom="not_set";
|
|
_compiler="$($g -dumpmachine)-";
|
|
_tc_info="Native System Compiler \
|
|
$(gcc --version)";
|
|
_libsearchdir="/lib";
|
|
_menuname="native";
|
|
_sysroot="/usr/include";
|
|
EOF
|
|
cd "$workdir"
|
|
|
|
}
|
|
|