-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.sh
executable file
·35 lines (28 loc) · 950 Bytes
/
deploy.sh
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
#!/bin/bash
# Text file holding filenames and folders to be excluded
excluded_files="excluded_files.txt"
# Use the current directory as the source folder
source_folder="."
# Check if the destination folder argument is provided
if [ -z "$1" ]; then
echo "Usage: $0 <destination_folder>"
exit 1
fi
# Set the destination folder variable to the first argument
destination_folder="$1"
# Check if destination folder exists
if [[ ! -d "$destination_folder" ]]; then
echo "Error: destination folder not found."
exit 1
fi
# Check if exclude file exists
if [[ ! -f "$excluded_files" ]]; then
echo "-- Warning --"
echo "$excluded_files not found."
echo "Copying all files..."
exclude_option=""
else
exclude_option="--exclude-from=$excluded_files"
fi
# Use rsync to copy files, only those changed since last deploy
rsync -avz --progress --delete --update --checksum "$source_folder/" "$destination_folder/" $exclude_option