summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2021-04-20 10:53:24 +0200
committerSimon Rettberg2021-04-20 14:11:29 +0200
commitbc06ad3e823e4ce7e62617454598029b1f532b76 (patch)
treeb4bac7c8ce64d39ae0ce1b0f494c5839eb3bdb54
parent[SSUS] diffcp: Bail out if source file is missing (diff)
downloadsetup-scripts-bc06ad3e823e4ce7e62617454598029b1f532b76.tar.gz
setup-scripts-bc06ad3e823e4ce7e62617454598029b1f532b76.tar.xz
setup-scripts-bc06ad3e823e4ce7e62617454598029b1f532b76.zip
[SSUS] Add function to add all files from a static_files module
-rw-r--r--satellit_upgrader/updater.template.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/satellit_upgrader/updater.template.sh b/satellit_upgrader/updater.template.sh
index 99641a0..37ccb35 100644
--- a/satellit_upgrader/updater.template.sh
+++ b/satellit_upgrader/updater.template.sh
@@ -129,6 +129,20 @@ diffcp () {
return 0
}
+# install_files <module>
+# returns 0 (true) if at least one file was copied
+install_files () {
+ local SRC="$FILEDIR/$1"
+ local files file ret
+ [ -d "$SRC" ] || perror "NO SUCH DIRECTORY: $SRC"
+ readarray -t -d '' files < <( find "$SRC" -type f -print0 )
+ ret=1
+ for file in "${files[@]}"; do
+ diffcp "$1" "${file#$SRC}" && ret=0
+ done
+ return $ret
+}
+
# failprint apt-get install foobar
# Only prints command output to stdout if exit code is not 0
failprint () {