mirror of
https://github.com/YunoHost-Apps/kiwiirc_ynh.git
synced 2024-09-03 19:35:59 +02:00
commit
29195dd1a4
18 changed files with 215 additions and 378 deletions
|
@ -28,7 +28,7 @@ A versatile web based messenger using IRC
|
||||||
- Extremely versatile via a single JSON config file at runtime
|
- Extremely versatile via a single JSON config file at runtime
|
||||||
|
|
||||||
|
|
||||||
**Shipped version:** 20.05.24.1~ynh1
|
**Shipped version:** 1.7.0~ynh1
|
||||||
|
|
||||||
**Demo:** https://kiwiirc.com/nextclient
|
**Demo:** https://kiwiirc.com/nextclient
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ A versatile web based messenger using IRC
|
||||||
- Extremely versatile via a single JSON config file at runtime
|
- Extremely versatile via a single JSON config file at runtime
|
||||||
|
|
||||||
|
|
||||||
**Version incluse :** 20.05.24.1~ynh1
|
**Version incluse :** 1.7.0~ynh1
|
||||||
|
|
||||||
**Démo :** https://kiwiirc.com/nextclient
|
**Démo :** https://kiwiirc.com/nextclient
|
||||||
|
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
;; Test complet
|
|
||||||
; Manifest
|
|
||||||
domain="domain.tld"
|
|
||||||
path="/path"
|
|
||||||
admin="john"
|
|
||||||
is_public=1
|
|
||||||
; Checks
|
|
||||||
pkg_linter=1
|
|
||||||
setup_sub_dir=0
|
|
||||||
setup_root=1
|
|
||||||
setup_nourl=0
|
|
||||||
setup_private=1
|
|
||||||
setup_public=1
|
|
||||||
upgrade=1
|
|
||||||
backup_restore=1
|
|
||||||
multi_instance=0
|
|
||||||
change_url=1
|
|
||||||
;;; Options
|
|
||||||
Email=
|
|
||||||
Notification=none
|
|
||||||
;;; Upgrade options
|
|
||||||
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&is_public=1&
|
|
|
@ -1,7 +0,0 @@
|
||||||
SOURCE_URL=https://kiwiirc.com/downloads/kiwiirc_20.05.24.1-1_amd64.deb
|
|
||||||
SOURCE_SUM=c99504c6de678fd91aed357ff0dada16a8df9e932970ed85767b516a9f87df52
|
|
||||||
SOURCE_SUM_PRG=sha256sum
|
|
||||||
SOURCE_FORMAT=deb
|
|
||||||
SOURCE_IN_SUBDIR=true
|
|
||||||
SOURCE_FILENAME=kiwiirc.deb
|
|
||||||
SOURCE_EXTRACT=false
|
|
|
@ -16,10 +16,16 @@
|
||||||
{ "name": "Elite", "url": "static/themes/elite" }
|
{ "name": "Elite", "url": "static/themes/elite" }
|
||||||
],
|
],
|
||||||
"startupOptions" : {
|
"startupOptions" : {
|
||||||
|
"infoContent": "<h3>Welcome to your Kiwi IRC page!</h3><p>Now to configure it.</p><p>You can modify this page via the /etc/kiwiirc/client.json file.<br />Add your IRC network details to /etc/kiwiirc/config.conf</p><p>Have a quick read through the config file - there are plenty of comments explaining each feature.</p>"
|
||||||
|
"infoBackground": "",
|
||||||
|
"greetingText": "Libera Chat",
|
||||||
"channel": "#yunohost",
|
"channel": "#yunohost",
|
||||||
"nick": "web?",
|
"nick": "web?",
|
||||||
"greetingText": "Libera Chat",
|
},
|
||||||
"infoBackground": "",
|
"embedly": {
|
||||||
"infoContent": "<h3>Welcome to your Kiwi IRC page!</h3><p>Now to configure it.</p><p>You can modify this page via the /etc/kiwiirc/client.json file.<br />Add your IRC network details to /etc/kiwiirc/config.conf</p><p>Have a quick read through the config file - there are plenty of comments explaining each feature.</p>"
|
"key": ""
|
||||||
}
|
},
|
||||||
|
"plugins": [
|
||||||
|
{ "name": "customise", "url": "static/plugins/customise.html" }
|
||||||
|
]
|
||||||
}
|
}
|
|
@ -61,8 +61,8 @@ port = __PORT__
|
||||||
# Serve static files from a web root folder.
|
# Serve static files from a web root folder.
|
||||||
# Optional, but handy for serving the Kiwi IRC client if no other webserver is available
|
# Optional, but handy for serving the Kiwi IRC client if no other webserver is available
|
||||||
[fileserving]
|
[fileserving]
|
||||||
enabled = true
|
enabled = false
|
||||||
webroot = /usr/share/kiwiirc/
|
webroot = __INSTALL_DIR__/www/
|
||||||
|
|
||||||
[transports]
|
[transports]
|
||||||
websocket
|
websocket
|
||||||
|
@ -98,6 +98,11 @@ throttle = 2
|
||||||
# Webirc password as set in the IRC server config
|
# Webirc password as set in the IRC server config
|
||||||
webirc = ""
|
webirc = ""
|
||||||
serverpassword = ""
|
serverpassword = ""
|
||||||
|
# Outgoing protocol, valid options: tcp, tcp4, tcp6, unix
|
||||||
|
# this can be used to force ipv4, ipv6 etc
|
||||||
|
protocol = tcp
|
||||||
|
# IP address of the local network interface to bind for outgoing connections
|
||||||
|
localaddr = ""
|
||||||
|
|
||||||
|
|
||||||
# A public gateway to any IRC network
|
# A public gateway to any IRC network
|
||||||
|
@ -107,6 +112,10 @@ serverpassword = ""
|
||||||
enabled = false
|
enabled = false
|
||||||
timeout = 5
|
timeout = 5
|
||||||
throttle = 2
|
throttle = 2
|
||||||
|
# Outgoing protocol, valid options: tcp, tcp4, tcp6
|
||||||
|
protocol = tcp
|
||||||
|
# IP address of the local network interface to bind for outgoing connections
|
||||||
|
localaddr = ""
|
||||||
|
|
||||||
# Whitelisted IRC networks while in public gateway mode
|
# Whitelisted IRC networks while in public gateway mode
|
||||||
# If any networks are in this list then connections can only be made to these
|
# If any networks are in this list then connections can only be made to these
|
||||||
|
@ -122,7 +131,7 @@ irc.network2.org = webirc_password
|
||||||
[dnsbl]
|
[dnsbl]
|
||||||
# "verify" - if the client supports it, tell it to show a captcha
|
# "verify" - if the client supports it, tell it to show a captcha
|
||||||
# "deny" - deny the connection entirely
|
# "deny" - deny the connection entirely
|
||||||
action = deny
|
action = verify
|
||||||
|
|
||||||
[dnsbl.servers]
|
[dnsbl.servers]
|
||||||
dnsbl.dronebl.org
|
dnsbl.dronebl.org
|
|
@ -1,6 +1,6 @@
|
||||||
location / {
|
location / {
|
||||||
index index.html;
|
index index.html;
|
||||||
root /usr/share/kiwiirc/;
|
root __INSTALL_DIR__/www/;
|
||||||
}
|
}
|
||||||
|
|
||||||
location /webirc/ {
|
location /webirc/ {
|
||||||
|
|
49
conf/systemd.service
Normal file
49
conf/systemd.service
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
[Unit]
|
||||||
|
Description=KiwiIRC server
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
User=__APP__
|
||||||
|
Group=__APP__
|
||||||
|
WorkingDirectory=__INSTALL_DIR__/
|
||||||
|
ExecStart=__INSTALL_DIR__/kiwiirc --config __INSTALL_DIR__/config.conf
|
||||||
|
StandardOutput=append:/var/log/__APP__/__APP__.log
|
||||||
|
StandardError=inherit
|
||||||
|
|
||||||
|
### Depending on specificities of your service/app, you may need to tweak these
|
||||||
|
### .. but this should be a good baseline
|
||||||
|
# Sandboxing options to harden security
|
||||||
|
# Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html
|
||||||
|
NoNewPrivileges=yes
|
||||||
|
PrivateTmp=yes
|
||||||
|
PrivateDevices=yes
|
||||||
|
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 AF_NETLINK
|
||||||
|
RestrictNamespaces=yes
|
||||||
|
RestrictRealtime=yes
|
||||||
|
DevicePolicy=closed
|
||||||
|
ProtectClock=yes
|
||||||
|
ProtectHostname=yes
|
||||||
|
ProtectProc=invisible
|
||||||
|
ProtectSystem=full
|
||||||
|
ProtectControlGroups=yes
|
||||||
|
ProtectKernelModules=yes
|
||||||
|
ProtectKernelTunables=yes
|
||||||
|
LockPersonality=yes
|
||||||
|
SystemCallArchitectures=native
|
||||||
|
SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap @cpu-emulation @privileged
|
||||||
|
|
||||||
|
# Denying access to capabilities that should not be relevant for webapps
|
||||||
|
# Doc: https://man7.org/linux/man-pages/man7/capabilities.7.html
|
||||||
|
CapabilityBoundingSet=~CAP_RAWIO CAP_MKNOD
|
||||||
|
CapabilityBoundingSet=~CAP_AUDIT_CONTROL CAP_AUDIT_READ CAP_AUDIT_WRITE
|
||||||
|
CapabilityBoundingSet=~CAP_SYS_BOOT CAP_SYS_TIME CAP_SYS_MODULE CAP_SYS_PACCT
|
||||||
|
CapabilityBoundingSet=~CAP_LEASE CAP_LINUX_IMMUTABLE CAP_IPC_LOCK
|
||||||
|
CapabilityBoundingSet=~CAP_BLOCK_SUSPEND CAP_WAKE_ALARM
|
||||||
|
CapabilityBoundingSet=~CAP_SYS_TTY_CONFIG
|
||||||
|
CapabilityBoundingSet=~CAP_MAC_ADMIN CAP_MAC_OVERRIDE
|
||||||
|
CapabilityBoundingSet=~CAP_NET_ADMIN CAP_NET_BROADCAST CAP_NET_RAW
|
||||||
|
CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_SYSLOG
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
|
@ -1,37 +0,0 @@
|
||||||
{
|
|
||||||
"name": "KiwiIRC",
|
|
||||||
"id": "kiwiirc",
|
|
||||||
"packaging_format": 1,
|
|
||||||
"description": {
|
|
||||||
"en": "Versatile web based messenger using IRC",
|
|
||||||
"fr": "Messagerie Web polyvalente utilisant IRC"
|
|
||||||
},
|
|
||||||
"version": "20.05.24.1~ynh1",
|
|
||||||
"url": "https://github.com/kiwiirc/kiwiirc",
|
|
||||||
"upstream": {
|
|
||||||
"license": "AGPL-3.0-only",
|
|
||||||
"website": "https://kiwiirc.com/",
|
|
||||||
"demo": "https://kiwiirc.com/nextclient",
|
|
||||||
"admindoc": "https://github.com/kiwiirc/kiwiirc/wiki",
|
|
||||||
"code": "https://github.com/kiwiirc/kiwiirc"
|
|
||||||
},
|
|
||||||
"license": "AGPL-3.0-only",
|
|
||||||
"maintainer": {
|
|
||||||
"name": "eric_G"
|
|
||||||
},
|
|
||||||
"requirements": {
|
|
||||||
"yunohost": ">= 4.3.0"
|
|
||||||
},
|
|
||||||
"multi_instance": false,
|
|
||||||
"services": [
|
|
||||||
"nginx"
|
|
||||||
],
|
|
||||||
"arguments": {
|
|
||||||
"install" : [
|
|
||||||
{
|
|
||||||
"name": "domain",
|
|
||||||
"type": "domain"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
59
manifest.toml
Normal file
59
manifest.toml
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json
|
||||||
|
|
||||||
|
packaging_format = 2
|
||||||
|
|
||||||
|
id = "kiwiirc"
|
||||||
|
name = "KiwiIRC"
|
||||||
|
description.en = "Versatile web based messenger using IRC"
|
||||||
|
description.fr = "Messagerie Web polyvalente utilisant IRC"
|
||||||
|
|
||||||
|
version = "1.7.0~ynh1"
|
||||||
|
|
||||||
|
maintainers = ["eric_G"]
|
||||||
|
|
||||||
|
[upstream]
|
||||||
|
license = "AGPL-3.0-only"
|
||||||
|
website = "https://kiwiirc.com/"
|
||||||
|
demo = "https://kiwiirc.com/nextclient"
|
||||||
|
admindoc = "https://github.com/kiwiirc/kiwiirc/wiki"
|
||||||
|
code = "https://github.com/kiwiirc/kiwiirc"
|
||||||
|
fund = "https://kiwiirc.com/donate"
|
||||||
|
|
||||||
|
[integration]
|
||||||
|
yunohost = ">= 11.2"
|
||||||
|
architectures = "all"
|
||||||
|
multi_instance = false
|
||||||
|
|
||||||
|
ldap = "not_relevant"
|
||||||
|
|
||||||
|
sso = "not_relevant"
|
||||||
|
|
||||||
|
disk = "50M"
|
||||||
|
ram.build = "50M"
|
||||||
|
ram.runtime = "50M"
|
||||||
|
|
||||||
|
[install.domain]
|
||||||
|
type = "domain"
|
||||||
|
|
||||||
|
[install.init_main_permission]
|
||||||
|
type = "group"
|
||||||
|
default = "visitors"
|
||||||
|
|
||||||
|
[resources]
|
||||||
|
[resources.sources.main]
|
||||||
|
amd64.url = "https://github.com/kiwiirc/kiwiirc/releases/download/v1.7.0/kiwiirc-server_v1.7.0-2_linux_amd64.zip"
|
||||||
|
amd64.sha256 = "790d3b126ac4096d6a34de518f4cade9a291a1e0fe454c99aa460d508e916964"
|
||||||
|
arm64.url = "https://github.com/kiwiirc/kiwiirc/releases/download/v1.7.0/kiwiirc-server_v1.7.0-2_linux_arm64.zip"
|
||||||
|
arm64.sha256 = "32e1cc27f15c3057cd6c523a89c45e1663e0b02a4499df6a0c8338e8eebb0329"
|
||||||
|
armhf.url = "https://github.com/kiwiirc/kiwiirc/releases/download/v1.7.0/kiwiirc-server_v1.7.0-2_linux_armhf.zip"
|
||||||
|
armhf.sha256 = "a437d67447b169f6c72ae1a216aff277e2cd35df145c339d6ffd08eb796b6e22"
|
||||||
|
|
||||||
|
[resources.system_user]
|
||||||
|
|
||||||
|
[resources.install_dir]
|
||||||
|
|
||||||
|
[resources.permissions]
|
||||||
|
main.url = "/"
|
||||||
|
|
||||||
|
[resources.ports]
|
||||||
|
main.default = 7778
|
|
@ -9,41 +9,35 @@
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# MANAGE SCRIPT FAILURE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
ynh_print_info --message="Loading installation settings..."
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Declaring files to be backed up..."
|
ynh_print_info --message="Declaring files to be backed up..."
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP THE APP MAIN DIR
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_backup --src_path="$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
# Backup the nginx configuration
|
||||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
|
# Backup the systemd service unit
|
||||||
|
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||||
|
|
||||||
|
# Backup the logrotate configuration
|
||||||
|
ynh_backup --src_path="/etc/logrotate.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE CONFIGURATION FILE
|
# BACKUP VARIOUS FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/kiwiirc"
|
ynh_backup --src_path="/var/log/$app"
|
||||||
|
|
||||||
ynh_backup --src_path="/var/log/$app.log"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
|
@ -9,93 +9,12 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RETRIEVE ARGUMENTS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
old_domain=$YNH_APP_OLD_DOMAIN
|
|
||||||
old_path=$YNH_APP_OLD_PATH
|
|
||||||
|
|
||||||
new_domain=$YNH_APP_NEW_DOMAIN
|
|
||||||
new_path=$YNH_APP_NEW_PATH
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
|
||||||
|
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
|
|
||||||
|
|
||||||
# Backup the current version of the app
|
|
||||||
ynh_backup_before_upgrade
|
|
||||||
ynh_clean_setup () {
|
|
||||||
# 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"
|
|
||||||
|
|
||||||
# restore it if the upgrade fails
|
|
||||||
ynh_restore_upgradebackup
|
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CHECK WHICH PARTS SHOULD BE CHANGED
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
change_domain=0
|
|
||||||
if [ "$old_domain" != "$new_domain" ]
|
|
||||||
then
|
|
||||||
change_domain=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
change_path=0
|
|
||||||
if [ "$old_path" != "$new_path" ]
|
|
||||||
then
|
|
||||||
change_path=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY URL IN NGINX CONF
|
# MODIFY URL IN NGINX CONF
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
|
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
|
||||||
|
|
||||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
ynh_change_url_nginx_config
|
||||||
|
|
||||||
# Change the path in the NGINX config file
|
|
||||||
if [ $change_path -eq 1 ]
|
|
||||||
then
|
|
||||||
# Make a backup of the original NGINX config file if modified
|
|
||||||
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
|
|
||||||
# Set global variables for NGINX helper
|
|
||||||
domain="$old_domain"
|
|
||||||
path_url="$new_path"
|
|
||||||
# Create a dedicated NGINX config
|
|
||||||
ynh_add_nginx_config
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Change the domain for NGINX
|
|
||||||
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
|
|
||||||
# Store file checksum for the new config file location
|
|
||||||
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RELOAD NGINX
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
|
@ -9,83 +9,40 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# MANAGE SCRIPT FAILURE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
|
||||||
path_url="/"
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Validating installation parameters..." --weight=1
|
|
||||||
|
|
||||||
# Register (book) web path
|
|
||||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STORE SETTINGS FROM MANIFEST
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Storing installation settings..." --weight=2
|
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
|
||||||
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# FIND AND OPEN A PORT
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Finding an available port..." --weight=1
|
|
||||||
|
|
||||||
# Find an available port
|
|
||||||
port=$(ynh_find_port --port=7778)
|
|
||||||
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_script_progression --message="Setting up source files..." --weight=2
|
||||||
|
|
||||||
tempdir="$(mktemp -d)"
|
ynh_setup_source --source_id="main" --dest_dir="$install_dir"
|
||||||
ynh_setup_source --dest_dir=$tempdir --source_id=app
|
|
||||||
ynh_exec_warn_less dpkg -i $tempdir/kiwiirc.deb
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD A CONFIGURATION
|
# ADD A CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||||
|
|
||||||
ynh_add_config --template="../conf/client.json.example" --destination="/etc/kiwiirc/client.json"
|
ynh_add_config --template="config.conf" --destination="$install_dir/config.conf"
|
||||||
ynh_add_config --template="../conf/config.conf.example" --destination="/etc/kiwiirc/config.conf"
|
chmod 400 "$install_dir/config.conf"
|
||||||
|
|
||||||
chmod 744 "/etc/kiwiirc/config.conf"
|
ynh_add_config --template="client.json" --destination="$install_dir/www/static/client.json"
|
||||||
chown root: "/etc/kiwiirc/config.conf"
|
chmod 400 "$install_dir/www/static/client.json"
|
||||||
chmod 744 "/etc/kiwiirc/client.json"
|
|
||||||
chown root: "/etc/kiwiirc/client.json"
|
chmod 750 "$install_dir"
|
||||||
|
chown -R "$app:www-data" "$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# SYSTEM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
|
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
||||||
|
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#=================================================
|
ynh_add_systemd_config
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
yunohost service add "$app" --description="Versatile web based messenger using IRC" --log="/var/log/$app/$app.log"
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
|
||||||
|
|
||||||
yunohost service add $app --description="Versatile web based messenger using IRC" --log="/var/log/$app.log"
|
# Use logrotate to manage application logfile(s)
|
||||||
|
ynh_use_logrotate
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
|
@ -93,14 +50,7 @@ yunohost service add $app --description="Versatile web based messenger using IRC
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||||
|
|
||||||
# Start a systemd service
|
# Start a systemd service
|
||||||
ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd"
|
ynh_systemd_action --service_name="$app" --action="restart" --log_path="systemd"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RELOAD NGINX
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=2
|
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
|
@ -10,60 +10,30 @@ source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# REMOVE SYSTEM CONFIGURATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
# 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
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
yunohost service remove "$app"
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD REMOVE
|
|
||||||
#=================================================
|
|
||||||
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
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
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# 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
|
||||||
|
|
||||||
#=================================================
|
ynh_remove_logrotate
|
||||||
# REMOVE APP MAIN DIR
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing Kiwiirc..." --weight=6
|
|
||||||
|
|
||||||
dpkg --purge kiwiirc
|
# Remove the dedicated nginx config
|
||||||
|
ynh_remove_nginx_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE VARIOUS FILES
|
# REMOVE VARIOUS FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing various files..." --weight=1
|
ynh_script_progression --message="Removing various files..." --weight=1
|
||||||
|
|
||||||
# Remove a cron file
|
|
||||||
ynh_secure_remove --file="/etc/$app"
|
|
||||||
|
|
||||||
# Remove the log files
|
# Remove the log files
|
||||||
ynh_secure_remove --file="/var/log/$app.log"
|
ynh_secure_remove --file="/var/log/$app"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=5
|
|
||||||
|
|
||||||
# Remove the dedicated nginx config
|
|
||||||
ynh_remove_nginx_config
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
|
@ -10,66 +10,42 @@ source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MANAGE SCRIPT FAILURE
|
# RESTORE THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
||||||
|
|
||||||
# Exit if an error occurs during the execution of the script
|
ynh_restore_file --origin_path="$install_dir"
|
||||||
ynh_abort_if_errors
|
|
||||||
|
chown -R "$app:www-data" "$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# RESTORE SYSTEM CONFIGURATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Loading settings..." --weight=1
|
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
||||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE THE NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Restoring the NGINX configuration..."
|
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
systemctl enable "$app.service" --quiet
|
||||||
#=================================================
|
yunohost service add "$app" --description="Versatile web based messenger using IRC" --log="/var/log/$app/$app.log"
|
||||||
ynh_script_progression --message="Setting up source files..." --weight=2
|
|
||||||
|
|
||||||
tempdir="$(mktemp -d)"
|
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||||
ynh_setup_source --dest_dir=$tempdir --source_id=app
|
|
||||||
ynh_exec_warn_less dpkg -i $tempdir/kiwiirc.deb
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE NGINX CONFIGURATION
|
# RESTORE VARIOUS FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring various file..." --weight=1
|
ynh_script_progression --message="Restoring various file..." --weight=1
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/kiwiirc"
|
ynh_restore_file --origin_path="/var/log/$app"
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/var/log/$app.log"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
|
||||||
|
|
||||||
yunohost service add $app --description="Versatile web based messenger using IRC" --log="/var/log/$app.log"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RELOAD NGINX
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
|
||||||
|
|
||||||
|
ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd"
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -9,62 +9,35 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Loading installation settings..." --weight=2
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
||||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CHECK VERSION
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Backing up KiwiIRC before upgrading..." --weight=3
|
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Setting up source files..." --weight=2
|
||||||
|
|
||||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
ynh_setup_source --source_id="main" --dest_dir="$install_dir" --full_replace=1 --keep="config.conf www/static/client.json"
|
||||||
then
|
|
||||||
tempdir="$(mktemp -d)"
|
ynh_add_config --template="config.conf" --destination="$install_dir/config.conf"
|
||||||
ynh_setup_source --dest_dir=$tempdir --source_id=app
|
chmod 400 "$install_dir/config.conf"
|
||||||
ynh_exec_warn_less dpkg -i $tempdir/kiwiirc.deb
|
|
||||||
fi
|
ynh_add_config --template="client.json" --destination="$install_dir/www/static/client.json"
|
||||||
|
chmod 400 "$install_dir/www/static/client.json"
|
||||||
|
|
||||||
|
chmod 750 "$install_dir"
|
||||||
|
chown -R "$app:www-data" "$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# REAPPLY SYSTEM CONFIGURATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2
|
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
|
||||||
|
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#=================================================
|
ynh_add_systemd_config
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
yunohost service add "$app" --description="Versatile web based messenger using IRC" --log="/var/log/$app/$app.log"
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
|
||||||
|
|
||||||
yunohost service add $app --description="Versatile web based messenger using IRC" --log="/var/log/$app.log"
|
# Use logrotate to manage application logfile(s)
|
||||||
|
ynh_use_logrotate
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
|
@ -72,14 +45,7 @@ yunohost service add $app --description="Versatile web based messenger using IRC
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||||
|
|
||||||
# Start a systemd service
|
# Start a systemd service
|
||||||
ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd"
|
ynh_systemd_action --service_name="$app" --action="restart" --log_path="systemd"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RELOAD NGINX
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
5
tests.toml
Normal file
5
tests.toml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json
|
||||||
|
|
||||||
|
test_format = 1.0
|
||||||
|
|
||||||
|
[default]
|
Loading…
Reference in a new issue