From fccfac2e7b89231d35e562552584d36ae92a56af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 13 Aug 2023 12:38:51 +0200 Subject: [PATCH 01/11] v2 --- manifest.toml | 42 ++++++++++++++++++++++++++++++++++++++++++ scripts/_common.sh | 2 +- scripts/backup | 16 ++++++++-------- scripts/install | 44 ++++++++++++++++++++++---------------------- scripts/remove | 16 ++++++++-------- scripts/restore | 44 ++++++++++++++++++++++---------------------- scripts/upgrade | 18 +++++++++--------- 7 files changed, 112 insertions(+), 70 deletions(-) create mode 100644 manifest.toml diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..5347000 --- /dev/null +++ b/manifest.toml @@ -0,0 +1,42 @@ +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" +cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number) +fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin. + +[integration] +yunohost = ">= 11.2" +architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"] +multi_instance = false +ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials. +sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal. +disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... +ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... +ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... + + [install.warning] + 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." + ask.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." + type = "display_text" + +[resources] + [resources.system_user] + + [resources.install_dir] + + [resources.data_dir] + + [resources.permissions] diff --git a/scripts/_common.sh b/scripts/_common.sh index 54e3926..e9f8678 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,7 @@ #================================================= # dependencies used by the app -pkg_dependencies="samba" +#REMOVEME? pkg_dependencies="samba" #================================================= # PERSONAL HELPERS diff --git a/scripts/backup b/scripts/backup index 787fa59..813375d 100755 --- a/scripts/backup +++ b/scripts/backup @@ -15,18 +15,18 @@ source /usr/share/yunohost/helpers #================================================= # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading installation settings..." +#REMOVEME? ynh_print_info --message="Loading installation settings..." -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? 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) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -37,13 +37,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..f57addd 100755 --- a/scripts/install +++ b/scripts/install @@ -14,31 +14,31 @@ source /usr/share/yunohost/helpers #================================================= # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_script_progression --message="Validating installation parameters..." +#REMOVEME? ynh_script_progression --message="Validating installation parameters..." -final_path="/etc/samba" +#REMOVEME? install_dir="/etc/samba" #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_script_progression --message="Storing installation settings..." --weight=1 +#REMOVEME? 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=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 +#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir #================================================= # STANDARD MODIFICATIONS @@ -52,52 +52,52 @@ ynh_exec_warn_less yunohost firewall allow Both 445 --no-upnp #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing dependencies..." --weight=10 +#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=10 -ynh_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_install_app_dependencies $pkg_dependencies #================================================= # SPECIFIC SETUP #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring permissions..." +#REMOVEME? 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 +#REMOVEME? 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 +#REMOVEME? data_dir=/home/yunohost.app/samba +#REMOVEME? ynh_app_setting_set --app=samba --key=data_dir --value=$data_dir -mkdir -p $datadir/share +mkdir -p $data_dir/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 diff --git a/scripts/remove b/scripts/remove index 58c0d3e..7b61f36 100755 --- a/scripts/remove +++ b/scripts/remove @@ -12,12 +12,12 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? 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) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) #================================================= # STANDARD REMOVE @@ -35,10 +35,10 @@ fi #================================================= # REMOVE DEPENDENCIES #================================================= -ynh_script_progression --message="Removing dependencies..." --weight=2 +#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=2 # Remove metapackage and its dependencies -ynh_remove_app_dependencies +#REMOVEME? ynh_remove_app_dependencies #================================================= # REMOVE DATA DIR @@ -48,8 +48,8 @@ ynh_remove_app_dependencies 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" +#REMOVEME? ynh_secure_remove --file="$data_dir" +#REMOVEME? ynh_secure_remove --file="$install_dir" fi #================================================= diff --git a/scripts/restore b/scripts/restore index cb47d72..7efff34 100755 --- a/scripts/restore +++ b/scripts/restore @@ -14,30 +14,30 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +#REMOVEME? ynh_clean_setup () { ynh_clean_check_starting } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? 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) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) +#REMOVEME? directories=$(ynh_app_setting_get --app=$app --key=directories) +#REMOVEME? advanced=$(ynh_app_setting_get --app=$app --key=advanced) +#REMOVEME? readonly_dir=$(ynh_app_setting_get --app=$app --key=readonly_dir) +#REMOVEME? 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 +#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=1 #================================================= # STANDARD RESTORATION STEPS @@ -46,34 +46,34 @@ 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" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +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 +ynh_restore_file --origin_path="$data_dir" --not_mandatory -mkdir -p $datadir +mkdir -p $data_dir -chmod 750 "$datadir" -chmod -R o-rwx "$datadir" -chown -R root:root "$datadir" +chmod 750 "$data_dir" +chmod -R o-rwx "$data_dir" +chown -R root:root "$data_dir" #================================================= # SPECIFIC RESTORATION #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=1 +#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=1 # Define and install dependencies -ynh_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_install_app_dependencies $pkg_dependencies #================================================= # FIND AND OPEN A PORT diff --git a/scripts/upgrade b/scripts/upgrade index 19ff23d..e521e2b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,9 +12,9 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK VERSION @@ -26,17 +26,17 @@ 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 +#REMOVEME? 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 () { +#REMOVEME? ynh_backup_before_upgrade +#REMOVEME? ynh_clean_setup () { ynh_clean_check_starting # Restore it if the upgrade fails - ynh_restore_upgradebackup +#REMOVEME? ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # STANDARD UPGRADE STEPS @@ -55,9 +55,9 @@ ynh_script_progression --message="Ensuring downward compatibility..." #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=12 +#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=12 -ynh_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_install_app_dependencies $pkg_dependencies #================================================= # GENERIC FINALIZATION From 5a482af0b5cee905af6b19d4b4cd0ac277fab43f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 13 Aug 2023 12:49:12 +0200 Subject: [PATCH 02/11] v2 --- manifest.json | 38 ---------------------------------- manifest.toml | 23 ++++++++++++++------- scripts/backup | 18 ---------------- scripts/install | 47 +++--------------------------------------- scripts/remove | 30 --------------------------- scripts/restore | 55 +------------------------------------------------ scripts/upgrade | 37 +-------------------------------- 7 files changed, 20 insertions(+), 228 deletions(-) delete mode 100644 manifest.json 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 index 5347000..ed95980 100644 --- a/manifest.toml +++ b/manifest.toml @@ -14,18 +14,16 @@ 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" -cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number) -fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin. [integration] yunohost = ">= 11.2" -architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"] +architectures = "all" multi_instance = false -ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials. -sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal. -disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... -ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... -ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... +ldap = "not_relevant" +sso = "not_relevant" +disk = "50M" +ram.build = "50M" +ram.runtime = "50M" [install.warning] 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." @@ -36,7 +34,16 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen [resources.system_user] [resources.install_dir] + dir = ["/etc/samba"] + + [resources.ports] + main.default = 445 + main.exposed = "Both" [resources.data_dir] + subdirs = ["share"] [resources.permissions] + + [resources.apt] + packages = ["samba"] \ No newline at end of file diff --git a/scripts/backup b/scripts/backup index 813375d..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 -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_print_info --message="Loading installation settings..." - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= diff --git a/scripts/install b/scripts/install index f57addd..b6c6b9a 100755 --- a/scripts/install +++ b/scripts/install @@ -9,52 +9,15 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# RETRIEVE ARGUMENTS FROM THE MANIFEST -#================================================= - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS -#================================================= -#REMOVEME? ynh_script_progression --message="Validating installation parameters..." - -#REMOVEME? install_dir="/etc/samba" - #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -#REMOVEME? ynh_script_progression --message="Storing installation settings..." --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=advanced --value=0 ynh_app_setting_set --app=$app --key=readonly_dir --value='' ynh_app_setting_set --app=$app --key=unbrowseable --value='' -#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir - -#================================================= -# 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 -#================================================= -#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=10 - -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies #================================================= # SPECIFIC SETUP @@ -66,16 +29,12 @@ ynh_exec_warn_less yunohost firewall allow Both 445 --no-upnp # We define the permission in advance to be able to use the group # in unix permission #REMOVEME? ynh_permission_create --permission="share" --allowed=all_users + #================================================= # CREATE DATA DIRECTORY #================================================= ynh_script_progression --message="Creating a data directory..." --weight=1 -#REMOVEME? data_dir=/home/yunohost.app/samba -#REMOVEME? ynh_app_setting_set --app=samba --key=data_dir --value=$data_dir - -mkdir -p $data_dir/share - chmod 750 "$data_dir/share" chmod -R o-rwx "$data_dir/share" chown -R root:root "$data_dir/share" @@ -106,7 +65,7 @@ cat $install_dir/smb.conf.d/*.conf >> $install_dir/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 7b61f36..8c02fa1 100755 --- a/scripts/remove +++ b/scripts/remove @@ -9,16 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) - #================================================= # STANDARD REMOVE #================================================= @@ -32,26 +22,6 @@ then yunohost service remove smbd fi -#================================================= -# REMOVE DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=2 - -# Remove metapackage and its dependencies -#REMOVEME? 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 -#REMOVEME? ynh_secure_remove --file="$data_dir" -#REMOVEME? ynh_secure_remove --file="$install_dir" -fi - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index 7efff34..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 -#================================================= - -#REMOVEME? ynh_clean_setup () { - ynh_clean_check_starting -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) -#REMOVEME? directories=$(ynh_app_setting_get --app=$app --key=directories) -#REMOVEME? advanced=$(ynh_app_setting_get --app=$app --key=advanced) -#REMOVEME? readonly_dir=$(ynh_app_setting_get --app=$app --key=readonly_dir) -#REMOVEME? unbrowseable=$(ynh_app_setting_get --app=$app --key=unbrowseable) - -#================================================= -# CHECK IF THE APP CAN BE RESTORED -#================================================= -#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=1 - #================================================= # STANDARD RESTORATION STEPS #================================================= @@ -48,8 +19,6 @@ ynh_script_progression --message="Restoring the app main directory..." ynh_restore_file --origin_path="$install_dir" -chmod 750 "$install_dir" -chmod -R o-rwx "$install_dir" chown -R root:root "$install_dir" #================================================= @@ -59,37 +28,15 @@ ynh_script_progression --message="Restoring the data directory..." --weight=1 ynh_restore_file --origin_path="$data_dir" --not_mandatory -mkdir -p $data_dir - -chmod 750 "$data_dir" -chmod -R o-rwx "$data_dir" chown -R root:root "$data_dir" -#================================================= -# SPECIFIC RESTORATION -#================================================= -# REINSTALL DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=1 - -# Define and install dependencies -#REMOVEME? 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 #================================================= 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 e521e2b..31da8bf 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,35 +9,12 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#REMOVEME? 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 -#================================================= -#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 - -# Backup the current version of the app -#REMOVEME? ynh_backup_before_upgrade -#REMOVEME? ynh_clean_setup () { - ynh_clean_check_starting - # Restore it if the upgrade fails -#REMOVEME? ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -#REMOVEME? 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 -#================================================= -#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=12 - -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies - #================================================= # GENERIC FINALIZATION #================================================= @@ -67,7 +32,7 @@ ynh_script_progression --message="Ensuring downward compatibility..." 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 From 88379efac9876cc686995d0cf7cd2ddf0d6aadd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 13 Aug 2023 12:51:17 +0200 Subject: [PATCH 03/11] fix --- manifest.toml | 3 +++ scripts/install | 11 ----------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/manifest.toml b/manifest.toml index ed95980..8a94f8c 100644 --- a/manifest.toml +++ b/manifest.toml @@ -44,6 +44,9 @@ ram.runtime = "50M" subdirs = ["share"] [resources.permissions] + share.url = "/" + share.show_tile = false + share.allowed = "all_users" [resources.apt] packages = ["samba"] \ No newline at end of file diff --git a/scripts/install b/scripts/install index b6c6b9a..3c2b913 100755 --- a/scripts/install +++ b/scripts/install @@ -19,17 +19,6 @@ 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='' -#================================================= -# SPECIFIC SETUP -#================================================= -# SETUP SSOWAT -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring permissions..." - -# We define the permission in advance to be able to use the group -# in unix permission -#REMOVEME? ynh_permission_create --permission="share" --allowed=all_users - #================================================= # CREATE DATA DIRECTORY #================================================= From ea72fa4b0d3f75d124b5bd7123cbd3e7d6a12448 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 13 Aug 2023 12:51:51 +0200 Subject: [PATCH 04/11] Create tests.toml --- tests.toml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 tests.toml 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 From e1085a9a29c7aef9e0bd1c4f924c04da19dcbe6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 9 Nov 2023 21:31:18 +0100 Subject: [PATCH 05/11] cleaning --- check_process | 20 -------------------- manifest.toml | 2 +- scripts/_common.sh | 3 --- 3 files changed, 1 insertion(+), 24 deletions(-) delete mode 100644 check_process 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/manifest.toml b/manifest.toml index 8a94f8c..01492e3 100644 --- a/manifest.toml +++ b/manifest.toml @@ -49,4 +49,4 @@ ram.runtime = "50M" share.allowed = "all_users" [resources.apt] - packages = ["samba"] \ No newline at end of file + packages = "samba" diff --git a/scripts/_common.sh b/scripts/_common.sh index e9f8678..944a65e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,9 +4,6 @@ # COMMON VARIABLES #================================================= -# dependencies used by the app -#REMOVEME? pkg_dependencies="samba" - #================================================= # PERSONAL HELPERS #================================================= From ba3f1e8e0d0cc876497cd784fd80b5d76274950b Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Thu, 9 Nov 2023 20:31:25 +0000 Subject: [PATCH 06/11] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 From f91420b3359f211e8d0540376904b46dadd5881a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 9 Nov 2023 22:06:33 +0100 Subject: [PATCH 07/11] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 01492e3..6931b5f 100644 --- a/manifest.toml +++ b/manifest.toml @@ -28,7 +28,7 @@ ram.runtime = "50M" [install.warning] 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." ask.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." - type = "display_text" + type = "alert" [resources] [resources.system_user] From fb38e352a7ba198fff5d80eaadbbe2c3c709c255 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 9 Nov 2023 22:10:26 +0100 Subject: [PATCH 08/11] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 6931b5f..6035d36 100644 --- a/manifest.toml +++ b/manifest.toml @@ -34,7 +34,7 @@ ram.runtime = "50M" [resources.system_user] [resources.install_dir] - dir = ["/etc/samba"] + dir = "/etc/samba" [resources.ports] main.default = 445 From dff7f60c81c2f0962856e50b01d85c5bdfe7f0a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 9 Nov 2023 22:18:53 +0100 Subject: [PATCH 09/11] fix --- doc/PRE_INSTALL.md | 1 + doc/PRE_INSTALL_fr.md | 1 + manifest.toml | 8 +++----- 3 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 doc/PRE_INSTALL.md create mode 100644 doc/PRE_INSTALL_fr.md 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.toml b/manifest.toml index 6035d36..18f6b90 100644 --- a/manifest.toml +++ b/manifest.toml @@ -19,17 +19,15 @@ code = "https://git.samba.org/?p=samba.git;a=summary" yunohost = ">= 11.2" architectures = "all" multi_instance = false + ldap = "not_relevant" + sso = "not_relevant" + disk = "50M" ram.build = "50M" ram.runtime = "50M" - [install.warning] - 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." - ask.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." - type = "alert" - [resources] [resources.system_user] From 7c3845467d12b2c9cc5f0c45a3f49d413e402e36 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin <4533074+alexAubin@users.noreply.github.com> Date: Sat, 2 Dec 2023 22:52:15 +0100 Subject: [PATCH 10/11] Update manifest.toml: we do need an install question section, even if empty x_x ... --- manifest.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/manifest.toml b/manifest.toml index 18f6b90..5332f62 100644 --- a/manifest.toml +++ b/manifest.toml @@ -28,6 +28,8 @@ disk = "50M" ram.build = "50M" ram.runtime = "50M" +[install] + [resources] [resources.system_user] From c95f94aa4b62fc490b5833bb54e3da642c6d6cec Mon Sep 17 00:00:00 2001 From: Alexandre Aubin <4533074+alexAubin@users.noreply.github.com> Date: Sat, 2 Dec 2023 23:24:33 +0100 Subject: [PATCH 11/11] Update manifest.toml: can't set url for permissions if the app is not a webapp --- manifest.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 5332f62..207401b 100644 --- a/manifest.toml +++ b/manifest.toml @@ -44,7 +44,6 @@ ram.runtime = "50M" subdirs = ["share"] [resources.permissions] - share.url = "/" share.show_tile = false share.allowed = "all_users"