virusforget

This commit is contained in:
Patrick Schleizer 2019-08-19 08:19:35 +00:00
parent 2d867d9fee
commit 416906d4f9
No known key found for this signature in database
GPG Key ID: CB8D50BB77BB3C48

View File

@ -52,6 +52,14 @@ parse_cmd_options() {
unit_test="true"
shift
;;
--commit)
commit="true"
shift
;;
--check)
check="true"
shift
;;
--)
shift
break
@ -114,7 +122,16 @@ init() {
process_file_system_objects() {
if [ "$store" = "true" ]; then
if [ "$test_mode" = "true" ]; then
echo Simulate: rm -r -f "$backup_folder"
else
rm -r -f "$backup_folder"
fi
fi
if [ "$test_mode" = "true" ]; then
true
else
mkdir -p "$backup_folder"
fi
@ -131,8 +148,12 @@ process_files() {
full_path_dangerous_dirname="${full_path_dangerous%/*}"
if [ "$store" = "true" ]; then
if [ -e "$full_path_original" ]; then
if [ "$test_mode" = "true" ]; then
echo Simulate: cp --no-dereference --archive "$full_path_original" "$backup_folder/"
else
cp --no-dereference --archive "$full_path_original" "$backup_folder/"
fi
fi
else
check_file_walker
fi
@ -169,9 +190,13 @@ process_folders() {
# echo chattr -i "$full_path_backup"
# echo rm "$full_path_backup"
#fi
if [ "$test_mode" = "true" ]; then
echo Simulate: cp --no-dereference --archive "$full_path_original" "$full_path_backup_dirname/"
else
mkdir -p "$full_path_backup_dirname"
cp --no-dereference --archive "$full_path_original" "$full_path_backup_dirname/"
fi
fi
else
check_file_walker
fi
@ -310,12 +335,14 @@ init
variables
unit_test_one
## TODO
if [ "$commit" = "true" ]; then
store=true
process_file_system_objects
fi
unit_test_two
## TODO
if [ "$check" = "true" ]; then
store=false
process_file_system_objects
fi