From 49e499f5441263e2874c858a682a15985c37e213 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 3 Oct 2021 07:40:37 +0200 Subject: [PATCH] Update Crystal (#63) * Update Crystal --- scripts/install | 11 +++++++---- scripts/remove | 1 + scripts/restore | 34 ++++++++++------------------------ scripts/upgrade | 7 +++---- 4 files changed, 21 insertions(+), 32 deletions(-) diff --git a/scripts/install b/scripts/install index 5211c3e..b5d96b5 100644 --- a/scripts/install +++ b/scripts/install @@ -68,9 +68,11 @@ ynh_script_progression --message="Installing dependencies..." --weight=15 ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies -tempdir="$(mktemp -d)" -ynh_setup_source --dest_dir=$tempdir --source_id=crystal -ynh_exec_warn_less dpkg -i $tempdir/crystal_1.0.0-1_amd64.deb +# tempdir="$(mktemp -d)" +# ynh_setup_source --dest_dir=$tempdir --source_id=crystal +# ynh_exec_warn_less dpkg -i $tempdir/crystal_1.0.0-1_amd64.deb + +curl -fsSL https://crystal-lang.org/install.sh | bash -s -- --channel=nightly #================================================= # CREATE DEDICATED USER @@ -155,7 +157,8 @@ ynh_add_systemd_config ynh_script_progression --message="Setuping a cron..." --weight=1 ynh_add_config --template="../conf/cron_invidious" --destination="/etc/cron.d/$app" -chmod 644 /etc/cron.d/$app +chown root: "/etc/cron.d/$app" +chmod 644 "/etc/cron.d/$app" #================================================= # SETUP LOGROTATE diff --git a/scripts/remove b/scripts/remove index 8566bf5..2382b33 100644 --- a/scripts/remove +++ b/scripts/remove @@ -88,6 +88,7 @@ ynh_remove_logrotate #================================================= # REMOVE VARIOUS FILES #================================================= +ynh_script_progression --message="Removing the cron file..." --weight=1 # Remove a cron file ynh_secure_remove --file="/etc/cron.d/$app" diff --git a/scripts/restore b/scripts/restore index 2c1c5fc..25557fa 100644 --- a/scripts/restore +++ b/scripts/restore @@ -79,9 +79,7 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=7 # Define and install dependencies ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies -tempdir="$(mktemp -d)" -ynh_setup_source --dest_dir=$tempdir --source_id=crystal -ynh_exec_warn_less dpkg -i $tempdir/crystal_1.0.0-1_amd64.deb +curl -fsSL https://crystal-lang.org/install.sh | bash -s -- --channel=nightly #================================================= # RESTORE THE POSTGRESQL DATABASE @@ -92,13 +90,6 @@ ynh_psql_test_if_first_run ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name -#================================================= -# RESTORE VARIOUS FILES -#================================================= -ynh_script_progression --message="Restoring various files..." --weight=1 - -ynh_restore_file --origin_path="/etc/cron.d/$app" - #================================================= # RESTORE SYSTEMD #================================================= @@ -107,6 +98,15 @@ ynh_script_progression --message="Restoring the systemd configuration..." --weig ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet +#================================================= +# RESTORE VARIOUS FILES +#================================================= +ynh_script_progression --message="Restoring various files..." --weight=1 + +ynh_restore_file --origin_path="/etc/cron.d/$app" +chown root: "/etc/cron.d/$app" +chmod 644 "/etc/cron.d/$app" + #================================================= # RESTORE THE LOGROTATE CONFIGURATION #================================================= @@ -128,20 +128,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action=start --log_path=systemd -#================================================= -# RESTORE VARIOUS FILES -#================================================= -ynh_script_progression --message="Restoring various files..." --weight=1 - -ynh_restore_file --origin_path="/etc/cron.d/$app" - -#================================================= -# 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 #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index bdbb1d9..6ffa7dc 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -122,9 +122,7 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=8 ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies -tempdir="$(mktemp -d)" -ynh_setup_source --dest_dir=$tempdir --source_id=crystal -ynh_exec_warn_less dpkg -i $tempdir/crystal_1.0.0-1_amd64.deb +curl -fsSL https://crystal-lang.org/install.sh | bash -s -- --channel=nightly #================================================= # MODIFY A CONFIG FILE @@ -148,7 +146,8 @@ ynh_add_systemd_config ynh_script_progression --message="Setuping a cron..." --weight=1 ynh_add_config --template="../conf/cron_invidious" --destination="/etc/cron.d/$app" -chmod 644 /etc/cron.d/$app +chown root: "/etc/cron.d/$app" +chmod 644 "/etc/cron.d/$app" #================================================= # GENERIC FINALIZATION