mirror of
https://github.com/YunoHost-Apps/kiwiirc_ynh.git
synced 2024-09-03 19:35:59 +02:00
commit
220d255fb1
17 changed files with 102 additions and 259 deletions
|
@ -27,7 +27,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:** 1.5.0~ynh1
|
**Shipped version:** 20.05.24.1~ynh1
|
||||||
|
|
||||||
**Demo:** https://kiwiirc.com/nextclient
|
**Demo:** https://kiwiirc.com/nextclient
|
||||||
|
|
||||||
|
@ -38,7 +38,6 @@ A versatile web based messenger using IRC
|
||||||
## Documentation and resources
|
## Documentation and resources
|
||||||
|
|
||||||
* Official app website: https://kiwiirc.com/
|
* Official app website: https://kiwiirc.com/
|
||||||
* Official user documentation: https://yunohost.org/apps
|
|
||||||
* Official admin documentation: https://github.com/kiwiirc/kiwiirc/wiki
|
* Official admin documentation: https://github.com/kiwiirc/kiwiirc/wiki
|
||||||
* Upstream app code repository: https://github.com/kiwiirc/kiwiirc
|
* Upstream app code repository: https://github.com/kiwiirc/kiwiirc
|
||||||
* YunoHost documentation for this app: https://yunohost.org/app_kiwiirc
|
* YunoHost documentation for this app: https://yunohost.org/app_kiwiirc
|
||||||
|
|
|
@ -23,7 +23,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 :** 1.5.0~ynh1
|
**Version incluse :** 20.05.24.1~ynh1
|
||||||
|
|
||||||
**Démo :** https://kiwiirc.com/nextclient
|
**Démo :** https://kiwiirc.com/nextclient
|
||||||
|
|
||||||
|
@ -34,7 +34,6 @@ A versatile web based messenger using IRC
|
||||||
## Documentations et ressources
|
## Documentations et ressources
|
||||||
|
|
||||||
* Site officiel de l'app : https://kiwiirc.com/
|
* Site officiel de l'app : https://kiwiirc.com/
|
||||||
* Documentation officielle utilisateur : https://yunohost.org/apps
|
|
||||||
* Documentation officielle de l'admin : https://github.com/kiwiirc/kiwiirc/wiki
|
* Documentation officielle de l'admin : https://github.com/kiwiirc/kiwiirc/wiki
|
||||||
* Dépôt de code officiel de l'app : https://github.com/kiwiirc/kiwiirc
|
* Dépôt de code officiel de l'app : https://github.com/kiwiirc/kiwiirc
|
||||||
* Documentation YunoHost pour cette app : https://yunohost.org/app_kiwiirc
|
* Documentation YunoHost pour cette app : https://yunohost.org/app_kiwiirc
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
is_public=1
|
is_public=1
|
||||||
; Checks
|
; Checks
|
||||||
pkg_linter=1
|
pkg_linter=1
|
||||||
setup_sub_dir=1
|
setup_sub_dir=0
|
||||||
setup_root=1
|
setup_root=1
|
||||||
setup_nourl=0
|
setup_nourl=0
|
||||||
setup_private=1
|
setup_private=1
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
SOURCE_URL=https://github.com/kiwiirc/kiwiirc/releases/download/v1.5.0/kiwiirc_v1.5.0.zip
|
SOURCE_URL=https://kiwiirc.com/downloads/kiwiirc_20.05.24.1-1_amd64.deb
|
||||||
SOURCE_SUM=c7b31b2a92b173db4a3878d95aa74c8eb796e7b4d5600a80a00a73d80aa12ada
|
SOURCE_SUM=c99504c6de678fd91aed357ff0dada16a8df9e932970ed85767b516a9f87df52
|
||||||
SOURCE_SUM_PRG=sha256sum
|
SOURCE_SUM_PRG=sha256sum
|
||||||
SOURCE_FORMAT=zip
|
SOURCE_FORMAT=deb
|
||||||
SOURCE_IN_SUBDIR=true
|
SOURCE_IN_SUBDIR=true
|
||||||
SOURCE_FILENAME=
|
SOURCE_FILENAME=kiwiirc.deb
|
||||||
|
SOURCE_EXTRACT=false
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{
|
||||||
"windowTitle": "Kiwi IRC",
|
"windowTitle": "Web IRC",
|
||||||
"startupScreen": "welcome",
|
"startupScreen": "welcome",
|
||||||
"kiwiServer": "https://__DOMAIN____PATH__",
|
"kiwiServer": "/webirc/kiwiirc/",
|
||||||
"restricted": false,
|
"restricted": true,
|
||||||
"theme": "Default",
|
"theme": "Default",
|
||||||
"themes": [
|
"themes": [
|
||||||
{ "name": "Default", "url": "static/themes/default" },
|
{ "name": "Default", "url": "static/themes/default" },
|
||||||
|
@ -16,16 +16,10 @@
|
||||||
{ "name": "Elite", "url": "static/themes/elite" }
|
{ "name": "Elite", "url": "static/themes/elite" }
|
||||||
],
|
],
|
||||||
"startupOptions" : {
|
"startupOptions" : {
|
||||||
"server": "irc.freenode.net",
|
|
||||||
"port": 6697,
|
|
||||||
"tls": true,
|
|
||||||
"channel": "#yunohost",
|
"channel": "#yunohost",
|
||||||
"nick": ""
|
"nick": "web?",
|
||||||
},
|
"greetingText": "Libera Chat",
|
||||||
"embedly": {
|
"infoBackground": "",
|
||||||
"key": ""
|
"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>"
|
||||||
},
|
}
|
||||||
"plugins": [
|
|
||||||
{ "name": "customise", "url": "static/plugins/customise.html" }
|
|
||||||
]
|
|
||||||
}
|
}
|
|
@ -38,8 +38,8 @@ realname = "I am a webchat user"
|
||||||
|
|
||||||
# The websocket / http server
|
# The websocket / http server
|
||||||
[server.1]
|
[server.1]
|
||||||
bind = "0.0.0.0"
|
bind = "127.0.0.1"
|
||||||
port = 80
|
port = __PORT__
|
||||||
|
|
||||||
# Example TLS server
|
# Example TLS server
|
||||||
#[server.2]
|
#[server.2]
|
||||||
|
@ -55,14 +55,14 @@ port = 80
|
||||||
|
|
||||||
# Example unix socket server
|
# Example unix socket server
|
||||||
#[server.3]
|
#[server.3]
|
||||||
bind = unix:/tmp/webircgateway.sock
|
#bind = unix:/tmp/webircgateway.sock
|
||||||
bind_mode = 0777
|
#bind_mode = 0777
|
||||||
|
|
||||||
# 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 = true
|
||||||
webroot = www/
|
webroot = /usr/share/kiwiirc/
|
||||||
|
|
||||||
[transports]
|
[transports]
|
||||||
websocket
|
websocket
|
||||||
|
@ -89,8 +89,8 @@ kiwiirc
|
||||||
# Connections will be sent to a random upstream
|
# Connections will be sent to a random upstream
|
||||||
[upstream.1]
|
[upstream.1]
|
||||||
hostname = "irc.libera.chat"
|
hostname = "irc.libera.chat"
|
||||||
port = 6697
|
port = 6667
|
||||||
tls = true
|
tls = false
|
||||||
# Connection timeout in seconds
|
# Connection timeout in seconds
|
||||||
timeout = 5
|
timeout = 5
|
||||||
# Throttle the lines being written by X per second
|
# Throttle the lines being written by X per second
|
||||||
|
|
|
@ -1,14 +1,21 @@
|
||||||
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
location / {
|
||||||
location __PATH__/ {
|
index index.html;
|
||||||
|
root /usr/share/kiwiirc/;
|
||||||
# Path to source
|
|
||||||
alias __FINALPATH__/ ;
|
|
||||||
|
|
||||||
# Force usage of https
|
|
||||||
if ($scheme = http) {
|
|
||||||
rewrite ^ https://$server_name$request_uri? permanent;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Include SSOWAT user panel.
|
location /webirc/ {
|
||||||
include conf.d/yunohost_panel.conf.inc;
|
# Forward incoming requests to local webircgateway socket
|
||||||
|
proxy_pass http://127.0.0.1:__PORT__/webirc/;
|
||||||
|
|
||||||
|
# Set http version and headers
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
|
||||||
|
# Add X-Forwarded-* headers
|
||||||
|
proxy_set_header X-Forwarded-Host $host;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header X-Forwarded-For $remote_addr;
|
||||||
|
|
||||||
|
# Allow upgrades to websockets
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=Websocket gateway to IRC networks
|
|
||||||
Documentation=https://github.com/kiwiirc/webircgateway
|
|
||||||
After=network.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
User=__APP__
|
|
||||||
Group=__APP__
|
|
||||||
ExecStart=/var/www/webircgateway/kiwiirc --config=/var/www/webircgateway/config.conf
|
|
||||||
ExecReload=/usr/bin/kill -USR1 $MAINPID
|
|
||||||
LimitNOFILE=1048576
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
|
@ -3,17 +3,16 @@
|
||||||
"id": "kiwiirc",
|
"id": "kiwiirc",
|
||||||
"packaging_format": 1,
|
"packaging_format": 1,
|
||||||
"description": {
|
"description": {
|
||||||
"en": "A versatile web based messenger using IRC",
|
"en": "Versatile web based messenger using IRC",
|
||||||
"fr": "Une messagerie Web polyvalente utilisant IRC"
|
"fr": "Messagerie Web polyvalente utilisant IRC"
|
||||||
},
|
},
|
||||||
"version": "1.5.0~ynh1",
|
"version": "20.05.24.1~ynh1",
|
||||||
"url": "https://github.com/kiwiirc/kiwiirc",
|
"url": "https://github.com/kiwiirc/kiwiirc",
|
||||||
"upstream": {
|
"upstream": {
|
||||||
"license": "AGPL-3.0-only",
|
"license": "AGPL-3.0-only",
|
||||||
"website": "https://kiwiirc.com/",
|
"website": "https://kiwiirc.com/",
|
||||||
"demo": "https://kiwiirc.com/nextclient",
|
"demo": "https://kiwiirc.com/nextclient",
|
||||||
"admindoc": "https://github.com/kiwiirc/kiwiirc/wiki",
|
"admindoc": "https://github.com/kiwiirc/kiwiirc/wiki",
|
||||||
"userdoc": "https://yunohost.org/apps",
|
|
||||||
"code": "https://github.com/kiwiirc/kiwiirc"
|
"code": "https://github.com/kiwiirc/kiwiirc"
|
||||||
},
|
},
|
||||||
"license": "AGPL-3.0-only",
|
"license": "AGPL-3.0-only",
|
||||||
|
@ -21,7 +20,7 @@
|
||||||
"name": ""
|
"name": ""
|
||||||
},
|
},
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 4.2.4"
|
"yunohost": ">= 4.3.0"
|
||||||
},
|
},
|
||||||
"multi_instance": false,
|
"multi_instance": false,
|
||||||
"services": [
|
"services": [
|
||||||
|
@ -31,23 +30,7 @@
|
||||||
"install" : [
|
"install" : [
|
||||||
{
|
{
|
||||||
"name": "domain",
|
"name": "domain",
|
||||||
"type": "domain",
|
"type": "domain"
|
||||||
"example": "domain.org"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "path",
|
|
||||||
"type": "path",
|
|
||||||
"example": "/kiwiirc",
|
|
||||||
"default": "/kiwiirc"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "is_public",
|
|
||||||
"type": "boolean",
|
|
||||||
"help": {
|
|
||||||
"en": "If enabled, KiwiIRC will be accessible by people who do not have an account. This can be changed later via the webadmin.",
|
|
||||||
"fr": "Si cette case est cochée, KiwiIRC sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin."
|
|
||||||
},
|
|
||||||
"default": true
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,11 +4,6 @@
|
||||||
# COMMON VARIABLES
|
# COMMON VARIABLES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# dependencies used by the app
|
|
||||||
#pkg_dependencies="postgresql apt-transport-https"
|
|
||||||
|
|
||||||
#nodejs_version=12
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PERSONAL HELPERS
|
# PERSONAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -13,9 +13,6 @@ source /usr/share/yunohost/helpers
|
||||||
# MANAGE SCRIPT FAILURE
|
# MANAGE SCRIPT FAILURE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_clean_setup () {
|
|
||||||
ynh_clean_check_starting
|
|
||||||
}
|
|
||||||
# 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
|
||||||
|
|
||||||
|
@ -34,12 +31,6 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
#=================================================
|
#=================================================
|
||||||
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="$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -47,13 +38,15 @@ ynh_backup --src_path="$final_path"
|
||||||
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 SYSTEMD
|
# BACKUP THE CONFIGURATION FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
ynh_backup --src_path="/etc/kiwiirc"
|
||||||
|
|
||||||
|
ynh_backup --file="/var/log/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_print_info --message="Backup script completed for KiwiIRC. (YunoHost will then actually copy those files to the archive)."
|
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||||
|
|
|
@ -26,14 +26,12 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||||
|
|
||||||
# Needed for helper "ynh_add_nginx_config"
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Backing up KiwiIRC before changing its URL (may take a while)..." --weight=1
|
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
|
# Backup the current version of the app
|
||||||
ynh_backup_before_upgrade
|
ynh_backup_before_upgrade
|
||||||
|
@ -103,4 +101,4 @@ ynh_systemd_action --service_name=nginx --action=reload
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Change of URL completed for KiwiIRC" --last
|
ynh_script_progression --message="Change of URL completed for $app" --last
|
||||||
|
|
|
@ -21,8 +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
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -31,9 +30,6 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Validating installation parameters..." --weight=1
|
ynh_script_progression --message="Validating installation parameters..." --weight=1
|
||||||
|
|
||||||
final_path=/var/www/$app
|
|
||||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
|
||||||
|
|
||||||
# Register (book) web path
|
# Register (book) web path
|
||||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||||
|
|
||||||
|
@ -54,42 +50,27 @@ ynh_script_progression --message="Finding an available port..." --weight=1
|
||||||
port=$(ynh_find_port --port=7778)
|
port=$(ynh_find_port --port=7778)
|
||||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CREATE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring system user..." --weight=3
|
|
||||||
|
|
||||||
# Create a system user
|
|
||||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# 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
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
tempdir="$(mktemp -d)"
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
ynh_setup_source --dest_dir=$tempdir --source_id=app
|
||||||
ynh_setup_source --dest_dir="$final_path"
|
ynh_exec_warn_less dpkg -i $tempdir/kiwiirc.deb
|
||||||
|
|
||||||
chmod 750 "$final_path"
|
|
||||||
chmod -R o-rwx "$final_path"
|
|
||||||
chown -R $app:www-data "$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
#CREAT GATEWAYPATH
|
# ADD A CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting up gatheway path..." --weight=2
|
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||||
|
|
||||||
webircgateway_path=/var/www/webircgateway
|
ynh_add_config --template="../conf/client.json.example" --destination="/etc/kiwiirc/client.json"
|
||||||
mkdir -p $webircgateway_path
|
ynh_add_config --template="../conf/config.conf.example" --destination="/etc/kiwiirc/config.conf"
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=webircgateway_path --value=$webircgateway_path
|
chmod 744 "/etc/kiwiirc/config.conf"
|
||||||
|
chown root: "/etc/kiwiirc/config.conf"
|
||||||
mv ../sources/webircgateway/* $webircgateway_path
|
chmod 744 "/etc/kiwiirc/client.json"
|
||||||
|
chown root: "/etc/kiwiirc/client.json"
|
||||||
chmod 750 "$webircgateway_path"
|
|
||||||
chmod -R o-rwx "$webircgateway_path"
|
|
||||||
chown -R $app:www-data "$webircgateway_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
|
@ -99,28 +80,12 @@ 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
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SETUP SYSTEMD
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring a systemd service..." --weight=1
|
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
|
||||||
ynh_add_systemd_config
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# MODIFY A CONFIG FILE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Modifying a config file..."
|
|
||||||
|
|
||||||
ynh_add_config --template="../conf/config.json.example" --destination="$final_path/static/config.json"
|
|
||||||
ynh_add_config --template="../conf/config.conf.example" --destination="$webircgateway_path/config.conf"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
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/$app.log"
|
yunohost service add $app --description="Versatile web based messenger using IRC" --log="/var/log/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
|
@ -128,18 +93,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="start" --log_path="systemd"
|
ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SETUP SSOWAT
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring SSOwat..." --weight=1
|
|
||||||
|
|
||||||
# Make app public if necessary or protect it
|
|
||||||
if [ $is_public -eq 1 ]
|
|
||||||
then
|
|
||||||
ynh_permission_update --permission="main" --add="visitors"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
|
@ -152,4 +106,4 @@ ynh_systemd_action --service_name=nginx --action=reload
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Installation of KiwiIRC completed" --last
|
ynh_script_progression --message="Installation of $app completed" --last
|
||||||
|
|
|
@ -18,7 +18,6 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD REMOVE
|
# STANDARD REMOVE
|
||||||
|
@ -43,12 +42,20 @@ ynh_remove_systemd_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE APP MAIN DIR
|
# REMOVE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing KiwiIRC main directory..." --weight=6
|
ynh_script_progression --message="Removing Kiwiirc..." --weight=6
|
||||||
|
|
||||||
# Remove the app directory securely
|
dpkg --purge kiwiirc
|
||||||
ynh_secure_remove --file="$final_path"
|
|
||||||
|
|
||||||
ynh_secure_remove --file="/var/www/webircgateway"
|
#=================================================
|
||||||
|
# REMOVE VARIOUS FILES
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing various files..." --weight=1
|
||||||
|
|
||||||
|
# Remove a cron file
|
||||||
|
ynh_secure_remove --file="/etc/$app"
|
||||||
|
|
||||||
|
# Remove the log files
|
||||||
|
ynh_secure_remove --file="/var/log/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE NGINX CONFIGURATION
|
# REMOVE NGINX CONFIGURATION
|
||||||
|
@ -58,18 +65,8 @@ ynh_script_progression --message="Removing NGINX web server configuration..." --
|
||||||
# Remove the dedicated nginx config
|
# Remove the dedicated nginx config
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
|
||||||
# REMOVE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
|
||||||
|
|
||||||
# Delete a system user
|
|
||||||
ynh_system_user_delete --username=$app
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Removal of KiwiIRC completed" --last
|
ynh_script_progression --message="Removal of $app completed" --last
|
||||||
|
|
|
@ -13,9 +13,6 @@ source /usr/share/yunohost/helpers
|
||||||
# MANAGE SCRIPT FAILURE
|
# MANAGE SCRIPT FAILURE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_clean_setup () {
|
|
||||||
ynh_clean_check_starting
|
|
||||||
}
|
|
||||||
# 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
|
||||||
|
|
||||||
|
@ -28,15 +25,6 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Validating restoration parameters..." --weight=2
|
|
||||||
|
|
||||||
test ! -d $final_path \
|
|
||||||
|| ynh_die --message="There is already a directory: $final_path "
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE NGINX CONFIGURATION
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
|
@ -46,31 +34,22 @@ 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"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RECREATE THE DEDICATED USER
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
ynh_script_progression --message="Setting up source files..." --weight=2
|
||||||
|
|
||||||
# Create the dedicated user (if not existing)
|
tempdir="$(mktemp -d)"
|
||||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
ynh_setup_source --dest_dir=$tempdir --source_id=app
|
||||||
|
ynh_exec_warn_less dpkg -i $tempdir/kiwiirc.deb
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring KiwiIRC main directory..." --weight=60
|
ynh_script_progression --message="Restoring various file..." --weight=1
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$final_path"
|
ynh_restore_file --origin_path="/etc/kiwiirc"
|
||||||
|
|
||||||
chmod 750 "$final_path"
|
ynh_restore_file --origin_path="/var/log/$app.log"
|
||||||
chmod -R o-rwx "$final_path"
|
|
||||||
chown -R $app:www-data "$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE SYSTEMD
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Restoring the systemd configuration..." --weight=1
|
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
|
||||||
systemctl enable $app.service --quiet
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
|
@ -84,7 +63,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
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
|
ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
|
@ -97,4 +76,4 @@ ynh_systemd_action --service_name=nginx --action=reload
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Restoration completed for KiwiIRC" --last
|
ynh_script_progression --message="Restoration completed for $app" --last
|
||||||
|
|
|
@ -18,13 +18,11 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK VERSION
|
# CHECK VERSION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Checking version..."
|
|
||||||
|
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
upgrade_type=$(ynh_check_app_version_changed)
|
||||||
|
|
||||||
|
@ -42,57 +40,17 @@ ynh_clean_setup () {
|
||||||
# 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
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
|
||||||
|
|
||||||
# Cleaning legacy permissions
|
|
||||||
if ynh_legacy_permissions_exists; then
|
|
||||||
ynh_legacy_permissions_delete_all
|
|
||||||
|
|
||||||
ynh_app_setting_delete --app=$app --key=is_public
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CREATE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
|
||||||
|
|
||||||
# Create a dedicated user (if not existing)
|
|
||||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Upgrading source files..." --weight=3
|
tempdir="$(mktemp -d)"
|
||||||
|
ynh_setup_source --dest_dir=$tempdir --source_id=app
|
||||||
# Create a temporary directory
|
ynh_exec_warn_less dpkg -i $tempdir/kiwiirc.deb
|
||||||
tmpdir="$(mktemp -d)"
|
|
||||||
|
|
||||||
# Backup the config file in the temp dir
|
|
||||||
cp -a "$final_path/static/config.json" "$tmpdir/config.json"
|
|
||||||
|
|
||||||
# Remove the app directory securely
|
|
||||||
ynh_secure_remove --file=$final_path
|
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
|
||||||
ynh_setup_source --dest_dir=$final_path
|
|
||||||
|
|
||||||
#Copy the admin saved settings from tmp directory to final path
|
|
||||||
cp -a "$tmpdir/config.json" "$final_path/static/config.json"
|
|
||||||
|
|
||||||
# Remove the tmp directory securely
|
|
||||||
ynh_secure_remove --file="$tmpdir"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chmod 750 "$final_path"
|
|
||||||
chmod -R o-rwx "$final_path"
|
|
||||||
chown -R $app:www-data "$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -114,7 +72,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="start" --log_path="systemd"
|
ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
|
@ -127,4 +85,4 @@ ynh_systemd_action --service_name=nginx --action=reload
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Upgrade of KiwiIRC completed" --last
|
ynh_script_progression --message="Upgrade of $app completed" --last
|
||||||
|
|
Loading…
Reference in a new issue