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

Cleaning up

This commit is contained in:
ericgaspar 2022-05-07 18:24:57 +02:00
parent a951630e97
commit c91123d8d7
No known key found for this signature in database
GPG key ID: 574F281483054D44
7 changed files with 32 additions and 43 deletions

View file

@ -2,6 +2,6 @@ This package allows you to create directories reachable on a private network.
### Features ### Features
- Create and name your directories ; - Create and name your directories;
- Configure permissions for your directories thanks to the yunohost permission view ; - Configure permissions for your directories thanks to the yunohost permission view;
- Define readonly directories ; - Define readonly directories

View file

@ -1,12 +0,0 @@
* Any known limitations, constrains or stuff not working, such as (but not limited to):
* requiring a full dedicated domain ?
* architectures not supported ?
* not-working single-sign on or LDAP integration ?
* the app requires an important amount of RAM / disk / .. to install or to work properly
* etc...
* Other infos that people should be aware of, such as:
* any specific step to perform after installing (such as manually finishing the install, specific admin credentials, ...)
* how to configure / administrate the application if it ain't obvious
* upgrade process / specificities / things to be aware of ?
* security considerations ?

View file

@ -3,8 +3,8 @@
"id": "samba", "id": "samba",
"packaging_format": 1, "packaging_format": 1,
"description": { "description": {
"en": "An 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": "Un 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~ynh2",
"url": "https://www.samba.org/", "url": "https://www.samba.org/",
@ -31,7 +31,8 @@
"name": "warning", "name": "warning",
"type": "boolean", "type": "boolean",
"help": { "help": {
"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."
} }
} }
] ]

View file

@ -33,12 +33,12 @@ test $warning = "1" || ynh_die --message="You should validate the warning"
#================================================= #=================================================
# STORE SETTINGS FROM MANIFEST # STORE SETTINGS FROM MANIFEST
#================================================= #=================================================
ynh_script_progression --message="Storing installation settings..." --time --weight=1 ynh_script_progression --message="Storing installation settings..." --weight=1
#================================================= #=================================================
# STORE SETTINGS FROM MANIFEST # STORE SETTINGS FROM MANIFEST
#================================================= #=================================================
ynh_script_progression --message="Storing installation settings..." --time --weight=1 ynh_script_progression --message="Storing installation settings..." --weight=1
ynh_app_setting_set --app=$app --key=directories --value=shared ynh_app_setting_set --app=$app --key=directories --value=shared
ynh_app_setting_set --app=$app --key=advanced --value=0 ynh_app_setting_set --app=$app --key=advanced --value=0
@ -56,7 +56,7 @@ ynh_exec_warn_less yunohost firewall allow Both 445 --no-upnp
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Installing dependencies..." --time --weight=1 ynh_script_progression --message="Installing dependencies..." --weight=10
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
@ -69,7 +69,7 @@ ynh_permission_create --permission="share" --allowed=all_users
#================================================= #=================================================
# CREATE DATA DIRECTORY # CREATE DATA DIRECTORY
#================================================= #=================================================
ynh_script_progression --message="Creating a data directory..." --time --weight=1 ynh_script_progression --message="Creating a data directory..." --weight=1
datadir=/home/yunohost.app/samba datadir=/home/yunohost.app/samba
ynh_app_setting_set --app=samba --key=datadir --value=$datadir ynh_app_setting_set --app=samba --key=datadir --value=$datadir
@ -84,7 +84,7 @@ setfacl -R -m g:samba.share:rwx,d:g:samba.share:rwx $datadir/share
#================================================= #=================================================
# ADD A CONFIGURATION # ADD A CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Adding a configuration file..." --time --weight=1 ynh_script_progression --message="Adding a configuration file..." --weight=1
mkdir -p $final_path/smb.conf.d mkdir -p $final_path/smb.conf.d
ynh_add_config --template="global-smb.conf" --destination="$final_path/smb.conf.d/0-global.conf" ynh_add_config --template="global-smb.conf" --destination="$final_path/smb.conf.d/0-global.conf"
@ -108,7 +108,7 @@ yunohost service add smbd --description="Samba service" --log="/var/log/smbd/smb
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --time --weight=1 ynh_script_progression --message="Starting a systemd service..." --weight=10
# Start a systemd service # Start a systemd service
ynh_systemd_action --service_name=smbd --action="start" ynh_systemd_action --service_name=smbd --action="start"
@ -118,4 +118,4 @@ ynh_systemd_action --service_name=smbd --action="start"
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Installation of $app completed" --time --last ynh_script_progression --message="Installation of $app completed" --last

View file

@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --time --weight=1 ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -28,14 +28,14 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) # Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status $app >/dev/null if ynh_exec_warn_less yunohost service status $app >/dev/null
then then
ynh_script_progression --message="Removing $app service integration..." --time --weight=1 ynh_script_progression --message="Removing $app service integration..." --weight=1
yunohost service remove smbd yunohost service remove smbd
fi fi
#================================================= #=================================================
# REMOVE DEPENDENCIES # REMOVE DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Removing dependencies..." --time --weight=1 ynh_script_progression --message="Removing dependencies..." --weight=2
# Remove metapackage and its dependencies # Remove metapackage and its dependencies
ynh_remove_app_dependencies ynh_remove_app_dependencies
@ -47,7 +47,7 @@ ynh_remove_app_dependencies
# Remove the data directory if --purge option is used # Remove the data directory if --purge option is used
if [ "${YNH_APP_PURGE:-0}" -eq 1 ] if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
then then
ynh_script_progression --message="Removing app data directory..." --time --weight=1 ynh_script_progression --message="Removing app data directory..." --weight=10
ynh_secure_remove --file="$datadir" ynh_secure_remove --file="$datadir"
ynh_secure_remove --file="$final_path" ynh_secure_remove --file="$final_path"
fi fi
@ -56,4 +56,4 @@ fi
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Removal of $app completed" --time --last ynh_script_progression --message="Removal of $app completed" --last

View file

@ -20,7 +20,7 @@ ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --time --weight=1 ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -34,12 +34,12 @@ unbrowseable=$(ynh_app_setting_get --app=$app --key=unbrowseable)
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED
#================================================= #=================================================
ynh_script_progression --message="Validating restoration parameters..." --time --weight=1 ynh_script_progression --message="Validating restoration parameters..." --weight=1
#================================================= #=================================================
# FIND AND OPEN A PORT # FIND AND OPEN A PORT
#================================================= #=================================================
ynh_script_progression --message="Open 445 port..." --time --weight=1 ynh_script_progression --message="Open 445 port..." --weight=1
ynh_exec_warn_less yunohost firewall allow Both 445 --no-upnp ynh_exec_warn_less yunohost firewall allow Both 445 --no-upnp
@ -47,7 +47,7 @@ ynh_exec_warn_less yunohost firewall allow Both 445 --no-upnp
#================================================= #=================================================
# RESTORE THE DATA DIRECTORY # RESTORE THE DATA DIRECTORY
#================================================= #=================================================
ynh_script_progression --message="Restoring the data directory..." --time --weight=1 ynh_script_progression --message="Restoring the data directory..." --weight=1
ynh_restore_file --origin_path="$datadir" --not_mandatory ynh_restore_file --origin_path="$datadir" --not_mandatory
@ -64,7 +64,7 @@ ynh_restore_file --origin_path="$final_path" --not_mandatory
#================================================= #=================================================
# REINSTALL DEPENDENCIES # REINSTALL DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Reinstalling dependencies..." --time --weight=1 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
@ -78,7 +78,7 @@ yunohost service add smbd --description="Samba service" --log="/var/log/smbd/smb
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --time --weight=1 ynh_script_progression --message="Starting a systemd service..." --weight=10
ynh_systemd_action --service_name=smbd --action="start" ynh_systemd_action --service_name=smbd --action="start"
@ -88,4 +88,4 @@ ynh_systemd_action --service_name=smbd --action="start"
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Restoration completed for $app" --time --last ynh_script_progression --message="Restoration completed for $app" --last

View file

@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --time --weight=1 ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -26,7 +26,7 @@ upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --time --weight=1 ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
@ -42,21 +42,21 @@ ynh_abort_if_errors
#================================================= #=================================================
# STOP SYSTEMD SERVICE # STOP SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Stopping a systemd service..." --time --weight=1 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"
#================================================= #=================================================
# UPGRADE DEPENDENCIES # UPGRADE DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Upgrading dependencies..." --time --weight=1 ynh_script_progression --message="Upgrading dependencies..." --weight=12
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --time --weight=1 ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=smbd --action="start" ynh_systemd_action --service_name=smbd --action="start"
@ -64,4 +64,4 @@ ynh_systemd_action --service_name=smbd --action="start"
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Upgrade of $app completed" --time --last ynh_script_progression --message="Upgrade of $app completed" --last