#!/usr/bin/env bash #shellcheck disable=SC2155,SC2034 #shellcheck source=/dev/null # /usr/share/bigbashview/bcc/apps/big-store/config.sh.htm # Description: Big Store installing programs for BigLinux # # Created: 2022/11/01 # Altered: 2024/08/09 # # Copyright (c) 2023-2024, Vilmar Catafesta # 2022-2023, Bruno Gonçalves # 2022-2023, Rafael Ruscher # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. APP="${0##*/}" _VERSION_="1.0.0-20240809" LIBRARY=${LIBRARY:-'/usr/share/bigbashview/bcc/shell'} [[ -f "${LIBRARY}/bcclib.sh" ]] && source "${LIBRARY}/bcclib.sh" [[ -f "${LIBRARY}/tinilib.sh" ]] && source "${LIBRARY}/tinilib.sh" [[ -f "${LIBRARY}/bstrlib.sh" ]] && source "${LIBRARY}/bstrlib.sh" function sh_config_sh_htm_config { #Translation export TEXTDOMAINDIR="/usr/share/locale" export TEXTDOMAIN=big-store # declare -g Pacotes_text=$"Pacotes" declare -g Pacotes_text=$"Geral" declare -g Pacotes_flatpak_text=$"Pacotes Flatpak" declare -g Pacotes_Snap_text=$"Pacotes Snap" declare -g Traducao_Online_text=$"Tradução online da descrição dos pacotes" declare -g Ativar_XIVA_Store="XIVA Store" declare -g Ativado_text=$"Ativado" declare -g Desativado_text=$"Desativado" declare -g Atualizacoes_text=$"Atualizações" declare -g Atualizar_sistema_text=$"Atualizar seu sistema" declare -g Atualizar_text=$"Atualizar" declare -g Atualizado_text=$"Atualizado em" declare -g Repositorios_nativos=$"Repositórios nativos" declare -g Atualizar_cache_dos_repositorios_nativos=$"Atualizar cache dos repositórios nativos" declare -g Atualizar_cache_do_pamac=$"Atualizar cache do Pamac" declare -g Procurar_servidor_mais_rapido_text=$"Procurar servidor de repositórios nativos mais rápidos" declare -g Utilize_as_opcoes_a_seguir_com_Cautela_text=$"Utilize as opções a seguir com cautela" declare -g Reinstalar_text=$"Reinstalação" declare -g Reinstalar_forcado_text=$"Forçar reinstalação de todos os pacotes instalados" declare -g Reinstalar_chaves=$"Atualizar as chaves dos repositórios BigLinux, Manjaro e Archlinux. Lembre que se você ativou repositórios complementares será necessário adicionar as chaves desses repositórios novamente." declare -g Executar_text=$"Executar" declare -g Forcar_atualizacao_text=$"Forçar atualizações, utilize essa opção se não estiver conseguindo atualizar o sistema, porém, na atualização forçada alguns programas podem ser removidos." declare -g Configuracoes=$"Configurações" declare -g MsgSnap=$"Para o Snap aparecer no menu do sistema finalize essa instância do Big-Store e inicie novamente." declare -g MsgFlatpak=$"Para o Flatpak aparecer no menu do sistema finalize essa instância do Big-Store e inicie novamente." declare -g Ao_instalar_pacotes_verificar_se_ha_atualizacoes=$"Ao instalar pacotes, verificar se há atualizações:" declare -g tmp_file_upgradeable="${TMP_FOLDER}/upgradeable.txt" declare -g traducao_tooltipped=$"Ativar tradução online automática das descrições dos pacotes.
Obs: A tradução online pode aumentar a latência na busca dos pacotes." } function sh_config_sh_htm_style { cat <<-EOF EOF } function sh_config_sh_htm_main { local SimpleInstall local statusSimpleInstall sh_config_sh_htm_style source header.sh.htm ######################################################################################################################################################################################################## if [[ "$pkg_flatpak" = "y" ]]; then pkg_name='libpamac-flatpak-plugin' if ! sh_package_is_installed "$pkg_name"; then sh_run_pamac_installer "$pkg_name" 'flatpak' fi TIni.Set "$INI_FILE_BIG_STORE" "flatpak" "flatpak_active" '1' [[ ! -e "$flatpak_cache_file" ]] || [[ "$(find "$flatpak_cache_file" -mtime +1 -print)" ]] && sh_run_action_standalone "sh_update_cache_flatpak" & kdialog --title $"Big-Store" --msgbox "$MsgFlatpak\n\n$(flatpak --version)\n$(flatpak remotes)" & pacman -Qu | cut -f1 -d" " >>"$tmp_file_upgradeable" wait elif [[ "$pkg_flatpak" = "n" ]]; then TIni.Set "$INI_FILE_BIG_STORE" "flatpak" "flatpak_active" '0' pacman -Qu | cut -f1 -d" " >>"$tmp_file_upgradeable" fi ######################################################################################################################################################################################################## if [[ "$pkg_snap" = "y" ]]; then pkg_name='libpamac-snap-plugin' if ! sh_package_is_installed "$pkg_name"; then sh_run_pamac_installer "$pkg_name" 'apparmor' 'snapd' fi sh_run_action_standalone "sh_enable_snapd_and_apparmor" TIni.Set "$INI_FILE_BIG_STORE" "snap" "snap_active" '1' [[ ! -e "$snap_cache_file" ]] || [[ "$(find "$snap_cache_file" -mtime +1 -print)" ]] && sh_run_action_standalone "sh_update_cache_snap" & kdialog \ --title $"Big-Store" \ --msgbox "$MsgSnap \nAVISO: Caso observe o erro (code=exited, status=42) no snapd, isso é esperado quando nenhum snap é/está instalado. O snapd desliga em tais cenários. \n$(systemctl status snapd --lines=0) $(systemctl status apparmor --lines=0) $(systemctl status snapd.apparmor --lines=0)" & pacman -Qu | cut -f1 -d" " >>"$tmp_file_upgradeable" wait elif [[ "$pkg_snap" = "n" ]]; then TIni.Set "$INI_FILE_BIG_STORE" "snap" "snap_active" '0' pacman -Qu | cut -f1 -d" " >>"$tmp_file_upgradeable" fi ######################################################################################################################################################################################################## # Verifica se a variável update_SimpleInstall está definida e não é vazia # ou se é igual a '0' ou '1' if [[ -n "$update_SimpleInstall" && ( "$update_SimpleInstall" = '0' || "$update_SimpleInstall" = '1' ) ]]; then # Obtém o status atual da variável SimpleInstall em /etc/pamac.conf statusSimpleInstall="$(sh_check_status_simple_install)" # Compara o status atual com o valor de atualização if [[ "$statusSimpleInstall" != "$update_SimpleInstall" ]]; then # Se o status atual é diferente do valor de atualização, tenta executar sh_toggle_comment_pamac_conf com pkexec # Se a execução for bem-sucedida, atualiza o valor no arquivo INI if sh_pkexec_which_result sh_toggle_comment_pamac_conf "$update_SimpleInstall" SimpleInstall /etc/pamac.conf; then TIni.Set "$INI_FILE_BIG_STORE" "PAMAC" "SimpleInstall" "$update_SimpleInstall" fi # Se o status atual é igual ao valor de atualização, apenas atualiza o valor no arquivo INI elif [[ "$statusSimpleInstall" = "$update_SimpleInstall" ]]; then TIni.Set "$INI_FILE_BIG_STORE" "PAMAC" "SimpleInstall" "$update_SimpleInstall" # Se o status atual é igual a 2 (o que pode indicar que não há entrada no arquivo /etc/pamac.conf # ou outro erro), define o valor no arquivo INI como '1' que o default e ativado. elif [[ "$statusSimpleInstall" -eq 2 ]]; then TIni.Set "$INI_FILE_BIG_STORE" "PAMAC" "SimpleInstall" '1' fi fi ######################################################################################################################################################################################################## function sh_update_pacman() { local script_name1="${0##*/}[${FUNCNAME[0]}:${BASH_LINENO[0]}]" echo "${cyan}$script_name1 - $(gettext "Sincronizando a base de dados de pacotes")" paru -Syy echo echo "${cyan}$script_name1 - $(gettext "Sincronizando a base de dados de arquivos")" paru -Fyy return $? } export -f sh_update_pacman [[ "$update_pacman" = "y" ]] && { # sh_run_action "update_pacman" "$WINDOW_ID" "$PACKAGE_NAME" "$PACKAGE_ID" "$REPOSITORY" "$DRIVER" if sh_run_action_standalone "sh_update_pacman"; then TIni.Set "$INI_FILE_BIG_STORE" "nativo" "nativo_atualizado" '1' TIni.Set "$INI_FILE_BIG_STORE" "nativo" "nativo_data_atualizacao" "$(date "+%d/%m/%y %H:%M")" fi } [[ "$update_pamac" = "y" ]] && sh_run_action "update_pamac" "$WINDOW_ID" "$PACKAGE_NAME" "$PACKAGE_ID" "$REPOSITORY" "$DRIVER" [[ "$update_mirror" = "y" ]] && sh_run_action "update_mirror" "$WINDOW_ID" "$PACKAGE_NAME" "$PACKAGE_ID" "$REPOSITORY" "$DRIVER" [[ "$update_keys" = "y" ]] && sh_run_action "update_keys" "$WINDOW_ID" "$PACKAGE_NAME" "$PACKAGE_ID" "$REPOSITORY" "$DRIVER" [[ "$force_upgrade" = "y" ]] && sh_run_action "force_upgrade" "$WINDOW_ID" "$PACKAGE_NAME" "$PACKAGE_ID" "$REPOSITORY" "$DRIVER" [[ "$reinstall_allpkg" = "y" ]] && sh_run_action "reinstall_allpkg" "$WINDOW_ID" "$PACKAGE_NAME" "$PACKAGE_ID" "$REPOSITORY" "$DRIVER" [[ "$system_upgrade" = "y" ]] && sh_run_action "system_upgrade" "$WINDOW_ID" "$PACKAGE_NAME" "$PACKAGE_ID" "$REPOSITORY" "$DRIVER" [[ "$system_upgradetotal" = "y" ]] && sh_run_action "system_upgradetotal" "$WINDOW_ID" "$PACKAGE_NAME" "$PACKAGE_ID" "$REPOSITORY" "$DRIVER" [[ "$update_flatpak" = "y" ]] && sh_run_action_standalone "sh_update_cache_flatpak" [[ "$update_snap" = "y" ]] && sh_run_action_standalone "sh_update_cache_snap" [[ "$update_traducao" = "y" ]] && TIni.Set "$INI_FILE_BIG_STORE" "bigstore" "traducao_online" '1' [[ "$update_traducao" = "n" ]] && TIni.Set "$INI_FILE_BIG_STORE" "bigstore" "traducao_online" '0' [[ "$update_xiva" = "y" ]] && TIni.Set "$INI_FILE_BIG_STORE" "XIVA" "xiva_active" '1' [[ "$update_xiva" = "n" ]] && TIni.Set "$INI_FILE_BIG_STORE" "XIVA" "xiva_active" '0' ################################################################################################################################################################################################################################### cat <<-EOF
$Configuracoes
$Pacotes_text
    EOF #FLATPAK cat <<-EOF
  • $Pacotes_flatpak_text
    EOF if TIni.Exist "$INI_FILE_BIG_STORE" "flatpak" "flatpak_active" '1' && [[ -e "/usr/lib/libpamac-flatpak.so" ]]; then local _circle='true' local _checked='checked' local _handle='n' local _text=$Ativado_text else local _circle='false' local _checked='' local _handle='y' local _text=$Desativado_text fi cat <<-EOF $Ativado_text
  • EOF #FLATPAK END #SNAP BEGIN cat <<-EOF
  • $Pacotes_Snap_text
    EOF if TIni.Exist "$INI_FILE_BIG_STORE" "snap" "snap_active" '1' && [[ -e "/usr/lib/libpamac-snap.so" ]]; then local _circle='true' local _checked='checked' local _handle='n' local _text=$Ativado_text else local _circle='false' local _checked='' local _handle='y' local _text=$Desativado_text fi cat <<-EOF $_text
  • EOF #SNAP #TRADUCAO BEGIN cat <<-EOF
  • $Traducao_online_text $Traducao_Online_text
    EOF if TIni.Exist "$INI_FILE_BIG_STORE" "bigstore" "traducao_online" '1'; then local _circle='true' local _checked='checked' local _handle='n' local _text=$Ativado_text else local _circle='false' local _checked='' local _handle='y' local _text=$Desativado_text fi cat <<-EOF $_text
  • EOF #TRADUCAO END #PAMAC UPDATE BEGIN cat <<-EOF
  • $Ao_instalar_pacotes_verificar_se_ha_atualizacoes $Ao_instalar_pacotes_verificar_se_ha_atualizacoes
    EOF if TIni.Exist "$INI_FILE_BIG_STORE" "PAMAC" "SimpleInstall" '1'; then local _circle='true' local _checked='checked' local _handle='0' local _text=$Ativado_text else local _circle='false' local _checked='' local _handle='1' local _text=$Desativado_text fi cat <<-EOF $_text
  • EOF #PAMAC UPDATE END #XIVA BEGIN cat <<-EOF
  • $Ativar_XIVA_Store $Ativar_XIVA_Store
    EOF if TIni.Exist "$INI_FILE_BIG_STORE" "XIVA" "xiva_active" '1'; then local _circle='true' local _checked='checked' local _handle='n' local _text=$Ativado_text else local _circle='false' local _checked='' local _handle='y' local _text=$Desativado_text fi cat <<-EOF $_text
  • EOF #XIVA END cat <<-EOF
EOF ################################################################################################################################################################################################################################### cat <<-EOF
$Repositorios_nativos
  • $Atualizar_cache_dos_repositorios_nativos
    EOF if TIni.Exist "$INI_FILE_BIG_STORE" "nativo" "nativo_atualizado" '1'; then local nativo_data_atualizacao=$(TIni.Get "$INI_FILE_BIG_STORE" "nativo" "nativo_data_atualizacao") local _circle='true' local _checked='checked' local _handle='n' local _text="$Atualizado_text $nativo_data_atualizacao" else local _circle='false' local _checked='' local _handle='y' local _text=$Atualizar_text fi cat <<-EOF $_text
  • EOF cat <<-EOF
  • $Atualizar_cache_do_pamac
    EOF if TIni.Exist "$INI_FILE_BIG_STORE" "PAMAC" "pamac_atualizado" '1'; then local pamac_data_atualizacao=$(TIni.Get "$INI_FILE_BIG_STORE" "PAMAC" "pamac_data_atualizacao") local _circle='true' local _checked='checked' local _handle='n' local _text="$Atualizado_text $pamac_data_atualizacao" else local _circle='false' local _checked='' local _handle='y' local _text=$Atualizar_text fi cat <<-EOF $_text
  • EOF cat <<-EOF
  • $Procurar_servidor_mais_rapido_text
EOF ################################################################################################################################################################################################################################### if TIni.Exist "$INI_FILE_BIG_STORE" "flatpak" "flatpak_active" '1' && [[ -e "/usr/lib/libpamac-flatpak.so" ]]; then cat <<-EOF
$(gettext "Repositório Flatpak")
EOF #BEGIN-Reconstruir base de dados Flatpak if TIni.Exist "$INI_FILE_BIG_STORE" "flatpak" "flatpak_atualizado" '1'; then local flatpak_data_atualizacao=$(TIni.Get "$INI_FILE_BIG_STORE" "flatpak" "flatpak_data_atualizacao") local _circle='true' local _checked='checked' local _handle='n' local _text="$Atualizado_text $flatpak_data_atualizacao" else local _circle='false' local _checked='unchecked' local _handle='y' local _text=$Atualizar_text fi cat <<-EOF
  • $(gettext "Reconstruir base de dados Flatpak")
    $_text
EOF #END-Reconstruir base de dados Flatpak cat <<-EOF
  • $(gettext "Outro procedimento com Flatpak")
    $_text
EOF #END-Reconstruir base de dados Flatpak cat <<-EOF
EOF fi ################################################################################################################################################################################################################################### if TIni.Exist "$INI_FILE_BIG_STORE" "snap" "snap_active" '1' && [[ -e "/usr/lib/libpamac-snap.so" ]]; then cat <<-EOF
$(gettext "Repositório Snap")
  • $(gettext "Reconstruir base de dados Snap")
    EOF if TIni.Exist "$INI_FILE_BIG_STORE" "snap" "snap_atualizado" '1'; then local snap_data_atualizacao=$(TIni.Get "$INI_FILE_BIG_STORE" "snap" "snap_data_atualizacao") local _circle='true' local _checked='checked' local _handle='n' local _text="$Atualizado_text $snap_data_atualizacao" else local _circle='false' local _checked='unchecked' local _handle='y' local _text=$Atualizar_text fi cat <<-EOF $_text
EOF fi ################################################################################################################################################################################################################################### cat <<-EOF
$Utilize_as_opcoes_a_seguir_com_Cautela_text
  • $Reinstalar_forcado_text
    $Reinstalar_text
  • $Reinstalar_chaves
  • $Forcar_atualizacao_text


EOF } #sh_debug sh_config_sh_htm_config sh_config_sh_htm_main