mirror of
https://github.com/YunoHost-Apps/lychee_ynh.git
synced 2024-09-03 19:36:36 +02:00
Fix
This commit is contained in:
parent
5ad6429800
commit
f97b72a21a
4 changed files with 35 additions and 82 deletions
|
@ -5,72 +5,20 @@
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
YNH_PHP_VERSION=7.4
|
YNH_PHP_VERSION=7.4
|
||||||
YNH_COMPOSER_VERSION=2.0.8
|
YNH_COMPOSER_VERSION=2.0.13
|
||||||
extra_php_dependencies="php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-bcmath php${YNH_PHP_VERSION}-exif php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-mysqli php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-zip"
|
extra_php_dependencies="php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-bcmath php${YNH_PHP_VERSION}-exif php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-mysqli php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-zip"
|
||||||
|
|
||||||
# needed for raw upload and video playback
|
# needed for raw upload and video playback
|
||||||
pkg_dependencies="ufraw-batch ffmpeg"
|
pkg_dependencies="ufraw-batch ffmpeg"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# PERSONAL HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# EXPERIMENTAL HELPERS
|
# EXPERIMENTAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# readonly YNH_DEFAULT_COMPOSER_VERSION=1.10.17
|
#=================================================
|
||||||
# # Declare the actual composer version to use.
|
# FUTURE OFFICIAL HELPERS
|
||||||
# # A packager willing to use another version of composer can override the variable into its _common.sh.
|
#=================================================
|
||||||
# YNH_COMPOSER_VERSION=${YNH_COMPOSER_VERSION:-$YNH_DEFAULT_COMPOSER_VERSION}
|
|
||||||
|
|
||||||
# # Execute a command with Composer
|
|
||||||
# #
|
|
||||||
# # usage: ynh_composer_exec [--phpversion=phpversion] [--workdir=$final_path] --commands="commands"
|
|
||||||
# # | arg: -v, --phpversion - PHP version to use with composer
|
|
||||||
# # | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path.
|
|
||||||
# # | arg: -c, --commands - Commands to execute.
|
|
||||||
# ynh_composer_exec () {
|
|
||||||
# # Declare an array to define the options of this helper.
|
|
||||||
# local legacy_args=vwc
|
|
||||||
# declare -Ar args_array=( [v]=phpversion= [w]=workdir= [c]=commands= )
|
|
||||||
# local phpversion
|
|
||||||
# local workdir
|
|
||||||
# local commands
|
|
||||||
# # Manage arguments with getopts
|
|
||||||
# ynh_handle_getopts_args "$@"
|
|
||||||
# workdir="${workdir:-$final_path}"
|
|
||||||
# phpversion="${phpversion:-$YNH_PHP_VERSION}"
|
|
||||||
|
|
||||||
# COMPOSER_HOME="$workdir/.composer" \
|
|
||||||
# php${phpversion} "$workdir/composer.phar" $commands \
|
|
||||||
# -d "$workdir" --quiet --no-interaction
|
|
||||||
# }
|
|
||||||
|
|
||||||
# # Install and initialize Composer in the given directory
|
|
||||||
# #
|
|
||||||
# # usage: ynh_install_composer [--phpversion=phpversion] [--workdir=$final_path] [--install_args="--optimize-autoloader"] [--composerversion=composerversion]
|
|
||||||
# # | arg: -v, --phpversion - PHP version to use with composer
|
|
||||||
# # | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path.
|
|
||||||
# # | arg: -a, --install_args - Additional arguments provided to the composer install. Argument --no-dev already include
|
|
||||||
# # | arg: -c, --composerversion - Composer version to install
|
|
||||||
# ynh_install_composer () {
|
|
||||||
# # Declare an array to define the options of this helper.
|
|
||||||
# local legacy_args=vwa
|
|
||||||
# declare -Ar args_array=( [v]=phpversion= [w]=workdir= [a]=install_args= [c]=composerversion=)
|
|
||||||
# local phpversion
|
|
||||||
# local workdir
|
|
||||||
# local install_args
|
|
||||||
# local composerversion
|
|
||||||
# # Manage arguments with getopts
|
|
||||||
# ynh_handle_getopts_args "$@"
|
|
||||||
# workdir="${workdir:-$final_path}"
|
|
||||||
# phpversion="${phpversion:-$YNH_PHP_VERSION}"
|
|
||||||
# install_args="${install_args:-}"
|
|
||||||
# composerversion="${composerversion:-$YNH_COMPOSER_VERSION}"
|
|
||||||
|
|
||||||
# curl -sS https://getcomposer.org/installer 2>&1 \
|
|
||||||
# | COMPOSER_HOME="$workdir/.composer" \
|
|
||||||
# php${phpversion} -- --quiet --install-dir="$workdir" --version=$composerversion \
|
|
||||||
# || ynh_die "Unable to install Composer." 2>&1
|
|
||||||
|
|
||||||
# # update dependencies to create composer.lock
|
|
||||||
# ynh_composer_exec --phpversion="${phpversion}" --workdir="$workdir" --commands="install --no-dev $install_args" \
|
|
||||||
# || ynh_die "Unable to update core dependencies with Composer."
|
|
||||||
# }
|
|
||||||
|
|
|
@ -29,6 +29,11 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# 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
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -129,15 +129,19 @@ pushd $final_path
|
||||||
popd
|
popd
|
||||||
|
|
||||||
# Setup custom user.css file
|
# Setup custom user.css file
|
||||||
cp ../conf/user.css.example $final_path/public/dist/user.css
|
ynh_add_config --template="../conf/user.css.example" --destination="$final_path/public/dist/user.css"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SECURE FILES AND DIRECTORIES
|
# SECURE FILES AND DIRECTORIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Set permissions to app files
|
# Set permissions to app files
|
||||||
chown -R $app: $final_path
|
|
||||||
chmod 750 $final_path/bootstrap/cache
|
chmod 750 "$final_path"
|
||||||
|
chmod 750 "$final_path/bootstrap/cache"
|
||||||
|
chmod -R o-rwx "$final_path"
|
||||||
|
chown -R $app:www-data "$final_path"
|
||||||
|
|
||||||
chown -R $app: $public_path
|
chown -R $app: $public_path
|
||||||
chmod 755 $public_path
|
chmod 755 $public_path
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,6 @@ version=ynh_app_upstream_version
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK VERSION
|
# CHECK VERSION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Checking version..." --weight=1
|
|
||||||
|
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
upgrade_type=$(ynh_check_app_version_changed)
|
||||||
|
|
||||||
|
@ -77,6 +76,14 @@ ynh_clean_setup () {
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# 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"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -91,11 +98,8 @@ then
|
||||||
cp -a "$final_path/public/uploads" "$public_path/uploads"
|
cp -a "$final_path/public/uploads" "$public_path/uploads"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove the app directory securely
|
|
||||||
ynh_secure_remove --file="$final_path"
|
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
ynh_setup_source --dest_dir="$final_path" --keep="$final_path/public/dist/user.css"
|
ynh_setup_source --dest_dir="$final_path" --keep="$final_path/public/dist/user.css $final_path/.env"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -113,14 +117,6 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=6
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# 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
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PHP-FPM CONFIGURATION
|
# PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -134,15 +130,15 @@ ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencie
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing Composer..." --weight=1
|
ynh_script_progression --message="Installing Composer..." --weight=1
|
||||||
|
|
||||||
ynh_install_composer --workdir="$final_path" --install_args="--ignore-platform-reqs"
|
ynh_install_composer --install_args="--ignore-platform-reqs"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP APPLICATION CONFIG
|
# SETUP APPLICATION CONFIG
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting Lychee config..."
|
# ynh_script_progression --message="Setting Lychee config..."
|
||||||
|
|
||||||
# Setup application config
|
# # Setup application config
|
||||||
ynh_add_config --template="../conf/.env.example" --destination="$final_path/.env"
|
# ynh_add_config --template="../conf/.env.example" --destination="$final_path/.env"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL AND INITIALIZE COMPOSER
|
# INSTALL AND INITIALIZE COMPOSER
|
||||||
|
@ -152,8 +148,8 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Upgrading Lychee source files..." --weight=4
|
ynh_script_progression --message="Upgrading Lychee source files..." --weight=4
|
||||||
pushd $final_path
|
pushd $final_path
|
||||||
php$phpversion artisan key:generate --no-interaction --force
|
php$phpversion artisan key:generate -n --force
|
||||||
php$phpversion artisan migrate --no-interaction --force
|
php$phpversion artisan migrate -n --force
|
||||||
popd
|
popd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue