Instalación automatica de actualizaciones de Fopnu

Para instalar automáticamente la última versión de Fopnu cuando esté disponible, puedes crear un script que verifique las actualizaciones e instale la nueva versión si está disponible. Aquí hay un script simple que puedes usar:

  1. Crea un nuevo archivo llamado actualizar_fopnu.sh y ábrelo con un editor de texto:
touch actualizar_fopnu.sh
nano actualizar_fopnu.sh
  1. Agrega el siguiente contenido al archivo:
#!/bin/bash

# Obtén el número de última versión del sitio web de Fopnu
ultima_version=$(curl -s https://www.fopnu.com/download/linux.html | grep -oP 'Descargar Fopnu v\\K[0-9.]+')

# Obtén la versión actualmente instalada
version_instalada=$(fopnu --version 2>&1 | grep -oP 'Fopnu v\\K[0-9.]+') 

# Compara las versiones y actualiza si es necesario
if [[ $latest_version != $installed_version ]]; then
  echo "Actualizando Fopnu de la versión $installed_version a $latest_version"
  wget -q "https://download2.fopnu.com/download/fopnu-${latest_version}-1.x86_64.manualinstall.tar.gz"
  
  tar -xzf "fopnu-${latest_version}-1.x86_64.manualinstall.tar.gz"

  # Paso 1: Copia el ejecutable binario "fopnu" a /usr/bin
  sudo mv "fopnu-${latest_version}-1.x86_64.manualinstall/fopnu" /usr/bin/
  
  # Paso 2: Copia el archivo de icono "fopnu.png" a /usr/share/icons/hicolor/48x48/apps
  sudo mv "fopnu-${latest_version}-1.x86_64.manualinstall/fopnu.png" /usr/share/icons/hicolor/48x48/apps/

  # Paso 3: Copia el archivo de enlace "fopnu.desktop" a /usr/share/applications
  sudo mv "fopnu-${latest_version}-1.x86_64.manualinstall/fopnu.desktop" /usr/share/applications/

  # Paso 4: Actualiza la caché de iconos GTK
  sudo gtk-update-icon-cache

  rm "fopnu-${latest_version}-1.x86_64.manualinstall.tar.gz"
  rm -r "fopnu-${latest_version}-1.x86_64.manualinstall"

  echo "Fopnu actualizado a la versión $latest_version"

else
  echo "Fopnu ya está actualizado (versión $installed_version)"
fi
  1. Guarda el archivo y sal del editor de texto.

  2. Haz que el script sea ejecutable:

chmod +x actualizar_fopnu.sh
  1. Ejecuta el script para verificar actualizaciones e instalar la última versión si está disponible:
./actualizar_fopnu.sh

Para automatizar el proceso, puedes configurar una tarea cron para ejecutar el script periódicamente. Por ejemplo, para ejecutar el script una vez a la semana, puedes agregar la siguiente línea a tu crontab:

0 0 * * 1 /ruta/a/actualizar_fopnu.sh

Reemplaza /ruta/a/ con la ruta actual al script actualizar_fopnu.sh. Esto ejecutará el script todos los lunes a la medianoche.

https://aur.archlinux.org/packages/fopnu

You can see the AUR package was Flagged out-of-date (2022-10-13) a year ago.

Yes, but I would still rather use/modify a PKGBUILD instead of using some script to manually re-download it.

# Maintainer: FKonAUR <fkonaur at googlegroups dot com>
# Maintainer: Amy Wilson <awils_1 at xsmail dot com>
# Contributor: Dimitris Kiziridis <ragouel at outlook dot com>
pkgname=fopnu
pkgver=1.61
pkgrel=1
pkgdesc='A new and powerful P2P File Sharing System'
arch=('x86_64')
url='https://www.fopnu.com'
license=("custom:${pkgname}")
depends=('gtk2' 'dbus-glib')
makedepends=('tar')
source=("${pkgname}-${pkgver}.deb::https://download2.fopnu.com/download/fopnu_${pkgver}-1_amd64.deb"
        'LICENSE')
sha256sums=('dc0438b8588bc29eecfba3dbe0c7353dfb7922ffaf00db1b764f658c10bd0ce1'
            '0bc342f6415aa54c3d313af6a45152cb005024c7167d4fd0c71bfa004a2f8e4f')

package() {
  tar xvf data.tar.xz -C "${pkgdir}"
  install -Dm644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
}
# vim:set ts=2 sw=2 et:

I’ve done it with a job so I don’t need to check whether or not there is a new version available. If I knew how to modify the PKGBUILD automatically on new version releases, I would install it using the PKGBUILD.

git clone https://aur.archlinux.org/fopnu.git
cd fopnu
micro PKGBUILD
## here you edit the PKGBUILD .. its just the version numbers that need to change
## or just use something like `sed -i 's/57/61/' PKGBUILD`
updpkgsums
makepkg -sric

done.

If the maintainer, er, maintained the PKGBUILD then it would be updated regularly
… or …
If they actually provided source code then someone could make a fopnu-git package that wouldnt need manual updating like this
… but its an odd project.

Seems more from the windoze freeware sphere than actual libre or open source.

What you propose is manually checking whether there is a new version and then manually changing the version and the checksum in the PKGBUILD. What I want to do is install a new version automatically without having to do anything manually.

It would be something like this. Of course this is wrong because it’s not updating the checksums.

To install the latest version of Fopnu on Manjaro Linux using a cron job, you can follow these steps:

  1. Create a script to download the PKGBUILD, update the version number, and install Fopnu:
#!/bin/bash

path="$HOME"/.cache/yay/fopnu
mkdir -p $path
cd $path

# Download the PKGBUILD
curl -o PKGBUILD https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=fopnu

# Get the latest version number from the Fopnu website
latest_version=$(curl -s https://www.fopnu.com/download/linux.html | grep -oP 'Download Fopnu v\K[0-9.]+')

# Update PKGBUILD
sed -i "s/^pkgver=.*/pkgver=$latest_version/" $path/PKGBUILD

# Build and install the package
makepkg -si
  1. Save the script as update_fopnu.sh and make it executable:
chmod +x update_fopnu.sh
  1. Install cronie if it’s not already installed:
sudo pacman -S cronie
  1. Enable and start the cronie service:
sudo systemctl enable --now cronie.service
  1. Edit your crontab to run the script at the desired interval. For example, to run the script every day at midnight, open the crontab with crontab -e and add the following line:
0 0 * * * /path/to/update_fopnu.sh

Replace /path/to/update_fopnu.sh with the actual path to the script you created in step 1.

Now, the script will run every day at midnight, updating and installing the latest version of Fopnu on your Manjaro Linux system.