diff --git a/.dev/copy.sh b/.dev/copy.sh deleted file mode 100755 index f44e86f..0000000 --- a/.dev/copy.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -rsync -av --exclude-from=excludes.txt ../ ~/dotfiles/ diff --git a/.dev/excludes.txt b/.dev/excludes.txt index 6c51e38..e9d31e7 100644 --- a/.dev/excludes.txt +++ b/.dev/excludes.txt @@ -11,4 +11,4 @@ keyboard.conf keyboard.py animation.conf decoration.conf -window.conf +window.conf \ No newline at end of file diff --git a/.dev/sync.sh b/.dev/sync.sh new file mode 100755 index 0000000..6d29357 --- /dev/null +++ b/.dev/sync.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# Execute the script with ./sync version e.g., ./sync 2.5.2 + +if [ ! -z $1 ] ;then + if [ -d ~/dotfiles-versions/"$1" ] ;then + echo "Folder exists. Start rsync now ..." + rsync -avzh --exclude-from=excludes.txt ~/dotfiles-versions/$1/ ~/dotfiles + else + echo "Folder ~/dotfiles-versions/$1 not found." + fi +else + echo "No folder specified. Please use ./sync folder" +fi \ No newline at end of file diff --git a/.install/preparation.sh b/.install/preparation.sh index 229ad02..8684f09 100644 --- a/.install/preparation.sh +++ b/.install/preparation.sh @@ -13,7 +13,6 @@ cat <<"EOF" EOF echo -e "${NONE}" echo "Preparing temporary folders for the installation." -echo "" if [ ! -d ~/dotfiles-versions ]; then mkdir ~/dotfiles-versions echo "~/dotfiles-versions folder created." @@ -23,11 +22,9 @@ if [ ! -d ~/dotfiles-versions/$version ]; then echo "~/dotfiles-versions/$version folder created." else echo "The folder ~/dotfiles-versions/$version already exists from previous installations." - echo "" rm -fr ~/dotfiles-versions/$version mkdir ~/dotfiles-versions/$version echo "Clean build prepared for the installation." - echo "" fi rsync -a --exclude-from=.install/excludes.txt . ~/dotfiles-versions/$version/ echo "dotfiles $version successfully prepared in ~/dotfiles-versions/$version/" diff --git a/.install/restore.sh b/.install/restore.sh old mode 100644 new mode 100755 index 589e68c..e93b95d --- a/.install/restore.sh +++ b/.install/restore.sh @@ -2,7 +2,110 @@ # Restore # ------------------------------------------------------ +restorelist="" + +_showRestoreOptions() { + echo "The following configurations can be transferred into the new installation:" + echo "(SPACE = select/unselect a profile. RETURN = confirm. No selection = CANCEL)" + echo "" + restorelist="" + if [ -f ~/dotfiles/.bashrc ]; then + restorelist+="~/dotfiles/.bashrc " + fi + if [[ $profile == *"Hyprland"* ]]; then + if [ -f ~/dotfiles/hypr/conf/keyboard.conf ]; then + restorelist+="~/dotfiles/hypr/conf/keyboard.conf " + fi + if [ -f ~/dotfiles/hypr/conf/keybindings.conf ]; then + restorelist+="~/dotfiles/hypr/conf/keybindings.conf " + fi + if [ -f ~/dotfiles/hypr/conf/monitor.conf ] && [ -d ~/dotfiles/hypr/conf/monitor/ ]; then + restorelist+="~/dotfiles/hypr/conf/monitor.conf " + fi + if [ -f ~/dotfiles/hypr/conf/animation.conf ] && [ -d ~/dotfiles/hypr/conf/animation/ ]; then + restorelist+="~/dotfiles/hypr/conf/animation.conf " + fi + if [ -f ~/dotfiles/hypr/conf/decoration.conf ] && [ -d ~/dotfiles/hypr/conf/decorations/ ]; then + restorelist+="~/dotfiles/hypr/conf/decoration.conf " + fi + if [ -f ~/dotfiles/hypr/conf/window.conf ] && [ -d ~/dotfiles/hypr/conf/windows/ ]; then + restorelist+="~/dotfiles/hypr/conf/window.conf " + fi + fi + if [[ $profile == *"Qtile"* ]]; then + if [ -f ~/dotfiles/qtile/conf/keyboard.py ]; then + restorelist+="~/dotfiles/qtile/conf/keyboard.py " + fi + fi + if [ ! -z "$restorelist" ] ;then + restorelist+="All" + fi + restoreselect=$(gum choose --no-limit --cursor-prefix "( ) " --selected-prefix "(x) " --unselected-prefix "( ) " $restorelist) + if [ ! -z "$restoreselect" ] ;then + echo "Selected to restore:" + echo "$restoreselect" + echo "" + confirmrestore=$(gum choose "Start restore" "Change restore" "Cancel restore") + if [ "$confirmrestore" == "Start restore" ] ;then + _startRestore + elif [ "$confirmrestore" == "Change restore" ]; then + _showRestoreOptions + else + echo "Restore skipped." + return 0 + fi + else + echo "No files selected to restore." + confirmrestore=$(gum choose "Change restore" "Cancel restore") + if [ "$confirmrestore" == "Change restore" ]; then + echo "" + _showRestoreOptions + else + echo "Restore skipped." + return 0 + fi + fi +} + +_startRestore() { + if [[ $restoreselect == *"~/dotfiles/.bashrc"* ]] || [[ $restoreselect == *"All"* ]] ; then + cp ~/dotfiles/.bashrc ~/dotfiles-versions/$version/ + echo ".bashrc restored!" + fi + if [[ $restoreselect == *"~/dotfiles/hypr/conf/keyboard.conf"* ]] || [[ $restoreselect == *"All"* ]] ; then + cp ~/dotfiles/hypr/conf/keyboard.conf ~/dotfiles-versions/$version/hypr/conf/ + echo "Hyprland keyboard.conf restored!" + fi + if [[ $restoreselect == *"~/dotfiles/hypr/conf/monitor.conf"* ]] || [[ $restoreselect == *"All"* ]] ; then + cp ~/dotfiles/hypr/conf/monitor.conf ~/dotfiles-versions/$version/hypr/conf/ + echo "Hyprland monitor.conf restored!" + fi + if [[ $restoreselect == *"~/dotfiles/hypr/conf/keybindings.conf"* ]] || [[ $restoreselect == *"All"* ]] ; then + cp ~/dotfiles/hypr/conf/keybindings.conf ~/dotfiles-versions/$version/hypr/conf/ + echo "Hyprland keybindings.conf restored!" + fi + if [[ $restoreselect == *"~/dotfiles/hypr/conf/animation.conf"* ]] || [[ $restoreselect == *"All"* ]] ; then + cp ~/dotfiles/hypr/conf/animation.conf ~/dotfiles-versions/$version/hypr/conf/ + echo "Hyprland animation.conf restored!" + fi + if [[ $restoreselect == *"~/dotfiles/hypr/conf/decoration.conf"* ]] || [[ $restoreselect == *"All"* ]] ; then + cp ~/dotfiles/hypr/conf/decoration.conf ~/dotfiles-versions/$version/hypr/conf/ + echo "Hyprland decoration.conf restored!" + fi + if [[ $restoreselect == *"~/dotfiles/hypr/conf/window.conf"* ]] || [[ $restoreselect == *"All"* ]] ; then + cp ~/dotfiles/hypr/conf/window.conf ~/dotfiles-versions/$version/hypr/conf/ + echo "Hyprland keybindings.conf restored!" + fi + if [[ $restoreselect == *"~/dotfiles/qtile/conf/keyboard.py"* ]] || [[ $restoreselect == *"All"* ]] ; then + cp ~/dotfiles/qtile/conf/keyboard.py ~/dotfiles-versions/$version/qtile/conf/ + echo "Qtile keyboard.py restored!" + fi + restored=1 + return 0 +} + if [ -d ~/dotfiles ]; then + echo -e "${GREEN}" cat <<"EOF" ____ _ @@ -16,59 +119,10 @@ echo -e "${NONE}" restored=0 echo "The script will try to restore existing configurations." echo "PLEASE NOTE: Restoring is not possible with version < 2.5 of the dotfiles." - echo "In that case, please use the autamated backup or create your own backup manually." + echo "In that case, please use the automated backup or create your own backup manually." echo "" - echo "The following configurations can be transferred into the new installation." - if [ -f ~/dotfiles/.bashrc ]; then - echo ".bashrc file: ~/dotfiles/.bashrc" - fi - if [[ $profile == *"Hyprland"* ]]; then - if [ -f ~/dotfiles/hypr/conf/keyboard.conf ]; then - echo "Hyprland keyboard layout: ~/dotfiles/hypr/conf/keyboard.conf" - fi - if [ -f ~/dotfiles/hypr/conf/monitor.conf ]; then - echo "Hyprland monitor setup: ~/dotfiles/hypr/conf/monitor.conf" - fi - if [ -f ~/dotfiles/hypr/conf/keybindings.conf ]; then - echo "Hyprland keybindings: ~/dotfiles/hypr/conf/keybindings.conf" - fi - fi - if [[ $profile == *"Qtile"* ]]; then - if [ -f ~/dotfiles/qtile/conf/keyboard.py ]; then - echo "Qtile keyboard layout: ~/dotfiles/qtile/conf/keyboard.py" - fi - fi - echo "" - if gum confirm "Do you want to restore the files now and use it on your new installation?" ;then - 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!" - 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"* ]]; 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 - elif [ $? -eq 130 ]; then - exit 130 - else - echo "Restore skipped" - fi + + _showRestoreOptions + echo "" fi \ No newline at end of file diff --git a/text.txt b/text.txt deleted file mode 100644 index e69de29..0000000