1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/archivist_ynh.git synced 2024-09-03 18:15:55 +02:00

Merge pull request #44 from YunoHost-Apps/testing

Testing
This commit is contained in:
Alexandre Aubin 2021-11-30 19:24:10 +01:00 committed by GitHub
commit c4874abff3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 107 additions and 407 deletions

55
.github/ISSUE_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,55 @@
---
name: Bug report
about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently.
---
**How to post a meaningful bug report**
1. *Read this whole template first.*
2. *Determine if you are on the right place:*
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!*
- *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.*
- *When in doubt, post here and we will figure it out together.*
3. *Delete the italic comments as you write over them below, and remove this guide.*
---
### Describe the bug
*A clear and concise description of what the bug is.*
### Context
- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...*
- YunoHost version: x.x.x
- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...*
- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes*
- If yes, please explain:
- Using, or trying to install package version/branch:
- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`*
### Steps to reproduce
- *If you performed a command from the CLI, the command itself is enough. For example:*
```sh
sudo yunohost app install the_app
```
- *If you used the webadmin, please perform the equivalent command from the CLI first.*
- *If the error occurs in your browser, explain what you did:*
1. *Go to '...'*
2. *Click on '...'*
3. *Scroll down to '...'*
4. *See error*
### Expected behavior
*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.*
### Logs
*When an operation fails, YunoHost provides a simple way to share the logs.*
- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.*
- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.*
*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)*
*If applicable and useful, add screenshots to help explain your problem.*

16
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,16 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished and ready to be reviewed/tested
- [ ] The fix/enhancement were manually tested (if applicable)
## Automatic tests
Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization)

View file

@ -27,7 +27,7 @@
multi_instance=1 multi_instance=1
port_already_use=0 port_already_use=0
change_url=0 change_url=0
config_panel=1 config_panel=0
;; Test actions without encryption ;; Test actions without encryption
# Actions can't be tested with the encryption on, because LXC does not support fuse. # Actions can't be tested with the encryption on, because LXC does not support fuse.
; Manifest ; Manifest
@ -38,8 +38,6 @@
; Checks ; Checks
setup_nourl=1 setup_nourl=1
actions=1 actions=1
;;; Levels
Level 5=auto
;;; Options ;;; Options
Email= Email=
Notification=change Notification=change

View file

@ -1,6 +1,5 @@
SOURCE_URL=https://github.com/maniackcrudelis/archivist/archive/refs/tags/v1.3.1.tar.gz SOURCE_URL=https://github.com/maniackcrudelis/archivist/archive/refs/tags/v1.3.1.tar.gz
SOURCE_SUM=e4237249f330391ebd055db86346b861 SOURCE_SUM=1333254f3c2713aec5c802ba661788b12ca9261bce204476a0715a9205c74ec9
SOURCE_SUM_PRG=md5sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=

View file

@ -1,4 +1,4 @@
version = "0.1" version = "1.0"
name = "Archivist configuration panel" name = "Archivist configuration panel"
[main] [main]

View file

@ -3,10 +3,10 @@
"id": "archivist", "id": "archivist",
"packaging_format": 1, "packaging_format": 1,
"description": { "description": {
"en": "Automatic backups.", "en": "Automatic backups",
"fr": "Sauvegardes automatiques." "fr": "Sauvegardes automatiques"
}, },
"version": "1.3.1~ynh1", "version": "1.3.1~ynh2",
"url": "https://github.com/maniackcrudelis/archivist", "url": "https://github.com/maniackcrudelis/archivist",
"license": "GPL-3.0", "license": "GPL-3.0",
"maintainer": { "maintainer": {
@ -18,7 +18,7 @@
"email": "maniackc_dev@crudelis.fr" "email": "maniackc_dev@crudelis.fr"
}], }],
"requirements": { "requirements": {
"yunohost": ">= 4.1" "yunohost": ">= 4.3.0"
}, },
"multi_instance": true, "multi_instance": true,
"services": [], "services": [],
@ -28,7 +28,7 @@
"name": "encrypt", "name": "encrypt",
"type": "boolean", "type": "boolean",
"ask": { "ask": {
"en": "Do you want to encrypt your backups ?", "en": "Do you want to encrypt your backups?",
"fr": "Voulez-vous chiffrer vos sauvegardes ?" "fr": "Voulez-vous chiffrer vos sauvegardes ?"
}, },
"default": true "default": true
@ -50,7 +50,7 @@
"name": "core_backup", "name": "core_backup",
"type": "boolean", "type": "boolean",
"ask": { "ask": {
"en": "Would you like to backup your YunoHost core ?", "en": "Would you like to backup your YunoHost core?",
"fr": "Souhaitez-vous effectuer des sauvegardes du système YunoHost ?" "fr": "Souhaitez-vous effectuer des sauvegardes du système YunoHost ?"
}, },
"default": true "default": true
@ -59,7 +59,7 @@
"name": "apps_backup", "name": "apps_backup",
"type": "boolean", "type": "boolean",
"ask": { "ask": {
"en": "Would you like to backup your apps ?", "en": "Would you like to backup your apps?",
"fr": "Souhaitez-vous effectuer des sauvegardes de vos applications ?" "fr": "Souhaitez-vous effectuer des sauvegardes de vos applications ?"
}, },
"default": true "default": true
@ -68,7 +68,7 @@
"name": "frequency", "name": "frequency",
"type": "string", "type": "string",
"ask": { "ask": {
"en": "Choose the frequency of your backups ?", "en": "Choose the frequency of your backups?",
"fr": "Choississez la fréquence de votre backup ?" "fr": "Choississez la fréquence de votre backup ?"
}, },
"choices" : ["Daily", "Each 3 days", "Weekly", "Biweekly", "Monthly"], "choices" : ["Daily", "Each 3 days", "Weekly", "Biweekly", "Monthly"],

View file

@ -1,343 +1,11 @@
#!/bin/bash #!/bin/bash
#================================================= #=================================================
# FUTUR OFFICIAL HELPERS # COMMON VARIABLES
#================================================= #=================================================
# Install or update the main directory yunohost.multimedia # Dependencies
# app_depencencies="rsync encfs sshpass ccrypt lzop zstd lzip"
# usage: ynh_multimedia_build_main_dir
ynh_multimedia_build_main_dir () {
local ynh_media_release="v1.2"
local checksum="806a827ba1902d6911095602a9221181"
# Download yunohost.multimedia scripts
wget -nv https://github.com/YunoHost-Apps/yunohost.multimedia/archive/${ynh_media_release}.tar.gz
# Check the control sum
echo "${checksum} ${ynh_media_release}.tar.gz" | md5sum -c --status \
|| ynh_die "Corrupt source"
# Check if the package acl is installed. Or install it.
ynh_package_is_installed 'acl' \
|| ynh_package_install acl
# Extract
mkdir yunohost.multimedia-master
tar -xf ${ynh_media_release}.tar.gz -C yunohost.multimedia-master --strip-components 1
./yunohost.multimedia-master/script/ynh_media_build.sh
}
# Add a directory in yunohost.multimedia
# This "directory" will be a symbolic link to a existing directory.
#
# usage: ynh_multimedia_addfolder "Source directory" "Destination directory"
#
# | arg: -s, --source_dir= - Source directory - The real directory which contains your medias.
# | arg: -d, --dest_dir= - Destination directory - The name and the place of the symbolic link, relative to "/home/yunohost.multimedia"
ynh_multimedia_addfolder () {
# Declare an array to define the options of this helper.
declare -Ar args_array=( [s]=source_dir= [d]=dest_dir= )
local source_dir
local dest_dir
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
./yunohost.multimedia-master/script/ynh_media_addfolder.sh --source="$source_dir" --dest="$dest_dir"
}
# Move a directory in yunohost.multimedia, and replace by a symbolic link
#
# usage: ynh_multimedia_movefolder "Source directory" "Destination directory"
#
# | arg: -s, --source_dir= - Source directory - The real directory which contains your medias.
# It will be moved to "Destination directory"
# A symbolic link will replace it.
# | arg: -d, --dest_dir= - Destination directory - The new name and place of the directory, relative to "/home/yunohost.multimedia"
ynh_multimedia_movefolder () {
# Declare an array to define the options of this helper.
declare -Ar args_array=( [s]=source_dir= [d]=dest_dir= )
local source_dir
local dest_dir
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
./yunohost.multimedia-master/script/ynh_media_addfolder.sh --inv --source="$source_dir" --dest="$dest_dir"
}
# Allow an user to have an write authorisation in multimedia directories
#
# usage: ynh_multimedia_addaccess user_name
#
# | arg: -u, --user_name= - The name of the user which gain this access.
ynh_multimedia_addaccess () {
# Declare an array to define the options of this helper.
declare -Ar args_array=( [u]=user_name=)
local user_name
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
groupadd -f multimedia
usermod -a -G multimedia $user_name
}
#=================================================
# Get the total or free amount of RAM+swap on the system
#
# usage: ynh_get_ram [--free|--total] [--ignore_swap|--only_swap]
# | arg: -f, --free - Count free RAM+swap
# | arg: -t, --total - Count total RAM+swap
# | arg: -s, --ignore_swap - Ignore swap, consider only real RAM
# | arg: -o, --only_swap - Ignore real RAM, consider only swap
ynh_get_ram () {
# Declare an array to define the options of this helper.
local legacy_args=ftso
declare -Ar args_array=( [f]=free [t]=total [s]=ignore_swap [o]=only_swap )
local free
local total
local ignore_swap
local only_swap
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
ignore_swap=${ignore_swap:-0}
only_swap=${only_swap:-0}
free=${free:-0}
total=${total:-0}
local total_ram=$(vmstat --stats --unit M | grep "total memory" | awk '{print $1}')
local total_swap=$(vmstat --stats --unit M | grep "total swap" | awk '{print $1}')
local total_ram_swap=$(( total_ram + total_swap ))
local free_ram=$(vmstat --stats --unit M | grep "free memory" | awk '{print $1}')
local free_swap=$(vmstat --stats --unit M | grep "free swap" | awk '{print $1}')
local free_ram_swap=$(( free_ram + free_swap ))
# Use the total amount of ram
if [ $free -eq 1 ]
then
# Use the total amount of free ram
local ram=$free_ram_swap
if [ $ignore_swap -eq 1 ]
then
# Use only the amount of free ram
ram=$free_ram
elif [ $only_swap -eq 1 ]
then
# Use only the amount of free swap
ram=$free_swap
fi
elif [ $total -eq 1 ]
then
local ram=$total_ram_swap
if [ $ignore_swap -eq 1 ]
then
# Use only the amount of free ram
ram=$total_ram
elif [ $only_swap -eq 1 ]
then
# Use only the amount of free swap
ram=$total_swap
fi
else
ynh_print_warn --message="You have to choose --free or --total when using ynh_get_ram"
ram=0
fi
echo $ram
}
# Return 0 or 1 depending if the system has a given amount of RAM+swap free or total
#
# usage: ynh_require_ram --required=RAM required in Mb [--free|--total] [--ignore_swap|--only_swap]
# | arg: -r, --required - The amount to require, in Mb
# | arg: -f, --free - Count free RAM+swap
# | arg: -t, --total - Count total RAM+swap
# | arg: -s, --ignore_swap - Ignore swap, consider only real RAM
# | arg: -o, --only_swap - Ignore real RAM, consider only swap
ynh_require_ram () {
# Declare an array to define the options of this helper.
local legacy_args=rftso
declare -Ar args_array=( [r]=required= [f]=free [t]=total [s]=ignore_swap [o]=only_swap )
local required
local free
local total
local ignore_swap
local only_swap
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
# Dunno if that's the right way to do, but that's some black magic to be able to
# forward the bool args to ynh_get_ram easily?
# If the variable $free is not empty, set it to '--free'
free=${free:+--free}
total=${total:+--total}
ignore_swap=${ignore_swap:+--ignore_swap}
only_swap=${only_swap:+--only_swap}
local ram=$(ynh_get_ram $free $total $ignore_swap $only_swap)
if [ $ram -lt $required ]
then
return 1
else
return 0
fi
}
#=================================================
# Define the values to configure php-fpm
#
# usage: ynh_get_scalable_phpfpm --usage=usage --footprint=footprint [--print]
# | arg: -f, --footprint - Memory footprint of the service (low/medium/high).
# low - Less than 20Mb of ram by pool.
# medium - Between 20Mb and 40Mb of ram by pool.
# high - More than 40Mb of ram by pool.
# Or specify exactly the footprint, the load of the service as Mb by pool instead of having a standard value.
# To have this value, use the following command and stress the service.
# watch -n0.5 ps -o user,cmd,%cpu,rss -u APP
#
# | arg: -u, --usage - Expected usage of the service (low/medium/high).
# low - Personal usage, behind the sso.
# medium - Low usage, few people or/and publicly accessible.
# high - High usage, frequently visited website.
#
# | arg: -p, --print - Print the result
#
#
#
# The footprint of the service will be used to defined the maximum footprint we can allow, which is half the maximum RAM.
# So it will be used to defined 'pm.max_children'
# A lower value for the footprint will allow more children for 'pm.max_children'. And so for
# 'pm.start_servers', 'pm.min_spare_servers' and 'pm.max_spare_servers' which are defined from the
# value of 'pm.max_children'
# NOTE: 'pm.max_children' can't exceed 4 times the number of processor's cores.
#
# The usage value will defined the way php will handle the children for the pool.
# A value set as 'low' will set the process manager to 'ondemand'. Children will start only if the
# service is used, otherwise no child will stay alive. This config gives the lower footprint when the
# service is idle. But will use more proc since it has to start a child as soon it's used.
# Set as 'medium', the process manager will be at dynamic. If the service is idle, a number of children
# equal to pm.min_spare_servers will stay alive. So the service can be quick to answer to any request.
# The number of children can grow if needed. The footprint can stay low if the service is idle, but
# not null. The impact on the proc is a little bit less than 'ondemand' as there's always a few
# children already available.
# Set as 'high', the process manager will be set at 'static'. There will be always as many children as
# 'pm.max_children', the footprint is important (but will be set as maximum a quarter of the maximum
# RAM) but the impact on the proc is lower. The service will be quick to answer as there's always many
# children ready to answer.
ynh_get_scalable_phpfpm () {
local legacy_args=ufp
# Declare an array to define the options of this helper.
declare -Ar args_array=( [u]=usage= [f]=footprint= [p]=print )
local usage
local footprint
local print
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
# Set all characters as lowercase
footprint=${footprint,,}
usage=${usage,,}
print=${print:-0}
if [ "$footprint" = "low" ]
then
footprint=20
elif [ "$footprint" = "medium" ]
then
footprint=35
elif [ "$footprint" = "high" ]
then
footprint=50
fi
# Define the way the process manager handle child processes.
if [ "$usage" = "low" ]
then
php_pm=ondemand
elif [ "$usage" = "medium" ]
then
php_pm=dynamic
elif [ "$usage" = "high" ]
then
php_pm=static
else
ynh_die --message="Does not recognize '$usage' as an usage value."
fi
# Get the total of RAM available, except swap.
local max_ram=$(ynh_get_ram --total --ignore_swap)
at_least_one() {
# Do not allow value below 1
if [ $1 -le 0 ]
then
echo 1
else
echo $1
fi
}
# Define pm.max_children
# The value of pm.max_children is the total amount of ram divide by 2 and divide again by the footprint of a pool for this app.
# So if php-fpm start the maximum of children, it won't exceed half of the ram.
php_max_children=$(( $max_ram / 2 / $footprint ))
# If process manager is set as static, use half less children.
# Used as static, there's always as many children as the value of pm.max_children
if [ "$php_pm" = "static" ]
then
php_max_children=$(( $php_max_children / 2 ))
fi
php_max_children=$(at_least_one $php_max_children)
# To not overload the proc, limit the number of children to 4 times the number of cores.
local core_number=$(nproc)
local max_proc=$(( $core_number * 4 ))
if [ $php_max_children -gt $max_proc ]
then
php_max_children=$max_proc
fi
if [ "$php_pm" = "dynamic" ]
then
# Define pm.start_servers, pm.min_spare_servers and pm.max_spare_servers for a dynamic process manager
php_min_spare_servers=$(( $php_max_children / 8 ))
php_min_spare_servers=$(at_least_one $php_min_spare_servers)
php_max_spare_servers=$(( $php_max_children / 2 ))
php_max_spare_servers=$(at_least_one $php_max_spare_servers)
php_start_servers=$(( $php_min_spare_servers + ( $php_max_spare_servers - $php_min_spare_servers ) /2 ))
php_start_servers=$(at_least_one $php_start_servers)
else
php_min_spare_servers=0
php_max_spare_servers=0
php_start_servers=0
fi
if [ $print -eq 1 ]
then
ynh_debug --message="Footprint=${footprint}Mb by pool."
ynh_debug --message="Process manager=$php_pm"
ynh_debug --message="Max RAM=${max_ram}Mb"
if [ "$php_pm" != "static" ]; then
ynh_debug --message="\nMax estimated footprint=$(( $php_max_children * $footprint ))"
ynh_debug --message="Min estimated footprint=$(( $php_min_spare_servers * $footprint ))"
fi
if [ "$php_pm" = "dynamic" ]; then
ynh_debug --message="Estimated average footprint=$(( $php_max_spare_servers * $footprint ))"
elif [ "$php_pm" = "static" ]; then
ynh_debug --message="Estimated footprint=$(( $php_max_children * $footprint ))"
fi
ynh_debug --message="\nRaw php-fpm values:"
ynh_debug --message="pm.max_children = $php_max_children"
if [ "$php_pm" = "dynamic" ]; then
ynh_debug --message="pm.start_servers = $php_start_servers"
ynh_debug --message="pm.min_spare_servers = $php_min_spare_servers"
ynh_debug --message="pm.max_spare_servers = $php_max_spare_servers"
fi
fi
}
#================================================= #=================================================
# EXPERIMENTAL HELPERS # EXPERIMENTAL HELPERS
@ -700,18 +368,3 @@ ynh_app_changelog () {
echo "No significative changes from the changelog..." > "${final_changelog}_lite" echo "No significative changes from the changelog..." > "${final_changelog}_lite"
fi fi
} }
#=================================================
# Execute a command as another user
# usage: exec_as USER COMMAND [ARG ...]
ynh_exec_as() {
local USER=$1
shift 1
if [[ $USER = $(whoami) ]]; then
eval "$@"
else
sudo -u "$USER" "$@"
fi
}

View file

@ -1,4 +0,0 @@
#!/bin/bash
# Dependencies
app_depencencies="rsync encfs sshpass ccrypt lzop zstd lzip"

View file

@ -7,8 +7,6 @@
#================================================= #=================================================
# Load common variables for all scripts. # Load common variables for all scripts.
source scripts/_variables
source scripts/_common.sh source scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers

View file

@ -19,7 +19,7 @@ ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -30,7 +30,6 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#================================================= #=================================================
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Backing up the main app directory..."
ynh_backup --src_path="$final_path" ynh_backup --src_path="$final_path"
@ -39,14 +38,12 @@ ynh_backup --src_path="$final_path"
#================================================= #=================================================
# BACKUP LOGROTATE # BACKUP LOGROTATE
#================================================= #=================================================
ynh_script_progression --message="Backing up logrotate configuration..."
ynh_backup --src_path="/etc/logrotate.d/$app" ynh_backup --src_path="/etc/logrotate.d/$app"
#================================================= #=================================================
# BACKUP THE CRON FILE # BACKUP THE CRON FILE
#================================================= #=================================================
ynh_script_progression --message="Backing up cron file..."
ynh_backup --src_path="/etc/cron.d/$app" ynh_backup --src_path="/etc/cron.d/$app"
@ -54,4 +51,4 @@ ynh_backup --src_path="/etc/cron.d/$app"
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -7,8 +7,6 @@
#================================================= #=================================================
# Load common variables for all scripts. # Load common variables for all scripts.
source _variables
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -24,7 +22,7 @@ ynh_abort_if_errors
#================================================= #=================================================
encrypt=$YNH_APP_ARG_ENCRYPT encrypt=$YNH_APP_ARG_ENCRYPT
ynh_print_OFF; encryption_pwd=$YNH_APP_ARG_ENCRYPTION_PWD; ynh_print_ON encryption_pwd=$YNH_APP_ARG_ENCRYPTION_PWD
core_backup=$YNH_APP_ARG_CORE_BACKUP core_backup=$YNH_APP_ARG_CORE_BACKUP
apps_backup=$YNH_APP_ARG_APPS_BACKUP apps_backup=$YNH_APP_ARG_APPS_BACKUP
frequency="$YNH_APP_ARG_FREQUENCY" frequency="$YNH_APP_ARG_FREQUENCY"
@ -40,9 +38,7 @@ final_path=/opt/yunohost/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder" test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
if [ $encrypt -eq 1 ]; then if [ $encrypt -eq 1 ]; then
ynh_print_OFF
test -n "$encryption_pwd" || ynh_die --message="encryption_pwd can't be empty if you choose to enable encryption." test -n "$encryption_pwd" || ynh_die --message="encryption_pwd can't be empty if you choose to enable encryption."
ynh_print_ON
fi fi
#================================================= #=================================================
@ -106,7 +102,7 @@ then
encrypt=true encrypt=true
passkey="$final_path/passkey" passkey="$final_path/passkey"
ynh_print_OFF; echo "$encryption_pwd" > "$passkey"; ynh_print_ON echo "$encryption_pwd" > "$passkey"
chmod 400 "$passkey" chmod 400 "$passkey"
else else
encrypt=false encrypt=false
@ -129,7 +125,7 @@ then
while read backup_app while read backup_app
do do
ynh_replace_string --match_string="^ynh_app_backup=$" --replace_string="ynh_app_backup=$backup_app\n&" --target_file="$config_file" ynh_replace_string --match_string="^ynh_app_backup=$" --replace_string="ynh_app_backup=$backup_app\n&" --target_file="$config_file"
done <<< "$(yunohost app list -i | grep id: | sed 's/.*id: //')" done <<< "$(yunohost app list | grep 'id:' | sed 's/.*id: //')"
fi fi
# Calculate and store the config file checksum into the app settings # Calculate and store the config file checksum into the app settings
@ -197,11 +193,10 @@ ynh_print_info --message="$Informations"
if [ "$encrypt" = "true" ] if [ "$encrypt" = "true" ]
then then
ynh_print_OFF
encrypt_message="Your password for encryption is '$encryption_pwd' encrypt_message="Your password for encryption is '$encryption_pwd'
" "
ynh_print_ON
else else
encrypt_message="" encrypt_message=""
fi fi
@ -209,7 +204,6 @@ fi
# Get main domain and buid the url of the admin panel of the app. # Get main domain and buid the url of the admin panel of the app.
admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app" admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app"
ynh_print_OFF
echo "${encrypt_message}Archivist is going to run $run_freq. echo "${encrypt_message}Archivist is going to run $run_freq.
If you want to change the frequency, have a look to the file /etc/cron.d/$app. If you want to change the frequency, have a look to the file /etc/cron.d/$app.
$Informations $Informations
@ -219,7 +213,6 @@ You can configure this app easily by using the experimental __URL_TAG1__config-p
You can also find some specific actions for this app by using the experimental __URL_TAG1__action feature__URL_TAG2__$admin_panel/actions__URL_TAG3__. You can also find some specific actions for this app by using the experimental __URL_TAG1__action feature__URL_TAG2__$admin_panel/actions__URL_TAG3__.
If you're facing an issue or want to improve this app, please open a new issue in this __URL_TAG1__project__URL_TAG2__https://github.com/YunoHost-Apps/archivist_ynh__URL_TAG3__." > mail_to_send If you're facing an issue or want to improve this app, please open a new issue in this __URL_TAG1__project__URL_TAG2__https://github.com/YunoHost-Apps/archivist_ynh__URL_TAG3__." > mail_to_send
ynh_print_ON
ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type=install ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type=install

View file

@ -7,8 +7,6 @@
#================================================= #=================================================
# Load common variables for all scripts. # Load common variables for all scripts.
source ../settings/scripts/_variables
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -33,8 +31,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#================================================= #=================================================
ynh_script_progression --message="Validating restoration parameters..." ynh_script_progression --message="Validating restoration parameters..."
test ! -d $final_path \ test ! -d $final_path || ynh_die --message="There is already a directory: $final_path "
|| ynh_die --message="There is already a directory: $final_path "
#================================================= #=================================================
# STANDARD RESTORATION STEPS # STANDARD RESTORATION STEPS

View file

@ -7,8 +7,6 @@
#================================================= #=================================================
# Load common variables for all scripts. # Load common variables for all scripts.
source _variables
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -32,6 +30,20 @@ overwrite_cron=$(ynh_app_setting_get --app=$app --key=overwrite_cron)
upgrade_type=$(ynh_check_app_version_changed) 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=2
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
@ -73,20 +85,6 @@ if [ -z "$admin_mail_html" ]; then
ynh_app_setting_set --app=$app --key=admin_mail_html --value=$admin_mail_html ynh_app_setting_set --app=$app --key=admin_mail_html --value=$admin_mail_html
fi fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=2
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# 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 # STANDARD UPGRADE STEPS
#================================================= #=================================================