From b398243da30600879236cb0bbd9698732053ef98 Mon Sep 17 00:00:00 2001 From: Jacques Supcik Date: Fri, 22 Mar 2024 12:17:05 +0000 Subject: [PATCH] improve script --- .../toolchain/scripts/sync-rootfs.sh | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/.devcontainer/toolchain/scripts/sync-rootfs.sh b/.devcontainer/toolchain/scripts/sync-rootfs.sh index 21932d6..ef2e64a 100644 --- a/.devcontainer/toolchain/scripts/sync-rootfs.sh +++ b/.devcontainer/toolchain/scripts/sync-rootfs.sh @@ -5,12 +5,24 @@ set -o pipefail set -o nounset # set -o xtrace +SRC=/buildroot/output/target/ +DST=/rootfs/ +RSYNC_IGNORE=/workspace/rsyncignore + +# Copy all non-existing files from SRC to DST rsync -rlpgoD --itemize-changes \ --ignore-existing \ --exclude=THIS_IS_NOT_YOUR_ROOT_FILESYSTEM \ - /buildroot/output/target/ \ - /rootfs/ - + $SRC $DST + +RSYNC_OPT="" +if [[ -f $RSYNC_IGNORE ]]; then + RSYNC_OPT="--exclude-from=$RSYNC_IGNORE" + echo "Using rsyncignore" +fi + + +# Update all existing files in DST from SRC rsync -crlpgoD --itemize-changes \ --exclude=/etc/ssh/** \ --exclude=/etc/hostname \ @@ -19,5 +31,5 @@ rsync -crlpgoD --itemize-changes \ --exclude=/etc/shadow \ --exclude=/etc/fstab \ --exclude=THIS_IS_NOT_YOUR_ROOT_FILESYSTEM \ - /buildroot/output/target/ \ - /rootfs/ \ No newline at end of file + $RSYNC_OPT \ + $SRC $DST \ No newline at end of file