1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/haste_ynh.git synced 2024-09-03 20:36:28 +02:00

Merge branch 'testing' into fixes

This commit is contained in:
yalh76 2020-08-09 21:00:22 +02:00
commit 5977997e47
18 changed files with 438 additions and 373 deletions

2
.gitignore vendored
View file

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

View file

@ -1,41 +1,78 @@
# Haste for YunoHost # Haste for YunoHost
Haste is an open-source pastebin software written in node.js. [![Integration level](https://dash.yunohost.org/integration/haste.svg)](https://dash.yunohost.org/appci/app/haste) ![](https://ci-apps.yunohost.org/ci/badges/haste.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/haste.maintain.svg)
[![Install Haste with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=haste)
[Haste Github repository](https://github.com/seejohnrun/haste-server) *[Lire ce readme en français.](./README_fr.md)*
A publicly available version can be found at [http://hastebin.com/](http://hastebin.com/) > *This package allows you to install Haste quickly and simply on a YunoHost server.
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Requirements ## Overview
- Functionnal instance of [YunoHost](https://yunohost.org) 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
## Screenshots
![](sources/screenshot.png)
## Demo
* [Official demo](http://hastebin.com/)
## Configuration
How to configure this app: a plain file with SSH.
## Documentation
* Official documentation: https://hastebin.com/about.md
* YunoHost documentation: If specific documentation is needed, feel free to contribute.
## YunoHost specific features
#### Multi-user support
* Are LDAP and HTTP auth supported? **No**
* Can the app be used by multiple users? **Yes**
#### Supported architectures
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/haste%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/haste/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/haste%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/haste/)
## Limitations
* Any known limitations.
## Additional information
## `haste` command ## `haste` command
With this package is included the `haste` command based on this: This Haste package for Yunohost includes the [`haste` command](https://github.com/diethnis/standalones/blob/master/hastebin.sh), allowing you to share content from terminal:
https://github.com/diethnis/standalones/blob/master/hastebin.sh
This allow to pipe text to it and upload the text on your haste instance. You can also install it on your local computer by copying the file /usr/bin/haste on a computer that has bash and curl.
```bash ```bash
cat LICENSE | haste cat something | haste
######################################################################## 100,0%
https://haste.example.com/zuyejeduzu https://haste.example.com/zuyejeduzu
``` ```
The [Haste-client](https://github.com/seejohnrun/haste-client) is a simple client for uploading data to you Haste server.
## Installation ## Links
From command line:
`sudo yunohost app install -l Haste https://github.com/YunoHost-Apps/haste_ynh` * Report a bug: https://github.com/YunoHost-Apps/haste_ynh/issues
* Upstream app repository: https://github.com/seejohnrun/haste-server
* YunoHost website: https://yunohost.org/
## Upgrade ---
From command line:
`sudo yunohost app upgrade -u https://github.com/YunoHost-Apps/haste_ynh haste` ## Developer info
## Infos Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/haste_ynh/tree/testing).
- [YunoHost forum thread](https://forum.yunohost.org/t/haste-package-pastebin-software/2038) To try the testing branch, please proceed like that.
```
## License sudo yunohost app install https://github.com/YunoHost-Apps/haste_ynh/tree/testing --debug
or
Both Haste and this package are published under MIT License sudo yunohost app upgrade haste -u https://github.com/YunoHost-Apps/haste_ynh/tree/testing --debug
```

79
README_fr.md Normal file
View file

@ -0,0 +1,79 @@
# Haste pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/haste.svg)](https://dash.yunohost.org/appci/app/haste) ![](https://ci-apps.yunohost.org/ci/badges/haste.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/haste.maintain.svg)
[![Installer Haste avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=haste)
*[Read this readme in english.](./README.md)*
> *Ce package vous permet d'installer Haste rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install) pour apprendre comment l'installer.*
## Vue d'ensemble
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
## Captures d'écran
![](sources/screenshot.png)
## Démo
* [Démo officielle](http://hastebin.com/)
## Configuration
Comment configurer cette application: un fichier brut en SSH.
## Documentation
* Documentation officielle: https://hastebin.com/about.md
* Documentation YunoHost: Si une documentation spécifique est nécessaire, n'hésitez pas à contribuer.
## Caractéristiques spécifiques YunoHost
#### Support multi-utilisateur
* L'authentification LDAP et HTTP est-elle prise en charge ? **Non**
* L'application peut-elle être utilisée par plusieurs utilisateurs ? **Oui**
#### Architectures supportées
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/haste%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/haste/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/haste%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/haste/)
## Limitations
* Limitations connues.
## Informations additionnelles
## `haste` command
Ce paquet de Haste pour YunoHost comprend une commande [`haste`](https://github.com/diethnis/standalones/blob/master/hastebin.sh), vous permettant de partager du contenu avec le terminal :
```bash
cat something | haste
https://haste.example.com/zuyejeduzu
```
Le [client Haste](https://github.com/seejohnrun/haste-client) est un client simple pour télécharger des données sur votre serveur Haste.
## Liens
* Signaler un bug : https://github.com/YunoHost-Apps/haste_ynh/issues
* Dépôt de l'application principale : https://github.com/seejohnrun/haste-server
* Site web YunoHost : https://yunohost.org/
---
## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/haste_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
```
sudo yunohost app install https://github.com/YunoHost-Apps/haste_ynh/tree/testing --debug
ou
sudo yunohost app upgrade haste -u https://github.com/YunoHost-Apps/haste_ynh/tree/testing --debug
```

View file

@ -3,6 +3,7 @@
domain="domain.tld" (DOMAIN) domain="domain.tld" (DOMAIN)
path="/" (PATH) path="/" (PATH)
is_public=1 (PUBLIC|public=1|private=0) is_public=1 (PUBLIC|public=1|private=0)
port="7777" (PORT)
; Checks ; Checks
pkg_linter=1 pkg_linter=1
setup_sub_dir=0 setup_sub_dir=0
@ -13,8 +14,8 @@
upgrade=1 upgrade=1
backup_restore=1 backup_restore=1
multi_instance=0 multi_instance=0
incorrect_path=0 # incorrect_path=0
port_already_use=1 (7777) port_already_use=1
change_url=0 change_url=0
;;; Levels ;;; Levels
Level 1=auto Level 1=auto

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://github.com/seejohnrun/haste-server/archive/f19c5d10498e214b8323fff9e5eab77cbb7eebff.tar.gz SOURCE_URL=https://github.com/seejohnrun/haste-server/archive/master.tar.gz
SOURCE_SUM=6e67fd09bc7782d23d612c209a2de39212682239018a1bd2618c120f9cc36a47 SOURCE_SUM=71d1f09b5c46d3054075fd706c8f75284bafc4b09e2df612a641c4f30837b11f
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true

View file

@ -1,6 +1,7 @@
{ {
"host": "127.0.0.1", "host": "127.0.0.1",
"port": __PORT__, "port": __PORT__,
"keyLength": 10, "keyLength": 10,

View file

@ -1,4 +1,5 @@
location __PATH__ { #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ {
if ($scheme = http) { if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent; rewrite ^ https://$server_name$request_uri? permanent;

View file

@ -1,16 +1,16 @@
[Unit] [Unit]
Description=Haste is an open-source pastebin software Description=Haste is an open-source pastebin software
After=syslog.target After=network.target syslog.target
After=network.target
[Service] [Service]
Type=simple Type=simple
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
ExecStartPre=__NODEJS__
WorkingDirectory=__FINALPATH__ WorkingDirectory=__FINALPATH__
Environment="PATH=__ENV_PATH__" Environment="PATH=__ENV_PATH__"
ExecStart=__NODEPATH__/npm start ExecStart=__YNH_NPM__ start
StandardOutput=append:/var/log/__APP__/__APP__.log
StandardError=inherit
Restart=always Restart=always
[Install] [Install]

View file

@ -3,10 +3,10 @@
"id": "haste", "id": "haste",
"packaging_format": 1, "packaging_format": 1,
"description": { "description": {
"en": "Haste is an open-source pastebin software written in node.js", "en": "Open-source pastebin allowing to upload texts",
"fr": "Haste is an open-source pastebin software written in node.js" "fr": "Pastebin open-source permettant de mettre en ligne du texte"
}, },
"version": "f19c5d10498e214b8323fff9e5eab77cbb7eebff", "version": "0.1.0~ynh1",
"url": "https://github.com/seejohnrun/haste-server", "url": "https://github.com/seejohnrun/haste-server",
"license": "MIT", "license": "MIT",
"maintainer": { "maintainer": {
@ -14,7 +14,7 @@
"email": "maxime.bugeia@gmail.com" "email": "maxime.bugeia@gmail.com"
}, },
"requirements": { "requirements": {
"yunohost": ">= 2.7.2" "yunohost": ">= 3.8.1"
}, },
"multi_instance": false, "multi_instance": false,
"services": [ "services": [
@ -45,8 +45,8 @@
"name": "is_public", "name": "is_public",
"type": "boolean", "type": "boolean",
"ask": { "ask": {
"en": "Is it a public site? (you won't be able to use haste command easily if not)", "en": "Is it a public site? (you won't be able to use Haste command easily if not)",
"fr": "Est-ce un site publique ? (si non, vous ne pourrez pas utiliser la commande haste facilement)" "fr": "Est-ce un site publique ? (si non, vous ne pourrez pas utiliser la commande Haste facilement)"
}, },
"default": true "default": true
} }

18
pull_request_template.md Normal file
View file

@ -0,0 +1,18 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished.
- [ ] Tested with Package_check.
- [ ] Fix or enhancement tested.
- [ ] Upgrade from last version tested.
- [ ] Can be reviewed and tested.
## Package_check results
---
*If you have access to [App Continuous Integration for packagers](https://yunohost.org/#/packaging_apps_ci) you can provide a link to the package_check results like below, replacing '-NUM-' in this link by the PR number and USERNAME by your username on the ci-apps-dev. Or you provide a screenshot or a pastebin of the results*
[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/haste_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/haste_ynh%20PR-NUM-%20(USERNAME)/)

View file

@ -1,173 +1,19 @@
# INFOS
# n (Node version management) utilise la variable PATH pour stocker le path de la version de node à utiliser.
# C'est ainsi qu'il change de version
# ynh_install_nodejs installe la version de nodejs demandée en argument, avec n
# ynh_use_nodejs active une version de nodejs dans le script courant
# 3 variables sont mises à disposition, et 2 sont stockées dans la config de l'app
# - nodejs_path: Le chemin absolu de cette version de node
# Utilisé pour des appels directs à node.
# - nodejs_version: Simplement le numéro de version de nodejs pour cette application
# - nodejs_use_version: Un alias pour charger une version de node dans le shell courant.
# Utilisé pour démarrer un service ou un script qui utilise node ou npm
# Dans ce cas, c'est $PATH qui contient le chemin de la version de node. Il doit être propagé sur les autres shell si nécessaire.
n_install_dir="/opt/node_n"
node_version_path="/opt/node_n/n/versions/node"
# N_PREFIX est le dossier de n, il doit être chargé dans les variables d'environnement pour n.
export N_PREFIX="$n_install_dir"
ynh_install_n () {
echo "Installation of N - Node.js version management" >&2
# Build an app.src for n
mkdir -p "../conf"
echo "SOURCE_URL=https://github.com/tj/n/archive/v2.1.7.tar.gz
SOURCE_SUM=2ba3c9d4dd3c7e38885b37e02337906a1ee91febe6d5c9159d89a9050f2eea8f" > "../conf/n.src"
# Download and extract n
ynh_setup_source "$n_install_dir/git" n
# Install n
(cd "$n_install_dir/git"
PREFIX=$N_PREFIX make install 2>&1)
}
ynh_use_nodejs () {
nodejs_version=$(ynh_app_setting_get $app nodejs_version)
load_n_path="[[ :$PATH: == *\":$n_install_dir/bin:\"* ]] || PATH=\"$n_install_dir/bin:$PATH\"; N_PREFIX="$n_install_dir""
nodejs_use_version="$n_install_dir/bin/n -q $nodejs_version"
# "Load" a version of node
eval $load_n_path; $nodejs_use_version
# Get the absolute path of this version of node
nodejs_path="$(n bin $nodejs_version)"
# Make an alias for node use
ynh_node_exec="eval $load_n_path; n use $nodejs_version"
}
ynh_install_nodejs () {
# Use n, https://github.com/tj/n to manage the nodejs versions
nodejs_version="$1"
local n_install_script="https://git.io/n-install"
# Create $n_install_dir
mkdir -p "$n_install_dir"
# Load n path in PATH
CLEAR_PATH="$n_install_dir/bin:$PATH"
# Remove /usr/local/bin in PATH in case of node has already setup.
PATH=$(echo $CLEAR_PATH | sed 's@/usr/local/bin:@@')
# Move an existing node binary, to avoid to block n.
test -x /usr/bin/node && mv /usr/bin/node /usr/bin/node_n
test -x /usr/bin/npm && mv /usr/bin/npm /usr/bin/npm_n
# If n is not previously setup, install it
if ! test n --version > /dev/null 2>&1
then
ynh_install_n
fi
# Modify the default N_PREFIX in n script
ynh_replace_string "^N_PREFIX=\${N_PREFIX-.*}$" "N_PREFIX=\${N_PREFIX-$N_PREFIX}" "$n_install_dir/bin/n"
# Restore /usr/local/bin in PATH
PATH=$CLEAR_PATH
# And replace the old node binary.
test -x /usr/bin/node_n && mv /usr/bin/node_n /usr/bin/node
test -x /usr/bin/npm_n && mv /usr/bin/npm_n /usr/bin/npm
# Install the requested version of nodejs
n $nodejs_version
# Find the last "real" version for this major version of node.
real_nodejs_version=$(find $node_version_path/$nodejs_version* -maxdepth 0 | sort --version-sort | tail --lines=1)
real_nodejs_version=$(basename $real_nodejs_version)
# Create a symbolic link for this major version. If the file doesn't already exist
if [ ! -e "$node_version_path/$nodejs_version" ]
then
ln --symbolic --force --no-target-directory $node_version_path/$real_nodejs_version $node_version_path/$nodejs_version
fi
# Store the ID of this app and the version of node requested for it
echo "$YNH_APP_ID:$nodejs_version" | tee --append "$n_install_dir/ynh_app_version"
# Store nodejs_version into the config of this app
ynh_app_setting_set $app nodejs_version $nodejs_version
# Build the update script and set the cronjob
ynh_cron_upgrade_node
ynh_use_nodejs
}
ynh_remove_nodejs () {
ynh_use_nodejs
# Remove the line for this app
sed --in-place "/$YNH_APP_ID:$nodejs_version/d" "$n_install_dir/ynh_app_version"
# If none another app uses this version of nodejs, remove it.
if ! grep --quiet "$nodejs_version" "$n_install_dir/ynh_app_version"
then
n rm $nodejs_version
fi
# If none another app uses n, remove n
if [ ! -s "$n_install_dir/ynh_app_version" ]
then
ynh_secure_remove "$n_install_dir"
ynh_secure_remove "/usr/local/n"
sed --in-place "/N_PREFIX/d" /root/.bashrc
fi
}
ynh_cron_upgrade_node () {
# Build the update script
cat > "$n_install_dir/node_update.sh" << EOF
#!/bin/bash #!/bin/bash
version_path="$node_version_path" #=================================================
n_install_dir="$n_install_dir" # COMMON VARIABLES
#=================================================
# Log the date nodejs_version=12
date
# List all real installed version of node #=================================================
all_real_version="\$(find \$version_path/* -maxdepth 0 -type d | sed "s@\$version_path/@@g")" # PERSONAL HELPERS
#=================================================
# Keep only the major version number of each line #=================================================
all_real_version=\$(echo "\$all_real_version" | sed 's/\..*\$//') # EXPERIMENTAL HELPERS
#=================================================
# Remove double entries #=================================================
all_real_version=\$(echo "\$all_real_version" | sort --unique) # FUTURE OFFICIAL HELPERS
#=================================================
# Read each major version
while read version
do
echo "Update of the version \$version"
sudo \$n_install_dir/bin/n \$version
# Find the last "real" version for this major version of node.
real_nodejs_version=\$(find \$version_path/\$version* -maxdepth 0 | sort --version-sort | tail --lines=1)
real_nodejs_version=\$(basename \$real_nodejs_version)
# Update the symbolic link for this version
sudo ln --symbolic --force --no-target-directory \$version_path/\$real_nodejs_version \$version_path/\$version
done <<< "\$(echo "\$all_real_version")"
EOF
chmod +x "$n_install_dir/node_update.sh"
# Build the cronjob
cat > "/etc/cron.daily/node_update" << EOF
#!/bin/bash
$n_install_dir/node_update.sh >> $n_install_dir/node_update.log
EOF
chmod +x "/etc/cron.daily/node_update"
}

37
scripts/backup Executable file → Normal file
View file

@ -6,12 +6,8 @@
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
if [ ! -e _common.sh ]; then #Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
# Get the _common.sh file if it's not in the current directory source ../settings/scripts/_common.sh
cp ../settings/scripts/_common.sh ./_common.sh
chmod a+rx _common.sh
fi
source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
@ -24,11 +20,17 @@ ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get $app final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
#================================================= #=================================================
# STANDARD BACKUP STEPS # STANDARD BACKUP STEPS
@ -36,13 +38,13 @@ domain=$(ynh_app_setting_get $app domain)
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_backup "$final_path" ynh_backup --src_path="$final_path"
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# SPECIFIC BACKUP # SPECIFIC BACKUP
@ -50,23 +52,28 @@ ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
# BACKUP LOGROTATE # BACKUP LOGROTATE
#================================================= #=================================================
# FIXME Currently, the log is only redirected to syslog. ynh_backup --src_path="/etc/logrotate.d/$app"
# ynh_backup "/etc/logrotate.d/$app"
#================================================= #=================================================
# BACKUP DATADIR DIRECTORY # BACKUP DATADIR DIRECTORY
#================================================= #=================================================
ynh_backup "/home/yunohost.app/$app" ynh_backup --src_path="/home/yunohost.app/$app"
#================================================= #=================================================
# BACKUP BINARY # BACKUP BINARY
#================================================= #=================================================
ynh_backup "/usr/bin/$app" ynh_backup --src_path="/usr/bin/$app"
#================================================= #=================================================
# BACKUP SYSTEMD # BACKUP SYSTEMD
#================================================= #=================================================
ynh_backup "/etc/systemd/system/$app.service" ynh_backup --src_path="/etc/systemd/system/$app.service"
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

122
scripts/install Executable file → Normal file
View file

@ -21,7 +21,7 @@ ynh_abort_if_errors
#================================================= #=================================================
domain=$YNH_APP_ARG_DOMAIN domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH path_url="/"
is_public=$YNH_APP_ARG_IS_PUBLIC is_public=$YNH_APP_ARG_IS_PUBLIC
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -29,76 +29,75 @@ app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS # CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS
#================================================= #=================================================
ynh_script_progression --message="Validating installation parameters..." --weight=1
final_path=/var/www/$app final_path=/var/www/$app
test ! -e "$final_path" || ynh_die "This path already contains a folder" test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
# Normalize the url path syntax
path_url=$(ynh_normalize_url_path $path_url)
if [ "$path_url" != "/" ]; then
ynh_die "Only / is allowed"
fi
# Check web path availability
ynh_webpath_available $domain $path_url
# Register (book) web path # Register (book) web path
ynh_webpath_register $app $domain $path_url ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#================================================= #=================================================
# STORE SETTINGS FROM MANIFEST # STORE SETTINGS FROM MANIFEST
#================================================= #=================================================
ynh_script_progression --message="Storing installation settings..." --weight=2
ynh_app_setting_set $app domain "$domain" ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set $app is_public "$is_public" ynh_app_setting_set --app=$app --key=is_public --value=$is_public
ynh_app_setting_set $app path_url "$path_url" ynh_app_setting_set --app=$app --key=path_url --value=$path_url
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
#================================================= #=================================================
# FIND AND OPEN A PORT # FIND AND OPEN A PORT
#================================================= #=================================================
ynh_script_progression --message="Configuring firewall..." --weight=2
# Find a free port # Find an available port
port=$(ynh_find_port 7777) port=$(ynh_find_port --port=7777)
ynh_app_setting_set $app port $port ynh_app_setting_set --app=$app --key=port --value=$port
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." --weight=2
ynh_app_setting_set $app final_path $final_path ynh_app_setting_set --app=$app --key=final_path --value=$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 "$final_path" ynh_setup_source --dest_dir=$final_path
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
# Create a dedicated nginx config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Configuring system user..." --weight=3
ynh_system_user_create $app # Create a system user
ynh_system_user_create --username=$app --home_dir=$final_path
#================================================= #=================================================
# SPECIFIC SETUP # SPECIFIC SETUP
#================================================= #=================================================
# INSTALL NODEJS # INSTALL NODEJS
#================================================= #=================================================
ynh_script_progression --message="Installing dependencies..." --weight=10
ynh_install_nodejs 4 # Install Nodejs
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
#================================================= #=================================================
# ADD SYSTEMD SERVICE # ADD SYSTEMD SERVICE
#================================================= #=================================================
ynh_replace_string "__NODEJS__" "$nodejs_use_version" "../conf/systemd.service" ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service"
ynh_replace_string "__ENV_PATH__" "$PATH" "../conf/systemd.service" ynh_replace_string --match_string="__YNH_NPM__" --replace_string="$ynh_npm" --target_file="../conf/systemd.service"
ynh_replace_string "__NODEPATH__" "$(dirname "$nodejs_path")" "../conf/systemd.service"
ynh_add_systemd_config ynh_add_systemd_config
@ -106,39 +105,51 @@ ynh_add_systemd_config
# INSTALL HASTEBIN # INSTALL HASTEBIN
#================================================= #=================================================
pushd "$final_path" || ynh_die
ynh_use_nodejs ynh_use_nodejs
ynh_exec_warn_less ynh_npm install
(cd "$final_path" popd || ynh_die
chown -R $app: "$final_path"
npm install)
#================================================= #=================================================
# CREATE DIRECTORY FOR DATA # CREATE DIRECTORY FOR DATA
#================================================= #=================================================
ynh_script_progression --message="Creating the data directory..."
data_path="/home/yunohost.app/$app" # Define app's data directory
data_path="/home/yunohost.app/${app}"
# Create app folders
mkdir -p "$data_path" mkdir -p "$data_path"
# Give permission to the datadir
chown -R $app:$app "$data_path"
#================================================= #=================================================
# CONFIGURE HASTE # CONFIGURE HASTE
#================================================= #=================================================
cp ../conf/config.js "$final_path/config.js" cp ../conf/config.js "$final_path/config.js"
ynh_replace_string "__PORT__" "$port" "$final_path/config.js"
ynh_replace_string "__YNH_DATA_PATH__" "$data_path" "$final_path/config.js" ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/config.js"
ynh_replace_string --match_string="__YNH_DATA_PATH__" --replace_string="$data_path" --target_file="$final_path/config.js"
# Calculate and store the config file checksum into the app settings # Calculate and store the config file checksum into the app settings
ynh_store_file_checksum "$final_path/config.js" ynh_store_file_checksum "$final_path/config.js"
# Replace ajax.googleapis by local file
cp ../sources/jquery.min.js "$final_path/static/jquery.min.js"
ynh_replace_string --match_string="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" --replace_string="jquery.min.js" --target_file="$final_path/static/index.html"
#================================================= #=================================================
# ADD HASTE AS A BINARY FILE # ADD HASTE AS A BINARY FILE
#================================================= #=================================================
ynh_replace_string "__YNH_HASTE_URL__" "${domain}${path_url%/}" "../conf/haste.sh" ynh_replace_string --match_string="__YNH_HASTE_URL__" --replace_string="${domain}${path_url%/}" --target_file="../conf/haste.sh"
ynh_replace_string "__PORT__" "$port" "../conf/haste.sh" ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="../conf/haste.sh"
sudo cp ../conf/haste.sh /usr/bin/$app
sudo chmod +x /usr/bin/"$app" cp ../conf/haste.sh /usr/bin/$app
echo "Please use 'cmd | $app' to paste the output of the command to your Haste server." >&2 chmod +x /usr/bin/$app
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
@ -148,41 +159,52 @@ echo "Please use 'cmd | $app' to paste the output of the command to your Haste s
chown -R root: $final_path chown -R root: $final_path
chown -R $app "$final_path/static" chown -R $app "$final_path/static"
chown -R $app "$data_path"
#================================================= #=================================================
# HANDLE LOG FILES AND SETUP LOGROTATE # HANDLE LOG FILES AND SETUP LOGROTATE
#================================================= #=================================================
ynh_script_progression --message="Configuring log rotation..." --weight=1
# FIXME Currently, the log is only redirected to syslog. # FIXME Currently, the log is only redirected to syslog.
# mkdir -p /var/log/$app mkdir -p /var/log/$app
# touch /var/log/$app/$app.log touch /var/log/$app/$app.log
# chown $app -R /var/log/$app chown $app -R /var/log/$app
# ynh_use_logrotate
ynh_use_logrotate
#================================================= #=================================================
# ENABLE SERVICE IN ADMIN PANEL # INTEGRATE SERVICE IN YUNOHOST
#================================================= #=================================================
yunohost service add $app --log "/var/log/$app/$app.log" yunohost service add $app --description "Haste is an open-source pastebin software" --log "/var/log/$app/$app.log"
#================================================= #=================================================
# START HASTEBIN # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=2
systemctl start $app # Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
ynh_script_progression --message="Configuring SSOwat..." --weight=1
if [ $is_public -eq 1 ]; if [ $is_public -eq 1 ]
then then
ynh_app_setting_set $app skipped_uris "/" ynh_permission_update --permission "main" --add "visitors"
fi fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
systemctl reload nginx ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last

View file

@ -12,46 +12,54 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
final_path=$(ynh_app_setting_get $app final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE
#=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST
#=================================================
# Remove the service from the list of services known by Yunohost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status $app >/dev/null
then
ynh_script_progression --message="Removing $app service integration..." --weight=1
yunohost service remove $app
fi
#================================================= #=================================================
# STOP AND REMOVE SERVICE # STOP AND REMOVE SERVICE
#================================================= #=================================================
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
# Remove the dedicated systemd config # Remove the dedicated systemd config
ynh_remove_systemd_config ynh_remove_systemd_config
#=================================================
# REMOVE SERVICE FROM ADMIN PANEL
#=================================================
if yunohost service status | grep -q $app
then
echo "Remove $app service"
yunohost service remove $app
fi
#================================================= #=================================================
# REMOVE APP MAIN DIR # REMOVE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Removing app main directory..." --weight=2
ynh_secure_remove "$final_path" # Remove the app directory securely
ynh_secure_remove --file="$final_path"
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # REMOVE NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
# Remove the dedicated NGINX config
ynh_remove_nginx_config ynh_remove_nginx_config
#================================================= #=================================================
# REMOVE LOGROTATE CONFIGURATION # REMOVE LOGROTATE CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
# FIXME Currently, the log is only redirected to syslog. # FIXME Currently, the log is only redirected to syslog.
# ynh_remove_logrotate # ynh_remove_logrotate
@ -62,13 +70,13 @@ ynh_remove_nginx_config
# REMOVE HASTE BINARY # REMOVE HASTE BINARY
#================================================= #=================================================
ynh_secure_remove "/usr/bin/$app" ynh_secure_remove --file="/usr/bin/$app"
#================================================= #=================================================
# REMOVE DATADIR DIRECTORY # REMOVE DATADIR DIRECTORY
#================================================= #=================================================
ynh_secure_remove "/home/yunohost.app/$app" ynh_secure_remove --file="/home/yunohost.app/$app"
#================================================= #=================================================
# REMOVE NODEJS # REMOVE NODEJS
@ -81,6 +89,13 @@ ynh_remove_nodejs
#================================================= #=================================================
# REMOVE DEDICATED USER # REMOVE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
# Delete a system user # Delete a system user
ynh_system_user_delete $app ynh_system_user_delete --username=$app
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed" --last

79
scripts/restore Executable file → Normal file
View file

@ -1,4 +1,3 @@
#!/bin/bash #!/bin/bash
#================================================= #=================================================
@ -7,34 +6,34 @@
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
if [ ! -e _common.sh ]; then source ../settings/scripts/_common.sh
# Get the _common.sh file if it's not in the current directory
cp ../settings/scripts/_common.sh ./_common.sh
chmod a+rx _common.sh
fi
source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
ynh_clean_setup () {
true
}
# 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
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get $app path) path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get $app final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED
#================================================= #=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=2
ynh_webpath_available $domain $path_url \ ynh_webpath_available $domain $path_url \
|| ynh_die "Path not available: ${domain}${path_url}" || ynh_die "Path not available: ${domain}${path_url}"
@ -47,55 +46,41 @@ test ! -d $final_path \
# RESTORE THE NGINX CONFIGURATION # RESTORE THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=6
ynh_restore_file "$final_path" ynh_restore_file --origin_path="$final_path"
#================================================= #=================================================
# RECREATE THE DEDICATED USER # RECREATE THE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
# Create the dedicated user (if not existing) # Create the dedicated user (if not existing)
ynh_system_user_create $app ynh_system_user_create --username=$app
#================================================= #=================================================
# SPECIFIC RESTORE # SPECIFIC RESTORE
#=================================================
# HANDLE LOG FILES AND RESTORE LOGROTATE
#=================================================
# FIXME Currently, the log is only redirected to syslog.
# mkdir -p /var/log/$app
# touch /var/log/$app/$app.log
# chown $app -R /var/log/$app
# ynh_restore_file "/etc/logrotate.d/$app"
#================================================= #=================================================
# INSTALL NODEJS # INSTALL NODEJS
#================================================= #=================================================
ynh_install_nodejs 4 ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
#=================================================
# ENABLE SERVICE IN ADMIN PANEL
#=================================================
yunohost service add $app --log "/var/log/$app/$app.log"
#================================================= #=================================================
# RESTORE SYSTEMD # RESTORE SYSTEMD
#================================================= #=================================================
ynh_script_progression --message="Restoring the systemd configuration..." --weight=2
ynh_restore_file "/etc/systemd/system/$app.service" ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service systemctl enable $app.service
#================================================= #=================================================
# RESTORE DATADIR DIRECTORY # RESTORE VARIOUS FILES
#================================================= #=================================================
ynh_restore_file "/home/yunohost.app/$app" ynh_restore_file "/home/yunohost.app/$app"
@ -109,15 +94,35 @@ chown -R $app "$final_path/static"
chown -R $app "/home/yunohost.app/$app" chown -R $app "/home/yunohost.app/$app"
#================================================= #=================================================
# START HASTEBIN # INTEGRATE SERVICE IN YUNOHOST
#================================================= #=================================================
systemctl start $app yunohost service add $app --description "Haste is an open-source pastebin software" --log "/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
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 THE LOGROTATE CONFIGURATION
#=================================================
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX AND PHP-FPM
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#================================================= #=================================================
systemctl reload nginx ynh_script_progression --message="Restoration completed for $app" --last

View file

@ -15,34 +15,42 @@ source /usr/share/yunohost/helpers
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get $app path_url) path_url=$(ynh_app_setting_get --app=$app --key=path_url)
is_public=$(ynh_app_setting_get $app is_public) is_public=$(ynh_app_setting_get --app=$app --key=is_public)
final_path=$(ynh_app_setting_get $app final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port=$(ynh_app_setting_get $app port) port=$(ynh_app_setting_get --app=$app --key=port)
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# Fix is_public as a boolean value # Fix is_public as a boolean value
if [ "$is_public" = "Yes" ]; then if [ "$is_public" = "Yes" ]; then
ynh_app_setting_set $app is_public 1 ynh_app_setting_set --app=$app --key=is_public --value=1
is_public=1 is_public=1
elif [ "$is_public" = "No" ]; then elif [ "$is_public" = "No" ]; then
ynh_app_setting_set $app is_public 0 ynh_app_setting_set --app=$app --key=is_public --value=0
is_public=0 is_public=0
fi fi
# If final_path doesn't exist, create it # If final_path doesn't exist, create it
if [ -z $final_path ]; then if [ -z "$final_path" ]; then
final_path=/var/www/$app final_path=/var/www/$app
ynh_app_setting_set $app final_path $final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi fi
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # 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 # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
@ -58,33 +66,44 @@ ynh_abort_if_errors
#================================================= #=================================================
# Normalize the URL path syntax # Normalize the URL path syntax
path_url=$(ynh_normalize_url_path $path_url) path_url=$(ynh_normalize_url_path --path_url=$path_url)
#=================================================
# STOP HASTE
#=================================================
systemctl stop $app
#================================================= #=================================================
# STANDARD UPGRADE STEPS # STANDARD UPGRADE STEPS
#=================================================
# 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"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_setup_source "$final_path" if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=7
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
fi
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2
# Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=2
ynh_system_user_create $app # Create a dedicated user (if not existing)
ynh_system_user_create --username=$app
#================================================= #=================================================
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
@ -92,29 +111,32 @@ ynh_system_user_create $app
# UPGRADE NODEJS # UPGRADE NODEJS
#================================================= #=================================================
ynh_install_nodejs 4 ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
#================================================= #=================================================
# UPGRADE NPM MODULES # UPGRADE NPM MODULES
#================================================= #=================================================
npm cache clean pushd "$final_path" || ynh_die
npm update ynh_use_nodejs
ynh_exec_warn_less ynh_npm install
popd || ynh_die
#================================================= #=================================================
# SETUP LOGROTATE # SETUP LOGROTATE
#================================================= #=================================================
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
# FIXME Currently, the log is only redirected to syslog. # FIXME Currently, the log is only redirected to syslog.
# ynh_use_logrotate ynh_use_logrotate --non-append
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
ynh_replace_string "__NODEJS__" "$nodejs_use_version" "../conf/systemd.service" ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service"
ynh_replace_string "__ENV_PATH__" "$PATH" "../conf/systemd.service" ynh_replace_string --match_string="__YNH_NPM__" --replace_string="$ynh_npm" --target_file="../conf/systemd.service"
ynh_replace_string "__NODEPATH__" "$(dirname "$nodejs_path")" "../conf/systemd.service"
ynh_add_systemd_config ynh_add_systemd_config
@ -126,20 +148,30 @@ ynh_add_systemd_config
ynh_backup_if_checksum_is_different "$final_path/config.js" ynh_backup_if_checksum_is_different "$final_path/config.js"
cp ../conf/config.js "$final_path/config.js" cp ../conf/config.js "$final_path/config.js"
ynh_replace_string "__PORT__" "$port" "$final_path/config.js"
data_path="/home/yunohost.app/$app" # Define app's data directory
ynh_replace_string "__YNH_DATA_PATH__" "$data_path" "$final_path/config.js" data_path="/home/yunohost.app/${app}"
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/config.js"
ynh_replace_string --match_string="__YNH_DATA_PATH__" --replace_string="$data_path" --target_file="$final_path/config.js"
# Recalculate and store the config file checksum into the app settings # Recalculate and store the config file checksum into the app settings
ynh_store_file_checksum "$final_path/config.js" ynh_store_file_checksum "$final_path/config.js"
# Replace ajax.googleapis by local file
cp ../sources/jquery.min.js "$final_path/static/jquery.min.js"
ynh_replace_string --match_string="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" --replace_string="jquery.min.js" --target_file="$final_path/static/index.html"
#================================================= #=================================================
# UPGRADE HASTE BINARY # UPGRADE HASTE BINARY
#================================================= #=================================================
ynh_replace_string "__YNH_HASTE_URL__" "${domain}${path_url}" "../conf/haste.sh" ynh_replace_string --match_string="__YNH_HASTE_URL__" --replace_string="${domain}${path_url}" --target_file="../conf/haste.sh"
sudo cp ../conf/haste.sh /usr/bin/$app
sudo chmod +x /usr/bin/"$app" cp ../conf/haste.sh /usr/bin/$app
chmod +x /usr/bin/$app
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
@ -152,22 +184,21 @@ chown -R $app "$final_path/static"
chown -R $app "$data_path" chown -R $app "$data_path"
#================================================= #=================================================
# START HASTEBIN # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
systemctl start $app ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
#=================================================
# SETUP SSOWAT
#=================================================
if [ $is_public -eq 1 ];
then
ynh_app_setting_set $app skipped_uris "/"
fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
systemctl reload nginx ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed" --last

4
sources/jquery.min.js vendored Normal file

File diff suppressed because one or more lines are too long

BIN
sources/screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 534 KiB