From 343fa03a05a20c29042e265435171afe7d435e7c Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 5 Feb 2019 21:08:32 +0100 Subject: [PATCH] adding _common.sh from example_ynh --- scripts/_common.sh | 13 +++++++++++++ scripts/backup | 2 ++ scripts/install | 3 +++ scripts/remove | 5 ++++- scripts/restore | 2 ++ scripts/upgrade | 2 +- 6 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 scripts/_common.sh diff --git a/scripts/_common.sh b/scripts/_common.sh new file mode 100644 index 0000000..bb04a03 --- /dev/null +++ b/scripts/_common.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# ============= 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 +} \ No newline at end of file diff --git a/scripts/backup b/scripts/backup index 1d0109b..90f0a37 100644 --- a/scripts/backup +++ b/scripts/backup @@ -5,6 +5,8 @@ #================================================= # IMPORT GENERIC HELPERS #================================================= + +source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers #================================================= diff --git a/scripts/install b/scripts/install index ab1bc82..ae47673 100755 --- a/scripts/install +++ b/scripts/install @@ -1,9 +1,12 @@ #!/bin/bash + #================================================= # GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= + +source _common.sh source _future.sh source ynh_systemd_action source /usr/share/yunohost/helpers diff --git a/scripts/remove b/scripts/remove index f0cfa95..a5cea32 100755 --- a/scripts/remove +++ b/scripts/remove @@ -1,9 +1,12 @@ #!/bin/bash + #================================================= -# GENERIC STARTING +# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= + +source _common.sh source _future.sh source /usr/share/yunohost/helpers diff --git a/scripts/restore b/scripts/restore index 41a87f1..c5f84f4 100644 --- a/scripts/restore +++ b/scripts/restore @@ -5,6 +5,8 @@ #================================================= # IMPORT GENERIC HELPERS #================================================= + +source ../settings/scripts/_common.sh source ../settings/scripts/_future.sh source ../settings/scripts/ynh_systemd_action source /usr/share/yunohost/helpers diff --git a/scripts/upgrade b/scripts/upgrade index 357efd5..c4f992c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -6,7 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= -source _future.sh +source _common.sh source ynh_systemd_action source /usr/share/yunohost/helpers