restore-source-code.sh
1 #!/bin/bash 2 3 # Exit on error 4 set -e 5 6 echo "╔════════════════════════════════════════════════════════════════╗" 7 echo "║ ║" 8 echo "║ KeepSync Source Code Restorer ║" 9 echo "║ ║" 10 echo "╚════════════════════════════════════════════════════════════════╝" 11 12 # Directories to restore 13 DIRS=( 14 "cmd/keepsync-cli-standalone" 15 "cmd/keepsync-cli" 16 "internal/cloud/provider" 17 "internal/security/tpm" 18 "internal/sync" 19 "internal/compression" 20 "internal/multifile" 21 "internal/cloud/retry" 22 ) 23 24 # Restore files from git repository 25 for dir in "${DIRS[@]}"; do 26 echo "Restoring files in $dir..." 27 mkdir -p "$dir" 28 29 # Get list of files in the directory from git 30 files=$(git ls-files "$dir/") 31 32 # Restore each file 33 for file in $files; do 34 echo " Restoring $file..." 35 mkdir -p "$(dirname "$file")" 36 git show HEAD:"$file" > "$file" 37 done 38 done 39 40 echo "╔════════════════════════════════════════════════════════════════╗" 41 echo "║ ║" 42 echo "║ Source Code Restoration Complete ║" 43 echo "║ ║" 44 echo "╚════════════════════════════════════════════════════════════════╝" 45 46 echo "The source code has been restored from the git repository." 47 echo "You can now build the fully integrated binary with all features."