Advertisement
Guest User

Untitled

a guest
Jul 14th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. %post
  2.  
  3. import()
  4. {
  5. echo "Do you want to import file?"
  6. select INPUT in "Y" "N"; do
  7. case $INPUT in
  8. Y ) echo "You selected to import file";break;;
  9. N ) echo "Exiting";exit 0;break;;
  10. esac
  11. done
  12.  
  13. read -p "Please file path: " FILE
  14. if [ -d "$FILE" ]; then
  15. cp $FILE/myFile /opt/tmp/
  16. echo "Done!"
  17. else
  18. echo "No File Path."
  19. done=0
  20. while [ $done = 0 ]
  21. do
  22. echo "Do you want to abort"
  23. select INPUT in "Y" "N";
  24. do
  25. case $INPUT in
  26. Y )
  27. echo "Aborting"
  28. done=1
  29. break
  30. ;;
  31. N )
  32. echo "You selected to import"
  33. # break
  34. #;;
  35. read -p "Please provide the directory : " FILE
  36. if [ -d "$FILE" ]; then
  37. cp $FILE/myFile /opt/tmp
  38. echo "Done"
  39. done=1
  40. else
  41. echo "Aborting."
  42. fi
  43. break
  44. ;;
  45. esac
  46. done
  47. done
  48.  
  49. fi
  50. }
  51.  
  52. import
  53. exit 0
  54.  
  55. if ! exec </dev/tty; then
  56. : "deal with the case where you simply can't read from the user here"
  57. exit
  58. fi
  59.  
  60. # ...the read command will work here.
  61.  
  62. mount -t cifs //1.2.3.4/share /var/www/html -o username=user
  63.  
  64. Password:
  65.  
  66. echo "Do you want to install <some package> [Y/n] "
  67. if exec </dev/tty; then
  68. read input;
  69. fi
  70.  
  71. # use input here or below
  72.  
  73. echo "Do you want to install <some package> [Y/n] " >/dev/tty
  74. if exec </dev/tty; then
  75. read input;
  76. fi
  77.  
  78. # use input here or below
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement