Skip to content

Instantly share code, notes, and snippets.

@dginovker
Last active January 20, 2024 13:28
Show Gist options
  • Save dginovker/6d2714ee7fde3c637272c7ec531e7c2b to your computer and use it in GitHub Desktop.
Save dginovker/6d2714ee7fde3c637272c7ec531e7c2b to your computer and use it in GitHub Desktop.
Jan-2024 2009scape Linux Flatpak Singpleplayer Migration Script
#!/bin/bash
# Define color codes
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NC='\033[0m' # No Color
# Define directories
OLD_DIR="$HOME/.local/share/2009scape/singleplayer"
NEW_DIR="$HOME/.var/app/org._2009scape.Launcher/data/2009scape/singleplayer"
BACKUP_DIR="$HOME/Downloads/backedup-var-2009scape-singleplayer"
# Check if the new directory already exists
if [ -d "$NEW_DIR" ]; then
echo -e "${YELLOW}The directory $NEW_DIR already exists. Creating a backup in $BACKUP_DIR.${NC}"
mv "$NEW_DIR" "$BACKUP_DIR"
echo -e "${GREEN}Backup created successfully.${NC}"
fi
# Check if the old directory exists and copy
if [ -d "$OLD_DIR" ]; then
echo -e "${YELLOW}Copying $OLD_DIR to $NEW_DIR.${NC}"
mkdir -p "$(dirname "$NEW_DIR")" && cp -r "$OLD_DIR" "$NEW_DIR"
echo -e "${GREEN}Migration completed successfully.${NC}"
else
echo -e "${GREEN}No singleplayer instance detected in $OLD_DIR, so no actions were taken.${NC}"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment