This commit adds support for folder synchronization.
An example is in the 810-files file where it is explained how to
synchronize all hotplug files of keepalived.
Signed-off-by: Francesco Benini <francy.benini@gmail.com>
PKG_NAME:=keepalived
PKG_VERSION:=2.3.1
-PKG_RELEASE:=2
+PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://www.keepalived.org/software
add_sync_file /etc/sysctl.conf
add_sync_file /tmp/dhcp.leases
+# uncomment the following line and add /etc/hotplug.d/keepalived to sysupgrade.conf or keepalived configuration in order to enable hotplug scripts sync
+# add_sync_file /etc/hotplug.d/keepalived
+
keepalived_hotplug
list_contains SYNC_FILES_LIST "$1"
}
+is_sync_file_in_folder() {
+ local f="$1"
+ while [ "$f" != "" ]; do
+ f="${f%/*}"
+ if list_contains SYNC_FILES_LIST "$f"; then
+ return 0
+ fi
+ done
+ return 1
+}
+
_set_update_target() {
set_var UPDATE_TARGET "${1:-1}"
}
return
fi
- is_sync_file "$RSYNC_TARGET" || return
+ is_sync_file "$RSYNC_TARGET" || is_sync_file_in_folder "$RSYNC_TARGET" || return
if ! cp -a "$RSYNC_SOURCE" "$RSYNC_TARGET"; then
log_err "can not copy $RSYNC_SOURCE => $RSYNC_TARGET"
config_get sync_list "$cfg" sync_list
for sync_file in $sync_list $(sysupgrade -l); do
- [ -f "$sync_file" ] && {
- dir="${sync_file%/*}"
- list_contains files_list "${sync_file}" || append files_list "${sync_file}"
- }
+ [ -f "$sync_file" ] && dir="${sync_file%/*}"
[ -d "$sync_file" ] && dir="${sync_file}"
+
+ list_contains files_list "${sync_file}" || append files_list "${sync_file}"
list_contains dirs_list "${sync_dir}${dir}" || append dirs_list "${sync_dir}${dir}"
done