mirror of
https://github.com/YunoHost-Apps/photoview_ynh.git
synced 2024-09-03 20:05:55 +02:00
Apply last example_ynh
This commit is contained in:
parent
ea21f66716
commit
e917b72d4b
14 changed files with 101 additions and 112 deletions
0
doc/.gitkeep
Normal file
0
doc/.gitkeep
Normal file
1
doc/DESCRIPTION.md
Normal file
1
doc/DESCRIPTION.md
Normal file
|
@ -0,0 +1 @@
|
|||
Photoview is a simple and user-friendly photo gallery that's made for photographers and aims to provide an easy and fast way to navigate directories, with thousands of high resolution photos.
|
0
doc/DISCLAIMER.md
Normal file
0
doc/DISCLAIMER.md
Normal file
0
doc/screenshots/.gitkeep
Normal file
0
doc/screenshots/.gitkeep
Normal file
BIN
doc/screenshots/screenshot1.png
Normal file
BIN
doc/screenshots/screenshot1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 MiB |
|
@ -8,13 +8,20 @@
|
|||
},
|
||||
"version": "2.3.9~ynh2",
|
||||
"url": "https://photoview.github.io/",
|
||||
"upstream": {
|
||||
"license": "AGPL-3.0-only",
|
||||
"website": "https://photoview.github.io/",
|
||||
"demo": "https://photos.qpqp.dk/",
|
||||
"admindoc": "https://photoview.github.io/docs/",
|
||||
"code": "https://github.com/photoview/photoview"
|
||||
},
|
||||
"license": "AGPL-3.0-only",
|
||||
"maintainer": {
|
||||
"name": "Jules Bertholet",
|
||||
"email": "jules.bertholet@gmail.com"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 4.1.7"
|
||||
"yunohost": ">= 4.3.0"
|
||||
},
|
||||
"multi_instance": true,
|
||||
"services": [
|
||||
|
@ -22,11 +29,15 @@
|
|||
"mysql"
|
||||
],
|
||||
"arguments": {
|
||||
"install" : [
|
||||
"install": [
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain",
|
||||
"example": "example.com"
|
||||
"type": "domain"
|
||||
},
|
||||
{
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"name": "mapbox_token",
|
||||
|
@ -41,11 +52,6 @@
|
|||
"en": "Required for mapping features. You can get one for free at https://www.mapbox.com/",
|
||||
"fr": "Nécessaire pour les fonctionnalités cartographiques. Vous pouvez en obtenir une gratuitement à https://www.mapbox.com/"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers
|
|||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup() {
|
||||
ynh_clean_setup () {
|
||||
true
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
|
@ -28,9 +28,9 @@ ynh_print_info --message="Loading installation settings..."
|
|||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
data_path=$(ynh_app_setting_get --app=$app --key=data_path)
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
data_path=$(ynh_app_setting_get --app=$app --key=data_path)
|
||||
|
||||
#=================================================
|
||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||
|
@ -69,18 +69,12 @@ ynh_backup --src_path="/etc/logrotate.d/$app"
|
|||
|
||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||
|
||||
#=================================================
|
||||
# BACKUP VARIOUS FILES
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/var/log/$app"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_print_info --message="Backing up the MySQL database..."
|
||||
|
||||
ynh_mysql_dump_db --database="$db_name" >db.sql
|
||||
ynh_mysql_dump_db --database="$db_name" > db.sql
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -40,13 +40,14 @@ data_path=$(ynh_app_setting_get --app=$app --key=data_path)
|
|||
mapbox_token=$(ynh_app_setting_get --app=$app --key=mapbox_token)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=35
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup() {
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
||||
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
|
||||
|
@ -61,7 +62,8 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
|
||||
change_domain=0
|
||||
if [ "$old_domain" != "$new_domain" ]; then
|
||||
if [ "$old_domain" != "$new_domain" ]
|
||||
then
|
||||
change_domain=1
|
||||
fi
|
||||
|
||||
|
@ -84,7 +86,8 @@ ynh_script_progression --message="Updating NGINX web server configuration..." --
|
|||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||
|
||||
# Change the domain for NGINX
|
||||
if [ $change_domain -eq 1 ]; then
|
||||
if [ $change_domain -eq 1 ]
|
||||
then
|
||||
# Delete file checksum for the old conf file location
|
||||
ynh_delete_file_checksum --file="$nginx_conf_path"
|
||||
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
||||
|
@ -107,6 +110,7 @@ ynh_add_config --template=".env" --destination="$final_path/output/.env"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -13,8 +13,8 @@ source /usr/share/yunohost/helpers
|
|||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup() {
|
||||
true
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
@ -39,7 +39,6 @@ final_path=/opt/yunohost/$app
|
|||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||
|
||||
data_path=/home/yunohost.app/$app
|
||||
test ! -e "$data_path" || ynh_die --message="This path already contains a folder"
|
||||
|
||||
# Register (book) web path
|
||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||
|
@ -56,7 +55,7 @@ ynh_app_setting_set --app=$app --key=mapbox_token --value=$mapbox_token
|
|||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
# FIND PORTS
|
||||
# FIND AND OPEN A PORT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Finding an available port..." --weight=1
|
||||
|
||||
|
@ -70,6 +69,8 @@ ynh_app_setting_set --app=$app --key=port --value=$port
|
|||
ynh_script_progression --message="Installing dependencies..." --weight=60
|
||||
|
||||
install_dependencies
|
||||
set_go_vars
|
||||
set_node_vars
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
|
@ -136,11 +137,12 @@ build_ui
|
|||
ynh_script_progression --message="Configuring a systemd service..." --weight=1
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config --service=$app
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
# ADD A CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding a configuration file..."
|
||||
|
||||
ynh_add_config --template=".env" --destination="$final_path/output/.env"
|
||||
|
||||
|
@ -177,7 +179,8 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap
|
|||
ynh_script_progression --message="Configuring permissions..." --weight=1
|
||||
|
||||
# Make app public if necessary
|
||||
if [ $is_public -eq 1 ]; then
|
||||
if [ $is_public -eq 1 ]
|
||||
then
|
||||
# Everyone can access the app.
|
||||
# The "main" permission is automatically created before the install script.
|
||||
ynh_permission_update --permission="main" --add="visitors"
|
||||
|
|
|
@ -43,7 +43,15 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
|
|||
|
||||
# Remove the dedicated systemd config
|
||||
ynh_remove_systemd_config
|
||||
I
|
||||
|
||||
#=================================================
|
||||
# REMOVE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
|
||||
|
||||
# Remove the app-specific logrotate config
|
||||
ynh_remove_logrotate
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
|
@ -52,14 +60,6 @@ ynh_script_progression --message="Removing the MySQL database..." --weight=1
|
|||
# Remove a database if it exists, along with the associated user
|
||||
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing dependencies..." --weight=5
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
|
@ -85,12 +85,14 @@ ynh_script_progression --message="Removing NGINX web server configuration..." --
|
|||
ynh_remove_nginx_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE LOGROTATE CONFIGURATION
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
|
||||
ynh_script_progression --message="Removing dependencies..." --weight=5
|
||||
|
||||
# Remove the app-specific logrotate config
|
||||
ynh_remove_logrotate
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_go
|
||||
ynh_remove_nodejs
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC REMOVE
|
||||
|
@ -101,20 +103,6 @@ ynh_remove_logrotate
|
|||
# Remove the log files
|
||||
ynh_secure_remove --file="/var/log/$app"
|
||||
|
||||
#=================================================
|
||||
# REMOVE GO
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing Go..." --weight=1
|
||||
|
||||
ynh_remove_go
|
||||
|
||||
#=================================================
|
||||
# REMOVE NODE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing Node.js..." --weight=1
|
||||
|
||||
ynh_remove_nodejs
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
|
|
@ -15,7 +15,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
|
||||
ynh_clean_setup() {
|
||||
true
|
||||
ynh_clean_check_starting
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
@ -42,36 +42,26 @@ mapbox_token=$(ynh_app_setting_get --app=$app --key=mapbox_token)
|
|||
#=================================================
|
||||
ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
||||
|
||||
ynh_webpath_available --domain=$domain --path_url=$path_url ||
|
||||
ynh_die --message="Path not available: ${domain}${path_url}"
|
||||
test ! -d $final_path ||
|
||||
ynh_die --message="There is already a directory: $final_path "
|
||||
test ! -d $final_path \
|
||||
|| ynh_die --message="There is already a directory: $final_path "
|
||||
|
||||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the NGINX web server configuration..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
||||
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=30
|
||||
|
||||
# Define and install dependencies
|
||||
install_dependencies
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
|
@ -84,7 +74,6 @@ set_permissions
|
|||
#=================================================
|
||||
# RESTORE THE APP DATA DIR
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Restoring the app data directory..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="$data_path" --not_mandatory
|
||||
|
@ -93,6 +82,16 @@ set_permissions
|
|||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=30
|
||||
|
||||
# Define and install dependencies
|
||||
install_dependencies
|
||||
set_go_vars
|
||||
set_node_vars
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
|
@ -100,21 +99,7 @@ ynh_script_progression --message="Restoring the MySQL database..." --weight=1
|
|||
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name <./db.sql
|
||||
|
||||
#=================================================
|
||||
# RESTORE GO
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring Go..." --weight=1
|
||||
|
||||
set_go_vars
|
||||
|
||||
#=================================================
|
||||
# RESTORE NODE.JS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring Node.js..." --weight=1
|
||||
|
||||
set_node_vars
|
||||
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEMD
|
||||
|
@ -124,6 +109,15 @@ 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 THE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the logrotate configuration..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||
|
||||
set_permissions
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
|
@ -138,20 +132,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
|
|||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# RESTORE VARIOUS FILES
|
||||
#=================================================
|
||||
|
||||
ynh_restore_file --origin_path="/var/log/$app"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||
|
||||
set_permissions
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
|
|
@ -29,6 +29,7 @@ mapbox_token=$(ynh_app_setting_get --app=$app --key=mapbox_token)
|
|||
#=================================================
|
||||
# CHECK VERSION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Checking version..."
|
||||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
|
@ -39,7 +40,8 @@ ynh_script_progression --message="Backing up the app before upgrading (may take
|
|||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup() {
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
|
@ -55,6 +57,18 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
|||
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..."
|
||||
|
||||
# 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
|
||||
#=================================================
|
||||
|
@ -63,13 +77,6 @@ ynh_script_progression --message="Making sure dedicated system user exists..." -
|
|||
# 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=1
|
||||
|
||||
install_dependencies
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
@ -88,9 +95,18 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
|
|||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..." --weight=1
|
||||
|
||||
install_dependencies
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
# BUILD APP
|
||||
#=================================================
|
||||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]; then
|
||||
#=================================================
|
||||
|
@ -121,11 +137,12 @@ fi
|
|||
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config --service=$app
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
# UPDATE A CONFIG FILE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating a configuration file..."
|
||||
|
||||
ynh_add_config --template=".env" --destination="$final_path/output/.env"
|
||||
|
||||
|
|
2
sources/extra_files/app/.gitignore
vendored
2
sources/extra_files/app/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
|||
*~
|
||||
*.sw[op]
|
2
sources/patches/.gitignore
vendored
2
sources/patches/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
|||
*~
|
||||
*.sw[op]
|
Loading…
Add table
Reference in a new issue