rear/SOURCES/pxe-rsync-output.patch
2022-08-19 18:18:27 +00:00

37 lines
1.1 KiB
Diff

diff --git a/usr/share/rear/output/PXE/default/820_copy_to_net.sh b/usr/share/rear/output/PXE/default/820_copy_to_net.sh
new file mode 100644
index 00000000..dba1e526
--- /dev/null
+++ b/usr/share/rear/output/PXE/default/820_copy_to_net.sh
@@ -0,0 +1,30 @@
+
+# 820_copy_to_net.sh
+
+# Check if we have a target location OUTPUT_URL
+test "$OUTPUT_URL" || return 0
+
+local scheme=$( url_scheme $OUTPUT_URL )
+local result_file=""
+local path=""
+
+case "$scheme" in
+ (nfs|cifs|usb|tape|file|davfs)
+ # The ISO has already been transferred by NETFS.
+ return 0
+ ;;
+ (fish|ftp|ftps|hftp|http|https|sftp)
+ # output/default/950_copy_result_files.sh will transfer them
+ return 0
+ ;;
+ (rsync)
+ LogPrint "Transferring PXE files to $OUTPUT_URL"
+ for result_file in "${RESULT_FILES[@]}" ; do
+ LogPrint "Transferring file: $result_file"
+ rsync -a $v "$result_file" "$OUTPUT_URL" || Error "Problem transferring '$result_file' to $OUTPUT_URL"
+ done
+ ;;
+ (*) Error "Invalid scheme '$scheme' in '$OUTPUT_URL'."
+ ;;
+esac
+