mirror of
https://github.com/YunoHost-Apps/jenkins_ynh.git
synced 2024-09-03 19:26:18 +02:00
commit
40b518a2ff
15 changed files with 896 additions and 218 deletions
68
README.md
68
README.md
|
@ -1,20 +1,64 @@
|
||||||
Jenkins for YunoHost
|
# Jenkins for YunoHost
|
||||||
==================
|
|
||||||
|
|
||||||
[Yunohost project](https://yunohost.org/#/)
|
[](https://ci-apps.yunohost.org/jenkins/job/jenkins%20%28Community%29/lastBuild/consoleFull)
|
||||||
|
[](https://install-app.yunohost.org/?app=jenkins)
|
||||||
|
|
||||||
|
*[Lire ce readme en français.](./README_fr.md)*
|
||||||
|
|
||||||
|
> *This package allow you to install jenkins quickly and simply on a YunoHost server.
|
||||||
|
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
|
||||||
|
|
||||||
|
## Overview
|
||||||
The leading open source automation server, Jenkins provides hundreds of plugins to support building, deploying and automating any project.
|
The leading open source automation server, Jenkins provides hundreds of plugins to support building, deploying and automating any project.
|
||||||
|
|
||||||
https://jenkins.io
|
**Shipped version:** 2.46.3
|
||||||
|
|
||||||
Le script installe les paquets *ca-certificates-java*, *daemon*, *default-jre-headless*, *java-common*, *jenkins*, *libasyncns0*, *libflac8*, *libice6*, *libnspr4*, *libnss3*, *libogg0*, *libpcsclite1*, *libpulse0*, *libsctp1*, *libsm6*, *libsndfile1*, *libvorbis0a*, *libvorbisenc2*, *libx11-xcb1*, *libxtst6*, *lksctp-tools*, *openjdk-7-jre-headless*, *tzdata-java*, *x11-common*.
|
## Screenshots
|
||||||
|
|
||||||
**Mise à jour du package:**
|

|
||||||
sudo yunohost app upgrade jenkins -u https://github.com/YunoHost-Apps/jenkins_ynh
|
|
||||||
|
|
||||||
**Multi-utilisateur:** Oui, avec support ldap.
|
## Configuration
|
||||||
|
|
||||||
**Voir l'état du package:**
|
Use the admin panel of your Jenkins to configure this app.
|
||||||
*[Dernier rapport hebdomadaire](https://forum.yunohost.org/t/rapport-hebdomadaire-dintegration-continue/2297)*
|
|
||||||
*[Dernier test d'intégration continue](https://ci-apps.yunohost.org/jenkins/job/jenkins%20%28Community%29/lastBuild/consoleFull)*
|
## Documentation
|
||||||
**Cette application est déconseillé sur architecture ARM. Son fonctionnement est fortement ralenti.**
|
|
||||||
|
* Official documentation: https://jenkins.io/doc/
|
||||||
|
* YunoHost documentation: There no other documentations, feel free to contribute.
|
||||||
|
|
||||||
|
## YunoHost specific features
|
||||||
|
|
||||||
|
#### Multi-users support
|
||||||
|
|
||||||
|
Supported, with LDAP and SSO.
|
||||||
|
|
||||||
|
#### Supported architectures
|
||||||
|
|
||||||
|
* Tested on x86_64
|
||||||
|
* Really too slow on ARM architecture. Mostly not recommended to use it on ARM.
|
||||||
|
|
||||||
|
## Limitations
|
||||||
|
|
||||||
|
* Can't be updated after the current version 2.46, because it need some packages not available on jessie.
|
||||||
|
|
||||||
|
## Additionnal informations
|
||||||
|
|
||||||
|
## Links
|
||||||
|
|
||||||
|
* Report a bug: https://github.com/YunoHost-Apps/jenkins_ynh/issues
|
||||||
|
* Jenkins website: https://jenkins.io
|
||||||
|
* YunoHost website: https://yunohost.org/
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Developers infos
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/jenkins_ynh/tree/testing).
|
||||||
|
|
||||||
|
To try the testing branch, please proceed like that.
|
||||||
|
```
|
||||||
|
sudo yunohost app install https://github.com/YunoHost-Apps/jenkins_ynh/tree/testing --verbose
|
||||||
|
or
|
||||||
|
sudo yunohost app upgrade jenkins -u https://github.com/YunoHost-Apps/jenkins_ynh/tree/testing --verbose
|
||||||
|
```
|
||||||
|
|
64
README_fr.md
Normal file
64
README_fr.md
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
# Jenkins pour YunoHost
|
||||||
|
|
||||||
|
[](https://ci-apps.yunohost.org/jenkins/job/jenkins%20%28Community%29/lastBuild/consoleFull)
|
||||||
|
[](https://install-app.yunohost.org/?app=jenkins)
|
||||||
|
|
||||||
|
*[Read this readme in english.](./README.md)*
|
||||||
|
|
||||||
|
> *Ce package vous permet d'installer jenkins rapidement et simplement sur un serveur YunoHost.
|
||||||
|
Si vous n'avez pas YunoHost, merci de regarder [ici](https://yunohost.org/#/install_fr) pour savoir comment l'installer et en profiter.*
|
||||||
|
|
||||||
|
## Résumé
|
||||||
|
Premier serveur d'automatisation open source, Jenkins fournit des centaines de plugins pour supporter la construction, le déploiement et l'automatisation de n'importe quel projet.
|
||||||
|
|
||||||
|
**Version embarquée:** 2.46.3
|
||||||
|
|
||||||
|
## Captures d'écran
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
Utiliser le panneau d'administration de votre Jenkins pour configurer cette application.
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
* Documentation officielle: https://jenkins.io/doc/
|
||||||
|
* Documentation YunoHost: Il n'y a pas d'autre documentation, n'hésitez pas à contribuer.
|
||||||
|
|
||||||
|
## Fonctionnalités spécifiques à YunoHost
|
||||||
|
|
||||||
|
#### Support multi-utilisateurs
|
||||||
|
|
||||||
|
Supportée, avec LDAP et SSO.
|
||||||
|
|
||||||
|
#### Architectures supportées.
|
||||||
|
|
||||||
|
* Testé sur x86_64
|
||||||
|
* Vraiment trop lent sur architecture ARM. Vraiment pas recommandé de l'utiliser sur ARM.
|
||||||
|
|
||||||
|
## Limitations
|
||||||
|
|
||||||
|
* Ne peut pas être mis à jour après la version actuelle 2.46, car il a besoin de certains paquets qui ne sont pas disponibles sur jessie.
|
||||||
|
|
||||||
|
## Informations additionnelles
|
||||||
|
|
||||||
|
## Liens
|
||||||
|
|
||||||
|
* Reporter un bug: https://github.com/YunoHost-Apps/jenkins_ynh/issues
|
||||||
|
* Site de jenkins: https://jenkins.io
|
||||||
|
* Site de YunoHost: https://yunohost.org/
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Informations à l'intention des développeurs
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/jenkins_ynh/tree/testing).
|
||||||
|
|
||||||
|
Pour tester la branche testing, merci de procéder ainsi.
|
||||||
|
```
|
||||||
|
sudo yunohost app install https://github.com/YunoHost-Apps/jenkins_ynh/tree/testing --verbose
|
||||||
|
ou
|
||||||
|
sudo yunohost app upgrade jenkins -u https://github.com/YunoHost-Apps/jenkins_ynh/tree/testing --verbose
|
||||||
|
```
|
117
YEP.md
Normal file
117
YEP.md
Normal file
|
@ -0,0 +1,117 @@
|
||||||
|
#### [Level 0](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-0)
|
||||||
|
[YEP 1.1 - Nommer son app et son dépot](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-11)
|
||||||
|
`Validated`
|
||||||
|
[YEP 1.2 - Inscrire l'app sur un "répertoire" connu](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-12)
|
||||||
|
`Validated`
|
||||||
|
|
||||||
|
#### [Level 1](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-1)
|
||||||
|
[YEP 2.2 - Utiliser bash pour les scripts principaux](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-22)
|
||||||
|
`Validated`
|
||||||
|
[YEP 2.5 - Copier correctement des fichiers](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-25)
|
||||||
|
`Don't know`
|
||||||
|
[YEP 2.7 - Donner des permissions suffisantes aux instructions bash](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-27)
|
||||||
|
`Validated`
|
||||||
|
[YEP 2.15 - Suivre les instructions d'installation de l'application](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-215)
|
||||||
|
`Validated`
|
||||||
|
|
||||||
|
#### [Level 2](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-2)
|
||||||
|
[YEP 1.5 - Mettre à jour régulièrement le statut de l'app](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-11)
|
||||||
|
`Validated`
|
||||||
|
[YEP 2.18.2 - Gérer l'installation à la racine d’un nom de domaine](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-2182)
|
||||||
|
`Validated` - *Automatically verified.*
|
||||||
|
[YEP 2.18.3 - Gérer l'installation sur un sous-domaine](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-2183)
|
||||||
|
`Validated` - *Automatically verified.*
|
||||||
|
[YEP 2.18.4 - Gérer l'installation sur un chemin /path](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-2184)
|
||||||
|
`Validated` - *Automatically verified.*
|
||||||
|
[YEP 4.6 - Gère le multi-instance](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-11)
|
||||||
|
`Not applicable`
|
||||||
|
|
||||||
|
#### [Level 3](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-3)
|
||||||
|
[YEP 2.3 - Sauvegarder les réponses lors de l'installation](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-23)
|
||||||
|
`Validated`
|
||||||
|
|
||||||
|
#### [Level 4](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-4)
|
||||||
|
[YEP 4.1 - Lier au ldap](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-41)
|
||||||
|
`Validated`
|
||||||
|
[YEP 4.2 - Lier l'authentification au sso](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-42)
|
||||||
|
`Validated`
|
||||||
|
|
||||||
|
#### [Level 5](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-5)
|
||||||
|
[YEP 1.3 - Indiquer la licence associée au paquet](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-13)
|
||||||
|
`Validated`
|
||||||
|
[YEP 2.1 - Respecter le format du manifeste](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-21)
|
||||||
|
`Validated` - *Automatically verified.*
|
||||||
|
[YEP 2.12 - Utiliser les commandes pratiques (helpers)](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-212)
|
||||||
|
`Validated`
|
||||||
|
[YEP 2.18.1 - Lancer le script d'installation d'une webapp correctement](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-2181)
|
||||||
|
`Not applicable`
|
||||||
|
|
||||||
|
#### [Level 6](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-6)
|
||||||
|
[YEP 1.4 - Informer sur l'intention de maintenir un paquet](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-14)
|
||||||
|
`Validated`
|
||||||
|
[YEP 1.6 - Se tenir informé sur l'évolution du packaging d'apps](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-16)
|
||||||
|
`Validated`
|
||||||
|
[YEP 1.7 - Ajouter l'app à l'organisation YunoHost-Apps](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-17)
|
||||||
|
`Validated` - *Automatically verified.*
|
||||||
|
[YEP 1.8 - Publier des demandes de test](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-18)
|
||||||
|
`Validated`
|
||||||
|
[YEP 1.9 - Documenter l'app](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-19)
|
||||||
|
`Validated`
|
||||||
|
[YEP 1.10 - Garder un historique de version propre](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-110)
|
||||||
|
`Don't know`
|
||||||
|
[YEP 2.9 - Enlever toutes traces de l'app lors de la suppression](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-29)
|
||||||
|
`Validated`
|
||||||
|
[YEP 3.3 - Faciliter le contrôle de l'intégrité des sources](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-33)
|
||||||
|
`Not yet validated`
|
||||||
|
[YEP 3.5 - Suivre les recommendations de la documentation de l'app](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-35)
|
||||||
|
`Validated`
|
||||||
|
[YEP 3.6 - Mettre à jour les versions contenant des CVE](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-36)
|
||||||
|
`Validated`
|
||||||
|
[YEP 4.3 - Fournir un script de sauvegarde YunoHost fonctionnel](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-43)
|
||||||
|
`Validated` - *Automatically verified.*
|
||||||
|
[YEP 4.4 - Fournir un script de restauration YunoHost fonctionnel](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-44)
|
||||||
|
`Validated` - *Automatically verified.*
|
||||||
|
|
||||||
|
#### [Level 7](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-7)
|
||||||
|
[YEP 2.6 - Annuler l'action si les valeurs d'entrées sont incorrectes](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-26)
|
||||||
|
`Validated`
|
||||||
|
[YEP 3.2 - Ouvrir un port correctement](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-32)
|
||||||
|
`Validated`
|
||||||
|
|
||||||
|
#### [Level 8](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-8)
|
||||||
|
[YEP 2.4 - Détecter et gérer les erreurs](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-24)
|
||||||
|
`Validated`
|
||||||
|
[YEP 2.8 - Modifier correctement une configuration système](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-28)
|
||||||
|
`Validated`
|
||||||
|
[YEP 2.16 - Vérifier la disponibilité des dépendances sur ARM, x86 et x64](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-216)
|
||||||
|
`Not yet validated` - *Automatically verified.*
|
||||||
|
[YEP 2.18.5 - Gérer la tuile YunoHost pour faciliter la navigation entre les applications](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-2185)
|
||||||
|
`Validated`
|
||||||
|
[YEP 3.4 - Isoler l'app](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-34)
|
||||||
|
`Not yet validated`
|
||||||
|
[YEP 4.5 - Utiliser les hooks](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-45)
|
||||||
|
`Not applicable`
|
||||||
|
|
||||||
|
#### [Level 9](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-9)
|
||||||
|
[YEP 2.10 - Configurer les logs de l'application](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-210)
|
||||||
|
`Not applicable`
|
||||||
|
[YEP 2.11 - Utiliser une variable plutôt que l'app id directement](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-211)
|
||||||
|
`Validated`
|
||||||
|
[YEP 2.13 - Traduire le paquet en anglais](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-213)
|
||||||
|
`Not yet validated`
|
||||||
|
[YEP 2.14 - Remplir correctement un fichier de conf](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-214)
|
||||||
|
`Not yet validated`
|
||||||
|
[YEP 2.17 - Prendre en compte la version d'origine lors des mises à jour](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-217)
|
||||||
|
`Validated`
|
||||||
|
[YEP 4.2.1 - Déconnexion](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-421)
|
||||||
|
`Don't know`
|
||||||
|
|
||||||
|
#### Other YEP
|
||||||
|
[YEP 3.1 - Ne pas demander ou stocker de mot de passe LDAP](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-31)
|
||||||
|
`Validated`
|
||||||
|
[YEP 4.7 - Ajouter un module à la CLI](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-47)
|
||||||
|
`Not applicable`
|
||||||
|
[YEP 4.8 - Ajouter un module à l'admin web](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-48)
|
||||||
|
`Not applicable`
|
||||||
|
|
||||||
|
State of each YEP can be one of these: `Validated`, `Partially validated`, `Not yet validated`, `Not applicable`, `Don't know`.
|
|
@ -1,5 +1,4 @@
|
||||||
;; Test complet
|
;; Test complet
|
||||||
auto_remove=1
|
|
||||||
; Manifest
|
; Manifest
|
||||||
domain="domain.tld" (DOMAIN)
|
domain="domain.tld" (DOMAIN)
|
||||||
path="/path" (PATH)
|
path="/path" (PATH)
|
||||||
|
@ -12,19 +11,19 @@
|
||||||
setup_private=1
|
setup_private=1
|
||||||
setup_public=1
|
setup_public=1
|
||||||
upgrade=1
|
upgrade=1
|
||||||
|
upgrade=1 from_commit=a8a843c80846eced71edb4f62f4b2981578751e2
|
||||||
backup_restore=1
|
backup_restore=1
|
||||||
multi_instance=0
|
multi_instance=0
|
||||||
incorrect_path=1
|
incorrect_path=1
|
||||||
port_already_use=1 (8080)
|
port_already_use=1 (8080)
|
||||||
change_url=0
|
change_url=1
|
||||||
;;; Levels
|
;;; Levels
|
||||||
Level 1=auto
|
Level 1=auto
|
||||||
Level 2=auto
|
Level 2=auto
|
||||||
Level 3=auto
|
Level 3=auto
|
||||||
# Level 4: https://github.com/YunoHost-Apps/jenkins_ynh/blob/master/conf/config.xml#L11-L26
|
# Level 4: https://github.com/YunoHost-Apps/jenkins_ynh/blob/master/conf/config.xml#L11-L26
|
||||||
Level 4=1
|
Level 4=1
|
||||||
# Level 5: https://github.com/YunoHost-Apps/jenkins_ynh/issues/7
|
Level 5=auto
|
||||||
Level 5=1
|
|
||||||
Level 6=auto
|
Level 6=auto
|
||||||
Level 7=auto
|
Level 7=auto
|
||||||
Level 8=0
|
Level 8=0
|
||||||
|
@ -33,3 +32,7 @@
|
||||||
;;; Options
|
;;; Options
|
||||||
Email=
|
Email=
|
||||||
Notification=down
|
Notification=down
|
||||||
|
;;; Upgrade options
|
||||||
|
; commit=a8a843c80846eced71edb4f62f4b2981578751e2
|
||||||
|
name=5 Sep 2017 a8a843c80846eced71edb4f62f4b2981578751e2
|
||||||
|
manifest_arg=domain=DOMAIN&path=PATH&is_public=1&
|
||||||
|
|
|
@ -28,4 +28,3 @@ location __PATH__ {
|
||||||
# Include SSOWAT user panel.
|
# Include SSOWAT user panel.
|
||||||
include conf.d/yunohost_panel.conf.inc;
|
include conf.d/yunohost_panel.conf.inc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"en": "Extendable continuous integration server",
|
"en": "Extendable continuous integration server",
|
||||||
"fr": "Serveur d'intégration continue extensible"
|
"fr": "Serveur d'intégration continue extensible"
|
||||||
},
|
},
|
||||||
"version": "2.46.3",
|
"version": "2.46.3~ynh1",
|
||||||
"url": "https://jenkins.io/index.html",
|
"url": "https://jenkins.io/index.html",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
|
|
|
@ -1,31 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# DISPLAYING
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
NO_PRINT () { # Supprime l'affichage dans stdout pour la commande en argument.
|
|
||||||
set +x
|
|
||||||
$@
|
|
||||||
set -x
|
|
||||||
}
|
|
||||||
|
|
||||||
WARNING () { # Écrit sur le canal d'erreur pour passer en warning.
|
|
||||||
$@ >&2
|
|
||||||
}
|
|
||||||
|
|
||||||
SUPPRESS_WARNING () { # Force l'écriture sur la sortie standard
|
|
||||||
$@ 2>&1
|
|
||||||
}
|
|
||||||
|
|
||||||
QUIET () { # Redirige la sortie standard dans /dev/null
|
|
||||||
$@ > /dev/null
|
|
||||||
}
|
|
||||||
|
|
||||||
ALL_QUIET () { # Redirige la sortie standard et d'erreur dans /dev/null
|
|
||||||
$@ > /dev/null 2>&1
|
|
||||||
}
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP
|
# BACKUP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -42,8 +16,8 @@ CHECK_SIZE () { # Vérifie avant chaque backup que l'espace est suffisant
|
||||||
|
|
||||||
if [ $free_space -le $backup_size ]
|
if [ $free_space -le $backup_size ]
|
||||||
then
|
then
|
||||||
WARNING echo "Espace insuffisant pour sauvegarder $file_to_analyse."
|
ynh_print_err "Espace insuffisant pour sauvegarder $file_to_analyse."
|
||||||
WARNING echo "Espace disponible: $(HUMAN_SIZE $free_space)"
|
ynh_print_err "Espace disponible: $(HUMAN_SIZE $free_space)"
|
||||||
ynh_die "Espace nécessaire: $(HUMAN_SIZE $backup_size)"
|
ynh_die "Espace nécessaire: $(HUMAN_SIZE $backup_size)"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -57,7 +31,7 @@ IS_PACKAGE_CHECK () { # Détermine une exécution en conteneur (Non testé)
|
||||||
}
|
}
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NODEJS
|
# EXPERIMENTAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# INFOS
|
# INFOS
|
||||||
|
@ -78,6 +52,19 @@ node_version_path="/opt/node_n/n/versions/node"
|
||||||
# N_PREFIX est le dossier de n, il doit être chargé dans les variables d'environnement pour n.
|
# N_PREFIX est le dossier de n, il doit être chargé dans les variables d'environnement pour n.
|
||||||
export N_PREFIX="$n_install_dir"
|
export N_PREFIX="$n_install_dir"
|
||||||
|
|
||||||
|
ynh_install_n () {
|
||||||
|
echo "Installation of N - Node.js version management" >&2
|
||||||
|
# Build an app.src for n
|
||||||
|
mkdir -p "../conf"
|
||||||
|
echo "SOURCE_URL=https://github.com/tj/n/archive/v2.1.7.tar.gz
|
||||||
|
SOURCE_SUM=2ba3c9d4dd3c7e38885b37e02337906a1ee91febe6d5c9159d89a9050f2eea8f" > "../conf/n.src"
|
||||||
|
# Download and extract n
|
||||||
|
ynh_setup_source "$n_install_dir/git" n
|
||||||
|
# Install n
|
||||||
|
(cd "$n_install_dir/git"
|
||||||
|
PREFIX=$N_PREFIX make install 2>&1)
|
||||||
|
}
|
||||||
|
|
||||||
ynh_use_nodejs () {
|
ynh_use_nodejs () {
|
||||||
nodejs_version=$(ynh_app_setting_get $app nodejs_version)
|
nodejs_version=$(ynh_app_setting_get $app nodejs_version)
|
||||||
|
|
||||||
|
@ -113,9 +100,10 @@ ynh_install_nodejs () {
|
||||||
test -x /usr/bin/npm && mv /usr/bin/npm /usr/bin/npm_n
|
test -x /usr/bin/npm && mv /usr/bin/npm /usr/bin/npm_n
|
||||||
|
|
||||||
# If n is not previously setup, install it
|
# If n is not previously setup, install it
|
||||||
n --version > /dev/null 2>&1 || \
|
if ! test n --version > /dev/null 2>&1
|
||||||
( echo "Installation of N - Node.js version management" >&2; \
|
then
|
||||||
curl -sL $n_install_script | N_PREFIX=$N_PREFIX bash -s -- -y - 2>&1 )
|
ynh_install_n
|
||||||
|
fi
|
||||||
|
|
||||||
# Modify the default N_PREFIX in n script
|
# Modify the default N_PREFIX in n script
|
||||||
ynh_replace_string "^N_PREFIX=\${N_PREFIX-.*}$" "N_PREFIX=\${N_PREFIX-$N_PREFIX}" "$n_install_dir/bin/n"
|
ynh_replace_string "^N_PREFIX=\${N_PREFIX-.*}$" "N_PREFIX=\${N_PREFIX-$N_PREFIX}" "$n_install_dir/bin/n"
|
||||||
|
@ -219,3 +207,357 @@ EOF
|
||||||
|
|
||||||
chmod +x "/etc/cron.daily/node_update"
|
chmod +x "/etc/cron.daily/node_update"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Start or restart a service and follow its booting
|
||||||
|
#
|
||||||
|
# usage: ynh_check_starting "Line to match" [Log file] [Timeout]
|
||||||
|
#
|
||||||
|
# | arg: Line to match - The line to find in the log to attest the service have finished to boot.
|
||||||
|
# | arg: Log file - The log file to watch
|
||||||
|
# /var/log/$app/$app.log will be used if no other log is defined.
|
||||||
|
# | arg: Timeout - The maximum time to wait before ending the watching. Defaut 300 seconds.
|
||||||
|
ynh_check_starting () {
|
||||||
|
local line_to_match="$1"
|
||||||
|
local app_log="${2:-/var/log/$app/$app.log}"
|
||||||
|
local timeout=${3:-300}
|
||||||
|
|
||||||
|
ynh_clean_check_starting () {
|
||||||
|
# Stop the execution of tail.
|
||||||
|
kill -s 15 $pid_tail 2>&1
|
||||||
|
ynh_secure_remove "$templog" 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "Starting of $app" >&2
|
||||||
|
systemctl restart $app
|
||||||
|
local templog="$(mktemp)"
|
||||||
|
# Following the starting of the app in its log
|
||||||
|
tail -f -n1 "$app_log" > "$templog" &
|
||||||
|
# Get the PID of the tail command
|
||||||
|
local pid_tail=$!
|
||||||
|
|
||||||
|
local i=0
|
||||||
|
for i in `seq 1 $timeout`
|
||||||
|
do
|
||||||
|
# Read the log until the sentence is found, that means the app finished to start. Or run until the timeout
|
||||||
|
if grep --quiet "$line_to_match" "$templog"
|
||||||
|
then
|
||||||
|
echo "The service $app has correctly started." >&2
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
echo -n "." >&2
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
if [ $i -eq $timeout ]
|
||||||
|
then
|
||||||
|
echo "The service $app didn't fully started before the timeout." >&2
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
ynh_clean_check_starting
|
||||||
|
}
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_print_log () {
|
||||||
|
echo "${1}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Print an info on stdout
|
||||||
|
#
|
||||||
|
# usage: ynh_print_info "Text to print"
|
||||||
|
# | arg: text - The text to print
|
||||||
|
ynh_print_info () {
|
||||||
|
ynh_print_log "[INFO] ${1}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Print a warning on stderr
|
||||||
|
#
|
||||||
|
# usage: ynh_print_warn "Text to print"
|
||||||
|
# | arg: text - The text to print
|
||||||
|
ynh_print_warn () {
|
||||||
|
ynh_print_log "[WARN] ${1}" >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
# Print a error on stderr
|
||||||
|
#
|
||||||
|
# usage: ynh_print_err "Text to print"
|
||||||
|
# | arg: text - The text to print
|
||||||
|
ynh_print_err () {
|
||||||
|
ynh_print_log "[ERR] ${1}" >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
# Execute a command and print the result as an error
|
||||||
|
#
|
||||||
|
# usage: ynh_exec_err command to execute
|
||||||
|
# usage: ynh_exec_err "command to execute | following command"
|
||||||
|
# In case of use of pipes, you have to use double quotes. Otherwise, this helper will be executed with the first command, then be send to the next pipe.
|
||||||
|
#
|
||||||
|
# | arg: command - command to execute
|
||||||
|
ynh_exec_err () {
|
||||||
|
ynh_print_err "$(eval $@)"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Execute a command and print the result as a warning
|
||||||
|
#
|
||||||
|
# usage: ynh_exec_warn command to execute
|
||||||
|
# usage: ynh_exec_warn "command to execute | following command"
|
||||||
|
# In case of use of pipes, you have to use double quotes. Otherwise, this helper will be executed with the first command, then be send to the next pipe.
|
||||||
|
#
|
||||||
|
# | arg: command - command to execute
|
||||||
|
ynh_exec_warn () {
|
||||||
|
ynh_print_warn "$(eval $@)"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Execute a command and force the result to be printed on stdout
|
||||||
|
#
|
||||||
|
# usage: ynh_exec_warn_less command to execute
|
||||||
|
# usage: ynh_exec_warn_less "command to execute | following command"
|
||||||
|
# In case of use of pipes, you have to use double quotes. Otherwise, this helper will be executed with the first command, then be send to the next pipe.
|
||||||
|
#
|
||||||
|
# | arg: command - command to execute
|
||||||
|
ynh_exec_warn_less () {
|
||||||
|
eval $@ 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Execute a command and redirect stdout in /dev/null
|
||||||
|
#
|
||||||
|
# usage: ynh_exec_quiet command to execute
|
||||||
|
# usage: ynh_exec_quiet "command to execute | following command"
|
||||||
|
# In case of use of pipes, you have to use double quotes. Otherwise, this helper will be executed with the first command, then be send to the next pipe.
|
||||||
|
#
|
||||||
|
# | arg: command - command to execute
|
||||||
|
ynh_exec_quiet () {
|
||||||
|
eval $@ > /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
# Execute a command and redirect stdout and stderr in /dev/null
|
||||||
|
#
|
||||||
|
# usage: ynh_exec_fully_quiet command to execute
|
||||||
|
# usage: ynh_exec_fully_quiet "command to execute | following command"
|
||||||
|
# In case of use of pipes, you have to use double quotes. Otherwise, this helper will be executed with the first command, then be send to the next pipe.
|
||||||
|
#
|
||||||
|
# | arg: command - command to execute
|
||||||
|
ynh_exec_fully_quiet () {
|
||||||
|
eval $@ > /dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Install or update the main directory yunohost.multimedia
|
||||||
|
#
|
||||||
|
# usage: ynh_multimedia_build_main_dir
|
||||||
|
ynh_multimedia_build_main_dir () {
|
||||||
|
wget -nv https://github.com/YunoHost-Apps/yunohost.multimedia/archive/master.zip 2>&1
|
||||||
|
unzip -q master.zip
|
||||||
|
./yunohost.multimedia-master/script/ynh_media_build.sh
|
||||||
|
}
|
||||||
|
|
||||||
|
# Add a directory in yunohost.multimedia
|
||||||
|
# This "directory" will be a symbolic link to a existing directory.
|
||||||
|
#
|
||||||
|
# usage: ynh_multimedia_addfolder "Source directory" "Destination directory"
|
||||||
|
#
|
||||||
|
# | arg: Source directory - The real directory which contains your medias.
|
||||||
|
# | arg: Destination directory - The name and the place of the symbolic link, relative to "/home/yunohost.multimedia"
|
||||||
|
ynh_multimedia_addfolder () {
|
||||||
|
local source_dir="$1"
|
||||||
|
local dest_dir="$2"
|
||||||
|
./yunohost.multimedia-master/script/ynh_media_addfolder.sh --source="$source_dir" --dest="$dest_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Move a directory in yunohost.multimedia, and replace by a symbolic link
|
||||||
|
#
|
||||||
|
# usage: ynh_multimedia_movefolder "Source directory" "Destination directory"
|
||||||
|
#
|
||||||
|
# | arg: Source directory - The real directory which contains your medias.
|
||||||
|
# It will be moved to "Destination directory"
|
||||||
|
# A symbolic link will replace it.
|
||||||
|
# | arg: Destination directory - The new name and place of the directory, relative to "/home/yunohost.multimedia"
|
||||||
|
ynh_multimedia_movefolder () {
|
||||||
|
local source_dir="$1"
|
||||||
|
local dest_dir="$2"
|
||||||
|
./yunohost.multimedia-master/script/ynh_media_addfolder.sh --inv --source="$source_dir" --dest="$dest_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Allow an user to have an write authorisation in multimedia directories
|
||||||
|
#
|
||||||
|
# usage: ynh_multimedia_addaccess user_name
|
||||||
|
#
|
||||||
|
# | arg: user_name - The name of the user which gain this access.
|
||||||
|
ynh_multimedia_addaccess () {
|
||||||
|
local user_name=$1
|
||||||
|
groupadd -f multimedia
|
||||||
|
usermod -a -G multimedia $user_name
|
||||||
|
}
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Create a dedicated fail2ban config (jail and filter conf files)
|
||||||
|
#
|
||||||
|
# usage: ynh_add_fail2ban_config log_file filter [max_retry [ports]]
|
||||||
|
# | arg: log_file - Log file to be checked by fail2ban
|
||||||
|
# | arg: failregex - Failregex to be looked for by fail2ban
|
||||||
|
# | arg: max_retry - Maximum number of retries allowed before banning IP address - default: 3
|
||||||
|
# | arg: ports - Ports blocked for a banned IP address - default: http,https
|
||||||
|
ynh_add_fail2ban_config () {
|
||||||
|
# Process parameters
|
||||||
|
logpath=$1
|
||||||
|
failregex=$2
|
||||||
|
max_retry=${3:-3}
|
||||||
|
ports=${4:-http,https}
|
||||||
|
|
||||||
|
test -n "$logpath" || ynh_die "ynh_add_fail2ban_config expects a logfile path as first argument and received nothing."
|
||||||
|
test -n "$failregex" || ynh_die "ynh_add_fail2ban_config expects a failure regex as second argument and received nothing."
|
||||||
|
|
||||||
|
finalfail2banjailconf="/etc/fail2ban/jail.d/$app.conf"
|
||||||
|
finalfail2banfilterconf="/etc/fail2ban/filter.d/$app.conf"
|
||||||
|
ynh_backup_if_checksum_is_different "$finalfail2banjailconf" 1
|
||||||
|
ynh_backup_if_checksum_is_different "$finalfail2banfilterconf" 1
|
||||||
|
|
||||||
|
sudo tee $finalfail2banjailconf <<EOF
|
||||||
|
[$app]
|
||||||
|
enabled = true
|
||||||
|
port = $ports
|
||||||
|
filter = $app
|
||||||
|
logpath = $logpath
|
||||||
|
maxretry = $max_retry"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
sudo tee $finalfail2banfilterconf <<EOF
|
||||||
|
[INCLUDES]
|
||||||
|
before = common.conf
|
||||||
|
[Definition]
|
||||||
|
failregex = $failregex
|
||||||
|
ignoreregrex ="
|
||||||
|
EOF
|
||||||
|
|
||||||
|
ynh_store_file_checksum "$finalfail2banjailconf"
|
||||||
|
ynh_store_file_checksum "$finalfail2banfilterconf"
|
||||||
|
|
||||||
|
sudo systemctl restart fail2ban
|
||||||
|
}
|
||||||
|
|
||||||
|
# Remove the dedicated fail2ban config (jail and filter conf files)
|
||||||
|
#
|
||||||
|
# usage: ynh_remove_fail2ban_config
|
||||||
|
ynh_remove_fail2ban_config () {
|
||||||
|
ynh_secure_remove "/etc/fail2ban/jail.d/$app.conf"
|
||||||
|
ynh_secure_remove "/etc/fail2ban/filter.d/$app.conf"
|
||||||
|
sudo systemctl restart fail2ban
|
||||||
|
}
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Read the value of a key in a ynh manifest file
|
||||||
|
#
|
||||||
|
# usage: ynh_read_manifest manifest key
|
||||||
|
# | arg: manifest - Path of the manifest to read
|
||||||
|
# | arg: key - Name of the key to find
|
||||||
|
ynh_read_manifest () {
|
||||||
|
manifest="$1"
|
||||||
|
key="$2"
|
||||||
|
python3 -c "import sys, json;print(json.load(open('$manifest'))['$key'])"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Exit without error if the package is up to date
|
||||||
|
#
|
||||||
|
# This helper should be used to avoid an upgrade of a package
|
||||||
|
# when it's not needed.
|
||||||
|
#
|
||||||
|
# To force an upgrade, even if the package is up to date,
|
||||||
|
# you have to set the variable YNH_FORCE_UPGRADE before.
|
||||||
|
# example: sudo YNH_FORCE_UPGRADE=1 yunohost app upgrade MyApp
|
||||||
|
#
|
||||||
|
# usage: ynh_abort_if_up_to_date
|
||||||
|
ynh_abort_if_up_to_date () {
|
||||||
|
local force_upgrade=${YNH_FORCE_UPGRADE:-0}
|
||||||
|
local package_check=${PACKAGE_CHECK_EXEC:-0}
|
||||||
|
|
||||||
|
local version=$(ynh_read_manifest "/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" "version" || echo 1.0)
|
||||||
|
local last_version=$(ynh_read_manifest "../manifest.json" "version" || echo 1.0)
|
||||||
|
if [ "$version" = "$last_version" ]
|
||||||
|
then
|
||||||
|
if [ "$force_upgrade" != "0" ]
|
||||||
|
then
|
||||||
|
echo "Upgrade forced by YNH_FORCE_UPGRADE." >&2
|
||||||
|
unset YNH_FORCE_UPGRADE
|
||||||
|
elif [ "$package_check" != "0" ]
|
||||||
|
then
|
||||||
|
echo "Upgrade forced for package check." >&2
|
||||||
|
else
|
||||||
|
ynh_die "Up-to-date, nothing to do" 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Send an email to inform the administrator
|
||||||
|
#
|
||||||
|
# usage: ynh_send_readme_to_admin app_message [recipients]
|
||||||
|
# | arg: app_message - The message to send to the administrator.
|
||||||
|
# | arg: recipients - The recipients of this email. Use spaces to separate multiples recipients. - default: root
|
||||||
|
# example: "root admin@domain"
|
||||||
|
# If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you
|
||||||
|
# example: "root admin@domain user1 user2"
|
||||||
|
ynh_send_readme_to_admin() {
|
||||||
|
local app_message="${1:-...No specific informations...}"
|
||||||
|
local recipients="${2:-root}"
|
||||||
|
|
||||||
|
# Retrieve the email of users
|
||||||
|
find_mails () {
|
||||||
|
local list_mails="$1"
|
||||||
|
local mail
|
||||||
|
local recipients=" "
|
||||||
|
# Read each mail in argument
|
||||||
|
for mail in $list_mails
|
||||||
|
do
|
||||||
|
# Keep root or a real email address as it is
|
||||||
|
if [ "$mail" = "root" ] || echo "$mail" | grep --quiet "@"
|
||||||
|
then
|
||||||
|
recipients="$recipients $mail"
|
||||||
|
else
|
||||||
|
# But replace an user name without a domain after by its email
|
||||||
|
if mail=$(ynh_user_get_info "$mail" "mail" 2> /dev/null)
|
||||||
|
then
|
||||||
|
recipients="$recipients $mail"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "$recipients"
|
||||||
|
}
|
||||||
|
recipients=$(find_mails "$recipients")
|
||||||
|
|
||||||
|
local mail_subject="☁️🆈🅽🅷☁️: \`$app\` was just installed!"
|
||||||
|
|
||||||
|
local mail_message="This is an automated message from your beloved YunoHost server.
|
||||||
|
|
||||||
|
Specific informations for the application $app.
|
||||||
|
|
||||||
|
$app_message
|
||||||
|
|
||||||
|
---
|
||||||
|
Automatic diagnosis data from YunoHost
|
||||||
|
|
||||||
|
$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')"
|
||||||
|
|
||||||
|
# Send the email to the recipients
|
||||||
|
echo "$mail_message" | mail -a "Content-Type: text/plain; charset=UTF-8" -s "$mail_subject" "$recipients"
|
||||||
|
}
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
#============= FUTURE YUNOHOST HELPER ============
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Delete a file checksum from the app settings
|
||||||
|
#
|
||||||
|
# $app should be defined when calling this helper
|
||||||
|
#
|
||||||
|
# usage: ynh_remove_file_checksum file
|
||||||
|
# | arg: file - The file for which the checksum will be deleted
|
||||||
|
ynh_delete_file_checksum () {
|
||||||
|
local checksum_setting_name=checksum_${1//[\/ ]/_} # Replace all '/' and ' ' by '_'
|
||||||
|
ynh_app_setting_delete $app $checksum_setting_name
|
||||||
|
}
|
||||||
|
|
51
scripts/_sed
Normal file
51
scripts/_sed
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# https://github.com/YunoHost/yunohost/pull/394
|
||||||
|
|
||||||
|
# Substitute/replace a string (or expression) by another in a file
|
||||||
|
#
|
||||||
|
# usage: ynh_replace_string match_string replace_string target_file
|
||||||
|
# | arg: match_string - String to be searched and replaced in the file
|
||||||
|
# | arg: replace_string - String that will replace matches
|
||||||
|
# | arg: target_file - File in which the string will be replaced.
|
||||||
|
#
|
||||||
|
# As this helper is based on sed command, regular expressions and
|
||||||
|
# references to sub-expressions can be used
|
||||||
|
# (see sed manual page for more information)
|
||||||
|
ynh_replace_string () {
|
||||||
|
local delimit=@
|
||||||
|
local match_string=$1
|
||||||
|
local replace_string=$2
|
||||||
|
local workfile=$3
|
||||||
|
|
||||||
|
# Escape the delimiter if it's in the string.
|
||||||
|
match_string=${match_string//${delimit}/"\\${delimit}"}
|
||||||
|
replace_string=${replace_string//${delimit}/"\\${delimit}"}
|
||||||
|
|
||||||
|
sudo sed --in-place "s${delimit}${match_string}${delimit}${replace_string}${delimit}g" "$workfile"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Substitute/replace a password by another in a file
|
||||||
|
#
|
||||||
|
# usage: ynh_replace_password_string match_string replace_string target_file
|
||||||
|
# | arg: match_string - String to be searched and replaced in the file
|
||||||
|
# | arg: replace_string - String that will replace matches
|
||||||
|
# | arg: target_file - File in which the string will be replaced.
|
||||||
|
#
|
||||||
|
# This helper will use ynh_replace_string, but as you can use special
|
||||||
|
# characters, you can't use some regular expressions and sub-expressions.
|
||||||
|
ynh_replace_password_string () {
|
||||||
|
local match_string=$1
|
||||||
|
local replace_string=$2
|
||||||
|
local workfile=$3
|
||||||
|
|
||||||
|
# Escape any backslash to preserve them as simple backslash.
|
||||||
|
match_string=${match_string//\\/"\\\\"}
|
||||||
|
replace_string=${replace_string//\\/"\\\\"}
|
||||||
|
|
||||||
|
# Escape the & character, who has a special function in sed.
|
||||||
|
match_string=${match_string//&/"\&"}
|
||||||
|
replace_string=${replace_string//&/"\&"}
|
||||||
|
|
||||||
|
ynh_replace_string "$match_string" "$replace_string" "$workfile"
|
||||||
|
}
|
|
@ -4,4 +4,4 @@
|
||||||
app_depencencies="default-jre-headless daemon"
|
app_depencencies="default-jre-headless daemon"
|
||||||
|
|
||||||
# Jenkins version
|
# Jenkins version
|
||||||
version=2.46.3
|
jenkins_version=2.46.3
|
||||||
|
|
|
@ -20,8 +20,7 @@ source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
SUPPRESS_WARNING kill -s 15 $PID_TAIL # Arrête l'exécution de tail.
|
ynh_clean_check_starting
|
||||||
ynh_secure_remove "$tempfile"
|
|
||||||
}
|
}
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
@ -60,30 +59,9 @@ ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
ynh_backup /etc/default/$app
|
ynh_backup /etc/default/$app
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# START JENKINS IN BACKGROUND
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Démarre jenkins
|
|
||||||
WARNING echo "Redémarrage de jenkins"
|
|
||||||
tempfile="$(mktemp)"
|
|
||||||
tail -f -n1 /var/log/$app/$app.log > "$tempfile" & # Suit le démarrage dans le log
|
|
||||||
PID_TAIL=$! # Récupère le PID de la commande tail, qui est passée en arrière plan.
|
|
||||||
systemctl restart $app
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK JENKINS STARTING
|
# CHECK JENKINS STARTING
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
for i in `seq 1 300`
|
# Wait for Jenkins fully started
|
||||||
do # La boucle attend le démarrage de jenkins ou 5 minutes
|
ynh_check_starting "Jenkins is fully up and running" "/var/log/$app/$app.log" "300"
|
||||||
if grep -q "Jenkins is fully up and running" "$tempfile"; then
|
|
||||||
WARNING echo "Le service $app a démarré correctement."
|
|
||||||
break # Si le log annonce le démarrage de jenkins, sort de la boucle.
|
|
||||||
fi
|
|
||||||
WARNING echo -n "."
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
echo ""
|
|
||||||
QUIET kill -s 15 $PID_TAIL # Arrête l'exécution de tail.
|
|
||||||
ynh_secure_remove "$tempfile"
|
|
||||||
|
|
131
scripts/change_url
Normal file
131
scripts/change_url
Normal file
|
@ -0,0 +1,131 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC STARTING
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
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=$YNH_APP_NEW_PATH
|
||||||
|
|
||||||
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CHECK THE SYNTAX OF THE PATHS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
test -n "$old_path" || old_path="/"
|
||||||
|
test -n "$new_path" || new_path="/"
|
||||||
|
new_path=$(ynh_normalize_url_path $new_path)
|
||||||
|
old_path=$(ynh_normalize_url_path $old_path)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# 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
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_clean_setup () {
|
||||||
|
ynh_clean_check_starting
|
||||||
|
}
|
||||||
|
# Exit if an error occurs during the execution of the script
|
||||||
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# STANDARD MODIFICATIONS
|
||||||
|
#=================================================
|
||||||
|
# MODIFY URL IN NGINX CONF
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
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 "$nginx_conf_path"
|
||||||
|
|
||||||
|
ynh_replace_string "location $old_path" "location $new_path" "$nginx_conf_path"
|
||||||
|
ynh_replace_string "\(proxy_redirect.*\)$old_domain$old_path" "\1$old_domain$new_path" "$nginx_conf_path"
|
||||||
|
|
||||||
|
# Calculate and store the nginx config file checksum
|
||||||
|
ynh_store_file_checksum "$nginx_conf_path"
|
||||||
|
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 "$nginx_conf_path"
|
||||||
|
|
||||||
|
ynh_replace_string "\(proxy_redirect.*\)$old_domain" "\1$new_domain" "$nginx_conf_path"
|
||||||
|
|
||||||
|
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
||||||
|
|
||||||
|
nginx_conf_path=/etc/nginx/conf.d/$new_domain.d/$app.conf
|
||||||
|
# Calculate and store the nginx config file checksum
|
||||||
|
ynh_store_file_checksum "$nginx_conf_path"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC MODIFICATIONS
|
||||||
|
#=================================================
|
||||||
|
# FIX JENKINS SETUP
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
if [ $change_path -eq 1 ]
|
||||||
|
then
|
||||||
|
# Ajoute le path en cas d'installation en sous-dossier dans les options de démarrage de Jenkins
|
||||||
|
|
||||||
|
# Change to root
|
||||||
|
if [ "$new_path" == "/" ]
|
||||||
|
then
|
||||||
|
sed -i "s@--prefix=$old_path@@g" /etc/default/jenkins
|
||||||
|
# Change to a sub path
|
||||||
|
else
|
||||||
|
if ! grep --quiet "prefix=$old_path" /etc/default/jenkins
|
||||||
|
then
|
||||||
|
sed -i "$ s@--httpPort=\$HTTP_PORT@& --prefix=$new_path@g" /etc/default/jenkins
|
||||||
|
else
|
||||||
|
sed -i "s@--prefix=$old_path@--prefix=$new_path@g" /etc/default/jenkins
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTART JENKINS IN BACKGROUND
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Wait for Jenkins fully started
|
||||||
|
ynh_check_starting "Jenkins is fully up and running" "/var/log/$app/$app.log" "300"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RELOAD NGINX
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
systemctl reload nginx
|
132
scripts/install
132
scripts/install
|
@ -10,6 +10,7 @@ source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
# Load common variables for all scripts.
|
# Load common variables for all scripts.
|
||||||
source _variables
|
source _variables
|
||||||
|
source _sed
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MANAGE FAILURE OF THE SCRIPT
|
# MANAGE FAILURE OF THE SCRIPT
|
||||||
|
@ -17,17 +18,11 @@ source _variables
|
||||||
|
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
# Nettoyage des résidus d'installation non pris en charge par le script remove.
|
# Nettoyage des résidus d'installation non pris en charge par le script remove.
|
||||||
if test -n "$PID_TAIL"
|
ynh_clean_check_starting
|
||||||
then
|
ynh_exec_warn_less kill -s 15 $pid_change_port # Arrête l'exécution de change_port
|
||||||
SUPPRESS_WARNING kill -s 15 $PID_TAIL # Arrête l'exécution de tail.
|
|
||||||
SUPPRESS_WARNING kill -s 15 $pid_change_port # Arrête l'exécution de change_port
|
|
||||||
ynh_secure_remove "$tempfile"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Clean hosts
|
# Clean hosts
|
||||||
sed -i '/#jenkins/d' /etc/hosts
|
sed -i '/#jenkins/d' /etc/hosts
|
||||||
|
|
||||||
echo ""
|
|
||||||
}
|
}
|
||||||
ynh_abort_if_errors # Active trap pour arrêter le script si une erreur est détectée.
|
ynh_abort_if_errors # Active trap pour arrêter le script si une erreur est détectée.
|
||||||
|
|
||||||
|
@ -108,8 +103,8 @@ pid_change_port=$!
|
||||||
# INSTALL JENKINS
|
# INSTALL JENKINS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
wget --no-verbose https://pkg.jenkins.io/debian-stable/binary/jenkins_${version}_all.deb
|
wget --no-verbose https://pkg.jenkins.io/debian-stable/binary/jenkins_${jenkins_version}_all.deb
|
||||||
dpkg --install jenkins_${version}_all.deb
|
dpkg --install jenkins_${jenkins_version}_all.deb
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP JENKINS
|
# SETUP JENKINS
|
||||||
|
@ -123,15 +118,6 @@ then # Ajoute le path en cas d'installation en sous-dossier dans les options de
|
||||||
sed -i "$ s@--httpPort=\$HTTP_PORT@& --prefix=$path_url@g" /etc/default/jenkins
|
sed -i "$ s@--httpPort=\$HTTP_PORT@& --prefix=$path_url@g" /etc/default/jenkins
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# START JENKINS IN BACKGROUND
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
systemctl restart $app # Redémarre jenkins pour prendre en compte les modifications
|
|
||||||
tempfile="$(mktemp)"
|
|
||||||
tail -f -n1 /var/log/$app/$app.log > "$tempfile" & # Suit le démarrage dans le log
|
|
||||||
PID_TAIL=$! # Récupère le PID de la commande tail, qui est passée en arrière plan.
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# FORCE PUBLIC ACCESS
|
# FORCE PUBLIC ACCESS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -158,71 +144,55 @@ echo "127.0.0.1 $domain #jenkins" | tee -a /etc/hosts # Renseigne le domain dans
|
||||||
|
|
||||||
jenkins_cli="java -jar /var/lib/jenkins/jenkins-cli.jar -remoting -s http://$domain$path_url"
|
jenkins_cli="java -jar /var/lib/jenkins/jenkins-cli.jar -remoting -s http://$domain$path_url"
|
||||||
|
|
||||||
|
# Wait for Jenkins fully started
|
||||||
|
ynh_check_starting "Jenkins is fully up and running" "/var/log/$app/$app.log" "$timeout"
|
||||||
|
|
||||||
|
# Si le log annonce une première fois le démarrage de jenkins. Installe les plugins
|
||||||
|
wget -nv --no-check-certificate https://$domain$path_url/jnlpJars/jenkins-cli.jar -O /var/lib/jenkins/jenkins-cli.jar
|
||||||
for i in `seq 1 $timeout`
|
for i in `seq 1 $timeout`
|
||||||
do # La boucle attend le démarrage de jenkins Ou $timeout (Le démarrage sur arm est trèèèèèèèèès long...).
|
do # La boucle attend la mise à jour des dépôts de plugins.
|
||||||
if grep -q "Jenkins is fully up and running" "$tempfile" && [ "$config_OK" -eq 0 ]; then
|
|
||||||
# Si le log annonce une première fois le démarrage de jenkins. Installe les plugins
|
|
||||||
wget -nv --no-check-certificate https://$domain$path_url/jnlpJars/jenkins-cli.jar -O /var/lib/jenkins/jenkins-cli.jar
|
|
||||||
WARNING echo ""
|
|
||||||
for i in `seq 1 $timeout`
|
|
||||||
do # La boucle attend la mise à jour des dépôts de plugins.
|
|
||||||
if test -e /var/lib/jenkins/updates/default.json; then
|
if test -e /var/lib/jenkins/updates/default.json; then
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
WARNING echo -n "."
|
echo -n "."
|
||||||
sleep 1
|
sleep 1
|
||||||
fi
|
fi
|
||||||
done
|
|
||||||
|
|
||||||
# Installation du plugin pour l'authentification ldap et http auth
|
|
||||||
$jenkins_cli install-plugin reverse-proxy-auth-plugin
|
|
||||||
|
|
||||||
# Installation des plugins recommandés (Lors de l'install avec le Setup Wizard)
|
|
||||||
$jenkins_cli install-plugin cloudbees-folder # Folders Plugin
|
|
||||||
$jenkins_cli install-plugin antisamy-markup-formatter # OWASP Markup Formatter Plugin
|
|
||||||
$jenkins_cli install-plugin pam-auth # PAM Authentication plugin
|
|
||||||
$jenkins_cli install-plugin mailer # Mailer Plugin
|
|
||||||
$jenkins_cli install-plugin ldap # LDAP Plugin
|
|
||||||
$jenkins_cli install-plugin matrix-auth # Matrix Authorization Strategy Plugin
|
|
||||||
$jenkins_cli install-plugin build-timeout # Build timeout plugin
|
|
||||||
$jenkins_cli install-plugin credentials-binding # Credentials Binding Plugin
|
|
||||||
$jenkins_cli install-plugin timestamper # Timestamper
|
|
||||||
$jenkins_cli install-plugin ws-cleanup # Workspace Cleanup Plugin
|
|
||||||
$jenkins_cli install-plugin ant # Ant Plugin
|
|
||||||
$jenkins_cli install-plugin gradle # Gradle Plugin
|
|
||||||
$jenkins_cli install-plugin workflow-aggregator # Pipeline
|
|
||||||
$jenkins_cli install-plugin pipeline-stage-view # Pipeline: Stage View Plugin
|
|
||||||
$jenkins_cli install-plugin git # Git plugin
|
|
||||||
$jenkins_cli install-plugin github-organization-folder # GitHub Organization Folder Plugin
|
|
||||||
$jenkins_cli install-plugin subversion # Subversion Plug-in
|
|
||||||
$jenkins_cli install-plugin email-ext # Email Extension Plugin
|
|
||||||
$jenkins_cli install-plugin ssh-slaves # SSH Slaves plugin
|
|
||||||
|
|
||||||
# Installation de plugins supplémentaires pour le confort
|
|
||||||
$jenkins_cli install-plugin ansicolor # Prise en charge des couleurs pour la sortie console. Améliore la lisibilité de la console (par contre les couleurs ne passent pas...)
|
|
||||||
$jenkins_cli install-plugin fstrigger # Monitoring sur le système de fichier local. Pour surveiller des dossiers de code et builder sur les changements.
|
|
||||||
|
|
||||||
# Configure la sécurité globale avec ldap par défaut.
|
|
||||||
cp ../conf/config.xml /var/lib/jenkins/
|
|
||||||
chown jenkins: /var/lib/jenkins/config.xml
|
|
||||||
|
|
||||||
systemctl restart $app # Puis redémarre à nouveau le service.
|
|
||||||
cat /dev/null > "$tempfile" # Purge le log de suivi du démarrage.
|
|
||||||
config_OK=1
|
|
||||||
i=1;
|
|
||||||
fi
|
|
||||||
if grep -q "Jenkins is fully up and running" "$tempfile" && [ "$config_OK" -eq 1 ]; then
|
|
||||||
WARNING echo "Le service $app a démarré correctement."
|
|
||||||
break # Si le log annonce une deuxième fois le démarrage de jenkins, sort de la boucle.
|
|
||||||
fi
|
|
||||||
WARNING echo -n "."
|
|
||||||
sleep 1
|
|
||||||
done
|
done
|
||||||
SUPPRESS_WARNING kill -s 15 $PID_TAIL # Arrête l'exécution de tail.
|
|
||||||
ynh_secure_remove "$tempfile"
|
# Installation du plugin pour l'authentification ldap et http auth
|
||||||
if [ "$i" -ge $timeout ]; then
|
$jenkins_cli install-plugin reverse-proxy-auth-plugin
|
||||||
ynh_die "\nLe service $app n'a pas démarré dans le temps imparti."
|
|
||||||
fi
|
# Installation des plugins recommandés (Lors de l'install avec le Setup Wizard)
|
||||||
|
$jenkins_cli install-plugin cloudbees-folder # Folders Plugin
|
||||||
|
$jenkins_cli install-plugin antisamy-markup-formatter # OWASP Markup Formatter Plugin
|
||||||
|
$jenkins_cli install-plugin pam-auth # PAM Authentication plugin
|
||||||
|
$jenkins_cli install-plugin mailer # Mailer Plugin
|
||||||
|
$jenkins_cli install-plugin ldap # LDAP Plugin
|
||||||
|
$jenkins_cli install-plugin matrix-auth # Matrix Authorization Strategy Plugin
|
||||||
|
$jenkins_cli install-plugin build-timeout # Build timeout plugin
|
||||||
|
$jenkins_cli install-plugin credentials-binding # Credentials Binding Plugin
|
||||||
|
$jenkins_cli install-plugin timestamper # Timestamper
|
||||||
|
$jenkins_cli install-plugin ws-cleanup # Workspace Cleanup Plugin
|
||||||
|
$jenkins_cli install-plugin ant # Ant Plugin
|
||||||
|
$jenkins_cli install-plugin gradle # Gradle Plugin
|
||||||
|
$jenkins_cli install-plugin workflow-aggregator # Pipeline
|
||||||
|
$jenkins_cli install-plugin pipeline-stage-view # Pipeline: Stage View Plugin
|
||||||
|
$jenkins_cli install-plugin git # Git plugin
|
||||||
|
$jenkins_cli install-plugin github-organization-folder # GitHub Organization Folder Plugin
|
||||||
|
$jenkins_cli install-plugin subversion # Subversion Plug-in
|
||||||
|
$jenkins_cli install-plugin email-ext # Email Extension Plugin
|
||||||
|
$jenkins_cli install-plugin ssh-slaves # SSH Slaves plugin
|
||||||
|
|
||||||
|
# Installation de plugins supplémentaires pour le confort
|
||||||
|
$jenkins_cli install-plugin ansicolor # Prise en charge des couleurs pour la sortie console. Améliore la lisibilité de la console (par contre les couleurs ne passent pas...)
|
||||||
|
$jenkins_cli install-plugin fstrigger # Monitoring sur le système de fichier local. Pour surveiller des dossiers de code et builder sur les changements.
|
||||||
|
|
||||||
|
# Configure la sécurité globale avec ldap par défaut.
|
||||||
|
cp ../conf/config.xml /var/lib/jenkins/
|
||||||
|
chown jenkins: /var/lib/jenkins/config.xml
|
||||||
|
|
||||||
|
# Wait for Jenkins fully started
|
||||||
|
ynh_check_starting "Jenkins is fully up and running" "/var/log/$app/$app.log" "$timeout"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
|
@ -240,3 +210,11 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
sed -i '/#jenkins/d' /etc/hosts
|
sed -i '/#jenkins/d' /etc/hosts
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SEND A README FOR THE ADMIN
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
message="If you facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/jenkins_ynh"
|
||||||
|
|
||||||
|
ynh_send_readme_to_admin "$message" "$admin root"
|
||||||
|
|
|
@ -25,7 +25,7 @@ domain=$(ynh_app_setting_get $app domain)
|
||||||
|
|
||||||
if yunohost service status | grep -q $app # Test l'existence du service dans Yunohost
|
if yunohost service status | grep -q $app # Test l'existence du service dans Yunohost
|
||||||
then
|
then
|
||||||
echo "Remove $app service"
|
ynh_print_info "Remove $app service" >&2
|
||||||
yunohost service remove $app
|
yunohost service remove $app
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -22,12 +22,7 @@ source ../settings/scripts/_variables
|
||||||
|
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
# Nettoyage des résidus d'installation non pris en charge par le script remove.
|
# Nettoyage des résidus d'installation non pris en charge par le script remove.
|
||||||
if test -n "$PID_TAIL"
|
ynh_clean_check_starting
|
||||||
then
|
|
||||||
SUPPRESS_WARNING kill -s 15 $PID_TAIL # Arrête l'exécution de tail.
|
|
||||||
SUPPRESS_WARNING kill -s 15 $pid_change_port # Arrête l'exécution de change_port
|
|
||||||
ynh_secure_remove "$tempfile"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
# 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
|
||||||
|
@ -47,7 +42,7 @@ port=$(ynh_app_setting_get $app port)
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
yunohost app checkurl "${domain}${path_url}" -a "$app" \
|
ynh_webpath_available $domain $path_url \
|
||||||
|| ynh_die "Path not available: ${domain}${path_url}"
|
|| ynh_die "Path not available: ${domain}${path_url}"
|
||||||
test ! -d $final_path \
|
test ! -d $final_path \
|
||||||
|| ynh_die "There is already a directory: $final_path "
|
|| ynh_die "There is already a directory: $final_path "
|
||||||
|
@ -91,8 +86,8 @@ pid_change_port=$!
|
||||||
# INSTALL JENKINS
|
# INSTALL JENKINS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
wget --no-verbose https://pkg.jenkins.io/debian-stable/binary/jenkins_${version}_all.deb
|
wget --no-verbose https://pkg.jenkins.io/debian-stable/binary/jenkins_${jenkins_version}_all.deb
|
||||||
dpkg --install jenkins_${version}_all.deb
|
dpkg --install jenkins_${jenkins_version}_all.deb
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE OF THE MAIN DIR OF THE APP
|
# RESTORE OF THE MAIN DIR OF THE APP
|
||||||
|
@ -107,15 +102,6 @@ ynh_restore_file "$final_path"
|
||||||
ynh_secure_remove "/etc/default/jenkins"
|
ynh_secure_remove "/etc/default/jenkins"
|
||||||
ynh_restore_file /etc/default/$app
|
ynh_restore_file /etc/default/$app
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# START JENKINS IN BACKGROUND
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
systemctl restart $app # Redémarre jenkins pour prendre en compte les modifications
|
|
||||||
tempfile="$(mktemp)"
|
|
||||||
tail -f -n1 /var/log/$app/$app.log > "$tempfile" & # Suit le démarrage dans le log
|
|
||||||
PID_TAIL=$! # Récupère le PID de la commande tail, qui est passée en arrière plan.
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENABLE SERVICE IN ADMIN PANEL
|
# ENABLE SERVICE IN ADMIN PANEL
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -126,15 +112,13 @@ yunohost service add $app --log "/var/log/$app/$app.log"
|
||||||
# CHECK JENKINS STARTING
|
# CHECK JENKINS STARTING
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Surveille le démarrage du service.
|
# Wait for Jenkins fully started
|
||||||
for i in `seq 1 120`
|
ynh_check_starting "Jenkins is fully up and running" "/var/log/$app/$app.log" "300"
|
||||||
do # La boucle attend le démarrage de jenkins Ou 120 secondes.
|
|
||||||
if grep -q "INFOS: Jenkins is fully up and running" "$tempfile"; then
|
#=================================================
|
||||||
WARNING echo "Le service $app a démarré correctement."
|
# SEND A README FOR THE ADMIN
|
||||||
break # Si le log annonce le démarrage de jenkins, sort de la boucle.
|
#=================================================
|
||||||
fi
|
|
||||||
WARNING echo -n "."
|
message="If you facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/jenkins_ynh"
|
||||||
sleep 1
|
|
||||||
done
|
ynh_send_readme_to_admin "$message" "$admin root"
|
||||||
SUPPRESS_WARNING kill -s 15 $PID_TAIL # Arrête l'exécution de tail.
|
|
||||||
ynh_secure_remove "$tempfile"
|
|
||||||
|
|
|
@ -23,6 +23,12 @@ path_url=$(ynh_app_setting_get $app path)
|
||||||
is_public=$(ynh_app_setting_get $app is_public)
|
is_public=$(ynh_app_setting_get $app is_public)
|
||||||
port=$(ynh_app_setting_get $app port)
|
port=$(ynh_app_setting_get $app port)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CHECK VERSION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_abort_if_up_to_date
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# FIX OLD THINGS
|
# FIX OLD THINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -49,20 +55,22 @@ fi
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
BACKUP_BEFORE_UPGRADE # Backup the current version of the app
|
# Backup the current version of the app
|
||||||
|
ynh_backup_before_upgrade
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
SUPPRESS_WARNING kill -s 15 $PID_TAIL # Arrête l'exécution de tail.
|
ynh_clean_check_starting
|
||||||
ynh_secure_remove "$tempfile"
|
# restore it if the upgrade fails
|
||||||
BACKUP_FAIL_UPGRADE # restore it if the upgrade fails
|
ynh_restore_upgradebackup
|
||||||
}
|
}
|
||||||
ynh_abort_if_errors # Active trap pour arrêter le script si une erreur est détectée.
|
# Exit if an error occurs during the execution of the script
|
||||||
|
ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPGRADE JENKINS
|
# UPGRADE JENKINS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
wget --no-verbose https://pkg.jenkins.io/debian-stable/binary/jenkins_${version}_all.deb
|
wget --no-verbose https://pkg.jenkins.io/debian-stable/binary/jenkins_${jenkins_version}_all.deb
|
||||||
dpkg --install jenkins_${version}_all.deb
|
dpkg --install jenkins_${jenkins_version}_all.deb
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# FIX JENKINS SETUP
|
# FIX JENKINS SETUP
|
||||||
|
@ -82,17 +90,6 @@ fi
|
||||||
|
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# START JENKINS IN BACKGROUND
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Démarre jenkins
|
|
||||||
WARNING echo "Redémarrage de jenkins"
|
|
||||||
tempfile="$(mktemp)"
|
|
||||||
tail -f -n1 /var/log/$app/$app.log > "$tempfile" & # Suit le démarrage dans le log
|
|
||||||
PID_TAIL=$! # Récupère le PID de la commande tail, qui est passée en arrière plan.
|
|
||||||
systemctl restart $app
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -114,15 +111,5 @@ systemctl reload nginx
|
||||||
# CHECK JENKINS STARTING
|
# CHECK JENKINS STARTING
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
for i in `seq 1 300`
|
# Wait for Jenkins fully started
|
||||||
do # La boucle attend le démarrage de jenkins ou 5 minutes
|
ynh_check_starting "Jenkins is fully up and running" "/var/log/$app/$app.log" "300"
|
||||||
if grep -q "Jenkins is fully up and running" "$tempfile"; then
|
|
||||||
WARNING echo "Le service $app a démarré correctement."
|
|
||||||
break # Si le log annonce le démarrage de jenkins, sort de la boucle.
|
|
||||||
fi
|
|
||||||
WARNING echo -n "."
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
echo ""
|
|
||||||
QUIET kill -s 15 $PID_TAIL # Arrête l'exécution de tail.
|
|
||||||
ynh_secure_remove "$tempfile"
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue