56 lines
1.4 KiB
Bash
Executable File
56 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
SOURCE=$1
|
|
|
|
if [ -z "$SOURCE" ]; then
|
|
echo "Usage: $0 <path-to-zip-or-directory>"
|
|
exit 1
|
|
fi
|
|
|
|
# Handle zip extraction
|
|
if [[ "$SOURCE" == *.zip ]]; then
|
|
TEMP_DIR=$(mktemp -d)
|
|
unzip -q "$SOURCE" -d "$TEMP_DIR"
|
|
RESTORE_PATH=$(find "$TEMP_DIR" -maxdepth 1 -type d -name "config-*" | head -n 1)
|
|
else
|
|
RESTORE_PATH="$SOURCE"
|
|
fi
|
|
|
|
if [ ! -d "$RESTORE_PATH" ]; then
|
|
echo "Error: Invalid config source"
|
|
exit 1
|
|
fi
|
|
|
|
# Clean and restore config-scripts/
|
|
rm -rf ~/config-scripts
|
|
cp -r "$RESTORE_PATH/config-scripts" ~/
|
|
|
|
# Clean and restore Pictures/Wallpapers/
|
|
rm -rf ~/Pictures/Wallpapers
|
|
cp -r "$RESTORE_PATH/Pictures/Wallpapers" ~/Pictures
|
|
|
|
# Clean and restore .themes/
|
|
rm -rf ~/.themes/Colloid-Transparent-Dracula
|
|
mkdir -p ~/.themes
|
|
cp -r "$RESTORE_PATH/.themes/Colloid-Transparent-Dracula" ~/.themes/
|
|
|
|
# Clean and restore .config/
|
|
for dir in nvim rofi yazi hypr waybar dunst kitty fastfetch; do
|
|
rm -rf ~/.config/$dir
|
|
mkdir -p ~/.config/$dir
|
|
cp -r "$RESTORE_PATH/.config/$dir/." ~/.config/$dir/
|
|
done
|
|
|
|
# Restore single dotfiles
|
|
cp -r "$RESTORE_PATH/.inputrc" ~/
|
|
cp -r "$RESTORE_PATH/.bash_profile" ~/
|
|
cp -r "$RESTORE_PATH/.bashrc" ~/
|
|
cp -r "$RESTORE_PATH/.bash_exports" ~/
|
|
cp -r "$RESTORE_PATH/.bash_aliases" ~/
|
|
cp -r "$RESTORE_PATH/.ideavimrc" ~/
|
|
echo 'Restored configs'
|
|
|
|
# Cleanup temp files
|
|
[ -n "$TEMP_DIR" ] && rm -rf "$TEMP_DIR"
|
|
|
|
echo -e "\e[32mDone!\e[0m"
|