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:
Crea un nuevo archivo llamado actualizar_fopnu.sh y ábrelo con un editor de texto:
#!/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
Guarda el archivo y sal del editor de texto.
Haz que el script sea ejecutable:
chmod +x actualizar_fopnu.sh
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.
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:
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
Save the script as update_fopnu.sh and make it executable:
chmod +x update_fopnu.sh
Install cronie if it’s not already installed:
sudo pacman -S cronie
Enable and start the cronie service:
sudo systemctl enable --now cronie.service
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.