forked from Shinonome/dots-hyprland
bugfix excluding mechanism now works
This commit is contained in:
+7
-6
@@ -9,7 +9,7 @@ export base="$(pwd)"
|
|||||||
|
|
||||||
# Define paths to update
|
# Define paths to update
|
||||||
folders=(".config" ".local")
|
folders=(".config" ".local")
|
||||||
excludes=(".config/hypr/custom", ".config/ags/user_options.js", ".config/hypr/hyprland.conf")
|
excludes=(".config/hypr/custom" ".config/ags/user_options.js" ".config/hypr/hyprland.conf")
|
||||||
|
|
||||||
function get_checksum() {
|
function get_checksum() {
|
||||||
# Get the checksum of a specific file
|
# Get the checksum of a specific file
|
||||||
@@ -58,7 +58,7 @@ if ! git fetch; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if there are any changes
|
# Check if there are any changes
|
||||||
if [[ $(git rev-list HEAD...origin/$current_branch --count) -eq 0 ]]; then
|
if [[ ! $(git rev-list HEAD...origin/$current_branch --count) -eq 0 ]]; then
|
||||||
echo "Repository is already up-to-date. Do not run git pull before this script. Exiting."
|
echo "Repository is already up-to-date. Do not run git pull before this script. Exiting."
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
@@ -69,7 +69,8 @@ modified_files=()
|
|||||||
# Find all files in the specified folders and their subfolders
|
# Find all files in the specified folders and their subfolders
|
||||||
while IFS= read -r -d '' file; do
|
while IFS= read -r -d '' file; do
|
||||||
# If the file is not in the home directory, skip it
|
# If the file is not in the home directory, skip it
|
||||||
if [[ ! -f "$HOME/$file" ]]; then
|
if [[ ! -f "$HOME/$file" ]] || file_in_excludes "$file" ; then
|
||||||
|
echo "Skipping $file"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -84,7 +85,7 @@ while IFS= read -r -d '' file; do
|
|||||||
fi
|
fi
|
||||||
done < <(find "${folders[@]}" -type f -print0)
|
done < <(find "${folders[@]}" -type f -print0)
|
||||||
|
|
||||||
|
echo
|
||||||
echo "Excluded files and folders: ${excludes[@]}"
|
echo "Excluded files and folders: ${excludes[@]}"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
@@ -181,7 +182,7 @@ else
|
|||||||
if [[ -d "$temp_folder/$file" ]]; then
|
if [[ -d "$temp_folder/$file" ]]; then
|
||||||
mkdir -p "$HOME/$file"
|
mkdir -p "$HOME/$file"
|
||||||
fi
|
fi
|
||||||
if [[ -f "$temp_folder/$file" && ! $(file_in_excludes "$file") && ! " ${modified_files[@]} " =~ " ${file} " ]]; then
|
if [[ -f "$temp_folder/$file" ]] && ! file_in_excludes "$file" && [[! " ${modified_files[@]} " =~ " ${file} " ]]; then
|
||||||
|
|
||||||
# Construct the destination path
|
# Construct the destination path
|
||||||
# Remove the temporary folder path
|
# Remove the temporary folder path
|
||||||
@@ -210,7 +211,7 @@ for folder in "${folders[@]}"; do
|
|||||||
mkdir -p "$HOME/$file"
|
mkdir -p "$HOME/$file"
|
||||||
fi
|
fi
|
||||||
# Check if the file is a regular file and not in the exclude_folders
|
# Check if the file is a regular file and not in the exclude_folders
|
||||||
if [[ -f "$file" && ! $(file_in_excludes "$file") && ! " ${modified_files[@]} " =~ " ${file} " ]]; then
|
if [[ -f "$temp_folder/$file" ]] && ! file_in_excludes "$file" && [[! " ${modified_files[@]} " =~ " ${file} " ]]; then
|
||||||
# Construct the destination path
|
# Construct the destination path
|
||||||
destination="$HOME/$file"
|
destination="$HOME/$file"
|
||||||
echo "Replacing \"$destination\" ..."
|
echo "Replacing \"$destination\" ..."
|
||||||
|
|||||||
Reference in New Issue
Block a user