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

Merge pull request #5 from YunoHost-Apps/upgrade

Apply example_ynh
This commit is contained in:
ljf (zamentur) 2022-07-19 14:07:59 +02:00 committed by GitHub
commit 35cfb3cd99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 155 additions and 68 deletions

55
.github/ISSUE_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,55 @@
---
name: Bug report
about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently.
---
**How to post a meaningful bug report**
1. *Read this whole template first.*
2. *Determine if you are on the right place:*
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!*
- *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.*
- *When in doubt, post here and we will figure it out together.*
3. *Delete the italic comments as you write over them below, and remove this guide.*
---
### Describe the bug
*A clear and concise description of what the bug is.*
### Context
- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...*
- YunoHost version: x.x.x
- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...*
- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes*
- If yes, please explain:
- Using, or trying to install package version/branch:
- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`*
### Steps to reproduce
- *If you performed a command from the CLI, the command itself is enough. For example:*
```sh
sudo yunohost app install the_app
```
- *If you used the webadmin, please perform the equivalent command from the CLI first.*
- *If the error occurs in your browser, explain what you did:*
1. *Go to '...'*
2. *Click on '...'*
3. *Scroll down to '...'*
4. *See error*
### Expected behavior
*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.*
### Logs
*When an operation fails, YunoHost provides a simple way to share the logs.*
- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.*
- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.*
*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)*
*If applicable and useful, add screenshots to help explain your problem.*

16
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,16 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished and ready to be reviewed/tested
- [ ] The fix/enhancement were manually tested (if applicable)
## Automatic tests
Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization)

View file

@ -5,7 +5,7 @@ It shall NOT be edited by hand.
# Samba for YunoHost # Samba for YunoHost
[![Integration level](https://dash.yunohost.org/integration/samba.svg)](https://dash.yunohost.org/appci/app/samba) ![](https://ci-apps.yunohost.org/ci/badges/samba.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/samba.maintain.svg) [![Integration level](https://dash.yunohost.org/integration/samba.svg)](https://dash.yunohost.org/appci/app/samba) ![Working status](https://ci-apps.yunohost.org/ci/badges/samba.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/samba.maintain.svg)
[![Install Samba with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=samba) [![Install Samba with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=samba)
*[Lire ce readme en français.](./README_fr.md)* *[Lire ce readme en français.](./README_fr.md)*
@ -24,32 +24,26 @@ This package allows you to create directories reachable on a private network.
- Define readonly directories - Define readonly directories
**Shipped version:** 4.9.5~ynh2 **Shipped version:** 4.9.5~ynh3
## Screenshots
![](./doc/screenshots/example.jpg)
## Documentation and resources ## Documentation and resources
* Official app website: https://www.samba.org/ * Official app website: <https://www.samba.org/>
* Official user documentation: https://yunohost.org/app_samba * Official user documentation: <https://yunohost.org/app_samba>
* Official admin documentation: https://www.samba.org/samba/docs/ * Official admin documentation: <https://www.samba.org/samba/docs/>
* Upstream app code repository: https://git.samba.org/?p=samba.git;a=summary * Upstream app code repository: <https://git.samba.org/?p=samba.git;a=summary>
* YunoHost documentation for this app: https://yunohost.org/app_samba * YunoHost documentation for this app: <https://yunohost.org/app_samba>
* Report a bug: https://github.com/YunoHost-Apps/samba_ynh/issues * Report a bug: <https://github.com/YunoHost-Apps/samba_ynh/issues>
## Developer info ## Developer info
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/samba_ynh/tree/testing). Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/samba_ynh/tree/testing).
To try the testing branch, please proceed like that. To try the testing branch, please proceed like that.
```
``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/samba_ynh/tree/testing --debug sudo yunohost app install https://github.com/YunoHost-Apps/samba_ynh/tree/testing --debug
or or
sudo yunohost app upgrade samba -u https://github.com/YunoHost-Apps/samba_ynh/tree/testing --debug sudo yunohost app upgrade samba -u https://github.com/YunoHost-Apps/samba_ynh/tree/testing --debug
``` ```
**More info regarding app packaging:** https://yunohost.org/packaging_apps **More info regarding app packaging:** <https://yunohost.org/packaging_apps>

View file

