mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
helpers.v2.1: Add ynh_in_ci_tests to check if the scripts are running in CI or not
This commit is contained in:
parent
eab36d069d
commit
e0a9bafde2
2 changed files with 13 additions and 2 deletions
|
@ -216,7 +216,7 @@ ynh_store_file_checksum() {
|
|||
|
||||
ynh_app_setting_set --key=$checksum_setting_name --value=$(md5sum "$file" | cut --delimiter=' ' --fields=1)
|
||||
|
||||
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
|
||||
if ynh_in_ci_tests; then
|
||||
# Using a base64 is in fact more reversible than "replace / and space by _" ... So we can in fact obtain the original file path in an easy reliable way ...
|
||||
local file_path_base64=$(echo "$file" | base64 -w0)
|
||||
mkdir -p /var/cache/yunohost/appconfbackup/
|
||||
|
@ -253,7 +253,7 @@ ynh_backup_if_checksum_is_different() {
|
|||
cp --archive "$file" "$backup_file_checksum" # Backup the current file
|
||||
ynh_print_warn "File $file has been manually modified since the installation or last upgrade. So it has been duplicated in $backup_file_checksum"
|
||||
echo "$backup_file_checksum" # Return the name of the backup file
|
||||
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
|
||||
if ynh_in_ci_tests; then
|
||||
local file_path_base64=$(echo "$file" | base64 -w0)
|
||||
if test -e /var/cache/yunohost/appconfbackup/original_${file_path_base64}
|
||||
then
|
||||
|
|
|
@ -616,3 +616,14 @@ ynh_get_ram() {
|
|||
|
||||
echo $ram
|
||||
}
|
||||
|
||||
# Check if the scripts are being run by the package_check in CI
|
||||
#
|
||||
# usage: ynh_in_ci_tests
|
||||
#
|
||||
# Return 0 if in CI, 1 otherwise
|
||||
#
|
||||
# Requires YunoHost version 11.3 or higher.
|
||||
ynh_in_ci_tests() {
|
||||
[ "${PACKAGE_CHECK_EXEC:-0}" -eq 1 ]
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue