1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ssh_chroot_dir_ynh.git synced 2024-09-03 20:26:26 +02:00

Apply last example_ynh

This commit is contained in:
yalh76 2022-09-18 02:53:36 +02:00
parent 2617bebdb2
commit a31d147ed7
7 changed files with 96 additions and 219 deletions

3
.gitignore vendored
View file

@ -1,3 +0,0 @@
*.swp
*~
Notes

117
YEP.md
View file

@ -1,117 +0,0 @@
#### [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 dun nom de domaine](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-2182)
`Not applicable`
[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)
`Not applicable`
[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)
`Not applicable`
[YEP 4.6 - Gère le multi-instance](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-11)
`Validated` - *Automatically verified.*
#### [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)
`Not applicable`
[YEP 4.2 - Lier l'authentification au sso](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-42)
`Not applicable`
#### [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)
`Not yet 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)
`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)
`Not yet validated`
[YEP 4.4 - Fournir un script de restauration YunoHost fonctionnel](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-44)
`Not yet validated`
#### [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)
`Not applicable`
#### [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)
`Not applicable`
[YEP 3.4 - Isoler l'app](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-34)
`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)
`Not applicable`
#### 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`.

View file

@ -1,83 +1,83 @@
{
"name": "ssh chroot directory",
"id": "ssh_chroot_dir",
"packaging_format": 1,
"description": {
"en": "ssh chroot directories with quotas disk.",
"fr": "Dossier ssh en chroot avec gestion de quotas."
},
"version": "1.2~ynh4",
"url": "https://github.com/maniackcrudelis/ssh_chroot",
"name": "ssh chroot directory",
"id": "ssh_chroot_dir",
"packaging_format": 1,
"description": {
"en": "ssh chroot directories with quotas disk.",
"fr": "Dossier ssh en chroot avec gestion de quotas."
},
"version": "1.2~ynh4",
"url": "https://github.com/maniackcrudelis/ssh_chroot",
"upstream": {
"license": "GPL-3.0",
"website": "https://github.com/maniackcrudelis/ssh_chroot",
"code": "https://github.com/maniackcrudelis/ssh_chroot"
},
"license": "GPL-3.0",
"maintainer": {
"name": "",
"email": ""
},
"previous_maintainers": [{
"name": "Maniack Crudelis",
"email": "maniackc_dev@crudelis.fr"
}],
"requirements": {
"license": "GPL-3.0",
"maintainer": {
"name": "",
"email": ""
},
"previous_maintainers": [{
"name": "Maniack Crudelis",
"email": "maniackc_dev@crudelis.fr"
}],
"requirements": {
"yunohost": ">= 4.3.0"
},
"multi_instance": true,
"services": [
},
"multi_instance": true,
"services": [
],
"arguments": {
"install" : [
{
"name": "ssh_user",
"arguments": {
"install": [
{
"name": "ssh_user",
"type": "string",
"ask": {
"en": "Choose an new user for this directory",
"fr": "Choisissez un nouvel utilisateur pour ce dossier"
},
"help": {
"en": "It must be a new user, it will be created for this purpose.",
"fr": "Ce doit être un nouvel utilisateur, il sera créé pour cet usage."
},
"example": "johndoe"
},
{
"name": "password",
"type": "password",
"help": {
"en": "OPTIONAL. It's better to use a public ssh key instead. See below.",
"fr": "OPTIONNEL. Il est préférable d'utiliser une clé publique. Voir ci-dessous."
},
"optional": true
},
{
"name": "pub_key",
"ask": {
"en": "Choose an new user for this directory",
"fr": "Choisissez un nouvel utilisateur pour ce dossier"
},
"help": {
"en": "It must be a new user, it will be created for this purpose.",
"fr": "Ce doit être un nouvel utilisateur, il sera créé pour cet usage."
},
"example": "johndoe"
},
{
"name": "password",
"type": "password",
"help": {
"en": "OPTIONAL. It's better to use a public ssh key instead. See below.",
"fr": "OPTIONNEL. Il est préférable d'utiliser une clé publique. Voir ci-dessous."
},
"optional": true
},
{
"name": "pub_key",
"type": "string",
"ask": {
"en": "Give the public ssh key",
"fr": "Donnez une clé publique ssh"
},
"help": {
"en": "OPTIONAL. You can use a password instead, but a ssh public key is more secure. Ask to your beneficiary for his public key.",
"fr": "OPTIONNEL. Vous pouvez utiliser un mot de passe à la place, mais une clé ssh publique est plus sécurisée. Demandez à votre bénéficiaire sa clé publique."
},
"optional": true
},
{
"name": "size",
"ask": {
"en": "Give the public ssh key",
"fr": "Donnez une clé publique ssh"
},
"help": {
"en": "OPTIONAL. You can use a password instead, but a ssh public key is more secure. Ask to your beneficiary for his public key.",
"fr": "OPTIONNEL. Vous pouvez utiliser un mot de passe à la place, mais une clé ssh publique est plus sécurisée. Demandez à votre bénéficiaire sa clé publique."
},
"optional": true
},
{
"name": "size",
"type": "string",
"ask": {
"en": "Choose the maximum space allowed to this user",
"fr": "Choississez l'espace maximum à allouer à cet utilisateur"
},
"help": {
"en": "Default Ko, Use M, G or T to specified another unit.",
"fr": "Ko par défaut, utilisez M, G ou T pour indiquer une autre unité."
},
"default": "10G"
}
]
}
"ask": {
"en": "Choose the maximum space allowed to this user",
"fr": "Choississez l'espace maximum à allouer à cet utilisateur"
},
"help": {
"en": "Default Ko, Use M, G or T to specified another unit.",
"fr": "Ko par défaut, utilisez M, G ou T pour indiquer une autre unité."
},
"default": "10G"
}
]
}
}

View file

@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_clean_setup () {
ynh_clean_check_starting
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
@ -22,10 +22,9 @@ ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
ynh_script_progression --message="Retrieve arguments from the manifest" --weight=2
ssh_user=$YNH_APP_ARG_SSH_USER
ynh_print_OFF; password=${YNH_APP_ARG_PASSWORD:-}; ynh_print_ON
password=${YNH_APP_ARG_PASSWORD:-}
pub_key=${YNH_APP_ARG_PUB_KEY:-}
size=$YNH_APP_ARG_SIZE
@ -46,17 +45,15 @@ ynh_system_user_exists $ssh_user && ynh_die "This user already exist"
final_path=/opt/yunohost/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
ynh_print_OFF
if test -z "$password" && test -z "$pub_key"
then
ynh_die "You can't left empty both password and public key. Please fill at least one of them."
fi
ynh_print_ON
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_script_progression --message="Storing installation settings..."
ynh_script_progression --message="Storing installation settings..." --weight=1
ynh_app_setting_set --app=$app --key=ssh_user --value=$ssh_user
ynh_app_setting_set --app=$app --key=size --value=$size
@ -66,7 +63,7 @@ ynh_app_setting_set --app=$app --key=size --value=$size
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..."
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
@ -120,13 +117,11 @@ fi
ynh_script_progression --message="Create the user with Chroot_manager" --weight=5
add_password=""
ynh_print_OFF
if [ -n "$password" ]
then
auth_opt="--password"
auth_value="$password"
fi
ynh_print_ON
add_sshkey=""
if [ -n "$pub_key" ]
@ -136,12 +131,10 @@ then
auth_value="$pub_key"
fi
ynh_print_OFF
if ! IS_PACKAGE_CHECK
then
$final_path/chroot_manager.sh adduser --name $ssh_user $auth_opt "$auth_value" --directory "$user_dir" --quota $size
fi
ynh_print_ON
#=================================================
# ADD A LINK TO CHROOT_MANAGER
@ -189,4 +182,4 @@ ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root"
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation completed" --last
ynh_script_progression --message="Installation of $app completed" --last

View file

@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
@ -57,7 +57,7 @@ fi
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Remove app main directory"
ynh_script_progression --message="Remove app main directory" --weight=1
# Remove the app directory securely
ynh_secure_remove "$final_path"
@ -68,5 +68,10 @@ ynh_secure_remove "$final_path"
# DISCLAIMER
#=================================================
ynh_print_info "
The directory /home/yunohost.app/ssh_chroot_directories hasn't been removed."
ynh_print_info --message="The directory /home/yunohost.app/ssh_chroot_directories hasn't been removed."
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed" --last

View file

@ -15,7 +15,7 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_clean_setup () {
ynh_clean_check_starting
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
@ -23,7 +23,7 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
@ -33,7 +33,7 @@ ssh_user=$(ynh_app_setting_get --app=$app --key=ssh_user)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_script_progression --message="Validating restoration parameters..."
ynh_script_progression --message="Validating restoration parameters..." --weight=1
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
@ -43,14 +43,14 @@ test ! -d $final_path \
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..."
ynh_script_progression --message="Restoring the app main directory..." --weight=1
ynh_restore_file --origin_path="$final_path"
#=================================================
# RESTORE THE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Restoring the data directory..."
ynh_script_progression --message="Restoring the data directory..." --weight=1
ynh_restore_file --origin_path="/home/yunohost.app/ssh_chroot_directories/$ssh_user" --not_mandatory
@ -129,4 +129,4 @@ chown -R root: $final_path
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app"
ynh_script_progression --message="Restoration completed for $app" --last

View file

@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
@ -22,19 +22,18 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# CHECK VERSION
#=================================================
ynh_script_progression --message="Checking version..."
ynh_script_progression --message="Checking version..." --weight=1
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --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
}
@ -49,7 +48,7 @@ ynh_abort_if_errors
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..."
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"
@ -123,4 +122,4 @@ ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade completed" --last
ynh_script_progression --message="Upgrade of $app completed" --last