@ -1,10 +1,14 @@
<!--
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
It shall NOT be edited by hand.
-->
# Samba pour YunoHost # Samba pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/samba.svg)](https://dash.yunohost.org/appci/app/samba) ![](https://ci-apps.yunohost.org/ci/badges/samba.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/samba.maintain.svg) [![Niveau d'intégration](https://dash.yunohost.org/integration/samba.svg)](https://dash.yunohost.org/appci/app/samba) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/samba.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/samba.maintain.svg)
[![Installer Samba avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=samba) [![Installer Samba avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=samba)
*[Read this readme in english.](./README.md)* *[Read this readme in english.](./README.md)*
*[Lire ce readme en français.](./README_fr.md)*
> *Ce package vous permet d'installer Samba rapidement et simplement sur un serveur YunoHost. > *Ce package vous permet d'installer Samba rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
@ -20,32 +24,26 @@ This package allows you to create directories reachable on a private network.
- Define readonly directories - Define readonly directories
**Version incluse :** 4.9.5~ynh2 **Version incluse :** 4.9.5~ynh3
## Captures d'écran
![](./doc/screenshots/example.jpg)
## Documentations et ressources ## Documentations et ressources
* Site officiel de l'app : https://www.samba.org/ * Site officiel de l'app : <https://www.samba.org/>
* Documentation officielle utilisateur : https://yunohost.org/app_samba * Documentation officielle utilisateur : <https://yunohost.org/app_samba>
* Documentation officielle de l'admin : https://www.samba.org/samba/docs/ * Documentation officielle de l'admin : <https://www.samba.org/samba/docs/>
* Dépôt de code officiel de l'app : https://git.samba.org/?p=samba.git;a=summary * Dépôt de code officiel de l'app : <https://git.samba.org/?p=samba.git;a=summary>
* Documentation YunoHost pour cette app : https://yunohost.org/app_samba * Documentation YunoHost pour cette app : <https://yunohost.org/app_samba>
* Signaler un bug : https://github.com/YunoHost-Apps/samba_ynh/issues * Signaler un bug : <https://github.com/YunoHost-Apps/samba_ynh/issues>
## Informations pour les développeurs ## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/samba_ynh/tree/testing). Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/samba_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit. Pour essayer la branche testing, procédez comme suit.
```
``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/samba_ynh/tree/testing --debug sudo yunohost app install https://github.com/YunoHost-Apps/samba_ynh/tree/testing --debug
ou ou
sudo yunohost app upgrade samba -u https://github.com/YunoHost-Apps/samba_ynh/tree/testing --debug sudo yunohost app upgrade samba -u https://github.com/YunoHost-Apps/samba_ynh/tree/testing --debug
``` ```
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps **Plus d'infos sur le packaging d'applications :** <https://yunohost.org/packaging_apps>

View file

@ -9,7 +9,8 @@
setup_private=0 setup_private=0
setup_public=0 setup_public=0
upgrade=1 upgrade=1
#upgrade=1 from_commit=CommitHash # 4.9.5~ynh2
upgrade=1 from_commit=2e86319103d3b6031c78d51245b06dd47327e0c4
backup_restore=1 backup_restore=1
multi_instance=0 multi_instance=0
port_already_use=0 port_already_use=0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

View file

@ -6,7 +6,7 @@
"en": "App to share directories on your private network thanks to SMB protocol", "en": "App to share directories on your private network thanks to SMB protocol",
"fr": "Apllication pour partage des dossiers sur un reseaux privé via le protocole SMB" "fr": "Apllication pour partage des dossiers sur un reseaux privé via le protocole SMB"
}, },
"version": "4.9.5~ynh2", "version": "4.9.5~ynh3",
"url": "https://www.samba.org/", "url": "https://www.samba.org/",
"upstream": { "upstream": {
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
@ -26,11 +26,11 @@
"multi_instance": false, "multi_instance": false,
"services": [], "services": [],
"arguments": { "arguments": {
"install" : [ "install": [
{ {
"name": "warning", "name": "warning",
"type": "boolean", "type": "display_text",
"help": { "ask": {
"en": "I understand this app is only for private network purpose and i should not install it on a server with a public IP or open the 445 port on my home router.", "en": "I understand this app is only for private network purpose and i should not install it on a server with a public IP or open the 445 port on my home router.",
"fr": "Je comprends que cette application est uniquement à des fins de réseau privé et je ne dois pas l'installer sur un serveur avec une adresse IP publique ou ouvrir le port 445 sur mon routeur." "fr": "Je comprends que cette application est uniquement à des fins de réseau privé et je ne dois pas l'installer sur un serveur avec une adresse IP publique ou ouvrir le port 445 sur mon routeur."
} }

View file

@ -22,18 +22,12 @@ ynh_abort_if_errors
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
warning=$YNH_APP_ARG_WARNING
final_path="/etc/samba"
#================================================= #=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#================================================= #=================================================
test $warning = "1" || ynh_die --message="You should validate the warning" ynh_script_progression --message="Validating installation parameters..."
#================================================= final_path="/etc/samba"
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_script_progression --message="Storing installation settings..." --weight=1
#================================================= #=================================================
# STORE SETTINGS FROM MANIFEST # STORE SETTINGS FROM MANIFEST
@ -46,13 +40,15 @@ ynh_app_setting_set --app=$app --key=readonly_dir --value=''
ynh_app_setting_set --app=$app --key=unbrowseable --value='' ynh_app_setting_set --app=$app --key=unbrowseable --value=''
ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
#=================================================
# STANDARD MODIFICATIONS
#================================================= #=================================================
# FIND AND OPEN A PORT # FIND AND OPEN A PORT
#================================================= #=================================================
ynh_script_progression --message="Configuring firewall..."
ynh_exec_warn_less yunohost firewall allow Both 445 --no-upnp ynh_exec_warn_less yunohost firewall allow Both 445 --no-upnp
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
#================================================= #=================================================
@ -60,12 +56,16 @@ ynh_script_progression --message="Installing dependencies..." --weight=10
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
#=================================================
# SPECIFIC SETUP
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
ynh_script_progression --message="Configuring permissions..."
# We define the permission in advance to be able to use the group
# in unix permission
ynh_permission_create --permission="share" --allowed=all_users ynh_permission_create --permission="share" --allowed=all_users
#================================================= #=================================================
# CREATE DATA DIRECTORY # CREATE DATA DIRECTORY
#================================================= #=================================================
@ -99,12 +99,14 @@ ynh_add_config --template="share-smb.conf" --destination="$final_path/smb.conf.d
EOF EOF
cat $final_path/smb.conf.d/*.conf >> $final_path/smb.conf cat $final_path/smb.conf.d/*.conf >> $final_path/smb.conf
#================================================ #=================================================
# GENERIC FINALIZATION
#=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST
#================================================ #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add smbd --description="Samba service" --log="/var/log/smbd/smbd.log" yunohost service add smbd --description="Samba service" --log="/var/log/smbd/smbd.log" --needs_exposed_ports 445
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE

View file

@ -16,8 +16,8 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE

View file

@ -14,6 +14,9 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
ynh_clean_setup () {
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
@ -37,12 +40,17 @@ unbrowseable=$(ynh_app_setting_get --app=$app --key=unbrowseable)
ynh_script_progression --message="Validating restoration parameters..." --weight=1 ynh_script_progression --message="Validating restoration parameters..." --weight=1
#================================================= #=================================================
# FIND AND OPEN A PORT # STANDARD RESTORATION STEPS
#================================================= #=================================================
ynh_script_progression --message="Open 445 port..." --weight=1 # RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..."
ynh_exec_warn_less yunohost firewall allow Both 445 --no-upnp ynh_restore_file --origin_path="$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R root:root "$final_path"
#================================================= #=================================================
# RESTORE THE DATA DIRECTORY # RESTORE THE DATA DIRECTORY
@ -57,8 +65,6 @@ chmod 750 "$datadir"
chmod -R o-rwx "$datadir" chmod -R o-rwx "$datadir"
chown -R root:root "$datadir" chown -R root:root "$datadir"
ynh_restore_file --origin_path="$final_path" --not_mandatory
#================================================= #=================================================
# SPECIFIC RESTORATION # SPECIFIC RESTORATION
#================================================= #=================================================
@ -69,11 +75,20 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=1
# Define and install dependencies # Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
#================================================ #=================================================
# FIND AND OPEN A PORT
#=================================================
ynh_script_progression --message="Open 445 port..." --weight=1
ynh_exec_warn_less yunohost firewall allow Both 445 --no-upnp
#=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST
#================================================ #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
# Don't add --needs_exposed_ports 445 , we don't want a remote diagnosis here
yunohost service add smbd --description="Samba service" --log="/var/log/smbd/smbd.log" yunohost service add smbd --description="Samba service" --log="/var/log/smbd/smbd.log"
#================================================= #=================================================

View file

@ -19,6 +19,7 @@ app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
#================================================= #=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed) upgrade_type=$(ynh_check_app_version_changed)
@ -30,6 +31,7 @@ ynh_script_progression --message="Backing up the app before upgrading (may take
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
ynh_clean_setup () { ynh_clean_setup () {
ynh_clean_check_starting
# Restore it if the upgrade fails # Restore it if the upgrade fails
ynh_restore_upgradebackup ynh_restore_upgradebackup
} }
@ -45,6 +47,11 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=4
ynh_systemd_action --service_name=smbd --action="stop" ynh_systemd_action --service_name=smbd --action="stop"
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
#================================================= #=================================================
# UPGRADE DEPENDENCIES # UPGRADE DEPENDENCIES
#================================================= #=================================================
@ -52,11 +59,14 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=12
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
#================================================ #=================================================
# GENERIC FINALIZATION
#=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST
#================================================ #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
# Don't add --needs_exposed_ports 445 , we don't want a remote diagnosis here
yunohost service add smbd --description="Samba service" --log="/var/log/smbd/smbd.log" yunohost service add smbd --description="Samba service" --log="/var/log/smbd/smbd.log"
#================================================= #=================================================

View file

@ -1,2 +0,0 @@
*~
*.sw[op]

View file

@ -1,2 +0,0 @@
*~
*.sw[op]