mirror of
https://github.com/YunoHost-Apps/invidious_ynh.git
synced 2024-09-03 19:15:55 +02:00
f468e33809
* Fix linter warnings * Update README.md * Update README.md delete App website (it's down) brought link in line 26 and 30 up to date with link to new place of documentation * Change version * Update links * Finding an available port * Add more_set_headers to NGINX conf * Silencing PostgreSQL warnings * Update nginx.conf * Update nginx.conf * Make `/embed/` links work properly (#8) Gives them the right headers and redirects them to the right place * Update manifest.json * fix * Update restore * Update install * Fix * Update install * Fix * Update install * Fix * Fix * Update check_process * Fix embeds again (#12) * Fix embeds again * Remove extra repo (#14) * Remove extra repo * Update manifest.json * Cleaning up * Patch * Fix * Fix * Fix * Update manifest.json * Update upgrade * Fix * Preserve config file and protect it * Fix permissions * Fix * Fix * fix * Update README.md (#28) .yml iso .yaml file * Fix * Update install * [autopatch] Update issue and PR templates (#32) Co-authored-by: Yunohost-Bot <> * [autopatch] Update issue and PR templates (#33) Co-authored-by: Yunohost-Bot <> * Fix * Fix * Update install * Auto-update README * Update install * Fix * Update _common.sh * Fix * Auto-update README * Fix * Fix * Create change_url * Fix * Update nginx.conf * Update check_process * Auto-update README * Auto-update README * upgrade crystal * Auto-update README * Update restore * Update upgrade * Update upgrade * Revert "Update upgrade" This reverts commitf533eb02cb
. * Update upgrade * Update check_process * Add limitations * Auto-update README * New config file (#44) * Add config * Update check_process * From git commit (#46) * from commit * Fix doc link * Auto-update README * Update upgrade * Update config.yml * Update manifest.json * Auto-update README * Version bump (#54) * upgrade * Update restore * Add description * Auto-update README * config.yml may not exist during upgrade (#58) * Update systemd.service * Update manifest.json * Update manifest.json * Auto-update README * Reorder * Update _common.sh * Fix * Update Crystal (#63) * Update Crystal * Update install * Fix * Update _common.sh * Update _common.sh * 4.3 * Auto-update README * Upgrade * Auto-update README * Config panel (#72) * Add config panel * Update _common.sh * Fix * Auto-update README * upgrade to upstream * Auto-update README * Update _common.sh * Update manifest.json * Auto-update README * Update _common.sh * Update manifest.json * Auto-update README * Bugfix #77 by replace "shards" command (#79) * Bugfix #77 by "shards install" with "--production" See: https://github.com/iv-org/invidious/issues/2918#issuecomment-1048146335 * Upgrade to upstream * Auto-update README * Update check_process * 22.03.03 * Auto-update README * Add admin (#74) * Add admin * add email * Auto-update README * Fix * Update upgrade * Update _common.sh * Update _common.sh * Update manifest.json * Auto-update README * Fix * Update install * Fix * Fix * Auto-update README * Update upgrade * Revert "Update upgrade" This reverts commita1dce069b4
. * upgrade to upstream * Auto-update README * Upgrade to upstream * Auto-update README * upgrade to upstream * Auto-update README * Update _common.sh * Auto-update README * Upgrade to upstream * Auto-update README * upgrade * Auto-update README * Update _common.sh * Update manifest.json * Auto-update README * Auto-update README * Auto-update README * Upgrade to upstream * Auto-update README * Upgrade to upstream * Revert "Upgrade to upstream" This reverts commitdc91a2696e
. * Update _common.sh * Update manifest.json * Auto-update README * Upgrade to upstream * Auto-update README * upgrade to upstream * Auto-update README * Upgrade to upstream * Auto-update README * Upgrade to upstream * Auto-update README * Upgrade * Auto-update README * Upgrade to upstream * Auto-update README * Auto-update README * Upgrade to upstream * Auto-update README * Fix * Auto-update README * Fix * Update to upstream * Auto-update README * Update install * Update install * Update install * Auto-update README * Update install * Update install * Update install * Update install * Update install * Update install * Update install * Update install * upgrade to upstream * Auto-update README * Update upgrade --------- Co-authored-by: deckname <58575263+deckname@users.noreply.github.com> Co-authored-by: Alexandre Aubin <alex.aubin@mailoo.org> Co-authored-by: Georgelemental <georgelemental@gmail.com> Co-authored-by: Jules-Bertholet <jules.bertholet@gmail.com> Co-authored-by: clavelc <25869334+clavelc@users.noreply.github.com> Co-authored-by: YunoHost Bot <yunohost-bot@users.noreply.github.com> Co-authored-by: Yunohost-Bot <> Co-authored-by: Jens Diemer <github.com@jensdiemer.de> Co-authored-by: yunohost-bot <yunohost@yunohost.org> Co-authored-by: yalh76 <yalh@yahoo.com>
200 lines
6.9 KiB
Bash
200 lines
6.9 KiB
Bash
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# LOAD SETTINGS
|
|
#=================================================
|
|
ynh_script_progression --message="Loading installation settings..." --weight=2
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
|
port=$(ynh_app_setting_get --app=$app --key=port)
|
|
language=$(ynh_app_setting_get --app=$app --key=language)
|
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
|
db_user=$db_name
|
|
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
|
email=$(ynh_app_setting_get --app=$app --key=email)
|
|
|
|
registration_enabled=$(ynh_app_setting_get --app=$app --key=registration_enabled)
|
|
login_enabled=$(ynh_app_setting_get --app=$app --key=login_enabled)
|
|
captcha_enabled=$(ynh_app_setting_get --app=$app --key=captcha_enabled)
|
|
|
|
#=================================================
|
|
# CHECK VERSION
|
|
#=================================================
|
|
|
|
upgrade_type=$(ynh_check_app_version_changed)
|
|
|
|
#=================================================
|
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
|
#=================================================
|
|
ynh_script_progression --message="Backing up Invidious before upgrading..." --weight=4
|
|
|
|
# Backup the current version of the app
|
|
ynh_backup_before_upgrade
|
|
ynh_clean_setup () {
|
|
# restore it if the upgrade fails
|
|
ynh_restore_upgradebackup
|
|
}
|
|
# Exit if an error occurs during the execution of the script
|
|
ynh_abort_if_errors
|
|
|
|
#=================================================
|
|
# STANDARD UPGRADE STEPS
|
|
#=================================================
|
|
# STOP SYSTEMD SERVICE
|
|
#=================================================
|
|
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
|
|
|
|
if [ -z "$registration_enabled" ]; then
|
|
registration_enabled="true"
|
|
ynh_app_setting_set --app=$app --key=registration_enabled --value=$registration_enabled
|
|
fi
|
|
|
|
if [ -z "$login_enabled" ]; then
|
|
login_enabled="true"
|
|
ynh_app_setting_set --app=$app --key=login_enabled --value=$login_enabled
|
|
fi
|
|
|
|
if [ -z "$captcha_enabled" ]; then
|
|
captcha_enabled="true"
|
|
ynh_app_setting_set --app=$app --key=captcha_enabled --value=$captcha_enabled
|
|
fi
|
|
|
|
# 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
|
|
#=================================================
|
|
ynh_script_progression --message="Upgrading dependencies..." --weight=8
|
|
|
|
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
|
|
|
ynh_exec_warn_less curl -fsSL https://crystal-lang.org/install.sh | bash -s -- --channel=stable
|
|
|
|
#=================================================
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
#=================================================
|
|
|
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
|
then
|
|
ynh_script_progression --message="Upgrading source files..." --weight=5
|
|
|
|
pushd $final_path
|
|
chown -R $app:www-data "$final_path"
|
|
git config --system --add safe.directory $final_path
|
|
|
|
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 $final_path/src/invidious.cr --release
|
|
popd
|
|
fi
|
|
|
|
chmod 750 "$final_path"
|
|
chmod -R o-rwx "$final_path"
|
|
chown -R $app:www-data "$final_path"
|
|
|
|
#=================================================
|
|
# NGINX CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2
|
|
|
|
# Create a dedicated NGINX config
|
|
ynh_add_nginx_config
|
|
|
|
#=================================================
|
|
# MODIFY A CONFIG FILE
|
|
#=================================================
|
|
ynh_script_progression --message="Modifying a config file..."
|
|
|
|
ynh_add_config --template="../conf/config.yml" --destination="$final_path/config/config.yml"
|
|
chmod 600 $final_path/config/config.yml
|
|
|
|
#=================================================
|
|
# SETUP SYSTEMD
|
|
#=================================================
|
|
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
|
|
#=================================================
|
|
# SETUP LOGROTATE
|
|
#=================================================
|
|
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
|
|
|
|
# Use logrotate to manage app-specific logfile(s)
|
|
ynh_use_logrotate --non-append
|
|
|
|
#=================================================
|
|
# INTEGRATE SERVICE IN YUNOHOST
|
|
#=================================================
|
|
ynh_script_progression --message="Integrating service in YunoHost..." --weight=3
|
|
|
|
yunohost service add $app --description="Invidious is an alternative front-end to YouTube" --log="/var/log/$app/$app.log"
|
|
|
|
#=================================================
|
|
# START SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
|
|
|
ynh_systemd_action --service_name=$app --action=restart --log_path=systemd
|
|
|
|
#=================================================
|
|
# RELOAD NGINX
|
|
#=================================================
|
|
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
|
|
|
ynh_systemd_action --service_name=nginx --action=reload
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Upgrade of Invidious completed" --last
|