mirror of
https://github.com/YunoHost-Apps/nitter_ynh.git
synced 2024-09-03 19:46:24 +02:00
commit
4df28aabd7
24 changed files with 201 additions and 694 deletions
|
@ -31,7 +31,7 @@ Inspired by the Invidious project.
|
|||
- Mobile support (responsive design)
|
||||
|
||||
|
||||
**Shipped version:** 2023.05.30~ynh1
|
||||
**Shipped version:** 2023.07.10~ynh1
|
||||
|
||||
**Demo:** https://nitter.net/
|
||||
|
||||
|
@ -39,13 +39,6 @@ Inspired by the Invidious project.
|
|||
|
||||
![Screenshot of Nitter](./doc/screenshots/screenshot.png)
|
||||
|
||||
## Disclaimers / important information
|
||||
|
||||
### Configuration
|
||||
|
||||
This app requires a dedicated root domain.
|
||||
|
||||
Nitter config file is stored in `/var/www/nitter/nitter.conf` (for the first instance, subsequent installs will go in `nitter__2`, `nitter__3`, etc). Users can override the defaults and set custom settings at `https://instance-domain.tld/settings`.
|
||||
## :red_circle: Antifeatures
|
||||
|
||||
- **Non-free Network Services**: Promotes or depends entirely on a non-free network service.
|
||||
|
|
|
@ -30,7 +30,7 @@ Nitter est une interface alternative pour Twitter qui est plus rapide que le sit
|
|||
- Support mobile (conception réactive)
|
||||
|
||||
|
||||
**Version incluse :** 2023.05.30~ynh1
|
||||
**Version incluse :** 2023.07.10~ynh1
|
||||
|
||||
**Démo :** https://nitter.net/
|
||||
|
||||
|
@ -38,13 +38,6 @@ Nitter est une interface alternative pour Twitter qui est plus rapide que le sit
|
|||
|
||||
![Capture d’écran de Nitter](./doc/screenshots/screenshot.png)
|
||||
|
||||
## Avertissements / informations importantes
|
||||
|
||||
### Configuration
|
||||
|
||||
Cette application nécéssite un domaine dedié.
|
||||
|
||||
Le ficher de configuration de Nitter se trouve à `/var/www/nitter/nitter.conf` (pour la première installation, les prochaines installations iront dans `nitter__2`, `nitter__3`, etc). Les utilisateurs peuvent modifier les paramétres par défaut en visitant `https://instance-domain.tld/settings`.
|
||||
## :red_circle: Fonctions indésirables
|
||||
|
||||
- **Non-free Network Services**: Promotes or depends entirely on a non-free network service.
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
;; Test complet
|
||||
; Manifest
|
||||
domain="domain.tld"
|
||||
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
|
||||
# 2022.06.09~ynh1
|
||||
upgrade=0 from_commit=0f1e8c0d23500b4ec4aa8085c287fac1adbe0db8
|
||||
backup_restore=1
|
||||
multi_instance=1
|
||||
port_already_use=0
|
||||
change_url=1
|
||||
;;; Options
|
||||
Email=
|
||||
Notification=none
|
|
@ -1,7 +0,0 @@
|
|||
SOURCE_URL=https://nim-lang.org/download/nim-1.6.12-linux_x64.tar.xz
|
||||
SOURCE_SUM=6b22894d0db974e10bd271217ce7f01a5fcd0b37cb3ea9d539734cb46f2cac75
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.xz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=nim-1.6.12-linux_x64.tar.xz
|
||||
SOURCE_EXTRACT=true
|
|
@ -1,7 +0,0 @@
|
|||
SOURCE_URL=https://github.com/zedeus/nitter/tarball/38985af6ed30f050201b15425cdac0dc2e286b6d
|
||||
SOURCE_SUM=e3d4c27d6287ad382502ae2e577182d67d99fb305bea498200c7c34215236f55
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=38985af6ed30f050201b15425cdac0dc2e286b6d
|
||||
SOURCE_EXTRACT=true
|
|
@ -1,7 +0,0 @@
|
|||
SOURCE_URL=https://github.com/nim-lang/nightlies/releases/download/2023-06-01-version-1-6-b855404c711730c41114e86631fa19414080f999/nim-1.6.13-linux_arm64.tar.xz
|
||||
SOURCE_SUM=730f4d6d98e65a5587ff4b198161725b7f787aed729d69045fbe38e0035ae8fb
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.xz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=nim-1.6.13-linux_arm64.tar.xz
|
||||
SOURCE_EXTRACT=true
|
|
@ -1,7 +0,0 @@
|
|||
SOURCE_URL=https://github.com/nim-lang/nightlies/releases/download/2023-06-01-version-1-6-b855404c711730c41114e86631fa19414080f999/nim-1.6.13-linux_armv7l.tar.xz
|
||||
SOURCE_SUM=c34bc29d20c70c513382df8ef6d834d0588e4e99692a012c9b399020f49a4c1a
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.xz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=nim-1.6.13-linux_armv7l.tar.xz
|
||||
SOURCE_EXTRACT=true
|
|
@ -1,7 +0,0 @@
|
|||
SOURCE_URL=https://nim-lang.org/download/nim-1.6.12-linux_x32.tar.xz
|
||||
SOURCE_SUM=23b8069b54c22a0512e2e90c22abf7f976badd9277b03b25edd992e49ac4ea9e
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.xz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=nim-1.6.12-linux_x32.tar.xz
|
||||
SOURCE_EXTRACT=true
|
|
@ -2,7 +2,7 @@
|
|||
location __PATH__/ {
|
||||
|
||||
# Path to source
|
||||
alias __FINALPATH__/public/ ;
|
||||
alias __INSTALL_DIR__/public/;
|
||||
|
||||
try_files $uri @proxy_to_app;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,6 @@ theme = "__THEME__"
|
|||
replaceTwitter = "__DOMAIN__"
|
||||
replaceYouTube = "__REPLACE_YOUTUBE__"
|
||||
replaceReddit = "__REPLACE_REDDIT__"
|
||||
replaceInstagram = "__REPLACE_INSTAGRAM__"
|
||||
proxyVideos = true
|
||||
hlsPlayback = true
|
||||
infiniteScroll = false
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
[Unit]
|
||||
Description=Nitter: Alternative Twitter front-end
|
||||
Description=Nitter: alternative Twitter front-end
|
||||
After=network.target redis.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=__APP__
|
||||
Group=__APP__
|
||||
WorkingDirectory=__FINALPATH__/
|
||||
ExecStart=__FINALPATH__/nitter
|
||||
WorkingDirectory=__INSTALL_DIR__/
|
||||
ExecStart=__INSTALL_DIR__/nitter
|
||||
StandardOutput=append:/var/log/__APP__/__APP__.log
|
||||
StandardError=inherit
|
||||
|
||||
|
|
|
@ -4,20 +4,20 @@ version = "1.0"
|
|||
name = "Nitter configuration"
|
||||
services = ["__APP__"]
|
||||
|
||||
[main.config]
|
||||
name = "Configuration Options"
|
||||
[main.config]
|
||||
name = "Configuration Options"
|
||||
|
||||
[main.config.title]
|
||||
ask = "Default title"
|
||||
type = "string"
|
||||
default = "Nitter"
|
||||
help = "Choose a default title for this instance"
|
||||
bind = "title:__FINALPATH__/nitter.conf"
|
||||
[main.config.title]
|
||||
ask = "Default title"
|
||||
type = "string"
|
||||
default = "Nitter"
|
||||
help = "Choose a default title for this instance"
|
||||
bind = "title:__INSTALL_DIR__/nitter.conf"
|
||||
|
||||
[main.config.theme]
|
||||
ask = "Default theme"
|
||||
type = "select"
|
||||
choices = [
|
||||
[main.config.theme]
|
||||
ask = "Default theme"
|
||||
type = "select"
|
||||
choices = [
|
||||
"Auto",
|
||||
"Auto (Twitter)",
|
||||
"Black",
|
||||
|
@ -27,29 +27,22 @@ choices = [
|
|||
"Pleroma",
|
||||
"Twitter",
|
||||
"Twitter dark",
|
||||
]
|
||||
default = "Auto"
|
||||
help = "Choose a default theme for this instance"
|
||||
bind = "theme:__FINALPATH__/nitter.conf"
|
||||
]
|
||||
default = "Auto"
|
||||
help = "Choose a default theme for this instance"
|
||||
bind = "theme:__INSTALL_DIR__/nitter.conf"
|
||||
|
||||
[main.config.replace_youtube]
|
||||
ask = "Piped/Invidious instance"
|
||||
type = "string"
|
||||
default = "https://invidious.fdn.fr/"
|
||||
help = "Replace YouTube links with a Piped or Invidious instance"
|
||||
bind = "replaceYouTube:__FINALPATH__/nitter.conf"
|
||||
[main.config.replace_youtube]
|
||||
ask = "Piped/Invidious instance"
|
||||
type = "string"
|
||||
default = "https://invidious.fdn.fr/"
|
||||
help = "Replace YouTube links with a Piped or Invidious instance"
|
||||
bind = "replaceYouTube:__INSTALL_DIR__/nitter.conf"
|
||||
|
||||
[main.config.replace_reddit]
|
||||
ask = "Teddit/Libreddit instance"
|
||||
type = "string"
|
||||
default = "https://libredd.it/"
|
||||
help = "Replace Reddit links with a Teddit or Libreddit instance"
|
||||
bind = "replaceReddit:__FINALPATH__/nitter.conf"
|
||||
|
||||
[main.config.replace_instagram]
|
||||
ask = "Bibliogram instance"
|
||||
type = "string"
|
||||
default = "https://bibliogram.art/"
|
||||
help = "Replace Instagram links with a Bibliogram instance"
|
||||
bind = "replaceInstagram:__FINALPATH__/nitter.conf"
|
||||
[main.config.replace_reddit]
|
||||
ask = "Teddit/Libreddit instance"
|
||||
type = "string"
|
||||
default = "https://libredd.it/"
|
||||
help = "Replace Reddit links with a Teddit or Libreddit instance"
|
||||
bind = "replaceReddit:__INSTALL_DIR__/nitter.conf"
|
||||
|
||||
|
|
|
@ -1,5 +1 @@
|
|||
### Configuration
|
||||
|
||||
This app requires a dedicated root domain.
|
||||
|
||||
Nitter config file is stored in `/var/www/nitter/nitter.conf` (for the first instance, subsequent installs will go in `nitter__2`, `nitter__3`, etc). Users can override the defaults and set custom settings at `https://instance-domain.tld/settings`.
|
||||
Nitter config file is stored in `/var/www/nitter/nitter.conf` (for the first instance, subsequent installs will go in `nitter__2`, `nitter__3`, etc). Users can override the defaults and set custom settings at `https://__DOMAIN__/settings`.
|
|
@ -1,5 +1 @@
|
|||
### Configuration
|
||||
|
||||
Cette application nécéssite un domaine dedié.
|
||||
|
||||
Le ficher de configuration de Nitter se trouve à `/var/www/nitter/nitter.conf` (pour la première installation, les prochaines installations iront dans `nitter__2`, `nitter__3`, etc). Les utilisateurs peuvent modifier les paramétres par défaut en visitant `https://instance-domain.tld/settings`.
|
||||
Le ficher de configuration de Nitter se trouve à `/var/www/nitter/nitter.conf` (pour la première installation, les prochaines installations iront dans `nitter__2`, `nitter__3`, etc). Les utilisateurs peuvent modifier les paramétres par défaut en visitant `https://__DOMAIN__/settings`.
|
121
manifest.json
121
manifest.json
|
@ -1,121 +0,0 @@
|
|||
{
|
||||
"name": "Nitter",
|
||||
"id": "nitter",
|
||||
"packaging_format": 1,
|
||||
"description": {
|
||||
"en": "Alternative front-end for Twitter that respects your privacy",
|
||||
"fr": "Interface alternative pour Twitter qui respecte votre vie privée"
|
||||
},
|
||||
"version": "2023.05.30~ynh1",
|
||||
"url": "https://github.com/zedeus/nitter",
|
||||
"upstream": {
|
||||
"license": "AGPL-3.0-only",
|
||||
"website": "https://nitter.net/",
|
||||
"demo": "https://nitter.net/",
|
||||
"admindoc": "https://github.com/zedeus/nitter/wiki",
|
||||
"code": "https://github.com/zedeus/nitter"
|
||||
},
|
||||
"license": "AGPL-3.0-only",
|
||||
"maintainer": {
|
||||
"name": "Jules Bertholet",
|
||||
"email": "jules.bertholet@gmail.com"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 11.0.9"
|
||||
},
|
||||
"multi_instance": true,
|
||||
"services": [
|
||||
"nginx",
|
||||
"redis"
|
||||
],
|
||||
"arguments": {
|
||||
"install": [
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain"
|
||||
},
|
||||
{
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"help": {
|
||||
"en": "If public, anyone will be able to use this Nitter instance to browse Twitter. Note that heavy usage may cause Twitter API rate limits to be hit.",
|
||||
"fr": "Si public, tout le monde pourra utiliser cette instance Nitter pour parcourir Twitter. Notez qu'un usage trop intensif peut être bridé par l'API Twitter au dela d'un certain seuil."
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "title",
|
||||
"type": "string",
|
||||
"default": "Nitter",
|
||||
"ask": {
|
||||
"en": "Name of the instance",
|
||||
"fr": "Nom de l'instance"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "theme",
|
||||
"type": "string",
|
||||
"default": "Auto",
|
||||
"choices": [
|
||||
"Auto",
|
||||
"Black",
|
||||
"Mastodon",
|
||||
"Nitter",
|
||||
"Pleroma",
|
||||
"Twitter",
|
||||
"Twitter dark"
|
||||
],
|
||||
"ask": {
|
||||
"en": "Choose a default theme for this instance",
|
||||
"fr": "Choisissez un thème par défaut pour cette instance"
|
||||
},
|
||||
"help": {
|
||||
"en": "Users can override this setting",
|
||||
"fr": "Les utilisateurs peuvent modifier ce paramétre"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "replace_youtube",
|
||||
"type": "string",
|
||||
"optional": true,
|
||||
"default": "",
|
||||
"ask": {
|
||||
"en": "Replace YouTube links with an Invidious instance",
|
||||
"fr": "Remplacer les liens YouTube avec une instance Invidious"
|
||||
},
|
||||
"help": {
|
||||
"en": "You can choose to rewrite YouTube links in tweets to point to an Invidious instance. Use one from https://instances.invidious.io/ or install Invidious on your server! Users can override this setting.",
|
||||
"fr": "Vous pouvez choisir de réécrire les liens YouTube dans les tweets pour pointer vers une instance Invidious. Choisissez-en une de https://instances.invidious.io/ ou installez Invidious sur votre serveur! Les utilisateus peuvent modifier ce paramétre."
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "replace_instagram",
|
||||
"type": "string",
|
||||
"optional": true,
|
||||
"default": "",
|
||||
"ask": {
|
||||
"en": "Replace Instagram links with a Bibliogram instance",
|
||||
"fr": "Remplacer les liens Instagram avec une instance Bibliogram"
|
||||
},
|
||||
"help": {
|
||||
"en": "You can choose to rewrite Instagram links in tweets to point to a Bibliogram instance. Use one from https://git.sr.ht/~cadence/bibliogram-docs/tree/master/docs/Instances.md or install Bibliogram on your server! Users can override this setting.",
|
||||
"fr": "Vous pouvez choisir de réécrire les liens Instagram dans les tweets pour pointer vers une instance Bibliogram. Choisissez-en une de https://git.sr.ht/~cadence/bibliogram-docs/tree/master/docs/Instances.md ou installez Bibliogram sur votre serveur! Les utilisateurs peuvent modifier ce paramétre."
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "replace_reddit",
|
||||
"type": "string",
|
||||
"optional": true,
|
||||
"default": "",
|
||||
"ask": {
|
||||
"en": "Replace Reddit links with a Libreddit instance",
|
||||
"fr": "Remplacer les liens Reddit avec une instance Libreddit"
|
||||
},
|
||||
"help": {
|
||||
"en": "You can choose to rewrite Reddit links in tweets to point to a Libreddit instance. Use https://libredd.it/ or install Libreddit on your server! Users can override this setting.",
|
||||
"fr": "Vous pouvez choisir de réécrire les liens Reddit dans les tweets pour pointer vers une instance Libreddit. Choisissez https://libredd.it/ ou installez Libreddit sur votre serveur! Les utilisateurs peuvent modifier ce paramétre."
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
89
manifest.toml
Normal file
89
manifest.toml
Normal file
|
@ -0,0 +1,89 @@
|
|||
packaging_format = 2
|
||||
|
||||
id = "nitter"
|
||||
name = "Nitter"
|
||||
description.en = "Alternative front-end for Twitter that respects your privacy"
|
||||
description.fr = "Interface alternative pour Twitter qui respecte votre vie privée"
|
||||
|
||||
version = "2023.07.10~ynh1"
|
||||
|
||||
maintainers = ["Jules Bertholet"]
|
||||
|
||||
[upstream]
|
||||
license = "AGPL-3.0-only"
|
||||
website = "https://nitter.net/"
|
||||
demo = "https://nitter.net/"
|
||||
admindoc = "https://github.com/zedeus/nitter/wiki"
|
||||
code = "https://github.com/zedeus/nitter"
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 11.1.21"
|
||||
architectures = "all"
|
||||
multi_instance = true
|
||||
ldap = false
|
||||
sso = true
|
||||
disk = "50M"
|
||||
ram.build = "2000M"
|
||||
ram.runtime = "50M"
|
||||
|
||||
[install]
|
||||
[install.domain]
|
||||
type = "domain"
|
||||
full_domain = true
|
||||
|
||||
[install.init_main_permission]
|
||||
help.en = "If public, anyone will be able to use this Nitter instance to browse Twitter. Note that heavy usage may cause Twitter API rate limits to be hit."
|
||||
help.fr = "Si public, tout le monde pourra utiliser cette instance Nitter pour parcourir Twitter. Notez qu'un usage trop intensif peut être bridé par l'API Twitter au dela d'un certain seuil."
|
||||
type = "group"
|
||||
default = "visitors"
|
||||
|
||||
[install.title]
|
||||
ask.en = "Name of the instance"
|
||||
ask.fr = "Nom de l'instance"
|
||||
type = "string"
|
||||
default = "Nitter"
|
||||
|
||||
[install.replace_youtube]
|
||||
ask.en = "Replace YouTube links with a Piped or Invidious instance"
|
||||
ask.fr = "Remplacer les liens YouTube avec une instance Piped ou Invidious"
|
||||
help.en = "You can choose to rewrite YouTube links in tweets to point to a Piped or Invidious instance. Use one from https://github.com/TeamPiped/Piped/wiki/Instances or https://instances.invidious.io/, or install Invidious on your server! Users can override this setting."
|
||||
help.fr = "Vous pouvez choisir de réécrire les liens YouTube dans les tweets pour pointer vers une instance Piped ou Invidious. Choisissez-en une de https://github.com/TeamPiped/Piped/wiki/Instances ou https://instances.invidious.io/, ou installez Invidious sur votre serveur! Les utilisateus peuvent modifier ce paramétre."
|
||||
type = "string"
|
||||
optional = true
|
||||
default = ""
|
||||
|
||||
[install.replace_reddit]
|
||||
ask.en = "Replace Reddit links with a Libreddit or Teddit instance"
|
||||
ask.fr = "Remplacer les liens Reddit avec une instance Libreddit ou Teddit"
|
||||
help.en = "You can choose to rewrite Reddit links in tweets to point to a Libreddit or Teddit instance. Use https://libredd.it/ or install Libreddit on your server! Users can override this setting."
|
||||
help.fr = "Vous pouvez choisir de réécrire les liens Reddit dans les tweets pour pointer vers une instance Libreddit ou Teddit. Choisissez https://libredd.it/ ou installez Libreddit sur votre serveur! Les utilisateurs peuvent modifier ce paramétre."
|
||||
type = "string"
|
||||
optional = true
|
||||
default = ""
|
||||
|
||||
[resources]
|
||||
[resources.sources.main]
|
||||
url = "https://github.com/zedeus/nitter/tarball/0bc3c153d9b38a3c02f321fb64a375fef6b97e8e"
|
||||
sha256 = "0ec00b67ed8b2b33f5dd5008705985ea4853c666938ffe560c79f498c4a3baf3"
|
||||
|
||||
[resources.sources.nim]
|
||||
amd64.url = "https://nim-lang.org/download/nim-1.6.14-linux_x64.tar.xz"
|
||||
amd64.sha256 = "1e7073c05600f2be5f2d9018e73f4584f0369442455ab27521ca499b47eef904"
|
||||
arm64.url = "https://github.com/nim-lang/nightlies/releases/download/2023-07-04-version-1-6-1cd48e4b2abd867adf1ab52a70a1d8f1c6ac77c4/nim-1.6.15-linux_arm64.tar.xz"
|
||||
arm64.sha256 = "4ff08b1785e60bdac17fe4a40ce119b6f9d40fad0421e9576097f95122ce4125"
|
||||
armhf.url = "https://github.com/nim-lang/nightlies/releases/download/2023-07-04-version-1-6-1cd48e4b2abd867adf1ab52a70a1d8f1c6ac77c4/nim-1.6.15-linux_armv7l.tar.xz"
|
||||
armhf.sha256 = "7441e7feb3e3293c8662011e174d913ae276c853255f5792b31c3c2ec4d0ed30"
|
||||
i386.url = "https://nim-lang.org/download/nim-1.6.14-linux_x32.tar.xz"
|
||||
i386.sha256 = "18d285f62392b3cd725af91df4a7b3b99bbcd5446881725e18e372e3a2c3a89b"
|
||||
|
||||
[resources.ports]
|
||||
|
||||
[resources.system_user]
|
||||
|
||||
[resources.install_dir]
|
||||
|
||||
[resources.permissions]
|
||||
main.url = "/"
|
||||
|
||||
[resources.apt]
|
||||
packages = "acl nim libsass-dev"
|
|
@ -4,30 +4,27 @@
|
|||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
|
||||
# dependencies used by the app
|
||||
pkg_dependencies="acl nim libsass-dev"
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
#=================================================
|
||||
|
||||
function build_nitter {
|
||||
pushd "$final_path"
|
||||
chown -R $app:$app $final_path
|
||||
sudo -u $app env "PATH=$final_path/nim-installation/bin:$(sudo -u $app sh -c 'echo $PATH')" nimble build -d:release -y -d:danger --passC:"-flto" --passL:"-flto" 2>&1
|
||||
sudo -u $app env "PATH=$final_path/nim-installation/bin:$(sudo -u $app sh -c 'echo $PATH')" strip -s nitter 2>&1
|
||||
sudo -u $app env "PATH=$final_path/nim-installation/bin:$(sudo -u $app sh -c 'echo $PATH')" nimble scss -y 2>&1
|
||||
mkdir -p $final_path/tmp
|
||||
chown -R root:root $final_path
|
||||
pushd "$install_dir"
|
||||
chown -R $app:$app $install_dir
|
||||
sudo -u $app env "PATH=$install_dir/nim-installation/bin:$(sudo -u $app sh -c 'echo $PATH')" nimble build -d:release -y -d:danger --passC:"-flto" --passL:"-flto" 2>&1
|
||||
sudo -u $app env "PATH=$install_dir/nim-installation/bin:$(sudo -u $app sh -c 'echo $PATH')" strip -s nitter 2>&1
|
||||
sudo -u $app env "PATH=$install_dir/nim-installation/bin:$(sudo -u $app sh -c 'echo $PATH')" nimble scss -y 2>&1
|
||||
mkdir -p $install_dir/tmp
|
||||
chown -R root:root $install_dir
|
||||
popd
|
||||
}
|
||||
|
||||
function set_permissions {
|
||||
chown -R root:$app $final_path
|
||||
chown -R $app:$app $final_path/tmp
|
||||
chmod -R g=u,g-w,o-rwx $final_path
|
||||
setfacl -n -m u:www-data:--x $final_path
|
||||
setfacl -nR -m u:www-data:r-x -m d:u:www-data:r-x $final_path/public
|
||||
chown -R root:$app $install_dir
|
||||
chown -R $app:$app $install_dir/tmp
|
||||
chmod -R g=u,g-w,o-rwx $install_dir
|
||||
setfacl -n -m u:www-data:--x $install_dir
|
||||
setfacl -nR -m u:www-data:r-x -m d:u:www-data:r-x $install_dir/public
|
||||
}
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -10,26 +10,6 @@
|
|||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup() {
|
||||
true
|
||||
}
|
||||
# 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
|
||||
#=================================================
|
||||
|
@ -39,7 +19,7 @@ ynh_print_info --message="Declaring files to be backed up..."
|
|||
# BACKUP THE APP MAIN DIR
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="$final_path"
|
||||
ynh_backup --src_path="$install_dir"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
|
|
|
@ -9,60 +9,6 @@
|
|||
source _common.sh
|
||||
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="/"
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
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)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE CHANGE URL 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 () {
|
||||
ynh_clean_check_starting
|
||||
# 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
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
|
@ -77,29 +23,7 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app
|
|||
#=================================================
|
||||
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
|
||||
|
||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||
|
||||
# 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
|
||||
ynh_change_url_nginx_config
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC MODIFICATIONS
|
||||
|
@ -110,9 +34,9 @@ ynh_script_progression --message="Updating a configuration file..."
|
|||
|
||||
if [ $change_domain -eq 1 ]
|
||||
then
|
||||
ynh_delete_file_checksum --file="$final_path/nitter.conf"
|
||||
ynh_replace_string --match_string="hostname = \"$old_domain\"" --replace_string="hostname = \"$new_domain\"" --target_file="$final_path/nitter.conf"
|
||||
ynh_store_file_checksum --file="$final_path/nitter.conf"
|
||||
ynh_delete_file_checksum --file="$install_dir/nitter.conf"
|
||||
ynh_replace_string --match_string="hostname = \"$old_domain\"" --replace_string="hostname = \"$new_domain\"" --target_file="$install_dir/nitter.conf"
|
||||
ynh_store_file_checksum --file="$install_dir/nitter.conf"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -125,13 +49,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
|
|||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
150
scripts/install
150
scripts/install
|
@ -9,105 +9,26 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup() {
|
||||
ynh_clean_check_starting
|
||||
}
|
||||
# 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="/"
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
title=$YNH_APP_ARG_TITLE
|
||||
theme=$YNH_APP_ARG_THEME
|
||||
replace_youtube=$YNH_APP_ARG_REPLACE_YOUTUBE
|
||||
replace_instagram=$YNH_APP_ARG_REPLACE_INSTAGRAM
|
||||
replace_reddit=$YNH_APP_ARG_REPLACE_REDDIT
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
hmac_key=$(ynh_string_random --length=64)
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||
#=================================================
|
||||
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
|
||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||
|
||||
#=================================================
|
||||
# STORE SETTINGS FROM MANIFEST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Storing installation settings..." --weight=1
|
||||
|
||||
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
||||
ynh_app_setting_set --app=$app --key=title --value=$title
|
||||
ynh_app_setting_set --app=$app --key=theme --value=$theme
|
||||
ynh_app_setting_set --app=$app --key=replace_youtube --value=$replace_youtube
|
||||
ynh_app_setting_set --app=$app --key=replace_instagram --value=$replace_instagram
|
||||
ynh_app_setting_set --app=$app --key=replace_reddit --value=$replace_reddit
|
||||
theme="Auto"
|
||||
ynh_app_setting_set --app=$app --key=hmac_key --value=$hmac_key
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
# FIND AND OPEN A PORT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Finding an available port..." --weight=1
|
||||
|
||||
# Find an available port
|
||||
port=$(ynh_find_port --port=8080)
|
||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing dependencies..." --weight=1
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..." --weight=1
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
ynh_app_setting_set --app=$app --key=theme --value=$theme
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setting up source files..." --weight=1
|
||||
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path" --source_id="app"
|
||||
ynh_setup_source --dest_dir="$final_path/nim-installation" --source_id=$YNH_ARCH
|
||||
ynh_setup_source --dest_dir="$install_dir"
|
||||
ynh_setup_source --dest_dir="$install_dir/nim-installation" --source_id="nim"
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
|
@ -119,46 +40,34 @@ ynh_script_progression --message="Compiling Nitter..." --weight=30
|
|||
build_nitter
|
||||
|
||||
#=================================================
|
||||
# ADD A CONFIGURATION
|
||||
# SYSTEM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding a configuration file..."
|
||||
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
||||
|
||||
ynh_add_config --template="nitter.conf" --destination="$final_path/nitter.conf"
|
||||
|
||||
chmod 400 "$final_path/nitter.conf"
|
||||
chown $app:$app "$final_path/nitter.conf"
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring a systemd service..." --weight=1
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
# SECURE FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
# Set permissions to app files
|
||||
set_permissions
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring log rotation..." --weight=1
|
||||
|
||||
# Use logrotate to manage application logfile(s)
|
||||
ynh_use_logrotate
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||
|
||||
yunohost service add $app --description="Alternative front-end for Twitter that respects your privacy" --log="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# ADD A CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding a configuration file..."
|
||||
|
||||
ynh_add_config --template="nitter.conf" --destination="$install_dir/nitter.conf"
|
||||
|
||||
chmod 400 "$install_dir/nitter.conf"
|
||||
chown $app:$app "$install_dir/nitter.conf"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
|
@ -167,25 +76,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
|
|||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring permissions..." --weight=1
|
||||
|
||||
# Make app public if necessary
|
||||
if [ $is_public -eq 1 ]; then
|
||||
# Everyone can access the app.
|
||||
# The "main" permission is automatically created before the install script.
|
||||
ynh_permission_update --permission="main" --add="visitors"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -10,21 +10,11 @@ source _common.sh
|
|||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
# REMOVE SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
|
||||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
#=================================================
|
||||
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
||||
# REMOVE SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
||||
|
||||
# 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
|
||||
|
@ -32,56 +22,15 @@ if ynh_exec_warn_less yunohost service status $app >/dev/null; 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 LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
|
||||
|
||||
# Remove the app-specific logrotate config
|
||||
ynh_remove_logrotate
|
||||
|
||||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing app main directory..." --weight=1
|
||||
|
||||
# Remove the app directory securely
|
||||
ynh_secure_remove --file="$final_path"
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
|
||||
|
||||
# Remove the dedicated NGINX config
|
||||
ynh_remove_nginx_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing dependencies..." --weight=1
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
#=================================================
|
||||
|
|
|
@ -10,97 +10,33 @@
|
|||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup() {
|
||||
ynh_clean_check_starting
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --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)
|
||||
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=1
|
||||
|
||||
test ! -d $final_path ||
|
||||
ynh_die --message="There is already a directory: $final_path "
|
||||
|
||||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
||||
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
ynh_restore_file --origin_path="$install_dir"
|
||||
|
||||
chown -R $app:www-data "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
# RESTORE SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
|
||||
|
||||
# Define and install dependencies
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the NGINX web server configuration..."
|
||||
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RESTORE USER RIGHTS
|
||||
#=================================================
|
||||
|
||||
# Restore permissions on app files
|
||||
set_permissions
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
|
||||
|
||||
ynh_use_logrotate --non-append
|
||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||
|
||||
yunohost service add $app --description="Alternative front-end for Twitter that respects your privacy" --log="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
|
@ -110,13 +46,6 @@ 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"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -9,45 +9,22 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --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)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
title=$(ynh_app_setting_get --app=$app --key=title)
|
||||
theme=$(ynh_app_setting_get --app=$app --key=theme)
|
||||
replace_youtube=$(ynh_app_setting_get --app=$app --key=replace_youtube)
|
||||
replace_instagram=$(ynh_app_setting_get --app=$app --key=replace_instagram)
|
||||
replace_reddit=$(ynh_app_setting_get --app=$app --key=replace_reddit)
|
||||
hmac_key=$(ynh_app_setting_get --app=$app --key=hmac_key)
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Checking version..."
|
||||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
|
||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup() {
|
||||
ynh_clean_check_starting
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
# If theme doesn't exist, create it
|
||||
if [ -z "${theme:-}" ]; then
|
||||
theme="Auto"
|
||||
ynh_app_setting_set --app=$app --key=theme --value=$theme
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
|
@ -58,14 +35,6 @@ 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"
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
#=================================================
|
||||
|
@ -74,20 +43,12 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]; then
|
|||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path" --source_id="app"
|
||||
ynh_setup_source --dest_dir="$final_path/nim-installation" --source_id=$YNH_ARCH --keep="nitter.conf"
|
||||
ynh_setup_source --dest_dir="$install_dir"
|
||||
ynh_setup_source --dest_dir="$install_dir/nim-installation" --source_id="nim" --keep="nitter.conf"
|
||||
fi
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..." --weight=1
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
|
@ -111,7 +72,7 @@ build_nitter
|
|||
#=================================================
|
||||
ynh_script_progression --message="Updating a configuration file..."
|
||||
|
||||
ynh_add_config --template="nitter.conf" --destination="$final_path/nitter.conf"
|
||||
ynh_add_config --template="nitter.conf" --destination="$install_dir/nitter.conf"
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
|
@ -152,13 +113,6 @@ 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"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
9
tests.toml
Normal file
9
tests.toml
Normal file
|
@ -0,0 +1,9 @@
|
|||
test_format = 1.0
|
||||
|
||||
[default]
|
||||
|
||||
# -------------------------------
|
||||
# Commits to test upgrade from
|
||||
# -------------------------------
|
||||
|
||||
test_upgrade_from.5b6368a92174768c22bd2fa97e327d822a8d42f3.name = "Upgrade from 2023.02.02"
|
Loading…
Reference in a new issue