diff options
| author | Mosder <xmosder12@gmail.com> | 2026-07-18 20:17:13 +0200 |
|---|---|---|
| committer | Mosder <xmosder12@gmail.com> | 2026-07-18 20:17:13 +0200 |
| commit | 4a9d9ac589f7ef41eb869dffc3d1b499bd8c653c (patch) | |
| tree | 7948c6131f7af5d5a1731896898bb3d0e641d009 /load_config.sh | |
| parent | f3fcc7c9b4e603bede79e77cb05d505d0d83de3d (diff) | |
made loading and updating scripts more descriptive - now they show only operations that change something
Diffstat (limited to 'load_config.sh')
| -rwxr-xr-x | load_config.sh | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/load_config.sh b/load_config.sh index ec59828..0d947b9 100755 --- a/load_config.sh +++ b/load_config.sh @@ -14,6 +14,9 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" make_dir() { local dir="$1" + if [ -d "$dir" ]; then + return 1 + fi echo "mkdir -p $dir" if ! mkdir -p "$dir" 2>/dev/null; then echo "Failed - using sudo..." @@ -24,7 +27,17 @@ make_dir() { copy_file() { local src="$1" local dest="$2" - echo "cp -a $src $dest" + + if [ -f "$dest" ]; then + if diff "$src" "$dest" &> /dev/null; then + return 1 + else + echo "Updating $dest..." + fi + else + echo "$dest doesn't exist - copying..." + fi + if ! cp -a "$src" "$dest" 2>/dev/null; then echo "Failed - using sudo..." sudo cp -a "$src" "$dest" |
