mirror of
https://github.com/YunoHost-Apps/haste_ynh.git
synced 2024-09-03 20:36:28 +02:00
cleaning
This commit is contained in:
parent
c30bc919af
commit
7c9d3e52f5
6 changed files with 54 additions and 139 deletions
|
@ -1,25 +0,0 @@
|
|||
;; Test complet
|
||||
; Manifest
|
||||
domain="domain.tld"
|
||||
path="/"
|
||||
is_public=1
|
||||
port="7777"
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=0
|
||||
setup_root=1
|
||||
setup_nourl=0
|
||||
setup_private=1
|
||||
setup_public=1
|
||||
upgrade=1
|
||||
upgrade=1 from_commit=0ea46c375b775316cec39a96fa917ec240e45970
|
||||
backup_restore=1
|
||||
multi_instance=0
|
||||
change_url=1
|
||||
;;; Options
|
||||
Email=
|
||||
Notification=none
|
||||
;;; Upgrade options
|
||||
; commit=0ea46c375b775316cec39a96fa917ec240e45970
|
||||
name=Testing (#33)
|
||||
manifest_arg=domain=DOMAIN&path=PATH&is_public=1&language=fr&admin=USER&password=pass&port=666&
|
|
@ -20,8 +20,11 @@ code = "https://github.com/seejohnrun/haste-server"
|
|||
yunohost = ">= 11.2"
|
||||
architectures = "all"
|
||||
multi_instance = false
|
||||
|
||||
ldap = false
|
||||
|
||||
sso = true
|
||||
|
||||
disk = "50M"
|
||||
ram.build = "50M"
|
||||
ram.runtime = "50M"
|
||||
|
|
|
@ -9,6 +9,14 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# INSTALL NODEJS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing dependencies..." --weight=10
|
||||
|
||||
# Install Nodejs
|
||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
@ -25,24 +33,30 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2
|
|||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
# INSTALL NODEJS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing dependencies..." --weight=10
|
||||
|
||||
# Install Nodejs
|
||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
|
||||
#=================================================
|
||||
# ADD SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring a systemd service..." --weight=1
|
||||
|
||||
env_path="$PATH"
|
||||
ynh_add_systemd_config
|
||||
|
||||
# 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_use_logrotate
|
||||
|
||||
yunohost service add $app --description="Haste is a pastebin software" --log="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# CONFIGURE HASTE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||
|
||||
ynh_add_config --template="config.js" --destination="$install_dir/config.js"
|
||||
|
||||
# Replace ajax.googleapis by local file
|
||||
cp ../sources/jquery.min.js "$install_dir/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="$install_dir/static/index.html"
|
||||
|
||||
#=================================================
|
||||
# INSTALL HASTEBIN
|
||||
#=================================================
|
||||
|
@ -53,24 +67,12 @@ pushd "$install_dir"
|
|||
ynh_exec_warn_less $ynh_npm install
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
# CONFIGURE HASTE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||
|
||||
ynh_add_config --template="../conf/config.js" --destination="$install_dir/config.js"
|
||||
|
||||
# Replace ajax.googleapis by local file
|
||||
cp ../sources/jquery.min.js "$install_dir/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="$install_dir/static/index.html"
|
||||
|
||||
#=================================================
|
||||
# ADD HASTE AS A BINARY FILE
|
||||
#=================================================
|
||||
|
||||
haste_url="${domain}${path}"
|
||||
ynh_add_config --template="../conf/haste.sh" --destination="/usr/bin/$app"
|
||||
ynh_add_config --template="haste.sh" --destination="/usr/bin/$app"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
@ -83,25 +85,6 @@ chmod -R o-rwx "$install_dir"
|
|||
chown -R $app:www-data "$install_dir"
|
||||
chmod +x /usr/bin/$app
|
||||
|
||||
#=================================================
|
||||
# HANDLE LOG FILES AND SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring log rotation..." --weight=1
|
||||
|
||||
# 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_use_logrotate
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||
|
||||
yunohost service add $app --description="Haste is a pastebin software" --log="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
|
|
|
@ -22,43 +22,16 @@ then
|
|||
yunohost service remove $app
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# STOP AND REMOVE SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
|
||||
|
||||
# Remove the dedicated systemd config
|
||||
ynh_remove_systemd_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
|
||||
|
||||
# Remove the dedicated NGINX config
|
||||
ynh_remove_nginx_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
|
||||
|
||||
ynh_remove_logrotate
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC REMOVE
|
||||
#=================================================
|
||||
# REMOVE HASTE BINARY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing various files..." --weight=1
|
||||
|
||||
ynh_secure_remove --file="/usr/bin/$app"
|
||||
|
||||
#=================================================
|
||||
# REMOVE NODEJS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing dependencies..." --weight=5
|
||||
|
||||
ynh_remove_nodejs
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -9,6 +9,13 @@
|
|||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# INSTALL NODEJS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
|
||||
|
||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
|
@ -19,15 +26,6 @@ ynh_restore_file --origin_path="$install_dir"
|
|||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORE
|
||||
#=================================================
|
||||
# INSTALL NODEJS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
|
||||
|
||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
|
||||
#=================================================
|
||||
# RESTORE VARIOUS FILES
|
||||
#=================================================
|
||||
|
|
|
@ -34,6 +34,13 @@ then
|
|||
ynh_setup_source --dest_dir="$install_dir" --keep="config.js"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# UPGRADE NODEJS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..." --weight=8
|
||||
|
||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -42,14 +49,13 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
|
|||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
# UPGRADE NODEJS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..." --weight=8
|
||||
# FIXME Currently, the log is only redirected to syslog.
|
||||
ynh_use_logrotate --non-append
|
||||
|
||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
env_path="$PATH"
|
||||
ynh_add_systemd_config
|
||||
|
||||
yunohost service add $app --description="Haste is a pastebin software" --log="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# UPGRADE NPM MODULES
|
||||
|
@ -61,22 +67,6 @@ pushd "$install_dir"
|
|||
ynh_exec_warn_less $ynh_npm install
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
|
||||
|
||||
# FIXME Currently, the log is only redirected to syslog.
|
||||
ynh_use_logrotate --non-append
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
|
||||
|
||||
env_path="$PATH"
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
# UPGRADE HASTE CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -92,7 +82,7 @@ ynh_replace_string --match_string="https://ajax.googleapis.com/ajax/libs/jquery/
|
|||
ynh_script_progression --message="Updating a configuration file..." --weight=1
|
||||
|
||||
haste_url="${domain}${path}"
|
||||
ynh_add_config --template="../conf/haste.sh" --destination="/usr/bin/$app"
|
||||
ynh_add_config --template="haste.sh" --destination="/usr/bin/$app"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
@ -105,13 +95,6 @@ chmod -R o-rwx "$install_dir"
|
|||
chown -R $app:www-data "$install_dir"
|
||||
chmod +x /usr/bin/$app
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||
|
||||
yunohost service add $app --description="Haste is a pastebin software" --log="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue