diff --git a/README.md b/README.md index 9a5fd80..1f93c03 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ This package allows you to create directories reachable on a private network. * Official app website: * Official admin documentation: * Upstream app code repository: -* YunoHost documentation for this app: +* YunoHost Store: * Report a bug: ## Developer info diff --git a/README_fr.md b/README_fr.md index 43628f3..9437e24 100644 --- a/README_fr.md +++ b/README_fr.md @@ -31,7 +31,7 @@ This package allows you to create directories reachable on a private network. * Site officiel de l’app : * Documentation officielle de l’admin : * Dépôt de code officiel de l’app : -* Documentation YunoHost pour cette app : +* YunoHost Store: * Signaler un bug : ## Informations pour les développeurs diff --git a/check_process b/check_process deleted file mode 100644 index 6a7d009..0000000 --- a/check_process +++ /dev/null @@ -1,20 +0,0 @@ -;; Test complet - ; Manifest - warning=1 - ; Checks - pkg_linter=1 - setup_sub_dir=0 - setup_root=0 - setup_nourl=1 - setup_private=0 - setup_public=0 - upgrade=1 - # 4.9.5~ynh2 - upgrade=1 from_commit=2e86319103d3b6031c78d51245b06dd47327e0c4 - backup_restore=1 - multi_instance=0 - port_already_use=0 - change_url=0 -;;; Options -Email= -Notification=none diff --git a/doc/PRE_INSTALL.md b/doc/PRE_INSTALL.md new file mode 100644 index 0000000..27f46b5 --- /dev/null +++ b/doc/PRE_INSTALL.md @@ -0,0 +1 @@ +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. diff --git a/doc/PRE_INSTALL_fr.md b/doc/PRE_INSTALL_fr.md new file mode 100644 index 0000000..a9802bd --- /dev/null +++ b/doc/PRE_INSTALL_fr.md @@ -0,0 +1 @@ +Je comprends que cette application est uniquement à des fins de réseau privé et que je ne dois pas l'installer sur un serveur avec une adresse IP publique ou ouvrir le port 445 sur mon routeur. diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 1baafb8..0000000 --- a/manifest.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "Samba", - "id": "samba", - "packaging_format": 1, - "description": { - "en": "Share directories on your private network thanks to SMB protocol", - "fr": "Partager des dossiers sur un réseau privé via le protocole SMB" - }, - "version": "4.13.13~ynh1", - "url": "https://www.samba.org/", - "upstream": { - "license": "AGPL-3.0-only", - "website": "https://www.samba.org/", - "admindoc": "https://www.samba.org/samba/docs/", - "code": "https://git.samba.org/?p=samba.git;a=summary" - }, - "license": "AGPL-3.0-only", - "maintainer": { - "name": "Galette" - }, - "requirements": { - "yunohost": ">= 11.2" - }, - "multi_instance": false, - "services": [], - "arguments": { - "install": [ - { - "name": "warning", - "type": "display_text", - "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.", - "fr": "Je comprends que cette application est uniquement à des fins de réseau privé et que je ne dois pas l'installer sur un serveur avec une adresse IP publique ou ouvrir le port 445 sur mon routeur." - } - } - ] - } -} diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..207401b --- /dev/null +++ b/manifest.toml @@ -0,0 +1,51 @@ +packaging_format = 2 + +id = "samba" +name = "Samba" +description.en = "Share directories on your private network thanks to SMB protocol" +description.fr = "Partager des dossiers sur un réseau privé via le protocole SMB" + +version = "4.13.13~ynh1" + +maintainers = ["Galette"] + +[upstream] +license = "AGPL-3.0-only" +website = "https://www.samba.org/" +admindoc = "https://www.samba.org/samba/docs/" +code = "https://git.samba.org/?p=samba.git;a=summary" + +[integration] +yunohost = ">= 11.2" +architectures = "all" +multi_instance = false + +ldap = "not_relevant" + +sso = "not_relevant" + +disk = "50M" +ram.build = "50M" +ram.runtime = "50M" + +[install] + +[resources] + [resources.system_user] + + [resources.install_dir] + dir = "/etc/samba" + + [resources.ports] + main.default = 445 + main.exposed = "Both" + + [resources.data_dir] + subdirs = ["share"] + + [resources.permissions] + share.show_tile = false + share.allowed = "all_users" + + [resources.apt] + packages = "samba" diff --git a/scripts/_common.sh b/scripts/_common.sh index 54e3926..944a65e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,9 +4,6 @@ # COMMON VARIABLES #================================================= -# dependencies used by the app -pkg_dependencies="samba" - #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index 787fa59..d2db266 100755 --- a/scripts/backup +++ b/scripts/backup @@ -10,24 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -ynh_print_info --message="Loading installation settings..." - -app=$YNH_APP_INSTANCE_NAME - -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -domain=$(ynh_app_setting_get --app=$app --key=domain) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= @@ -37,13 +19,13 @@ ynh_print_info --message="Declaring files to be backed up..." # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$final_path" +ynh_backup --src_path="$install_dir" #================================================= # BACKUP THE DATA DIR #================================================= -ynh_backup --src_path="$datadir" --is_big +ynh_backup --src_path="$data_dir" --is_big #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index ae7878a..3c2b913 100755 --- a/scripts/install +++ b/scripts/install @@ -9,26 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# RETRIEVE ARGUMENTS FROM THE MANIFEST -#================================================= - -app=$YNH_APP_INSTANCE_NAME - -#================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS -#================================================= -ynh_script_progression --message="Validating installation parameters..." - -final_path="/etc/samba" - #================================================= # STORE SETTINGS FROM MANIFEST #================================================= @@ -38,66 +18,34 @@ 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=readonly_dir --value='' ynh_app_setting_set --app=$app --key=unbrowseable --value='' -ynh_app_setting_set --app=$app --key=final_path --value=$final_path -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# FIND AND OPEN A PORT -#================================================= -ynh_script_progression --message="Configuring firewall..." - -ynh_exec_warn_less yunohost firewall allow Both 445 --no-upnp - -#================================================= -# INSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Installing dependencies..." --weight=10 - -ynh_install_app_dependencies $pkg_dependencies - -#================================================= -# SPECIFIC SETUP -#================================================= -# 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 #================================================= # CREATE DATA DIRECTORY #================================================= ynh_script_progression --message="Creating a data directory..." --weight=1 -datadir=/home/yunohost.app/samba -ynh_app_setting_set --app=samba --key=datadir --value=$datadir - -mkdir -p $datadir/share - -chmod 750 "$datadir/share" -chmod -R o-rwx "$datadir/share" -chown -R root:root "$datadir/share" -setfacl -R -m g:samba.share:rwx,d:g:samba.share:rwx $datadir/share +chmod 750 "$data_dir/share" +chmod -R o-rwx "$data_dir/share" +chown -R root:root "$data_dir/share" +setfacl -R -m g:samba.share:rwx,d:g:samba.share:rwx $data_dir/share #================================================= # ADD A CONFIGURATION #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=1 -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="share-smb.conf" --destination="$final_path/smb.conf.d/share.conf" +mkdir -p $install_dir/smb.conf.d +ynh_add_config --template="global-smb.conf" --destination="$install_dir/smb.conf.d/0-global.conf" +ynh_add_config --template="share-smb.conf" --destination="$install_dir/smb.conf.d/share.conf" - cat > $final_path/smb.conf < $install_dir/smb.conf <> $final_path/smb.conf +cat $install_dir/smb.conf.d/*.conf >> $install_dir/smb.conf #================================================= # GENERIC FINALIZATION @@ -106,7 +54,7 @@ cat $final_path/smb.conf.d/*.conf >> $final_path/smb.conf #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add smbd --description="Samba service" --log="/var/log/smbd/smbd.log" --needs_exposed_ports 445 +yunohost service add smbd --description="Samba service" --log="/var/log/smbd/smbd.log" --needs_exposed_ports $port #================================================= # START SYSTEMD SERVICE diff --git a/scripts/remove b/scripts/remove index 58c0d3e..8c02fa1 100755 --- a/scripts/remove +++ b/scripts/remove @@ -9,16 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 - -app=$YNH_APP_INSTANCE_NAME - -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) - #================================================= # STANDARD REMOVE #================================================= @@ -32,26 +22,6 @@ then yunohost service remove smbd fi -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." --weight=2 - -# Remove metapackage and its dependencies -ynh_remove_app_dependencies - -#================================================= -# REMOVE DATA DIR -#================================================= - -# Remove the data directory if --purge option is used -if [ "${YNH_APP_PURGE:-0}" -eq 1 ] -then - ynh_script_progression --message="Removing app data directory..." --weight=10 - ynh_secure_remove --file="$datadir" - ynh_secure_remove --file="$final_path" -fi - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index cb47d72..ba15529 100755 --- a/scripts/restore +++ b/scripts/restore @@ -10,35 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -ynh_clean_setup () { - ynh_clean_check_starting -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 - -app=$YNH_APP_INSTANCE_NAME - -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) -directories=$(ynh_app_setting_get --app=$app --key=directories) -advanced=$(ynh_app_setting_get --app=$app --key=advanced) -readonly_dir=$(ynh_app_setting_get --app=$app --key=readonly_dir) -unbrowseable=$(ynh_app_setting_get --app=$app --key=unbrowseable) - -#================================================= -# CHECK IF THE APP CAN BE RESTORED -#================================================= -ynh_script_progression --message="Validating restoration parameters..." --weight=1 - #================================================= # STANDARD RESTORATION STEPS #================================================= @@ -46,42 +17,18 @@ ynh_script_progression --message="Validating restoration parameters..." --weight #================================================= ynh_script_progression --message="Restoring the app main directory..." -ynh_restore_file --origin_path="$final_path" +ynh_restore_file --origin_path="$install_dir" -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R root:root "$final_path" +chown -R root:root "$install_dir" #================================================= # RESTORE THE DATA DIRECTORY #================================================= ynh_script_progression --message="Restoring the data directory..." --weight=1 -ynh_restore_file --origin_path="$datadir" --not_mandatory - -mkdir -p $datadir - -chmod 750 "$datadir" -chmod -R o-rwx "$datadir" -chown -R root:root "$datadir" - -#================================================= -# SPECIFIC RESTORATION -#================================================= -# REINSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=1 - -# Define and install 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 +ynh_restore_file --origin_path="$data_dir" --not_mandatory +chown -R root:root "$data_dir" #================================================= # INTEGRATE SERVICE IN YUNOHOST @@ -89,7 +36,7 @@ ynh_exec_warn_less yunohost firewall allow Both 445 --no-upnp 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" --needs_exposed_ports 445 +yunohost service add smbd --description="Samba service" --log="/var/log/smbd/smbd.log" --needs_exposed_ports $port #================================================= # START SYSTEMD SERVICE diff --git a/scripts/upgrade b/scripts/upgrade index 19ff23d..31da8bf 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,35 +9,12 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 - -app=$YNH_APP_INSTANCE_NAME - #================================================= # CHECK VERSION #================================================= -ynh_script_progression --message="Checking version..." 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)..." --weight=1 - -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - ynh_clean_check_starting - # Restore it if the upgrade fails - ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -47,18 +24,6 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=4 ynh_systemd_action --service_name=smbd --action="stop" -#================================================= -# ENSURE DOWNWARD COMPATIBILITY -#================================================= -ynh_script_progression --message="Ensuring downward compatibility..." - -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=12 - -ynh_install_app_dependencies $pkg_dependencies - #================================================= # GENERIC FINALIZATION #================================================= @@ -67,7 +32,7 @@ ynh_install_app_dependencies $pkg_dependencies 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" --needs_exposed_ports 445 +yunohost service add smbd --description="Samba service" --log="/var/log/smbd/smbd.log" --needs_exposed_ports $port #================================================= # START SYSTEMD SERVICE diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..91daf17 --- /dev/null +++ b/tests.toml @@ -0,0 +1,7 @@ +test_format = 1.0 + +[default] + + # ------------ + # Tests to run + # ------------ \ No newline at end of file