forked from RP1/RaveOS-arch
157 lines
No EOL
7.5 KiB
Bash
157 lines
No EOL
7.5 KiB
Bash
#!/bin/bash
|
|
|
|
# Text modifiers
|
|
bold=$(tput bold) # ${bold}
|
|
normal=$(tput sgr0) # ${normal}
|
|
yellow=$(tput setaf 3) # ${yellow}
|
|
|
|
zenity --info --title='Please pick a folder!' --text='Choose a folder!' --width='300' --height='100'
|
|
|
|
# Folder variable
|
|
FOLDER=$(zenity --file-selection --title="Choose a backup directory" --directory)
|
|
if [[ $? -eq 1 ]]; then
|
|
echo You did not pick a ${bold}${yellow}folder.${normal} Exiting!
|
|
exit 1
|
|
else
|
|
echo Backups will be saved into: ${bold}${yellow}$FOLDER${normal}
|
|
fi
|
|
|
|
# Options input
|
|
user_choice=$(zenity --list --checklist --width='600' --height='400' \
|
|
--title="Backup script by RavePriest1" \
|
|
--text="Select from the options below" \
|
|
--column="Select" --column="Name" \
|
|
FALSE "BACKUP All of My Data and Settings" \
|
|
FALSE "RESTORE All of My Data and Settings")
|
|
if [[ $? -eq 1 ]]; then
|
|
echo You did not pick an ${bold}${yellow}option.${normal} Exiting!
|
|
exit 1
|
|
fi
|
|
sudo echo
|
|
|
|
if [[ $user_choice = *"BACKUP All of My Data and Settings"* ]]; then
|
|
cd
|
|
Locale=$(locale | grep "LANG" -c)
|
|
Desktop=$XDG_CURRENT_DESKTOP
|
|
echo
|
|
echo -----------------------------------------------------
|
|
echo Copying ${bold}${yellow}$USER Settings and Files${normal} into ${bold}${yellow}$FOLDER/${normal}
|
|
|
|
rsync -ap --info=progress2 /home/$USER/Games $FOLDER
|
|
rsync -ap --info=progress2 /home/$USER/.librewolf $FOLDER 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.steam $FOLDER 2>/dev/null
|
|
|
|
mkdir -p $FOLDER/.config
|
|
rsync -ap --info=progress2 /home/$USER/.config/Bitwarden $FOLDER/.config 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.config/heroic $FOLDER/.config 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.config/input-remapper-2 $FOLDER/.config 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.config/Mumble $FOLDER/.config 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.config/libvirt $FOLDER/.config 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.config/corectrl $FOLDER/.config 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.config/corectrl.ini $FOLDER/.config 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.config/vivaldi $FOLDER/.config 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.config/BraveSoftware $FOLDER/.config 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.config/FreeTube $FOLDER/.config 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.config/dosbox-x $FOLDER/.config 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.config/pavucontrol.ini $FOLDER/.config 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.config/keepassxc $FOLDER/.config 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.config/spotify $FOLDER/.config 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.config/spotube $FOLDER/.config 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.config/qBittorrent $FOLDER/.config 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.config/kdeglobals $FOLDER/.config 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.config/kdenliverc $FOLDER/.config 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.config/kdenlive-layoutsrc $FOLDER/.config 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.config/Signal $FOLDER/.config 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.config/discord $FOLDER/.config 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.config/Vencord $FOLDER/.config 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.config/goverlay $FOLDER/.config 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.config/MangoHud $FOLDER/.config 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.config/easyeffects $FOLDER/.config 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.config/mc $FOLDER/.config 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.config/doublecmd $FOLDER/.config 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.config/monophony $FOLDER/.config 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.config/pamac $FOLDER/.config 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.config/kdeconnect $FOLDER/.config 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.config/Helvum $FOLDER/.config 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.config/calibre $FOLDER/.config 2>/dev/null
|
|
|
|
mkdir -p $FOLDER/.local/share/
|
|
rsync -ap --info=progress2 /home/$USER/.local/share/gnome-shell $FOLDER/.local/share 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.local/share/flatpak/overrides/ $FOLDER/.local/share/flatpak 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.local/share/lutris $FOLDER/.local/share 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.local/share/TelegramDesktop $FOLDER/.local/share 2>/dev/null
|
|
|
|
mkdir -p $FOLDER/.var/app/
|
|
rsync -ap --info=progress2 /home/$USER/.var/app/ $FOLDER/.var/app 2>/dev/null
|
|
|
|
mkdir $FOLDER/etc/
|
|
sudo rsync -ap --info=progress2 /etc/libvirt $FOLDER 2>/dev/null
|
|
|
|
sudo rsync -ap --info=progress2 /usr/share/jellyfin/web/config.json $FOLDER 2>/dev/null
|
|
|
|
if [[ $Locale == LANG=hu_HU.UTF-8 ]]; then
|
|
echo ${bold}${yellow}Hungarian Language detected.${normal}
|
|
# HU lang
|
|
rsync -ap --info=progress2 /home/$USER/Asztal/ $FOLDER/
|
|
rsync -ap --info=progress2 /home/$USER/Dokumentumok/ $FOLDER/
|
|
rsync -ap --info=progress2 /home/$USER/Letöltések/ $FOLDER/
|
|
rsync -ap --info=progress2 /home/$USER/Zenék/ $FOLDER/
|
|
rsync -ap --info=progress2 /home/$USER/Képek/ $FOLDER/
|
|
rsync -ap --info=progress2 /home/$USER/Videók/ $FOLDER/
|
|
else
|
|
echo ${bold}${yellow}English Language detected.${normal}
|
|
# EN lang
|
|
rsync -ap --info=progress2 /home/$USER/Desktop $FOLDER
|
|
rsync -ap --info=progress2 /home/$USER/Documents $FOLDER
|
|
rsync -ap --info=progress2 /home/$USER/Downloads $FOLDER
|
|
rsync -ap --info=progress2 /home/$USER/Music $FOLDER
|
|
rsync -ap --info=progress2 /home/$USER/Pictures $FOLDER
|
|
rsync -ap --info=progress2 /home/$USER/Videos $FOLDER
|
|
fi
|
|
|
|
if [[ $Desktop == GNOME ]]; then
|
|
# GNOME SECTION
|
|
echo ${bold}${yellow}GNOME Detected - Dumping Dconf${normal}
|
|
dconf dump / > $FOLDER/$USER-ui
|
|
else
|
|
# KDE Section
|
|
echo ${bold}${yellow}KDE Detected - Saving Konsave${normal}
|
|
konsave -s raveui-kde -f
|
|
rsync -ap --info=progress2 /home/$USER/.config/konsave $FOLDER/.config
|
|
mkdir -p $FOLDER/.local/state
|
|
rsync -ap --info=progress2 /home/$USER/.local/state/dolphinstaterc $FOLDER/.local/state
|
|
fi
|
|
|
|
echo ${bold}${yellow}$USER files and settings are copied. ${normal}
|
|
echo -----------------------------------------------------
|
|
echo
|
|
fi
|
|
|
|
if [[ $user_choice = *"Restore all of my data and settings"* ]]; then
|
|
Locale=$(locale | grep "LANG")
|
|
Desktop=$XDG_CURRENT_DESKTOP
|
|
echo
|
|
echo -----------------------------------------------------
|
|
echo Copying ${bold}${yellow}Restoring $USER Settings and Files ${normal} into ${bold}${yellow}$FOLDER/${normal}
|
|
|
|
sudo rsync -ap --info=progress2 $FOLDER/etc/libvirt /etc/
|
|
sudo rsync -ap --info=progress2 $FOLDER/config.json /usr/share/jellyfin/web/
|
|
rsync -ap --info=progress2 $FOLDER /home/$USER/
|
|
|
|
if [[ $Desktop == GNOME ]]; then
|
|
# GNOME SECTION
|
|
echo ${bold}${yellow}GNOME Detected - Loading Dconf${normal}
|
|
dconf load / < $FOLDER/$USER-ui
|
|
else
|
|
# KDE Section
|
|
echo ${bold}${yellow}KDE Detected - Loading Konsave${normal}
|
|
rsync -ap --info=progress2 $FOLDER/.local/state/dolphinstaterc /home/$USER/.local/state/
|
|
konsave -a raveui-kde
|
|
fi
|
|
echo -----------------------------------------------------
|
|
sudo chown -R $USER:$GROUP /home/$USER/
|
|
echo
|
|
echo ${bold}${yellow}$USER settings RESTORED! ${normal}
|
|
fi
|
|
|
|
exit 1 |