From e927b7ec4454406b6f9ba0315c07f2ac0a8d7358 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 2 May 2024 11:21:26 +0200 Subject: [PATCH] extract from release --- manifest.toml | 7 ++++++- scripts/_common.sh | 2 -- scripts/install | 19 +++---------------- scripts/remove | 5 ----- scripts/restore | 11 ++--------- scripts/upgrade | 29 +++++------------------------ 6 files changed, 16 insertions(+), 57 deletions(-) diff --git a/manifest.toml b/manifest.toml index dfe6c05..47604c2 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Invidious" description.en = "Alternative front-end to YouTube" description.fr = "Front-end alternatif à YouTube" -version = "24.04.28~ynh1" +version = "24.04.27~ynh1" maintainers = [] @@ -48,6 +48,11 @@ ram.runtime = "50M" default = "fr" [resources] + + [resources.sources.main] + url = "https://github.com/iv-org/invidious/archive/refs/tags/v2.20240427.tar.gz" + sha256 = "0f290de213eda898f95fd0108652738f88bb6d09289e0cea86c178050271660d" + [resources.system_user] [resources.install_dir] diff --git a/scripts/_common.sh b/scripts/_common.sh index 60e5406..944a65e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,8 +4,6 @@ # COMMON VARIABLES #================================================= -version_commit=eda7444ca46dbc3941205316baba8030fe0b2989 - #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/install b/scripts/install index ec40918..a145ac3 100644 --- a/scripts/install +++ b/scripts/install @@ -42,23 +42,10 @@ ynh_exec_warn_less curl -fsSL https://crystal-lang.org/install.sh | bash -s -- - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..." --weight=4 +ynh_script_progression --message="Setting up source files..." --weight=1 -mkdir -p "$install_dir" -chown -R "$app:www-data" "$install_dir" - -git config --system --add safe.directory "$install_dir" - -# Download, check integrity, uncompress and patch the source from GitHub -# note: we can't use resources.sources instead of git because Invidious is -# expecting to be in a git environment for the building step... -# see: https://github.com/YunoHost-Apps/invidious_ynh/pull/127 -git clone https://github.com/iv-org/invidious "$install_dir" --quiet - -pushd "$install_dir" - git reset --hard --quiet "$version_commit" - make -popd +# Download, check integrity, uncompress and patch the source from manifest.toml +ynh_setup_source --dest_dir="$install_dir" chmod -R o-rwx "$install_dir" chown -R "$app:www-data" "$install_dir" diff --git a/scripts/remove b/scripts/remove index ca7f10d..3406a71 100644 --- a/scripts/remove +++ b/scripts/remove @@ -22,11 +22,6 @@ then yunohost service remove "$app" fi -#================================================= -# REMOVE SYSTEM CONFIGURATIONS -#================================================= -ynh_script_progression --message="Removing system configurations related to $app..." --weight=10 - dpkg --remove crystal # Remove the dedicated systemd config diff --git a/scripts/restore b/scripts/restore index 5fbbb2a..b6dca6e 100644 --- a/scripts/restore +++ b/scripts/restore @@ -9,15 +9,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..." - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -49,6 +40,8 @@ ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name" #================================================= ynh_script_progression --message="Restoring system configurations related to $app..." --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 diff --git a/scripts/upgrade b/scripts/upgrade index f8bb121..ca53700 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,12 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# CHECK VERSION -#================================================= - -upgrade_type=$(ynh_check_app_version_changed) - #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -69,26 +63,13 @@ ynh_exec_warn_less curl -fsSL https://crystal-lang.org/install.sh | bash -s -- - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_script_progression --message="Upgrading source files..." --weight=1 -if [ "$upgrade_type" == "UPGRADE_APP" ] -then - ynh_script_progression --message="Upgrading source files..." --weight=5 +# Download, check integrity, uncompress and patch the source from manifest.toml +ynh_setup_source --dest_dir="$install_dir" +ynh_exec_warn_less shards install --production +ynh_exec_warn_less crystal build "$install_dir/src/invidious.cr" --release - pushd "$install_dir" - chown -R "$app:www-data" "$install_dir" - git config --system --add safe.directory "$install_dir" - ynh_exec_as "$app" git config pull.rebase false - - ynh_exec_as "$app" git fetch - #git checkout master - ynh_exec_as "$app" git reset --hard --quiet "$version_commit" - ynh_exec_as "$app" git pull - ynh_exec_warn_less shards install --production - ynh_exec_warn_less crystal build "$install_dir/src/invidious.cr" --release - popd -fi - -chmod -R o-rwx "$install_dir" chown -R "$app:www-data" "$install_dir" #=================================================