mirror of
https://github.com/YunoHost-Apps/timemachine_ynh.git
synced 2024-09-03 20:26:33 +02:00
commit
ca6ed78771
16 changed files with 90 additions and 464 deletions
137
.github/workflows/updater.sh
vendored
137
.github/workflows/updater.sh
vendored
|
@ -1,137 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# PACKAGE UPDATING HELPER
|
||||
#=================================================
|
||||
|
||||
# This script is meant to be run by GitHub Actions
|
||||
# The YunoHost-Apps organisation offers a template Action to run this script periodically
|
||||
# Since each app is different, maintainers can adapt its contents so as to perform
|
||||
# automatic actions when a new upstream release is detected.
|
||||
|
||||
# Remove this exit command when you are ready to run this Action
|
||||
exit 1
|
||||
|
||||
#=================================================
|
||||
# FETCHING LATEST RELEASE AND ITS ASSETS
|
||||
#=================================================
|
||||
|
||||
# Fetching information
|
||||
current_version=$(cat manifest.json | jq -j '.version|split("~")[0]')
|
||||
repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]')
|
||||
# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions)
|
||||
version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1)
|
||||
assets=($(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '[ .[] | select(.tag_name=="'$version'").assets[].browser_download_url ] | join(" ") | @sh' | tr -d "'"))
|
||||
|
||||
# Later down the script, we assume the version has only digits and dots
|
||||
# Sometimes the release name starts with a "v", so let's filter it out.
|
||||
# You may need more tweaks here if the upstream repository has different naming conventions.
|
||||
if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then
|
||||
version=${version:1}
|
||||
fi
|
||||
|
||||
# Setting up the environment variables
|
||||
echo "Current version: $current_version"
|
||||
echo "Latest release from upstream: $version"
|
||||
echo "VERSION=$version" >> $GITHUB_ENV
|
||||
echo "REPO=$repo" >> $GITHUB_ENV
|
||||
# For the time being, let's assume the script will fail
|
||||
echo "PROCEED=false" >> $GITHUB_ENV
|
||||
|
||||
# Proceed only if the retrieved version is greater than the current one
|
||||
if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then
|
||||
echo "::warning ::No new version available"
|
||||
exit 0
|
||||
# Proceed only if a PR for this new version does not already exist
|
||||
elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then
|
||||
echo "::warning ::A branch already exists for this update"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Each release can hold multiple assets (e.g. binaries for different architectures, source code, etc.)
|
||||
echo "${#assets[@]} available asset(s)"
|
||||
|
||||
#=================================================
|
||||
# UPDATE SOURCE FILES
|
||||
#=================================================
|
||||
|
||||
# Here we use the $assets variable to get the resources published in the upstream release.
|
||||
# Here is an example for Grav, it has to be adapted in accordance with how the upstream releases look like.
|
||||
|
||||
# Let's loop over the array of assets URLs
|
||||
for asset_url in ${assets[@]}; do
|
||||
|
||||
echo "Handling asset at $asset_url"
|
||||
|
||||
# Assign the asset to a source file in conf/ directory
|
||||
# Here we base the source file name upon a unique keyword in the assets url (admin vs. update)
|
||||
# Leave $src empty to ignore the asset
|
||||
case $asset_url in
|
||||
*"admin"*)
|
||||
src="app"
|
||||
;;
|
||||
*"update"*)
|
||||
src="app-upgrade"
|
||||
;;
|
||||
*)
|
||||
src=""
|
||||
;;
|
||||
esac
|
||||
|
||||
# If $src is not empty, let's process the asset
|
||||
if [ ! -z "$src" ]; then
|
||||
|
||||
# Create the temporary directory
|
||||
tempdir="$(mktemp -d)"
|
||||
|
||||
# Download sources and calculate checksum
|
||||
filename=${asset_url##*/}
|
||||
curl --silent -4 -L $asset_url -o "$tempdir/$filename"
|
||||
checksum=$(sha256sum "$tempdir/$filename" | head -c 64)
|
||||
|
||||
# Delete temporary directory
|
||||
rm -rf $tempdir
|
||||
|
||||
# Get extension
|
||||
if [[ $filename == *.tar.gz ]]; then
|
||||
extension=tar.gz
|
||||
else
|
||||
extension=${filename##*.}
|
||||
fi
|
||||
|
||||
# Rewrite source file
|
||||
cat <<EOT > conf/$src.src
|
||||
SOURCE_URL=$asset_url
|
||||
SOURCE_SUM=$checksum
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=$extension
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=
|
||||
EOT
|
||||
echo "... conf/$src.src updated"
|
||||
|
||||
else
|
||||
echo "... asset ignored"
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPDATE STEPS
|
||||
#=================================================
|
||||
|
||||
# Any action on the app's source code can be done.
|
||||
# The GitHub Action workflow takes care of committing all changes after this script ends.
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
||||
# Replace new version in manifest
|
||||
echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json
|
||||
|
||||
# No need to update the README, yunohost-bot takes care of it
|
||||
|
||||
# The Action will proceed only if the PROCEED environment variable is set to true
|
||||
echo "PROCEED=true" >> $GITHUB_ENV
|
||||
exit 0
|
15
README.md
15
README.md
|
@ -24,25 +24,12 @@ Package to create a Time Machine Backup Source
|
|||
- Integrated with YunoHost's Backups
|
||||
- Supports multiple installs
|
||||
|
||||
**Shipped version:** 1.0~ynh5
|
||||
**Shipped version:** 1.0~ynh6
|
||||
|
||||
## Screenshots
|
||||
|
||||
![Screenshot of Time Machine](./doc/screenshots/example.jpg)
|
||||
|
||||
## Disclaimers / important information
|
||||
|
||||
* Known limitations
|
||||
* Only the *.local location is detected automatically. To use the domain, you need to first manually connect to the server using the command `open THE_CONNECTION_STRING` on your Mac
|
||||
* There is currently no granular control for disallowing connections from hosts (i.e anyone with the username, password and domain can connect to the Time Machine Volume)
|
||||
|
||||
* Connecting manually:
|
||||
* The connection string format is also sent via e-mail `smb://timemachine:password@IP_OR_DOMAIN/timemachine`
|
||||
* In Finder, use `Command+K` and enter the connection string. If `timemachine` is greyed out, you might need to unmount the volume using the command `sudo umount /Volumes/timemachine` first
|
||||
|
||||
* Disallowing connections from outside network:
|
||||
* Edit either `/etc/samba/smb.conf` or `/etc/smb/smb.d/timemachine.conf` (An option might be added in the future)
|
||||
|
||||
## Documentation and resources
|
||||
|
||||
* Official app website: <https://support.apple.com/en-us/HT201250>
|
||||
|
|
15
README_fr.md
15
README_fr.md
|
@ -24,25 +24,12 @@ Package to create a Time Machine Backup Source
|
|||
- Integrated with YunoHost's Backups
|
||||
- Supports multiple installs
|
||||
|
||||
**Version incluse :** 1.0~ynh5
|
||||
**Version incluse :** 1.0~ynh6
|
||||
|
||||
## Captures d’écran
|
||||
|
||||
![Capture d’écran de Time Machine](./doc/screenshots/example.jpg)
|
||||
|
||||
## Avertissements / informations importantes
|
||||
|
||||
* Known limitations
|
||||
* Only the *.local location is detected automatically. To use the domain, you need to first manually connect to the server using the command `open THE_CONNECTION_STRING` on your Mac
|
||||
* There is currently no granular control for disallowing connections from hosts (i.e anyone with the username, password and domain can connect to the Time Machine Volume)
|
||||
|
||||
* Connecting manually:
|
||||
* The connection string format is also sent via e-mail `smb://timemachine:password@IP_OR_DOMAIN/timemachine`
|
||||
* In Finder, use `Command+K` and enter the connection string. If `timemachine` is greyed out, you might need to unmount the volume using the command `sudo umount /Volumes/timemachine` first
|
||||
|
||||
* Disallowing connections from outside network:
|
||||
* Edit either `/etc/samba/smb.conf` or `/etc/smb/smb.d/timemachine.conf` (An option might be added in the future)
|
||||
|
||||
## Documentations et ressources
|
||||
|
||||
* Site officiel de l’app : <https://support.apple.com/en-us/HT201250>
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
Time Machine was successfully installed :)
|
||||
Your connection string is:
|
||||
smb://__APP__:__PASSWORD__@YOUR_IP/__APP__
|
||||
If you facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/timemachine_ynh
|
|
@ -1,6 +1,6 @@
|
|||
[__APP__]
|
||||
comment = Time Machine
|
||||
path = __DATADIR__
|
||||
path = __DATA_DIR__
|
||||
valid users = __APP__
|
||||
browseable = yes
|
||||
writeable = yes
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
* Known limitations
|
||||
* Only the *.local location is detected automatically. To use the domain, you need to first manually connect to the server using the command `open THE_CONNECTION_STRING` on your Mac
|
||||
* There is currently no granular control for disallowing connections from hosts (i.e anyone with the username, password and domain can connect to the Time Machine Volume)
|
||||
|
||||
* Connecting manually:
|
||||
* The connection string format is also sent via e-mail `smb://timemachine:password@IP_OR_DOMAIN/timemachine`
|
||||
* In Finder, use `Command+K` and enter the connection string. If `timemachine` is greyed out, you might need to unmount the volume using the command `sudo umount /Volumes/timemachine` first
|
3
doc/POST_INSTALL.md
Normal file
3
doc/POST_INSTALL.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
Your connection string is:
|
||||
|
||||
smb://__APP__:__PASSWORD__@YOUR_IP/__APP__
|
|
@ -1,43 +0,0 @@
|
|||
{
|
||||
"name": "Time Machine",
|
||||
"id": "timemachine",
|
||||
"packaging_format": 1,
|
||||
"description": {
|
||||
"en": "Application to configure the server as a Time Machine backup target",
|
||||
"fr": "Application pour configurer le serveur comme cible de sauvegarde Time Machine"
|
||||
},
|
||||
"version": "1.0~ynh5",
|
||||
"url": "https://support.apple.com/en-us/HT201250",
|
||||
"upstream": {
|
||||
"license": "WTFPL",
|
||||
"website": "https://support.apple.com/en-us/HT201250",
|
||||
"code": "https://github.com/YunoHost-Apps/timemachine_ynh"
|
||||
},
|
||||
"license": "WTFPL",
|
||||
"maintainer": {
|
||||
"name": "Navan Chauhan",
|
||||
"email": "timemachine@navan.email"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 4.3.0"
|
||||
},
|
||||
"multi_instance": true,
|
||||
"services": [
|
||||
],
|
||||
"arguments": {
|
||||
"install": [
|
||||
{
|
||||
"name": "admin",
|
||||
"type": "user"
|
||||
},
|
||||
{
|
||||
"name": "password",
|
||||
"type": "password",
|
||||
"help": {
|
||||
"en": "Password to access the Time Machine",
|
||||
"fr": "Mot de passe pour accéder à Time Machine"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
57
manifest.toml
Normal file
57
manifest.toml
Normal file
|
@ -0,0 +1,57 @@
|
|||
packaging_format = 2
|
||||
|
||||
id = "timemachine"
|
||||
name = "Time Machine"
|
||||
description.en = "Configure the server as a Time Machine backup target"
|
||||
description.fr = "Configurer le serveur comme cible de sauvegarde Time Machine"
|
||||
|
||||
version = "1.0~ynh6"
|
||||
|
||||
maintainers = ["Navan Chauhan"]
|
||||
|
||||
[upstream]
|
||||
license = "WTFPL"
|
||||
website = "https://support.apple.com/en-us/HT201250"
|
||||
code = "https://github.com/YunoHost-Apps/timemachine_ynh"
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 11.2"
|
||||
architectures = "all"
|
||||
multi_instance = true
|
||||
|
||||
ldap = false
|
||||
|
||||
sso = false
|
||||
|
||||
disk = "50M"
|
||||
ram.build = "50M"
|
||||
ram.runtime = "50M"
|
||||
|
||||
[install]
|
||||
|
||||
[install.init_main_permission]
|
||||
type = "group"
|
||||
default = "visitors"
|
||||
|
||||
[install.admin]
|
||||
type = "user"
|
||||
|
||||
[install.password]
|
||||
help.en = "Password to access the Time Machine"
|
||||
help.fr = "Mot de passe pour accéder à Time Machine"
|
||||
type = "password"
|
||||
|
||||
[resources]
|
||||
[resources.system_user]
|
||||
|
||||
[resources.install_dir]
|
||||
|
||||
[resources.data_dir]
|
||||
|
||||
# [resources.permissions]
|
||||
# main.url = "/"
|
||||
|
||||
[resources.ports]
|
||||
|
||||
[resources.apt]
|
||||
packages = "samba, samba-common-bin, avahi-daemon"
|
|
@ -4,9 +4,6 @@
|
|||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
|
||||
# dependencies used by the app
|
||||
pkg_dependencies="samba samba-common-bin avahi-daemon"
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
#=================================================
|
||||
|
|
|
@ -10,25 +10,6 @@
|
|||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
true
|
||||
}
|
||||
# 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
|
||||
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
|
||||
#=================================================
|
||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||
#=================================================
|
||||
|
@ -38,7 +19,7 @@ ynh_print_info --message="Declaring files to be backed up..."
|
|||
# BACKUP THE DATA DIR
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="$datadir" --is_big
|
||||
ynh_backup --src_path="$data_dir" --is_big
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC BACKUP
|
||||
|
|
|
@ -10,83 +10,29 @@ source _common.sh
|
|||
source ynh_send_readme_to_admin__2
|
||||
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
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||
#=================================================
|
||||
|
||||
admin=$YNH_APP_ARG_ADMIN
|
||||
password=$YNH_APP_ARG_PASSWORD
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
admin_mail=$(ynh_user_get_info --username=$admin --key=mail)
|
||||
|
||||
#=================================================
|
||||
# STORE SETTINGS FROM MANIFEST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Storing installation settings..." --weight=1
|
||||
|
||||
ynh_app_setting_set --app=$app --key=admin --value=$admin
|
||||
ynh_app_setting_set --app=$app --key=password --value=$password
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
# OPEN PORT 445
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Configuring firewall..." --weight=1
|
||||
|
||||
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP 445 # Allow SMB access
|
||||
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing dependencies..." --weight=1
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..." --weight=1
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
# CREATE DATA DIRECTORY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating a data directory..." --weight=1
|
||||
|
||||
datadir=/home/yunohost.app/$app
|
||||
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
||||
|
||||
mkdir -p $datadir
|
||||
|
||||
chmod 750 "$datadir"
|
||||
chmod -R o-rwx "$datadir"
|
||||
chown -R $app: "$datadir"
|
||||
|
||||
#=================================================
|
||||
# ADD A CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||
|
||||
samba_sysadmin_setup
|
||||
ynh_add_config --template="../conf/smb.conf" --destination="/etc/smb/smb.d/$app.conf"
|
||||
ynh_add_config --template="../conf/avahi-samba.service" --destination="/etc/avahi/services/$app.service"
|
||||
ynh_add_config --template="smb.conf" --destination="/etc/smb/smb.d/$app.conf"
|
||||
ynh_add_config --template="avahi-samba.service" --destination="/etc/avahi/services/$app.service"
|
||||
|
||||
# Create a samba user
|
||||
(echo "$password"; echo "$password") | ynh_exec_warn_less smbpasswd -s -a "$app"
|
||||
|
@ -100,7 +46,7 @@ samba_sysadmin_add
|
|||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||
|
||||
yunohost service add smbd --needs_exposed_ports 445
|
||||
|
||||
|
@ -114,13 +60,6 @@ ynh_exec_warn_less testparm -s
|
|||
ynh_systemd_action --service_name=smbd --action="reload"
|
||||
ynh_systemd_action --service_name=avahi-daemon --action="restart"
|
||||
|
||||
#=================================================
|
||||
# SEND A README FOR THE ADMIN
|
||||
#=================================================
|
||||
ynh_script_progression --message="Sending a readme for the admin..."
|
||||
|
||||
ynh_send_readme_to_admin --app_message="../conf/msg_install" --recipients="$admin_mail" --type='install'
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -9,20 +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
|
||||
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
|
||||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
#=================================================
|
||||
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
||||
|
||||
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
||||
if ynh_exec_warn_less yunohost service status smbd >/dev/null
|
||||
|
@ -38,67 +30,15 @@ then
|
|||
yunohost service remove avahi-daemon
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing app main directory..." --weight=1
|
||||
|
||||
#=================================================
|
||||
# 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=1
|
||||
ynh_secure_remove --file="$datadir"
|
||||
fi
|
||||
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing dependencies..." --weight=1
|
||||
|
||||
# Delete User from Samba
|
||||
ynh_exec_warn_less smbpasswd -x $app
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# CLOSE A PORT
|
||||
#=================================================
|
||||
|
||||
if yunohost firewall list | grep -q "\- 445$"
|
||||
then
|
||||
ynh_script_progression --message="Closing port 445..."
|
||||
ynh_exec_warn_less yunohost firewall disallow TCP 445
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC REMOVE
|
||||
#=================================================
|
||||
# REMOVE VARIOUS FILES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing various files..." --weight=1
|
||||
|
||||
# Remove the log files
|
||||
ynh_secure_remove --file="/etc/smb/smb.d/$app.conf"
|
||||
ynh_secure_remove --file="/etc/avahi/services/$app.service"
|
||||
|
||||
samba_sysadmin_update
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# REMOVE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
||||
|
||||
# Delete a system user
|
||||
ynh_system_user_delete --username=$app
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -6,62 +6,26 @@
|
|||
# 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
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
password=$(ynh_app_setting_get --app=$app --key=password)
|
||||
|
||||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
||||
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
|
||||
chmod 750 "$datadir"
|
||||
chmod -R o-rwx "$datadir"
|
||||
chown -R $app: "$datadir"
|
||||
chown -R $app: "$data_dir"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
# OPEN PORT 445
|
||||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
|
||||
ynh_script_progression --message="Configuring firewall..." --weight=1
|
||||
|
||||
# Define and install dependencies
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP 445 # Allow SMB access
|
||||
|
||||
#=================================================
|
||||
# RESTORE VARIOUS FILES
|
||||
|
|
|
@ -9,70 +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
|
||||
|
||||
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||
|
||||
# Cleaning legacy permissions
|
||||
if ynh_legacy_permissions_exists; then
|
||||
ynh_legacy_permissions_delete_all
|
||||
|
||||
ynh_app_setting_delete --app=$app --key=is_public
|
||||
fi
|
||||
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..." --weight=1
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
|
@ -80,12 +22,19 @@ ynh_install_app_dependencies $pkg_dependencies
|
|||
#=================================================
|
||||
ynh_script_progression --message="Updating a configuration file..." --weight=1
|
||||
|
||||
ynh_add_config --template="../conf/smb.conf" --destination="/etc/smb/smb.d/$app.conf"
|
||||
ynh_add_config --template="../conf/avahi-samba.service" --destination="/etc/avahi/services/$app.service"
|
||||
ynh_add_config --template="smb.conf" --destination="/etc/smb/smb.d/$app.conf"
|
||||
ynh_add_config --template="avahi-samba.service" --destination="/etc/avahi/services/$app.service"
|
||||
|
||||
samba_sysadmin_update
|
||||
samba_sysadmin_add
|
||||
|
||||
#=================================================
|
||||
# OPEN PORT 445
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring firewall..." --weight=1
|
||||
|
||||
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP 445 # Allow SMB access
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
|
7
tests.toml
Normal file
7
tests.toml
Normal file
|
@ -0,0 +1,7 @@
|
|||
test_format = 1.0
|
||||
|
||||
[default]
|
||||
|
||||
# ------------
|
||||
# Tests to run
|
||||
# ------------
|
Loading…
Reference in a new issue