mirror of
https://github.com/YunoHost-Apps/haste_ynh.git
synced 2024-09-03 20:36:28 +02:00
Testing (#37)
* Fix check_process warning * Update change_url * Update manifest.json * Fix linter warning * Update remove * Set badge in SVG * Use SVG for badge * Finding an available port * Patch (#21) * Fix linter warnings * Small fixes * Cleaning up * Update manifest.json * Cleaning up * Fix badges * [autopatch] Update issue and PR templates (#25) Co-authored-by: Yunohost-Bot <> * Add templates * Fix * Update restore * Fix * Update install * Fix * Update check_process * Patch (#27) * Fix * Auto-update README * Update systemd.service * Update nginx.conf Co-authored-by: Yunohost-Bot <> * Update manifest.json * 4.3 * Fix ynh_npm * Add purge option * Auto-update README * Update version (#30) * update * Auto-update README Co-authored-by: Yunohost-Bot <> * Upgrade (#32) * Fix * Auto-update README Co-authored-by: yunohost-bot <yunohost@yunohost.org> * Update _common.sh (#34) * Update _common.sh * Fix * cleaning up * Update manifest.json * Auto-update README * Auto-update README * set relative path for --keep opt * Auto-update README * Update manifest.json * Auto-update README * Upgrade to upstream * Auto-update README * Reorder script * Update restore Co-authored-by: Alexandre Aubin <alex.aubin@mailoo.org> Co-authored-by: YunoHost Bot <yunohost-bot@users.noreply.github.com> Co-authored-by: Yunohost-Bot <> Co-authored-by: yunohost-bot <yunohost@yunohost.org> Co-authored-by: yalh76 <yalh@yahoo.com>
This commit is contained in:
parent
b9928f90c8
commit
fef61b5470
7 changed files with 55 additions and 62 deletions
|
@ -18,8 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
|
|||
Haste is an open-source pastebin software written in node.js, which is easily installable in any network. YunoHost Project uses Haste as pastebin for log sharing: [paste.yunohost.org](https://paste.yunohost.org/)
|
||||
|
||||
|
||||
**Shipped version:** 0.1.0~ynh12
|
||||
|
||||
**Shipped version:** 0.1.0~ynh13
|
||||
|
||||
**Demo:** http://hastebin.com/
|
||||
|
||||
|
|
|
@ -18,8 +18,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
|
|||
Haste est un logiciel pastebin open-source écrit en node.js, facilement installable sur n'importe quel réseau. Le projet YunoHost utilise Haste comme pastebin pour le partage de log : [paste.yunohost.org](https://paste.yunohost.org/)
|
||||
|
||||
|
||||
**Version incluse :** 0.1.0~ynh12
|
||||
|
||||
**Version incluse :** 0.1.0~ynh13
|
||||
|
||||
**Démo :** http://hastebin.com/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
SOURCE_URL=https://github.com/seejohnrun/haste-server/archive/72863858338a57d54eb9dee55530e90ebbc22453.tar.gz
|
||||
SOURCE_SUM=0a9cfd42748e4410a3aa340d99ed6473962a013e9d5607b86121c32d5e0a5dd8
|
||||
SOURCE_URL=https://github.com/seejohnrun/haste-server/archive/7c65fb2f9b2e4b292e03c5d70957431bcc27d2c0.tar.gz
|
||||
SOURCE_SUM=8d420e2b47a640b38230114551ddffe86489cb6607af0659740385e6a9e36ebd
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"en": "Open-source pastebin allowing to upload texts",
|
||||
"fr": "Pastebin open-source permettant de mettre en ligne du texte"
|
||||
},
|
||||
"version": "0.1.0~ynh12",
|
||||
"version": "0.1.0~ynh13",
|
||||
"url": "http://hastebin.com/",
|
||||
"upstream": {
|
||||
"license": "MIT",
|
||||
|
|
|
@ -56,6 +56,14 @@ ynh_script_progression --message="Finding an available port..." --weight=2
|
|||
port=$(ynh_find_port --port=7777)
|
||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..." --weight=3
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
@ -73,14 +81,6 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2
|
|||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..." --weight=3
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
|
@ -115,7 +115,7 @@ popd
|
|||
ynh_script_progression --message="Creating the data directory..." --weight=1
|
||||
|
||||
# Define app's data directory
|
||||
data_path="/home/yunohost.app/${app}"
|
||||
data_path=/home/yunohost.app/$app
|
||||
ynh_app_setting_set --app=$app --key=data_path --value=$data_path
|
||||
|
||||
# Create app folders
|
||||
|
|
|
@ -33,16 +33,18 @@ data_path=$(ynh_app_setting_get --app=$app --key=data_path)
|
|||
#=================================================
|
||||
ynh_script_progression --message="Validating restoration parameters..." --weight=2
|
||||
|
||||
test ! -d $final_path || ynh_die "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
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
|
||||
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
|
@ -51,13 +53,16 @@ ynh_script_progression --message="Restoring the app main directory..." --weight=
|
|||
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORE
|
||||
|
@ -88,15 +93,6 @@ chown -R $app:www-data "$data_path"
|
|||
ynh_script_progression --message="Restoring various files..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/usr/bin/$app"
|
||||
|
||||
#=================================================
|
||||
# SECURE FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
chown -R $app: "$data_path"
|
||||
chmod +x /usr/bin/$app
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -27,6 +27,27 @@ data_path=$(ynh_app_setting_get --app=$app --key=data_path)
|
|||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --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
|
||||
|
||||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
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
|
||||
#=================================================
|
||||
|
@ -52,28 +73,15 @@ if ynh_legacy_permissions_exists; then
|
|||
ynh_app_setting_delete --app=$app --key=is_public
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --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
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=2
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
|
@ -95,14 +103,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
|
|||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=2
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
|
@ -135,8 +135,7 @@ ynh_use_logrotate --non-append
|
|||
#=================================================
|
||||
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
|
||||
|
||||
ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service"
|
||||
|
||||
env_path="$PATH"
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
|
|
Loading…
Reference in a new issue