mirror of
https://github.com/YunoHost-Apps/wallabag2_ynh.git
synced 2024-10-01 13:35:06 +02:00
* Keep optional configuration lines in nginx.conf to allow changing URL from/to "/path" locations Rename comment prefixes fore more readability * Add change_url script * Require YNH 2.7.2, remove helpers and sudo prefixes * Use ynh_replace_string * Handle nginx conf file checksums * Fix indentation * Update source to 2.3 * Update version to 2.3 * Update readme version to 2.3 * Fix 20-app.ini in restore * Replace app checkurl by webpath_available * Adapt existing patches to 2.3 * Remove need to manage parameters.yml file; adapt to version 2.3 * Fix php5-redis dependency (redis-server is installed by YunoHost) * Manage new domain_name parameter in change_url * Upgrade to upstream version 2.3.1 * Upgrade to upstream version 2.3.2 * Remove obsolete calls to checkurl * Fix check_process for upgrade from previous commit * Fix Version number
63 lines
1.6 KiB
Bash
63 lines
1.6 KiB
Bash
#
|
|
# Common variables
|
|
#
|
|
|
|
# Package dependencies
|
|
PKG_DEPENDENCIES="php5-cli php5-mysql php5-json php5-gd php5-tidy php5-curl php-gettext php5-redis"
|
|
|
|
# Execute a command as another user
|
|
# usage: exec_as USER COMMAND [ARG ...]
|
|
exec_as() {
|
|
local USER=$1
|
|
shift 1
|
|
|
|
if [[ $USER = $(whoami) ]]; then
|
|
eval $@
|
|
else
|
|
# use twice to be root and be allowed to use another user
|
|
sudo -u "$USER" "$@"
|
|
fi
|
|
}
|
|
|
|
# Execute a command through the wallabag console
|
|
# usage: exec_console AS_USER WORKDIR COMMAND [ARG ...]
|
|
exec_console() {
|
|
local AS_USER=$1
|
|
local WORKDIR=$2
|
|
shift 2
|
|
exec_as "$AS_USER" php "$WORKDIR/bin/console" --no-interaction --env=prod "$@"
|
|
}
|
|
|
|
WARNING () { # Print on error output
|
|
$@ >&2
|
|
}
|
|
|
|
QUIET () { # redirect standard output to /dev/null
|
|
$@ > /dev/null
|
|
}
|
|
|
|
CHECK_SIZE () { # Check if enough disk space available on backup storage
|
|
file_to_analyse=$1
|
|
backup_size=$(du --summarize "$file_to_analyse" | cut -f1)
|
|
free_space=$(df --output=avail "/home/yunohost.backup" | sed 1d)
|
|
|
|
if [ $free_space -le $backup_size ]
|
|
then
|
|
WARNING echo "Not enough backup disk space for: $file_to_analyse."
|
|
WARNING echo "Space available: $(HUMAN_SIZE $free_space)"
|
|
ynh_die "Space needed: $(HUMAN_SIZE $backup_size)"
|
|
fi
|
|
}
|
|
|
|
|
|
# ============= FUTURE YUNOHOST HELPER =============
|
|
# Delete a file checksum from the app settings
|
|
#
|
|
# $app should be defined when calling this helper
|
|
#
|
|
# usage: ynh_remove_file_checksum file
|
|
# | arg: file - The file for which the checksum will be deleted
|
|
ynh_delete_file_checksum () {
|
|
local checksum_setting_name=checksum_${1//[\/ ]/_} # Replace all '/' and ' ' by '_'
|
|
ynh_app_setting_delete $app $checksum_setting_name
|
|
}
|