mirror of
https://github.com/YunoHost-Apps/samba_ynh.git
synced 2024-09-03 20:16:27 +02:00
v2
This commit is contained in:
parent
fccfac2e7b
commit
5a482af0b5
7 changed files with 20 additions and 228 deletions
|
@ -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."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -14,18 +14,16 @@ license = "AGPL-3.0-only"
|
||||||
website = "https://www.samba.org/"
|
website = "https://www.samba.org/"
|
||||||
admindoc = "https://www.samba.org/samba/docs/"
|
admindoc = "https://www.samba.org/samba/docs/"
|
||||||
code = "https://git.samba.org/?p=samba.git;a=summary"
|
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]
|
[integration]
|
||||||
yunohost = ">= 11.2"
|
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
|
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.
|
ldap = "not_relevant"
|
||||||
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.
|
sso = "not_relevant"
|
||||||
disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ...
|
disk = "50M"
|
||||||
ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
|
ram.build = "50M"
|
||||||
ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
|
ram.runtime = "50M"
|
||||||
|
|
||||||
[install.warning]
|
[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.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.system_user]
|
||||||
|
|
||||||
[resources.install_dir]
|
[resources.install_dir]
|
||||||
|
dir = ["/etc/samba"]
|
||||||
|
|
||||||
|
[resources.ports]
|
||||||
|
main.default = 445
|
||||||
|
main.exposed = "Both"
|
||||||
|
|
||||||
[resources.data_dir]
|
[resources.data_dir]
|
||||||
|
subdirs = ["share"]
|
||||||
|
|
||||||
[resources.permissions]
|
[resources.permissions]
|
||||||
|
|
||||||
|
[resources.apt]
|
||||||
|
packages = ["samba"]
|
|
@ -10,24 +10,6 @@
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
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
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -9,52 +9,15 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
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
|
# 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=directories --value=shared
|
||||||
ynh_app_setting_set --app=$app --key=advanced --value=0
|
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=readonly_dir --value=''
|
||||||
ynh_app_setting_set --app=$app --key=unbrowseable --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
|
# 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
|
# We define the permission in advance to be able to use the group
|
||||||
# in unix permission
|
# in unix permission
|
||||||
#REMOVEME? ynh_permission_create --permission="share" --allowed=all_users
|
#REMOVEME? ynh_permission_create --permission="share" --allowed=all_users
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DATA DIRECTORY
|
# CREATE DATA DIRECTORY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Creating a data directory..." --weight=1
|
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 750 "$data_dir/share"
|
||||||
chmod -R o-rwx "$data_dir/share"
|
chmod -R o-rwx "$data_dir/share"
|
||||||
chown -R root:root "$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
|
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
|
# START SYSTEMD SERVICE
|
||||||
|
|
|
@ -9,16 +9,6 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
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
|
# STANDARD REMOVE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -32,26 +22,6 @@ then
|
||||||
yunohost service remove smbd
|
yunohost service remove smbd
|
||||||
fi
|
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
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -10,35 +10,6 @@
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
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
|
# STANDARD RESTORATION STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -48,8 +19,6 @@ ynh_script_progression --message="Restoring the app main directory..."
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$install_dir"
|
ynh_restore_file --origin_path="$install_dir"
|
||||||
|
|
||||||
chmod 750 "$install_dir"
|
|
||||||
chmod -R o-rwx "$install_dir"
|
|
||||||
chown -R root:root "$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
|
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"
|
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
|
# 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
|
# 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
|
# START SYSTEMD SERVICE
|
||||||
|
|
|
@ -9,35 +9,12 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
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
|
# CHECK VERSION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Checking version..."
|
|
||||||
|
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
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
|
# 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"
|
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
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -67,7 +32,7 @@ ynh_script_progression --message="Ensuring downward compatibility..."
|
||||||
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
|
# 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
|
# START SYSTEMD SERVICE
|
||||||
|
|
Loading…
Add table
Reference in a new issue