190 lines
No EOL
10 KiB
Bash
190 lines
No EOL
10 KiB
Bash
#!/bin/bash
|
|
|
|
Locale=$(locale | grep "LANG")
|
|
Desktop=$XDG_CURRENT_DESKTOP
|
|
|
|
# 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' 2>/dev/null
|
|
|
|
# Folder variable
|
|
FOLDER=$(zenity --file-selection --title="Choose a backup directory" --directory 2>/dev/null )
|
|
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" 2>/dev/null )
|
|
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
|
|
echo
|
|
echo -----------------------------------------------------
|
|
echo Copying ${bold}${yellow}$USER Settings and Files${normal} into ${bold}${yellow}$FOLDER/${normal}
|
|
|
|
rsync -ap --info=progress2 /home/$USER/Games $FOLDER 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.librewolf $FOLDER 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.steam $FOLDER 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.icons $FOLDER 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.themes $FOLDER 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.mozilla $FOLDER 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.ts3client $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/burn-my-windows $FOLDER/.config 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.config/btop $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/czkawka $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/libreoffice $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/gtk-4.0 $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/onlyoffice $FOLDER/.config 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.config/jellyfin.org $FOLDER/.config 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.config/nomacs $FOLDER/.config 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.config/tutanota-desktop $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/smplayer $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/torbrowser $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
|
|
rsync -ap --info=progress2 /home/$USER/.local/share/jellyfinmediaplayer $FOLDER/.local/share 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.local/share/Jellyfin\ Media\ Player/ $FOLDER/.local/share 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.local/share/Steam $FOLDER/.local/share 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.local/share/oss.krtirtho.spotube $FOLDER/.local/share 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.local/share/org.gnome.TextEditor $FOLDER/.local/share 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.local/share/kdenlive $FOLDER/.local/share 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.local/share/krusader $FOLDER/.local/share 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/Mumble $FOLDER/.local/share 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.local/share/nomacs $FOLDER/.local/share 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.local/share/onlyoffice $FOLDER/.local/share 2>/dev/null
|
|
rsync -ap --info=progress2 /home/$USER/.local/share/torbrowser $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 -p $FOLDER/etc/
|
|
sudo rsync -ap --info=progress2 /etc/libvirt $FOLDER/etc 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
|
|
rsync -ap --info=progress2 /home/$USER/Calibre\ Library/ $FOLDER 2>/dev/null
|
|
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
|
|
rsync -ap --info=progress2 /home/$USER/Calibre\ Library/ $FOLDER 2>/dev/null
|
|
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 backed up! ${normal}
|
|
echo -----------------------------------------------------
|
|
echo
|
|
|
|
sudo chown -R $USER:$GROUP $FOLDER
|
|
echo ${bold}${yellow} BACKUP SCRIPT FINISHED SUCCESSFULLY! ${normal}
|
|
fi
|
|
|
|
if [[ $user_choice = *"RESTORE All of My Data and Settings"* ]]; then
|
|
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/ 2>/dev/null
|
|
sudo rsync -ap --info=progress2 $FOLDER/config.json /usr/share/jellyfin/web/ 2>/dev/null
|
|
sudo 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
|
|
echo
|
|
echo ${bold}${yellow} Dconf loaded${normal}
|
|
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}SETTINGS RESTORED SUCCESSFULLY! ${normal}
|
|
fi |