hyprland-dotfiles/.install/restore.sh

74 lines
2.9 KiB
Bash
Raw Normal View History

2023-11-10 21:12:15 +00:00
# ------------------------------------------------------
# Restore
# ------------------------------------------------------
if [ -d ~/dotfiles ]; then
2023-11-17 12:48:02 +00:00
echo -e "${GREEN}"
2023-11-10 21:12:15 +00:00
cat <<"EOF"
____ _
| _ \ ___ ___| |_ ___ _ __ ___
| |_) / _ \/ __| __/ _ \| '__/ _ \
| _ < __/\__ \ || (_) | | | __/
|_| \_\___||___/\__\___/|_| \___|
EOF
2023-11-17 12:48:02 +00:00
echo -e "${NONE}"
restored=0
2023-11-10 21:12:15 +00:00
echo "The script will try to restore existing configurations."
echo "PLEASE NOTE: Restoring is not possible with version < 2.5 of the dotfiles."
2023-11-17 12:48:02 +00:00
echo "In that case, please use the autamated backup or create your own backup manually."
2023-11-10 21:12:15 +00:00
echo ""
2023-11-17 12:48:02 +00:00
echo "The following configurations can be transferred into the new installation."
2023-11-10 21:12:15 +00:00
if [ -f ~/dotfiles/.bashrc ]; then
2023-11-17 12:48:02 +00:00
echo ".bashrc file: ~/dotfiles/.bashrc"
2023-11-10 21:12:15 +00:00
fi
2023-11-21 20:19:51 +00:00
if [[ $profile == *"Hyprland"* ]]; then
2023-11-10 21:12:15 +00:00
if [ -f ~/dotfiles/hypr/conf/keyboard.conf ]; then
2023-11-17 12:48:02 +00:00
echo "Hyprland keyboard layout: ~/dotfiles/hypr/conf/keyboard.conf"
2023-11-10 21:12:15 +00:00
fi
if [ -f ~/dotfiles/hypr/conf/monitor.conf ]; then
2023-11-17 12:48:02 +00:00
echo "Hyprland monitor setup: ~/dotfiles/hypr/conf/monitor.conf"
2023-11-10 21:12:15 +00:00
fi
if [ -f ~/dotfiles/hypr/conf/keybindings.conf ]; then
2023-11-17 12:48:02 +00:00
echo "Hyprland keybindings: ~/dotfiles/hypr/conf/keybindings.conf"
2023-11-10 21:12:15 +00:00
fi
fi
2023-11-21 20:19:51 +00:00
if [[ $profile == *"Qtile"* ]]; then
2023-11-10 21:12:15 +00:00
if [ -f ~/dotfiles/qtile/conf/keyboard.py ]; then
2023-11-17 12:48:02 +00:00
echo "Qtile keyboard layout: ~/dotfiles/qtile/conf/keyboard.py"
2023-11-10 21:12:15 +00:00
fi
fi
echo ""
2023-11-20 21:11:39 +00:00
if gum confirm "Do you want to restore the files now and use it on your new installation?" ;then
2023-11-21 20:19:51 +00:00
if [ -f ~/dotfiles/.bashrc ]; then
cp ~/dotfiles/.bashrc ~/dotfiles-versions/$version/
echo ".bashrc restored!"
fi
if [[ $profile == *"Hyprland"* ]]; then
if [ -f ~/dotfiles/hypr/conf/keyboard.conf ]; then
cp ~/dotfiles/hypr/conf/keyboard.conf ~/dotfiles-versions/$version/hypr/conf/
echo "Hyprland keyboard.conf restored!"
fi
if [ -f ~/dotfiles/hypr/conf/monitor.conf ]; then
cp ~/dotfiles/hypr/conf/monitor.conf ~/dotfiles-versions/$version/hypr/conf/
echo "Hyprland monitor.conf restored!"
2023-11-20 21:11:39 +00:00
fi
2023-11-21 20:19:51 +00:00
if [ -f ~/dotfiles/hypr/conf/keybindings.conf ]; then
cp ~/dotfiles/hypr/conf/keybindings.conf ~/dotfiles-versions/$version/hypr/conf/
echo "Hyprland keybindings.conf restored!"
2023-11-20 21:11:39 +00:00
fi
2023-11-21 20:19:51 +00:00
fi
if [[ $profile == *"Qtile"* ]]; then
if [ -f ~/dotfiles/qtile/conf/keyboard.py ]; then
cp ~/dotfiles/qtile/conf/keyboard.py ~/dotfiles-versions/$version/qtile/conf/
echo "Qtile keyboard.py restored!"
2023-11-20 21:11:39 +00:00
fi
2023-11-21 20:19:51 +00:00
fi
restored=1
elif [ $? -eq 130 ]; then
exit 130
2023-11-20 21:11:39 +00:00
else
echo "Restore skipped"
fi
2023-11-17 12:48:02 +00:00
echo ""
2023-11-10 21:12:15 +00:00
fi