mirror of
https://github.com/YunoHost-Apps/invidious_ynh.git
synced 2024-09-03 19:15:55 +02:00
parent
fa47d482e0
commit
662223c7af
7 changed files with 59 additions and 67 deletions
|
@ -23,4 +23,3 @@ Notification=none
|
|||
; commit=d0b65b69558b6a1a98761eb7be0b34b4ccb7d6b3
|
||||
name=Testing (#36)
|
||||
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666&
|
||||
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
|
||||
version_commit=0db23f925225f50ed574c69abbb0bd5de58bf709
|
||||
version_commit=7b2aa5f98e140ae989eb4f61cd8a94e3127de025
|
||||
|
||||
# dependencies used by the app
|
||||
pkg_dependencies="apt-transport-https libssl-dev libxml2-dev libyaml-dev libgmp-dev libreadline-dev postgresql librsvg2-bin libsqlite3-dev zlib1g-dev libevent-dev pkg-config libpcre3-dev"
|
||||
pkg_dependencies="apt-transport-https libssl-dev libxml2-dev libyaml-dev libgmp-dev libreadline-dev postgresql librsvg2-bin imagemagick libsqlite3-dev zlib1g-dev libevent-dev pkg-config libpcre3-dev"
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
|
|
|
@ -29,10 +29,6 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
|
|||
# Needed for helper "ynh_add_nginx_config"
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
# Add settings here as needed by your application
|
||||
#db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
#db_user=$db_name
|
||||
#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
|
||||
|
|
|
@ -68,9 +68,7 @@ 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
|
||||
ynh_exec_warn_less curl -fsSL https://crystal-lang.org/install.sh | bash -s -- --channel=stable
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
|
@ -129,10 +127,10 @@ ynh_add_nginx_config
|
|||
#=================================================
|
||||
ynh_script_progression --message="Building Invidious.. (this will take some time and resources!)" --weight=60
|
||||
|
||||
pushd "$final_path" || ynh_die
|
||||
shards update && shards install
|
||||
crystal build $final_path/src/invidious.cr --release
|
||||
popd || ynh_die
|
||||
pushd "$final_path"
|
||||
ynh_exec_warn_less shards update && shards install
|
||||
ynh_exec_warn_less crystal build $final_path/src/invidious.cr --release
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
# MODIFY A CONFIG FILE
|
||||
|
@ -155,7 +153,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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
ynh_exec_warn_less curl -fsSL https://crystal-lang.org/install.sh | bash -s -- --channel=stable
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE POSTGRESQL DATABASE
|
||||
|
@ -100,6 +98,22 @@ 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
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
|
@ -114,18 +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_restore_file --origin_path="/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
|
|
@ -31,26 +31,6 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
|||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||
|
||||
# Cleaning legacy permissions
|
||||
if ynh_legacy_permissions_exists; then
|
||||
ynh_legacy_permissions_delete_all
|
||||
|
||||
ynh_app_setting_delete --app=$app --key=is_public
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
|
@ -74,6 +54,26 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
|||
|
||||
ynh_systemd_action --service_name=$app --action=stop --log_path=systemd
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||
|
||||
# Cleaning legacy permissions
|
||||
if ynh_legacy_permissions_exists; then
|
||||
ynh_legacy_permissions_delete_all
|
||||
|
||||
ynh_app_setting_delete --app=$app --key=is_public
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
|
@ -81,10 +81,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
|
||||
ynh_exec_warn_less curl -fsSL https://crystal-lang.org/install.sh | bash -s -- --channel=stable
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
|
@ -94,25 +91,14 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
|
|||
then
|
||||
ynh_script_progression --message="Upgrading source files..." --weight=5
|
||||
|
||||
#tmpdir="$(mktemp -d)"
|
||||
|
||||
# Backup the config file in the temp dir
|
||||
#cp -a "$final_path/config/config.yml" "$tmpdir/config.yml"
|
||||
|
||||
pushd $final_path
|
||||
git fetch
|
||||
#git checkout master
|
||||
git reset --hard --quiet $version_commit
|
||||
git pull
|
||||
shards update && shards install
|
||||
crystal build $final_path/src/invidious.cr --release
|
||||
ynh_exec_warn_less shards update && shards install
|
||||
ynh_exec_warn_less crystal build $final_path/src/invidious.cr --release
|
||||
popd
|
||||
|
||||
# Copy the admin saved settings from tmp directory to final path
|
||||
#cp -a "$tmpdir/config.yml" "$final_path/config/config.yml"
|
||||
|
||||
# Remove the tmp directory securely
|
||||
#ynh_secure_remove --file="$tmpdir"
|
||||
fi
|
||||
|
||||
chmod 750 "$final_path"
|
||||
|
@ -143,6 +129,15 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=2
|
|||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
# SETUP CRON
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setuping a cron..." --weight=1
|
||||
|
||||
ynh_add_config --template="../conf/cron_invidious" --destination="/etc/cron.d/$app"
|
||||
chown root: "/etc/cron.d/$app"
|
||||
chmod 644 "/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue