1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/jellyfin-vue_ynh.git synced 2024-09-03 19:26:31 +02:00

[autopatch] Automatic patch attempt for helpers 2.1

This commit is contained in:
Yunohost-Bot 2024-08-31 00:57:24 +02:00 committed by Alexandre Aubin
parent eb6984957c
commit 091ba66f9f
9 changed files with 52 additions and 110 deletions

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
*~ *~
*.sw[op] *.sw[op]
.DS_Store

View file

@ -19,7 +19,8 @@ demo = "https://jf-vue.pages.dev"
fund = "https://opencollective.com/jellyfin" fund = "https://opencollective.com/jellyfin"
[integration] [integration]
yunohost = ">= 11.2" yunohost = ">= 11.2.18"
helpers_version = "2.1"
architectures = "all" architectures = "all"
multi_instance = true multi_instance = true
ldap = true ldap = true
@ -54,6 +55,7 @@ ram.runtime = "0M"
[resources.system_user] [resources.system_user]
[resources.install_dir] [resources.install_dir]
group = "www-data:r-x"
[resources.permissions] [resources.permissions]
main.url = "/" main.url = "/"

View file

@ -1,15 +1,11 @@
#!/bin/bash #!/bin/bash
#================================================= #=================================================
# COMMON VARIABLES # COMMON VARIABLES AND CUSTOM HELPERS
#================================================= #=================================================
nodejs_version=20 nodejs_version=20
#=================================================
# PERSONAL HELPERS
#=================================================
_patch_config_json() { _patch_config_json() {
sourcedir=$1 sourcedir=$1
@ -24,21 +20,19 @@ _npm_build_install() {
targetdir=$2 targetdir=$2
subpath=$3 subpath=$3
ynh_use_nodejs
pushd "$sourcedir/frontend" || ynh_die "Could not pushd $sourcedir/frontend" pushd "$sourcedir/frontend" || ynh_die "Could not pushd $sourcedir/frontend"
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" \ ynh_hide_warnings ynh_exec_as_app node_load_PATH" \
"$ynh_npm" ci --no-audit --ignore-scripts npm ci --no-audit --ignore-scripts
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" \ ynh_hide_warnings ynh_exec_as_app node_load_PATH" \
"$ynh_npm" run build npm run build
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" \ ynh_hide_warnings ynh_exec_as_app node_load_PATH" \
"$ynh_npm" cache clean --force npm cache clean --force
popd || ynh_die "Could not popd" popd || ynh_die "Could not popd"
ynh_secure_remove --file="$targetdir" ynh_safe_rm "$targetdir"
mv "$sourcedir/frontend/dist" "$targetdir" mv "$sourcedir/frontend/dist" "$targetdir"
} }
_list_jellyfin_urls() { _list_jellyfin_urls() {
yunohost app list --full --json \ yunohost app list --full --json \
| jq -r '.apps[] | select(.manifest.id=="jellyfin") | .domain_path' | jq -r '.apps[] | select(.manifest.id=="jellyfin") | .domain_path'
@ -60,11 +54,3 @@ with open(file, "w", encoding="utf-8") as configfile:
_append_to_server_urls() { _append_to_server_urls() {
python3 -c "$PYTHON_APPEND_TO_SERVER_URLS" "$@" python3 -c "$PYTHON_APPEND_TO_SERVER_URLS" "$@"
} }
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================

View file

@ -1,34 +1,25 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= ynh_print_info "Declaring files to be backed up..."
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
#================================================= #=================================================
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_backup --src_path="$install_dir" ynh_backup "$install_dir"
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -1,29 +1,21 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# STANDARD MODIFICATIONS
#================================================= #=================================================
# MODIFY URL IN NGINX CONF # MODIFY URL IN NGINX CONF
#================================================= #=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 ynh_script_progression "Updating NGINX web server configuration..."
ynh_change_url_nginx_config ynh_config_change_url_nginx
#================================================= #=================================================
# SPECIFIC MODIFICATIONS # SPECIFIC MODIFICATIONS
#================================================= #=================================================
# Build Jellyfin-vue # Build Jellyfin-vue
#================================================= #=================================================
ynh_script_progression --message="Building Jellyfin Vue... (this will take some time and resources!)" --weight=24 ynh_script_progression "Building Jellyfin Vue... (this will take some time and resources!)"
# Already patched in install script # Already patched in install script
# _patch_config_json "$install_dir/source" # _patch_config_json "$install_dir/source"
@ -33,7 +25,7 @@ _npm_build_install "$install_dir/source" "$install_dir/www" "$path/"
#================================================= #=================================================
# ADD A CONFIGURATION # ADD A CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1 ynh_script_progression "Adding $app's configuration..."
# Check if Jellyfin is installed, and configure it as defaultServerURL. # Check if Jellyfin is installed, and configure it as defaultServerURL.
for url in $(_list_jellyfin_urls); do for url in $(_list_jellyfin_urls); do
@ -44,4 +36,4 @@ done
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Change of URL completed for $app" --last ynh_script_progression "Change of URL completed for $app"

View file

@ -1,11 +1,5 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -14,26 +8,25 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." --weight=1 ynh_script_progression "Setting up source files..."
ynh_setup_source --dest_dir="$install_dir/source" ynh_setup_source --dest_dir="$install_dir/source"
chown -R $app:www-data "$install_dir" #REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Installing NodeJS..." --weight=20 ynh_script_progression "Installing NodeJS..."
# Install Nodejs # Install Nodejs
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version ynh_nodejs_install
#================================================= #=================================================
# SPECIFIC SETUP # SPECIFIC SETUP
#================================================= #=================================================
# Build Jellyfin-vue # Build Jellyfin-vue
#================================================= #=================================================
ynh_script_progression --message="Building Jellyfin Vue... (this will take some time and resources!)" --weight=24 ynh_script_progression "Building Jellyfin Vue... (this will take some time and resources!)"
_patch_config_json "$install_dir/source" _patch_config_json "$install_dir/source"
_npm_build_install "$install_dir/source" "$install_dir/www" "$path/" _npm_build_install "$install_dir/source" "$install_dir/www" "$path/"
@ -41,17 +34,17 @@ _npm_build_install "$install_dir/source" "$install_dir/www" "$path/"
#================================================= #=================================================
# SYSTEM CONFIGURATION # SYSTEM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 ynh_script_progression "Adding system configurations related to $app..."
# Create a dedicated NGINX config using the conf/nginx.conf template # Create a dedicated NGINX config using the conf/nginx.conf template
ynh_add_nginx_config ynh_config_add_nginx
#================================================= #=================================================
# APP INITIAL CONFIGURATION # APP INITIAL CONFIGURATION
#================================================= #=================================================
# ADD A CONFIGURATION # ADD A CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1 ynh_script_progression "Adding $app's configuration..."
# Check if Jellyfin is installed, and configure it as defaultServerURL. # Check if Jellyfin is installed, and configure it as defaultServerURL.
for url in $(_list_jellyfin_urls); do for url in $(_list_jellyfin_urls); do
@ -61,4 +54,4 @@ done
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Installation of $app completed" --last ynh_script_progression "Installation of $app completed"

View file

@ -1,11 +1,5 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -14,12 +8,12 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# REMOVE SYSTEMD SERVICE # REMOVE SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 ynh_script_progression "Removing system configurations related to $app..."
ynh_remove_nginx_config ynh_config_remove_nginx
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Removal of $app completed" --last ynh_script_progression "Removal of $app completed"

View file

@ -1,11 +1,5 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -13,30 +7,27 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=1 ynh_script_progression "Restoring the app main directory..."
ynh_restore_file --origin_path="$install_dir" ynh_restore "$install_dir"
chown -R $app:www-data "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
#================================================= #=================================================
# RESTORE SYSTEM CONFIGURATIONS # RESTORE SYSTEM CONFIGURATIONS
#================================================= #=================================================
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 ynh_script_progression "Restoring system configurations related to $app..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# GENERIC FINALIZATION
#================================================= #=================================================
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE # RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 ynh_script_progression "Reloading NGINX web server and $app's service..."
ynh_systemd_action --service_name=nginx --action=reload ynh_systemctl --service=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Restoration completed for $app" --last ynh_script_progression "Restoration completed for $app"

View file

@ -1,11 +1,5 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -14,36 +8,34 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Upgrading source files..." --weight=1 ynh_script_progression "Upgrading source files..."
ynh_setup_source --dest_dir="$install_dir/source" --full_replace=1 ynh_setup_source --dest_dir="$install_dir/source" --full_replace
chown -R $app:www-data "$install_dir" #REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
ynh_script_progression "Installing NodeJS..."
ynh_script_progression --message="Installing NodeJS..." --weight=20
# Install Nodejs # Install Nodejs
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version ynh_nodejs_install
ynh_script_progression --message="Building Jellyfin Vue... (this will take some time and resources!)" --weight=24 ynh_script_progression "Building Jellyfin Vue... (this will take some time and resources!)"
_patch_config_json "$install_dir/source" _patch_config_json "$install_dir/source"
_npm_build_install "$install_dir/source" "$install_dir/www" "$path/" _npm_build_install "$install_dir/source" "$install_dir/www" "$path/"
chown -R $app:www-data "$install_dir" #REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
#================================================= #=================================================
# REAPPLY SYSTEM CONFIGURATIONS # REAPPLY SYSTEM CONFIGURATIONS
#================================================= #=================================================
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 ynh_script_progression "Upgrading system configurations related to $app..."
ynh_add_nginx_config ynh_config_add_nginx
#================================================= #=================================================
# RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...) # RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...)
#================================================= #=================================================
# UPDATE A CONFIG FILE # UPDATE A CONFIG FILE
#================================================= #=================================================
ynh_script_progression --message="Updating a configuration file..." --weight=1 ynh_script_progression "Updating configuration..."
# Check if Jellyfin is installed, and configure it as defaultServerURL. # Check if Jellyfin is installed, and configure it as defaultServerURL.
for url in $(_list_jellyfin_urls); do for url in $(_list_jellyfin_urls); do
@ -54,4 +46,4 @@ done
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Upgrade of $app completed" --last ynh_script_progression "Upgrade of $app completed"