Front para o slackpkg em dialog
Publicado por Slackjeff (última atualização em 17/02/2020)
[ Hits: 1.563 ]
Homepage: https://slackjeff.com.br
Ferramenta escrita em shell/dialog para ser um simples front para o slackpkg, voltado para os novatos. Adicione em /usr/sbin e dê permissão de execução.
#!/bin/bash
#=========================HEADER===========================================|
#
# magiic - Simple front for Slackpkg.
#
# Copyright (C) 2020 Jefferson 'Slackjeff' Rocha
# Jefferson Rocha (aka Slackjeff) root@slackjeff.com.br
#
# LICENSE
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# CHANGELOG
# Please consult changelog.txt
#
#==========================================================================|
#==================== VARS
PRG='magiic'
VERSION='0.2'
#==================== FUNCTIONS
MENU() # Main menu
{
the_menu=$(
dialog \
--stdout \
--title "Menu" \
--backtitle "$PRG Version ${VERSION}." \
--cancel-button "Exit" \
--help-button \
--menu "\nWelcome to $PRG a slackpkg front...\n\nselect what you need to do in the system." \
10 60 0 \
'Mirror' 'List of Mirrors' \
'Check' 'Check for system updates' \
'Update' 'Update the mirror' \
'Clean' 'List all unofficial packages for remove' \
'Search' 'Search for a package' \
'Install' 'Install a new package' \
'Remove' 'Remove a package' \
'Upgrade' 'Upgrade packages'
)
case $? in
1) exit 0 ;;
2) the_menu='Help' ;;
esac
}
MIRROR()
{
local mirrors='/etc/slackpkg/mirrors'
dialog \
--title "$mirrors" \
--editbox "/etc/slackpkg/mirrors" \
0 0 2> ${mirrors}.bkp
[[ $? -eq '0' ]] && { cp ${mirrors}.bkp ${mirrors}; rm ${mirrors}.bkp ;}
}
CHECK() #Check for system updates.
{
dialog \
--title "Checking for a new updates" \
--infobox "Wait...I'll check for updates." \
3 50
if slackpkg check-updates | grep -q "News on ChangeLog.txt"; then
dialog \
--title "News!" \
--msgbox "News on Changelog.txt" \
5 30
else
dialog \
--title "No news!" \
--msgbox "No news is good news" \
5 30
fi
}
UPDATE() # Update mirror
{
slackpkg update
}
CLEAN() # List all unofficial packages for remove.
{
slackpkg clean-system
}
SEARCH() # Search package
{
search=$(
dialog \
--stdout \
--title "Search" \
--inputbox "What package name do you want to look for?\n" \
0 50
)
[[ "$?" -eq '1' ]] && return 0
if [[ -z "$search" ]]; then
dialog \
--title "Ops!" \
--msgbox "\nYou must provide a package name for search." \
6 50
return 1
fi
slackpkg search "$search"
read -p "Press [ENTER] to continue." null
}
INSTALL() # Install package
{
local install_pkg=$(
dialog \
--stdout \
--title "Install" \
--inputbox "What package do you want to install?" \
0 50
)
if [[ -z "$install_pkg" ]]; then
dialog \
--title "Ops!" \
--msgbox "\nYou must provide a package name." \
6 50
return 1
fi
slackpkg install "$install_pkg"
}
REMOVE() # Remove package
{
local remove_pkg=$(
dialog \
--stdout \
--title "Remove" \
--inputbox "What package do you want Remove?" \
0 50
)
if [[ -z "$remove_pkg" ]]; then
dialog \
--title "Ops!" \
--msgbox "\nYou must provide a package name." \
6 50
return 1
fi
slackpkg remove "$remove_pkg"
}
UPGRADE()
{
slackpkg upgrade-all
}
HELP() # Help Button
{
local MSG=$(
cat <<EOF
Welcome to $PRG Help.
- WHAT IS ${PRG}?
It's a dialog front for slackpkg! Not all slackpkg options are available here.
$PRG is only meant to help with some simpler system tasks.
More detailed options available from main menu:
* Mirror
Open a simple dialog editor for you to change the mirrors of your system. Available in /etc/slackpkg/mirrors
* Check
Check for updates available on the system!
* Update
Updates the mirror.
* Clean
lists all unofficial packages that are present in the system. Ideal for cleaning up third party
packages you don't use.
* Search
Search for a package in the official repository.
* Install
Install a new package.
* Remove
Remove a package from your system.
* Upgrade
Upgrade your system.
EOF
)
dialog \
--title "Help" \
--msgbox "$MSG" \
0 0
}
#=================== MAIN
while true ;do
MENU
case $the_menu in
Mirror)
MIRROR
;;
Check)
CHECK
;;
Update)
UPDATE
;;
Clean)
CLEAN
;;
Search)
SEARCH
;;
Install)
INSTALL
;;
Remove)
REMOVE
;;
Upgrade)
UPGRADE
;;
Help)
HELP
;;
esac
done
Trocar wallpaper (papel de parede) do Gnome
Gerar backup do MySQL ou Postgres
Nenhum comentário foi encontrado.
IA Turbina o Desktop Linux enquanto distros renovam forças
Como extrair chaves TOTP 2FA a partir de QRCODE (Google Authenticator)
Linux em 2025: Segurança prática para o usuário
Desktop Linux em alta: novos apps, distros e privacidade marcam o sábado
Atualizando o Fedora 42 para 43
Como saber se o seu e-mail já teve a senha vazada?
Como descobrir se a sua senha já foi vazada na internet?
VOL já não é mais como antes? (5)
É normal não gostar de KDE? (12)
E aí? O Warsaw já está funcionando no Debian 13? [RESOLVIDO] (15)
Secure boot, artigo interessante, nada técnico. (4)
copiar library para diretorio /usr/share/..... su com Falha na a... (1)









