You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#!/bin/bash
# Define source and destination file paths from command-line arguments
DEST_DIR="$DEST_DIR/$(basename "$SOURCE_DIR")"
env
# Check if both arguments are provided
if [ -z "$SOURCE_DIR" ] || [ -z "$DEST_DIR" ]; then
echo "Usage: $0 <source_directory> <destination_directory>\nSOURCE_DIR: $SOURCE_DIR\nDEST_DIR: $DEST_DIR"
exit 1
fi
# Check if the source directory exists
if [ ! -d "$SOURCE_DIR" ]; then
echo "Source directory $SOURCE_DIR does not exist."
exit 1
fi
# Check if the destination directory exists
if [ -d "$DEST_DIR" ]; then
echo "Destination directory exists. Creating a backup: $DEST_DIR.bak"
# Remove the existing backup directory if it's there
if [ -d "$DEST_DIR.bak" ]; then
echo "Removing existing backup directory $DEST_DIR.bak"
rm -rf "$DEST_DIR.bak"
if [ $? -ne 0 ]; then
echo "Failed to remove existing backup. Exiting."
exit 1
fi
fi
# Move the existing destination directory to backup
mv "$DEST_DIR" "$DEST_DIR.bak"
if [ $? -ne 0 ]; then
echo "Failed to create backup. Exiting."
exit 1
fi
fi
# Create the destination directory if it does not exist
if [ ! -d "$DEST_DIR" ]; then
echo "Destination directory does not exist. Creating $DEST_DIR..."
mkdir -p "$DEST_DIR"
if [ $? -ne 0 ]; then
echo "Failed to create destination directory. Exiting."
exit 1
fi
fi
# Copy the source directory to the destination, overwriting if needed
echo "Copying contents from $SOURCE_DIR to $DEST_DIR..."
cp -r "$SOURCE_DIR"/* "$DEST_DIR"
if [ $? -eq 0 ]; then
echo "Contents copied successfully."
else
echo "Failed to copy contents. Exiting."
exit 1
fi
# Ensure the operation is completed before exiting
sync
echo "Syncing completed."
exit 0
Add custom environment variables
Nothing turns up in log besides Heroic's
Expected behavior
Custom environment variables to be accessible to launch scripts
Screenshots
No response
Heroic Version
Latest Stable (Flatpak)
System Information
LMDE 6
Additional information
No response
The text was updated successfully, but these errors were encountered:
Describe the bug
I have a script that automatically backs up my saves, I'm passing source and destination directory as environment variables and unable to access them.
Add logs
Steps to reproduce
Expected behavior
Custom environment variables to be accessible to launch scripts
Screenshots
No response
Heroic Version
Latest Stable (Flatpak)
System Information
LMDE 6
Additional information
No response
The text was updated successfully, but these errors were encountered: