1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/photoprism_ynh.git synced 2024-09-03 19:56:41 +02:00
This commit is contained in:
Thomas 2023-03-29 21:26:26 +02:00 committed by Félix Piédallu
parent add54b0416
commit 3c07c05f49

View file

@ -14,85 +14,25 @@ source /usr/share/yunohost/helpers
# RETRIEVE ARGUMENTS FROM THE MANIFEST # RETRIEVE ARGUMENTS FROM THE MANIFEST
#================================================= #=================================================
#REMOVEME? domain=$YNH_APP_ARG_DOMAIN
#REMOVEME? path=$YNH_APP_ARG_PATH
#REMOVEME? is_public=$YNH_APP_ARG_IS_PUBLIC
#REMOVEME? language=$YNH_APP_ARG_LANGUAGE
#REMOVEME? password=$YNH_APP_ARG_PASSWORD
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
if [ $language == "fr" ]; then if [ $language == "fr" ]; then
language_key="french" language_key="french"
else else
language_key="english" language_key="english"
fi fi
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
#REMOVEME? ynh_script_progression --message="Validating installation parameters..."
#REMOVEME? install_dir=/var/www/$app
#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder"
# Register (book) web path
#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path
#================================================= #=================================================
# STORE SETTINGS FROM MANIFEST # STORE SETTINGS FROM MANIFEST
#================================================= #=================================================
#REMOVEME? ynh_script_progression --message="Storing installation settings..."
#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain
#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path
ynh_app_setting_set --app=$app --key=language_key --value=$language_key ynh_app_setting_set --app=$app --key=language_key --value=$language_key
#REMOVEME? ynh_app_setting_set --app=$app --key=password --value=$password
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# FIND AND OPEN A PORT
#=================================================
#REMOVEME? ynh_script_progression --message="Finding an available port..."
# Find an available port
#REMOVEME? port=$(ynh_find_port --port=8095)
#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port
#=================================================
# INSTALL DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Installing dependencies..."
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
#REMOVEME? ynh_script_progression --message="Configuring system user..."
# Create a system user
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
#=================================================
# CREATE A MYSQL DATABASE
#=================================================
#REMOVEME? ynh_script_progression --message="Creating a MySQL database..."
#REMOVEME? db_name=$(ynh_sanitize_dbid --db_name=$app)
#REMOVEME? db_user=$db_name
#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name
#REMOVEME? ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." ynh_script_progression --message="Setting up source files..."
#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
# 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="$install_dir/build/" --source_id="docker-image-extract" ynh_setup_source
chmod 750 "$install_dir" chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir" chmod -R o-rwx "$install_dir"
@ -113,14 +53,15 @@ ynh_add_nginx_config
#================================================= #=================================================
ynh_script_progression --message="Making install..." ynh_script_progression --message="Making install..."
# Install photoprism Install photoprism
# pushd $install_dir/build pushd $install_dir/build
# detect_arch detect_arch
# ./docker-image-extract photoprism/photoprism:$PHOTOPRISM_VERSION ./docker-image-extract photoprism/photoprism:$PHOTOPRISM_VERSION
#popd popd
mkdir -p "$install_dir/live/" mkdir -p "$install_dir/live/"
rsync -a "$install_dir/build/output/opt/photoprism/" "$install_dir/live/" rsync -a "$install_dir/build/output/opt/photoprism/" "$install_dir/live/"
#REMOVEME? ynh_secure_remove --file="$install_dir/build" ynh_secure_remove --file="$install_dir/build"
chmod 750 "$install_dir" chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir" chmod -R o-rwx "$install_dir"
@ -131,12 +72,9 @@ chown -R $app:$app "$install_dir"
#================================================= #=================================================
ynh_script_progression --message="Creating a data directory..." ynh_script_progression --message="Creating a data directory..."
#REMOVEME? data_dir=/home/yunohost.app/$app
#REMOVEME? ynh_app_setting_set --app=$app --key=data_dir --value=$data_dir
mkdir -p $data_dir mkdir -p $data_dir
rsync -a "$install_dir/live/assets/" "$data_dir/assets/" rsync -a "$install_dir/live/assets/" "$data_dir/assets/"
#REMOVEME? ynh_secure_remove --file="$install_dir/live/assets/" ynh_secure_remove --file="$install_dir/live/assets/"
chmod 750 "$data_dir" chmod 750 "$data_dir"
chmod -R o-rwx "$data_dir" chmod -R o-rwx "$data_dir"
@ -185,29 +123,6 @@ ynh_script_progression --message="Starting a systemd service..."
# Start a systemd service # Start a systemd service
ynh_exec_warn_less ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="http: starting web server at" ynh_exec_warn_less ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="http: starting web server at"
#=================================================
# SETUP SSOWAT
#=================================================
#REMOVEME? ynh_script_progression --message="Configuring permissions..."
# Make app public if necessary
#REMOVEME? if [ $is_public -eq 1 ]
then
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
#REMOVEME? ynh_permission_update --permission="main" --add="visitors"
fi
# Permission to make link-sharing work
#REMOVEME? ynh_permission_create --permission="sharing" --url="/s" --allowed="visitors" --show_tile="false" --protected="true"
#=================================================
# RELOAD NGINX
#=================================================
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..."
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================