mirror of
https://github.com/YunoHost-Apps/samba_ynh.git
synced 2024-09-03 20:16:27 +02:00
[autopatch] Automatic patch attempt for helpers 2.1
This commit is contained in:
parent
9bb467095d
commit
28a8b0ed85
8 changed files with 46 additions and 113 deletions
|
@ -16,7 +16,8 @@ admindoc = "https://www.samba.org/samba/docs/"
|
|||
code = "https://git.samba.org/?p=samba.git;a=summary"
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 11.2"
|
||||
yunohost = ">= 11.2.18"
|
||||
helpers_version = "2.1"
|
||||
architectures = "all"
|
||||
multi_instance = false
|
||||
|
||||
|
|
|
@ -1,17 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# EXPERIMENTAL HELPERS
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# FUTURE OFFICIAL HELPERS
|
||||
# COMMON VARIABLES AND CUSTOM HELPERS
|
||||
#=================================================
|
||||
|
|
|
@ -1,34 +1,25 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||
#=================================================
|
||||
ynh_print_info --message="Declaring files to be backed up..."
|
||||
ynh_print_info "Declaring files to be backed up..."
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE APP MAIN DIR
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="$install_dir"
|
||||
ynh_backup "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE DATA DIR
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="$data_dir" --is_big
|
||||
ynh_backup "$data_dir"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||
|
|
|
@ -8,18 +8,12 @@
|
|||
# (validation of several interdependent fields, specific getter/setter for a value,
|
||||
# display dynamic informations or choices, pre-loading of config type .cube... ).
|
||||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
ynh_abort_if_errors
|
||||
#REMOVEME? ynh_abort_if_errors
|
||||
|
||||
data_dir=$(ynh_app_setting_get --app=$app --key=data_dir)
|
||||
install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
|
||||
data_dir=$(ynh_app_setting_get --key=data_dir)
|
||||
install_dir=$(ynh_app_setting_get --key=install_dir)
|
||||
|
||||
#=================================================
|
||||
# recreate the smb.conf from smb.conf.d
|
||||
|
@ -35,7 +29,6 @@ EOF
|
|||
cat $install_dir/smb.conf.d/*.conf >> $install_dir/smb.conf
|
||||
}
|
||||
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETTERS FOR TOML SHORT KEYS
|
||||
#=================================================
|
||||
|
@ -56,7 +49,7 @@ set__directories() {
|
|||
# Create the directory
|
||||
mkdir -p $data_dir/$directory
|
||||
|
||||
chmod 750 "$data_dir/$directory"
|
||||
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 750 "$data_dir/$directory"
|
||||
chmod -R o-rwx "$data_dir/$directory"
|
||||
chown -R root:root "$data_dir/$directory"
|
||||
setfacl -R -m g:samba.$directory:rwx,d:g:samba.$directory:rwx $data_dir/$directory
|
||||
|
@ -85,7 +78,7 @@ END
|
|||
# Remove configuration for unlisted directories
|
||||
for directory in $(find $install_dir/smb.conf.d/ -maxdepth 1 -type f -not -name '0-global.conf' -exec basename {} \;); do
|
||||
if ! [[ "${directory%.conf}" =~ $(echo "^($(echo $directories | sed 's/,\| /|/g'))$") ]]; then
|
||||
ynh_secure_remove "$install_dir/smb.conf.d/$directory"
|
||||
ynh_safe_rm "$install_dir/smb.conf.d/$directory"
|
||||
fi
|
||||
done
|
||||
|
||||
|
@ -123,7 +116,5 @@ set__unbrowseable() {
|
|||
write_smb_conf
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
ynh_app_config_run $1
|
||||
|
|
|
@ -1,30 +1,24 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# STORE SETTINGS FROM MANIFEST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Storing installation settings..." --weight=1
|
||||
ynh_script_progression "Storing installation settings..."
|
||||
|
||||
ynh_app_setting_set --app=$app --key=directories --value=share
|
||||
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 --key=directories --value=share
|
||||
ynh_app_setting_set --key=advanced --value=0
|
||||
ynh_app_setting_set --key=readonly_dir --value=''
|
||||
ynh_app_setting_set --key=unbrowseable --value=''
|
||||
|
||||
#=================================================
|
||||
# CREATE DATA DIRECTORY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating a data directory..." --weight=1
|
||||
ynh_script_progression "Creating a data directory..."
|
||||
|
||||
chmod 750 "$data_dir/share"
|
||||
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | 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
|
||||
|
@ -32,14 +26,15 @@ 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
|
||||
ynh_script_progression "Adding $app's configuration..."
|
||||
|
||||
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"
|
||||
ynh_config_add --template="global-smb.conf" --destination="$install_dir/smb.conf.d/0-global.conf"
|
||||
ynh_config_add --template="share-smb.conf" --destination="$install_dir/smb.conf.d/share.conf"
|
||||
|
||||
cat > $install_dir/smb.conf <<EOF
|
||||
# =================================================
|
||||
|
||||
# DO NOT EDIT THIS FILE
|
||||
# EDIT SUBPARTS IN /etc/samba/smb.conf.d
|
||||
# =================================================
|
||||
|
@ -47,25 +42,23 @@ ynh_add_config --template="share-smb.conf" --destination="$install_dir/smb.conf.
|
|||
EOF
|
||||
cat $install_dir/smb.conf.d/*.conf >> $install_dir/smb.conf
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||
ynh_script_progression "Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add smbd --description="Samba service" --log="/var/log/smbd/smbd.log" --needs_exposed_ports $port
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=10
|
||||
ynh_script_progression "Starting $app's systemd service..."
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=smbd --action="start"
|
||||
ynh_systemctl --service=smbd --action="start"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Installation of $app completed" --last
|
||||
ynh_script_progression "Installation of $app completed"
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
@ -16,9 +10,9 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
|
||||
# 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_hide_warnings yunohost service status $app >/dev/null
|
||||
then
|
||||
ynh_script_progression --message="Removing $app service integration..." --weight=1
|
||||
ynh_script_progression "Removing $app service integration..."
|
||||
yunohost service remove smbd
|
||||
fi
|
||||
|
||||
|
@ -26,4 +20,4 @@ fi
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Removal of $app completed" --last
|
||||
ynh_script_progression "Removal of $app completed"
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
@ -15,25 +9,24 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..."
|
||||
ynh_script_progression "Restoring the app main directory..."
|
||||
|
||||
ynh_restore_file --origin_path="$install_dir"
|
||||
|
||||
chown -R root:root "$install_dir"
|
||||
ynh_restore "$install_dir"
|
||||
|
||||
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R root:root "$install_dir"
|
||||
#=================================================
|
||||
# RESTORE THE DATA DIRECTORY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the data directory..." --weight=1
|
||||
ynh_script_progression "Restoring the data directory..."
|
||||
|
||||
ynh_restore_file --origin_path="$data_dir" --not_mandatory
|
||||
ynh_restore "$data_dir"
|
||||
|
||||
chown -R root:root "$data_dir"
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||
ynh_script_progression "Integrating service in YunoHost..."
|
||||
|
||||
# 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 $port
|
||||
|
@ -41,14 +34,12 @@ yunohost service add smbd --description="Samba service" --log="/var/log/smbd/smb
|
|||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=10
|
||||
ynh_script_progression "Starting $app's systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=smbd --action="start"
|
||||
ynh_systemctl --service=smbd --action="start"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Restoration completed for $app" --last
|
||||
ynh_script_progression "Restoration completed for $app"
|
||||
|
|
|
@ -1,35 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
#=================================================
|
||||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..." --weight=4
|
||||
ynh_script_progression "Stopping $app's systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=smbd --action="stop"
|
||||
ynh_systemctl --service=smbd --action="stop"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||
ynh_script_progression "Integrating service in YunoHost..."
|
||||
|
||||
# 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 $port
|
||||
|
@ -37,12 +21,12 @@ yunohost service add smbd --description="Samba service" --log="/var/log/smbd/smb
|
|||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
ynh_script_progression "Starting $app's systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=smbd --action="start"
|
||||
ynh_systemctl --service=smbd --action="start"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Upgrade of $app completed" --last
|
||||
ynh_script_progression "Upgrade of $app completed"
|
||||
|
|
Loading…
Add table
Reference in a new issue