Hyprland-dotfiles/.install/restore.sh

79 lines
3.3 KiB
Bash
Raw Normal View History

2023-11-10 16:12:15 -05:00
# ------------------------------------------------------
# Restore
# ------------------------------------------------------
if [ -d ~/dotfiles ]; then
2023-11-17 07:48:02 -05:00
echo -e "${GREEN}"
2023-11-10 16:12:15 -05:00
cat <<"EOF"
____ _
| _ \ ___ ___| |_ ___ _ __ ___
| |_) / _ \/ __| __/ _ \| '__/ _ \
| _ < __/\__ \ || (_) | | | __/
|_| \_\___||___/\__\___/|_| \___|
EOF
2023-11-17 07:48:02 -05:00
echo -e "${NONE}"
restored=0
2023-11-10 16:12:15 -05: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 07:48:02 -05:00
echo "In that case, please use the autamated backup or create your own backup manually."
2023-11-10 16:12:15 -05:00
echo ""
2023-11-17 07:48:02 -05:00
echo "The following configurations can be transferred into the new installation."
2023-11-10 16:12:15 -05:00
if [ -f ~/dotfiles/.bashrc ]; then
2023-11-17 07:48:02 -05:00
echo ".bashrc file: ~/dotfiles/.bashrc"
2023-11-10 16:12:15 -05:00
fi
if [ $profile == "Hyprland" ] || [ $profile == "All" ]; then
if [ -f ~/dotfiles/hypr/conf/keyboard.conf ]; then
2023-11-17 07:48:02 -05:00
echo "Hyprland keyboard layout: ~/dotfiles/hypr/conf/keyboard.conf"
2023-11-10 16:12:15 -05:00
fi
if [ -f ~/dotfiles/hypr/conf/monitor.conf ]; then
2023-11-17 07:48:02 -05:00
echo "Hyprland monitor setup: ~/dotfiles/hypr/conf/monitor.conf"
2023-11-10 16:12:15 -05:00
fi
if [ -f ~/dotfiles/hypr/conf/keybindings.conf ]; then
2023-11-17 07:48:02 -05:00
echo "Hyprland keybindings: ~/dotfiles/hypr/conf/keybindings.conf"
2023-11-10 16:12:15 -05:00
fi
fi
if [ $profile == "Qtile" ] || [ $profile == "All" ]; then
if [ -f ~/dotfiles/qtile/conf/keyboard.py ]; then
2023-11-17 07:48:02 -05:00
echo "Qtile keyboard layout: ~/dotfiles/qtile/conf/keyboard.py"
2023-11-10 16:12:15 -05:00
fi
fi
echo ""
2023-11-17 07:48:02 -05:00
while true; do
read -p "Do you want to restore the files now and use it on your new installation (Yy/Nn): " yn
case $yn in
[Yy]* )
if [ -f ~/dotfiles/.bashrc ]; then
cp ~/dotfiles/.bashrc ~/dotfiles-versions/$version/
echo ".bashrc restored!"
fi
if [ $profile == "Hyprland" ] || [ $profile == "All" ]; 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!"
fi
if [ -f ~/dotfiles/hypr/conf/keybindings.conf ]; then
cp ~/dotfiles/hypr/conf/keybindings.conf ~/dotfiles-versions/$version/hypr/conf/
echo "Hyprland keybindings.conf restored!"
fi
fi
if [ $profile == "Qtile" ] || [ $profile == "All" ]; 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!"
fi
fi
restored=1
break;;
[Nn]* )
break;;
* ) echo "Please answer yes or no.";;
esac
done
echo ""
2023-11-10 16:12:15 -05:00
fi