Repository navigation
Expand file tree
/
Copy pathffs.sh
More file actions
executable file
·67 lines (65 loc) · 2.15 KB
/
Copy pathffs.sh
File metadata and controls
executable file
·67 lines (65 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
source "$(pwd)/scripts.lib" || exit
SCRIPT_NAME="FreeFileSync"
SCRIPT_JOB="Launch with modified config"
if [[ -z "${FFS_PATH_BIN:-}" ]]; then tui_info "FFS_PATH_BIN missing in scripts.cfg"; exit; fi
#[CREATE MODIFIED CONFIG]
# Create an empty folder that can be mirrored to the destination
rm -rf "${SCRIPT_PATH:?}/.tmp/*"; mkdir -p "${SCRIPT_PATH}/.tmp/null"; cd "${SCRIPT_PATH}/.tmp" || exit 1
SKIP=false
# Iterate through input file
{ while IFS= read -r LINE; do
# SKIPPING LINES START
case "${LINE//$'\r'/}" in (*"<Include>"|*"<Synchronize>")
SKIP=true
;;
# SKIPPING LINES STOP
(*"</Include>"|" </Synchronize>")
SKIP=false
;;
# GLOBAL: INJECT SYNC CONFIG
(" </Synchronize>")
SKIP=false
printf '%s\n' \
' <Synchronize>' \
' <Differences LeftOnly="right" LeftNewer="right" RightNewer="right" RightOnly="right"/>' \
' <DeletionPolicy>Permanent</DeletionPolicy>' \
' <VersioningFolder Style="Replace"/>' \
' </Synchronize>'
;;
# GLOBAL: INJECT LEFT PATH
(" <Left>"*"</Left>")
printf '%s\n' " <Left>${SCRIPT_PATH}/.tmp/null</Left>"
;;
# GLOBAL: REVERSE FILTER
(" <Exclude>")
printf '%s\n' ' <Include>' '<Item>*</Item>'
;;
(" </Exclude>")
printf '%s\n' ' </Include>' ' <Exclude/>'
;;
(" <Exclude/>")
printf '%s\n' ' <Include/>' ' <Exclude/>'
;;
# PAIR: REVERSE FILTER
(" <Exclude>")
printf '%s\n' ' <Include>'
;;
(" </Exclude>")
printf '%s\n' ' </Include>' ' <Exclude/>'
;;
(" <Exclude/>")
printf '%s\n' ' <Include/>' ' <Exclude/>'
;;
# PASS-THROUGH
(*)
if [ "${SKIP}" = false ]; then
printf '%s\n' "$LINE"
fi
;; esac
done < "${1}"; } > "${SCRIPT_PATH}/.tmp/TEMPORARY-CONFIG.ffs_gui";
#[OPEN CONFIG WITH FFS & CLEANUP AFTER CLOSING IT]
thread() { ${FFS_PATH_BIN} "${SCRIPT_PATH}/.tmp/TEMPORARY-CONFIG.ffs_gui" -Edit; }
thread_single "Launching FreeFileSync"
rm -rf "${SCRIPT_PATH}/.tmp"
tui_info_results