diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh deleted file mode 100644 index 4119e88..0000000 --- a/.github/workflows/updater.sh +++ /dev/null @@ -1,133 +0,0 @@ -#!/bin/bash - -#================================================= -# PACKAGE UPDATING HELPER -#================================================= - -# This script is meant to be run by GitHub Actions -# The YunoHost-Apps organisation offers a template Action to run this script periodically - -#================================================= -# FETCHING LATEST RELEASE AND ITS ASSETS -#================================================= - -# Fetching information -current_version=$(cat manifest.json | jq -j '.version|split("~")[0]') -repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]') -# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions) -version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1) -assets=($(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '[ .[] | select(.tag_name=="'$version'").assets[].browser_download_url ] | join(" ") | @sh' | tr -d "'")) - -# Later down the script, we assume the version has only digits and dots -# Sometimes the release name starts with a "v", so let's filter it out. -# You may need more tweaks here if the upstream repository has different naming conventions. -if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then - version=${version:1} -fi - -# Setting up the environment variables -echo "Current version: $current_version" -echo "Latest release from upstream: $version" -echo "VERSION=$version" >> $GITHUB_ENV -# For the time being, let's assume the script will fail -echo "PROCEED=false" >> $GITHUB_ENV - -# Proceed only if the retrieved version is greater than the current one -if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then - echo "::warning ::No new version available" - exit 0 -# Proceed only if a PR for this new version does not already exist -elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then - echo "::warning ::A branch already exists for this update" - exit 0 -fi - -# Each release can hold multiple assets (e.g. binaries for different architectures, source code, etc.) -echo "${#assets[@]} available asset(s)" - -#================================================= -# UPDATE SOURCE FILES -#================================================= - -# Here we use the $assets variable to get the resources published in the upstream release. - -# Let's loop over the array of assets URLs -for asset_url in ${assets[@]}; do - -echo "Handling asset at $asset_url" - -# Assign the asset to a source file in conf/ directory -# Here we base the source file name upon a unique keyword in the assets url (admin vs. update) -# Leave $src empty to ignore the asset -case $asset_url in - *"linux-core-arm64"*) - src="app.arm64" - ;; - *"linux-core-arm"*) - src="app.arm" - ;; - *"linux-core-x64"*) - src="app.x64" - ;; - *) - src="" - ;; -esac - -# If $src is not empty, let's process the asset -if [ ! -z "$src" ]; then - -# Create the temporary directory -tempdir="$(mktemp -d)" - -# Download sources and calculate checksum -filename=${asset_url##*/} -curl --silent -4 -L $asset_url -o "$tempdir/$filename" -checksum=$(sha256sum "$tempdir/$filename" | head -c 64) - -# Delete temporary directory -rm -rf $tempdir - -# Get extension -if [[ $filename == *.tar.gz ]]; then - extension=tar.gz -else - extension=${filename##*.} -fi - -# Rewrite source file -cat < conf/$src.src -SOURCE_URL=$asset_url -SOURCE_SUM=$checksum -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=$extension -SOURCE_IN_SUBDIR=true -EOT -echo "... conf/$src.src updated" - -else -echo "... asset ignored" -fi - -done - -#================================================= -# SPECIFIC UPDATE STEPS -#================================================= - -# Any action on the app's source code can be done. -# The GitHub Action workflow takes care of committing all changes after this script ends. - -#================================================= -# GENERIC FINALIZATION -#================================================= - -# Replace new version in manifest -echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json - -# No need to update the README, yunohost-bot takes care of it - -# The Action will proceed only if the PROCEED environment variable is set to true -echo "PROCEED=true" >> $GITHUB_ENV -exit 0 - diff --git a/.github/workflows/updater.yml b/.github/workflows/updater.yml deleted file mode 100644 index a9ca97a..0000000 --- a/.github/workflows/updater.yml +++ /dev/null @@ -1,50 +0,0 @@ -# This workflow allows GitHub Actions to automagically update your app whenever a new upstream release is detected. -# You need to enable Actions in your repository settings, and fetch this Action from the YunoHost-Apps organization. -# This file should be enough by itself, but feel free to tune it to your needs. -# It calls updater.sh, which is where you should put the app-specific update steps. -name: Check for new upstream releases -on: - # Allow to manually trigger the workflow - workflow_dispatch: - # Run it every day at 6:00 UTC - schedule: - - cron: '0 6 * * *' -jobs: - updater: - runs-on: ubuntu-latest - steps: - - name: Fetch the source code - uses: actions/checkout@v3 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - name: Run the updater script - id: run_updater - run: | - # Setting up Git user - git config --global user.name 'yunohost-bot' - git config --global user.email 'yunohost-bot@users.noreply.github.com' - # Run the updater script - /bin/bash .github/workflows/updater.sh - - name: Commit changes - id: commit - if: ${{ env.PROCEED == 'true' }} - run: | - git commit -am "Upgrade to v$VERSION" - - name: Create Pull Request - id: cpr - if: ${{ env.PROCEED == 'true' }} - uses: peter-evans/create-pull-request@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - commit-message: Update to version ${{ env.VERSION }} - committer: 'yunohost-bot ' - author: 'yunohost-bot ' - signoff: false - branch: ci-auto-update-v${{ env.VERSION }} - base: testing - delete-branch: true - title: 'Upgrade to version ${{ env.VERSION }}' - body: | - Upgrade to v${{ env.VERSION }} - draft: false - diff --git a/README.md b/README.md index 5411c9e..90cf0b0 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Movie collection manager for Usenet and BitTorrent users -**Shipped version:** 4.3.2.6857~ynh1 +**Shipped version:** 5.0.3.8127~ynh1 ## Screenshots @@ -29,7 +29,6 @@ Movie collection manager for Usenet and BitTorrent users * Official app website: * Official admin documentation: * Upstream app code repository: -* YunoHost documentation for this app: * Report a bug: ## Developer info diff --git a/README_fr.md b/README_fr.md index a028057..3ddfc60 100644 --- a/README_fr.md +++ b/README_fr.md @@ -18,7 +18,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po Movie collection manager for Usenet and BitTorrent users -**Version incluse :** 4.3.2.6857~ynh1 +**Version incluse :** 5.0.3.8127~ynh1 ## Captures d’écran @@ -29,7 +29,6 @@ Movie collection manager for Usenet and BitTorrent users * Site officiel de l’app : * Documentation officielle de l’admin : * Dépôt de code officiel de l’app : -* Documentation YunoHost pour cette app : * Signaler un bug : ## Informations pour les développeurs diff --git a/conf/config.xml b/conf/config.xml index bc40bfb..a134403 100644 --- a/conf/config.xml +++ b/conf/config.xml @@ -6,7 +6,7 @@ __PORT__ __PATH__ __API_KEY__ - None + External BuiltIn develop __PORT__ diff --git a/manifest.toml b/manifest.toml index 55946c6..d92f94e 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Radarr" description.en = "Movie collection manager for Usenet and BitTorrent users" description.fr = "Gestionnaire de filmothèque pour utilisateurs de Usenet et BitTorrent" -version = "4.3.2.6857~ynh1" +version = "5.0.3.8127~ynh1" maintainers = ["tituspijean"] @@ -41,14 +41,14 @@ ram.runtime = "100M" [resources] [resources.sources.main] - armhf.url = "https://github.com/Radarr/Radarr/releases/download/v4.7.5.7809/Radarr.master.4.7.5.7809.linux-core-arm.tar.gz" - armhf.sha256 = "00972d3d587f214c1b3a446c5db2d9ef0823edba5a311670f81d6038bb11c1be" - arm64.url = "https://github.com/Radarr/Radarr/releases/download/v4.7.5.7809/Radarr.master.4.7.5.7809.linux-core-arm64.tar.gz" - arm64.sha256 = "82cc30caaf5920e6f0adcb3a3c006170de2c685f150d01cba4fdadac09d549c9" - amd64.url = "https://github.com/Radarr/Radarr/releases/download/v4.7.5.7809/Radarr.master.4.7.5.7809.linux-core-x64.tar.gz" - amd64.sha256 = "634f262eafe5a56ab071f7cf7332fe9ed4bb0962e63a0cfd8ab7db84829b2f90" - i386.url = "https://github.com/Radarr/Radarr/releases/download/v4.7.5.7809/Radarr.master.4.7.5.7809.linux-core-x86.tar.gz" - i386.sha256 = "e5ae54b2fdd2e310bdd720ce8b6e0bd9ebe4c9500a4af72c092bf8da052108e1" + armhf.url = "https://github.com/Radarr/Radarr/releases/download/v5.0.3.8127/Radarr.master.5.0.3.8127.linux-core-arm.tar.gz" + armhf.sha256 = "cc9a151b10df92e57cbd8e59404aca1e4cf70ce1766b9cf52d47930803471ec9" + arm64.url = "https://github.com/Radarr/Radarr/releases/download/v5.0.3.8127/Radarr.master.5.0.3.8127.linux-core-arm64.tar.gz" + arm64.sha256 = "1430edeada3b3d4127e1d872d7762d1c8856fca7845cd2632bd557af3449f963" + amd64.url = "https://github.com/Radarr/Radarr/releases/download/v5.0.3.8127/Radarr.master.5.0.3.8127.linux-core-x64.tar.gz" + amd64.sha256 = "40bd9b5881d3d053372a8863b6285642183f4aa48698e47f8ff40db8be5c165b" + i386.url = "https://github.com/Radarr/Radarr/releases/download/v5.0.3.8127/Radarr.master.5.0.3.8127.linux-core-x86.tar.gz" + i386.sha256 = "434cd9886a69c67a6b79100a6622794861e40981f1ed3a62bc179b9090359254" autoupdate.strategy = "latest_github_release" autoupdate.asset.armhf = ".*linux-core-arm.tar.gz" @@ -63,6 +63,7 @@ ram.runtime = "100M" [resources.install_dir] [resources.data_dir] + subdirs = ["logs"] [resources.permissions] main.url = "/" @@ -72,4 +73,4 @@ ram.runtime = "100M" api.protected = true [resources.apt] - packages = "curl mediainfo sqlite3" + packages = "curl, mediainfo, sqlite3" diff --git a/scripts/install b/scripts/install index 54cb182..4b7d790 100755 --- a/scripts/install +++ b/scripts/install @@ -17,7 +17,8 @@ ynh_script_progression --message="Setting up source files..." --weight=3 # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" -mkdir -p "$data_dir/logs" +chmod -R o-rwx "$install_dir" +chown -R $app: "$install_dir" #================================================= # NGINX CONFIGURATION @@ -27,16 +28,14 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# SPECIFIC SETUP -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Configuring a systemd service..." --weight=1 - # Create a dedicated systemd config ynh_add_systemd_config +ynh_use_logrotate +ynh_use_logrotate --logfile="$data_dir/logs" + +yunohost service add $app --description="Radarr daemon" --log="$data_dir/logs/radarr.txt" + #================================================= # ADD A CONFIGURATION #================================================= @@ -47,19 +46,6 @@ ynh_app_setting_set --app=$app --key=api_key --value=$api_key ynh_add_config --template="../conf/config.xml" --destination="$data_dir/config.xml" -#================================================= -# SETUP FILE PERMISSIONS -#================================================= -ynh_script_progression --message="Setting files permissions and ownership..." --weight=1 - -chmod 750 "$install_dir" -chmod -R o-rwx "$install_dir" -chown -R $app: "$install_dir" - -chmod 750 "$data_dir" -chmod -R o-rwx "$data_dir" -chown -R $app: "$data_dir" - chmod 400 "$data_dir/config.xml" chown $app:$app "$data_dir/config.xml" @@ -73,24 +59,6 @@ ynh_multimedia_build_main_dir # Enable writing into these directories ynh_multimedia_addaccess $app -#================================================= -# GENERIC FINALIZATION -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Configuring log rotation..." --weight=1 - -# Use logrotate to manage application logfile(s) -ynh_use_logrotate -ynh_use_logrotate --logfile="$data_dir/logs" - -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - -yunohost service add $app --description="Radarr daemon" --log="$data_dir/logs/radarr.txt" - #================================================= # START SYSTEMD SERVICE #================================================= diff --git a/scripts/remove b/scripts/remove index 272e743..5b8b9b5 100755 --- a/scripts/remove +++ b/scripts/remove @@ -22,45 +22,15 @@ then yunohost service remove $app fi -#================================================= -# STOP AND REMOVE SERVICE -#================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 - # Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE APP DATA DIR -#================================================= -ynh_script_progression --message="Removing app data directory..." --weight=1 - -# Remove the app directory securely -ynh_secure_remove --file="$data_dir" - -#================================================= -# REMOVE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 - # Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# REMOVE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Removing logrotate configuration..." --weight=1 - # Remove the app-specific logrotate config ynh_remove_logrotate -#================================================= -# SPECIFIC REMOVE -#================================================= -# REMOVE VARIOUS FILES -#================================================= -ynh_script_progression --message="Removing various files..." --weight=1 - # Remove the log files ynh_secure_remove --file="/var/log/$app" diff --git a/scripts/restore b/scripts/restore index 8b5663b..16c8284 100755 --- a/scripts/restore +++ b/scripts/restore @@ -10,15 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# STANDARD RESTORATION STEPS -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1 - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -39,8 +30,19 @@ ynh_restore_file --origin_path="$data_dir" --not_mandatory # (Same as for install dir) chown -R $app: "$data_dir" -#chmod 400 "$data_dir/config.xml" -#chown $app:$app "$data_dir/config.xml" +#================================================= +# RESTORE SYSTEMD +#================================================= +ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 + +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" + +ynh_restore_file --origin_path="/etc/systemd/system/$app.service" +systemctl enable $app.service --quiet + +ynh_restore_file --origin_path="/etc/logrotate.d/$app" + +yunohost service add $app --description="Radarr daemon" --log="$data_dir/logs/radarr.txt" #================================================= # YUNOHOST MULTIMEDIA INTEGRATION @@ -52,21 +54,6 @@ ynh_multimedia_build_main_dir # Enable writing into these directories ynh_multimedia_addaccess $app -#================================================= -# RESTORE SYSTEMD -#================================================= -ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 - -ynh_restore_file --origin_path="/etc/systemd/system/$app.service" -systemctl enable $app.service --quiet - -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - -yunohost service add $app --description="Radarr daemon" --log="$data_dir/logs/radarr.txt" - #================================================= # START SYSTEMD SERVICE #================================================= @@ -74,20 +61,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=2 ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Application started" --timeout=30 -#================================================= -# RESTORE THE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1 - -ynh_restore_file --origin_path="/etc/logrotate.d/$app" - -#================================================= -# GENERIC FINALIZATION -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - ynh_systemd_action --service_name=nginx --action=reload #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index fc3a3ec..6050a1f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -47,32 +47,13 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# SPECIFIC UPGRADE -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 - # Create a dedicated systemd config ynh_add_systemd_config -#================================================= -# GENERIC FINALIZATION -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 - # Use logrotate to manage app-specific logfile(s) ynh_use_logrotate --non-append ynh_use_logrotate --non-append --logfile="$data_dir/logs" -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - yunohost service add $app --description="Radarr daemon" --log="$data_dir/logs/radarr.txt" #================================================= diff --git a/tests.toml b/tests.toml index 8b3b8f8..a03f41b 100644 --- a/tests.toml +++ b/tests.toml @@ -2,12 +2,11 @@ test_format = 1.0 [default] - # ------------------------------- # Commits to test upgrade from # ------------------------------- - test_upgrade_from.35c7ebe4.name = "Upgrade from 3.2.2.5080~ynh1" - test_upgrade_from.35c7ebe4.args.domain = "sub.domain.tld" - test_upgrade_from.35c7ebe4.args.path = "/radarr" - test_upgrade_from.35c7ebe4.args.admin = "package_checker" + test_upgrade_from.4db47c2.name = "Upgrade from 4.3.2.6857~ynh1" + test_upgrade_from.4db47c2.args.domain = "sub.domain.tld" + test_upgrade_from.4db47c2.args.path = "/radarr" + test_upgrade_from.4db47c2.args.admin = "package_checker"