commit def71ab3399ca2cbcccc682535044b5cce049422 Author: luisgulo Date: Fri Jun 2 17:12:19 2023 +0200 Subida a Gitea diff --git a/.directory b/.directory new file mode 100644 index 0000000..06dab1c --- /dev/null +++ b/.directory @@ -0,0 +1,2 @@ +[Desktop Entry] +Icon=./.icon.png diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..06e26c5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,17 @@ +#---- Gambas files to ignore (v5) +*.gambas +.lock +*~ +core +core.* +vgcore +vgcore.* +.kdbg* +.*.prof +.lang/*.pot +.gambas/* +.settings +.startup +.list +.info +#---- diff --git a/.hidden/CHANGELOG b/.hidden/CHANGELOG new file mode 100644 index 0000000..8ce67ed --- /dev/null +++ b/.hidden/CHANGELOG @@ -0,0 +1,16 @@ +* Sun Aug 15 2021 luisgulo 1.0.10 +- Se muestra version exacta de Debian que se actualiza + +* Fri May 01 2020 luisgulo 1.0.9 +- Correccion mensaje y tiempo del aviso de ficheros a actualizar + +* Fri May 01 2020 luisgulo 1.0.8 +- Se avisa de numero de paquetes a actualizar + +* Sat Apr 11 2020 luisgulo 1.0.6 +- Se incluye solucion a subidas de releases en repositorios +- Se ajusta control delproceso en segundo plano y animación + +* Sun Apr 05 2020 luisgulo 1.0.5 +- Lanzamiento inicial + diff --git a/.icon.png b/.icon.png new file mode 100644 index 0000000..11e4a99 Binary files /dev/null and b/.icon.png differ diff --git a/.project b/.project new file mode 100644 index 0000000..028f846 --- /dev/null +++ b/.project @@ -0,0 +1,28 @@ +# Gambas Project File 3.0 +Title=Actualiza +Startup=FMain +Icon=Actualiza-icono.png +Version=1.0.10 +Component=gb.image +Component=gb.gui +Component=gb.form +Description="Actualizador Debian (SoloConLinux)" +Authors="luisgulo@soloconlinux.org.es" +TabSize=2 +Language=es_ES +SourcePath=/home/luisgulo/ProyectosGAMBAS/SOURCEs +Maintainer=luisgulo +Vendor=SoloConLinux +Address=luisgulo@soloconlinux.org.es +Url=https://repositorio.soloconlinux.org.es +License=General Public License +PackageName=actualiza-1.0.10 +CreateEachDirectory=1 +Packager=1 +Systems=debian +Menus=debian:"Applications/System/Administration" +Categories=debian:"System" +Groups=debian:"admin" +ExtraDependencies=debian:"ruby-notify\t\t" +WebSite=https://repositorio.soloconlinux.org.es +CreateMenu=1 diff --git a/.src/FMain.class b/.src/FMain.class new file mode 100644 index 0000000..3e1f144 --- /dev/null +++ b/.src/FMain.class @@ -0,0 +1,146 @@ +' Gambas class file + +Public Clave As String +Public hProceso As Process +Public txtSistema As String + +Public Function Actualiza() + Wait 0.1 + txtAviso.Text = "Actualizando repositorio..." + txtAviso.Refresh + 'Shell "sudo apt-get update" Wait + hProceso = Shell "sudo apt -y update" + Do While hProceso.State = Process.Running + Select Case txtGIRA.Text + Case "|" + txtGIRA.Text = "/" + Case "/" + txtGIRA.Text = "-" + Case "-" + txtGIRA.Text = "\\" + Case "\\" + txtGIRA.Text = "|" + Case Else + txtGIRA.Text = "|" + End Select + Wait 0.1 + Loop + 'Contar cuantos actualiza + Dim Contador As String + Shell "echo -ne $(apt list --upgradable -q 2>/dev/null|grep -i 'actualizable'|wc -l)" To Contador + If Not (Contador = "0") + Shell "notify-send -t 6000 'Se van a actualizar " & Contador & " programas\nEspere a que finalice'" + Endif + + txtAviso.Text = "Actualizando Debian..." + txtAviso.Refresh + hproceso = Shell "sudo apt -y upgrade" + Do While hProceso.State = Process.Running + Select Case txtGIRA.Text + Case "|" + txtGIRA.Text = "/" + Case "/" + txtGIRA.Text = "-" + Case "-" + txtGIRA.Text = "\\" + Case "\\" + txtGIRA.Text = "|" + Case Else + txtGIRA.Text = "|" + End Select + Wait 0.1 + Loop + txtGIRA.Text = "" + txtAviso.Text = "¡SISTEMA ACTUALIZADO!" + txtAviso.Refresh + Shell "notify-send -t 3000 '" & txtSistema & "\nSistema Operativo actualizado'" Wait + Quit +End + +Public Function ActualizaSudo() + Dim Salida As String + Clave = InputBox("Indique clave de root:", "Contraseña") + Shell "echo -ne $(echo '" & Clave & "' | su -l root -s '/bin/sh' -c 'clear;whoami'|tail -1)" To Salida + If Right(Salida, 4) = "root" + Wait 0.1 + txtAviso.Text = "Actualizando repositorio..." + txtAviso.Refresh + 'Shell "echo " & Clave & " | su -l root -c 'apt-get update'" Wait + hProceso = Shell "echo " & Clave & " | su -l root -c 'apt -y update'" + Do While hProceso.State = Process.Running + Select Case txtGIRA.Text + Case "|" + txtGIRA.Text = "/" + Case "/" + txtGIRA.Text = "-" + Case "-" + txtGIRA.Text = "\\" + Case "\\" + txtGIRA.Text = "|" + Case Else + txtGIRA.Text = "|" + End Select + Wait 0.1 + Loop + 'Contar cuantos actualiza + Dim Contador As String + Shell "echo -ne $(apt list --upgradable -q 2>/dev/null|grep -i 'actualizable'|wc -l)" To Contador + If Not (Contador = "0") + Shell "notify-send -t 6000 'Se van a actualizar " & Contador & " programas\nEspere a que finalice'" + Endif + txtAviso.Text = "Actualizando Debian..." + txtAviso.Refresh + Wait 0.1 + 'Shell "echo " & Clave & " | su -l root -c 'apt-get -y upgrade'" Wait + hProceso = Shell "echo " & Clave & " | su -l root -c 'apt -y upgrade'" + Do While hProceso.State = Process.Running + Select Case txtGIRA.Text + Case "|" + txtGIRA.Text = "/" + Case "/" + txtGIRA.Text = "-" + Case "-" + txtGIRA.Text = "\\" + Case "\\" + txtGIRA.Text = "|" + Case Else + txtGIRA.Text = "|" + End Select + Wait 0.1 + Loop + txtGIRA.Text = "" + txtAviso.Text = "¡SISTEMA ACTUALIZADO!" + txtAviso.Refresh + Wait 0.1 + ' Depende del programa: ruby-notify + Shell "notify-send -t 3000 '" & txtSistema & "\nSistema Operativo actualizado'" Wait + Else + Shell "notify-send -t 3000 'La contraseña no es válida\nNo se ha podido actualizar'" Wait + Endif + Quit +End + +Public Sub Form_Open() + System.Shell = "/bin/bash" + Me.x = 10 + Me.Y = 10 + Me.Show + Wait 0.1 + Me.Refresh + Wait 0.1 + ''Shell "lsb_release -d|awk -F 'Linux' '{print $2}'" To txtSistema + Shell "lsb_release -d|awk -F 'Description:\t' '{print $2}'" To txtSistema + ''txtSistema = Upper(txtSistema) + CompruebaRoot() +End + +Public Function CompruebaRoot() + Dim Devuelve As String + Shell "echo -ne $(sudo whoami)" To Devuelve + If Devuelve = "root" + Actualiza() + Else + ActualizaSudo() + Endif +End + diff --git a/.src/FMain.form b/.src/FMain.form new file mode 100644 index 0000000..6c0991a --- /dev/null +++ b/.src/FMain.form @@ -0,0 +1,24 @@ +# Gambas Form File 3.0 + +{ Form Form + MoveScaled(0,0,30,15) + Text = ("Actualizador") + Icon = Picture["Actualiza-icono.png"] + Resizable = False + { picLOGO PictureBox + MoveScaled(1,1,8,8) + Picture = Picture["actualizar_debian.png"] + Stretch = True + } + { txtAviso Label + MoveScaled(1,10,27,4) + Text = ("Actualizando repositorio") & "..." + } + { txtGIRA Label + MoveScaled(20,1,8,8) + Font = Font["Bold,22"] + Foreground = Color.DarkRed + Text = ("|") + Alignment = Align.Center + } +} diff --git a/Actualiza-icono.png b/Actualiza-icono.png new file mode 100644 index 0000000..7315466 Binary files /dev/null and b/Actualiza-icono.png differ diff --git a/README.md b/README.md new file mode 100644 index 0000000..5011cdd --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +# Actualiza +Aplicacion grafica en Gambas para actualizar Debian (y derivados) + +Luisgulo (soloconlinux.org.es) diff --git a/actualizar_debian.png b/actualizar_debian.png new file mode 100755 index 0000000..4ae960c Binary files /dev/null and b/actualizar_debian.png differ