Merge pull request #304 from rdunne2020/background-clone-fix

fix: Correctly Detect Pictures Directory and Clone Path for Background
This commit is contained in:
Chris Titus 2024-09-18 11:45:15 -05:00 committed by GitHub
commit b34f5240ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -143,29 +143,32 @@ clone_config_folders() {
} }
configure_backgrounds() { configure_backgrounds() {
# Set the variable PIC_DIR which stores the path for images
PIC_DIR="$HOME/Pictures"
# Set the variable BG_DIR to the path where backgrounds will be stored # Set the variable BG_DIR to the path where backgrounds will be stored
BG_DIR="$HOME/Pictures/backgrounds" BG_DIR="$PIC_DIR/backgrounds"
# Check if the ~/Pictures directory exists # Check if the ~/Pictures directory exists
if [ ! -d "~/Pictures" ]; then if [ ! -d "$PIC_DIR" ]; then
# If it doesn't exist, print an error message and return with a status of 1 (indicating failure) # If it doesn't exist, print an error message and return with a status of 1 (indicating failure)
echo "Pictures directory does not exist" echo "Pictures directory does not exist"
mkdir ~/Pictures mkdir "$PIC_DIR"
echo "Directory was created in Home folder" echo "Directory was created in Home folder"
fi fi
# Check if the backgrounds directory (BG_DIR) exists # Check if the backgrounds directory (BG_DIR) exists
if [ ! -d "$BG_DIR" ]; then if [ ! -d "$BG_DIR" ]; then
# If the backgrounds directory doesn't exist, attempt to clone a repository containing backgrounds # If the backgrounds directory doesn't exist, attempt to clone a repository containing backgrounds
if ! git clone https://github.com/ChrisTitusTech/nord-background.git ~/Pictures; then if ! git clone https://github.com/ChrisTitusTech/nord-background.git "$PIC_DIR/nord-background"; then
# If the git clone command fails, print an error message and return with a status of 1 # If the git clone command fails, print an error message and return with a status of 1
echo "Failed to clone the repository" echo "Failed to clone the repository"
return 1 return 1
fi fi
# Rename the cloned directory to 'backgrounds' # Rename the cloned directory to 'backgrounds'
mv ~/Pictures/nord-background ~/Pictures/backgrounds mv "$PIC_DIR/nord-background" "$PIC_DIR/backgrounds"
# Print a success message indicating that the backgrounds have been downloaded # Print a success message indicating that the backgrounds have been downloaded
echo "Downloaded desktop backgrounds to $BG_DIR" echo "Downloaded desktop backgrounds to $BG_DIR"
else else
# If the backgrounds directory already exists, print a message indicating that the download is being skipped # If the backgrounds directory already exists, print a message indicating that the download is being skipped
echo "Path $BG_DIR exists for desktop backgrounds, skipping download of backgrounds" echo "Path $BG_DIR exists for desktop backgrounds, skipping download of backgrounds"
@ -261,9 +264,6 @@ setupDisplayManager() {
;; ;;
esac esac
fi fi
} }
install_slstatus() { install_slstatus() {