moveout.sh 839 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/usr/bin/zsh
  2. #echo "Username?"
  3. #read username
  4. #echo "Server?"
  5. #read server
  6. #echo "Foreign path?"
  7. #read fpath
  8. #echo "Syncing Files"
  9. #rsync -rlpE --progress --delete ~ ${username}@${server}:${foreignpath}
  10. echo "Copying rpm install db, this may take time!"
  11. rpm -qa --qf "%{NAME}\n" >rpmdb.txt
  12. echo "Copying crontab."
  13. crontab -l >crontab.txt
  14. echo "Moving repos.d."
  15. mkdir repos.d
  16. sudo cp -r /etc/yum.repos.d repos.d
  17. echo "Creating movein.sh"
  18. cat <<EOF >movein.sh
  19. #!/usr/bin/bash
  20. echo "Reconstituting Crontab"
  21. cat crontab.txt | crontab
  22. echo "Reconstituting yum repos"
  23. sudo cp -r repos.d /etc/yum.repos.d
  24. echo "Reconstituting software"
  25. software = `cat rpmdb.txt`
  26. for \$pack in "\${software[@]}"
  27. do
  28. yum install \$pack
  29. done
  30. #echo "Syncing Files"
  31. #rsync -rlpE --delete ~ ${username}@${server}:${foreignpath}
  32. EOF
  33. chmod 0777 movein.sh