Log In     Register    

Help and Support
Ask a question, report a problem, request a feature...
<<  Back To Forum

[Feature Request] Check version from terminal

by Sumit316 on 2023/09/18 03:23:32 AM    
I would like to be able to automatically check the installed version and update if necessary, but I don't know how to get the current version from the terminal.

To automatically install the latest release of Fopnu whenever it's available, you can create a script that checks for updates and installs the new version if available. Here's a simple script that you can use:

1. Create a new file called `update_fopnu.sh` and open it with a text editor:

  touch update_fopnu.sh
  nano update_fopnu.sh

2. Add the following content to the file:


  # 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.]+')

  # Get the currently installed version
  installed_version=$(fopnu --version 2>&amp;1 | grep -oP 'Fopnu v\K[0-9.]+')

  # Compare the versions and update if necessary
  if [[ $latest_version != $installed_version ]]; then
      echo "Updating Fopnu from version $installed_version to $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"

      # Step 1: Copy the "fopnu" binary executable to /usr/bin
      sudo mv "fopnu-${latest_version}-1.x86_64.manualinstall/fopnu" /usr/bin/
      # Step 2: Copy the "fopnu.png" icon file to /usr/share/icons/hicolor/48x48/apps
      sudo mv "fopnu-${latest_version}-1.x86_64.manualinstall/fopnu.png" /usr/share/icons/hicolor/48x48/apps/
      # Step 3: Copy the "fopnu.desktop" shell-link file to /usr/share/applications
      sudo mv "fopnu-${latest_version}-1.x86_64.manualinstall/fopnu.desktop" /usr/share/applications/
      # Step 4: Update the GTK icon cache
      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 updated to version $latest_version"
      echo "Fopnu is already up-to-date (version $installed_version)"

3. Save the file and exit the text editor.

4. Make the script executable:

  chmod +x update_fopnu.sh

5. Run the script to check for updates and install the latest version if available:


To automate the process, you can set up a cron job to run the script periodically. For example, to run the script once a week, you can add the following line to your crontab:

0 0 * * 1 /path/to/update_fopnu.sh

Replace `/path/to/` with the actual path to the `update_fopnu.sh` script. This will run the script every Monday at midnight.

This web site is powered by Super Simple Server