Advertisement
Guest User

Post Install Script In Question

a guest
Sep 4th, 2016
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.23 KB | None | 0 0
  1. #!/usr/bin/bash
  2.  
  3. cd ./Setup_Fedora_Sections
  4.  
  5. function Welcome {
  6. #Opening Section
  7. WELCOME=$(echo "Welcome to Setup Fedora: Optional Programs section written by Dustin T. Carr! This script is ment to be run whenever Fedora is newly installed as it contains the programs that are not neccessary for your system to run and be basically useful after a clean install.")
  8.  
  9. echo $WELCOME
  10.  
  11. echo $'\nDo you wish to continue? Y/N\n'
  12. while true; do
  13. read -p "" yn
  14. case $yn in
  15. [Yy]* ) echo ""
  16. break;;
  17. [Nn]* ) clear
  18. echo $WELCOME
  19. echo $'\nBye.'
  20. exit
  21. break;;
  22. * ) clear
  23. echo $WELCOME
  24. echo $'\nDo you wish to continue? Y/N\n';;
  25. esac
  26. done
  27. return 0
  28. }
  29.  
  30. function CopyRepoFiles {
  31. echo $'Have the repository files been already copied over? Y/N\n'
  32. while true; do
  33. read -p "" yn
  34. case $yn in
  35. [Yy]* ) sudo cp -vf ./Outside_Required_Files/Repositories/*.repo /etc/yum.repos.d/
  36. TestInternet
  37. break;;
  38. [Nn]* ) TestInternet
  39. break;;
  40. * ) echo $'Have the repository files been already copied over? Y/N\n'
  41. esac
  42. done
  43. return 0
  44. }
  45.  
  46. function Update {
  47. echo 'Time to update.'
  48. sudo dnf -y update
  49. return 0
  50. }
  51.  
  52. function PostInstallMenue {
  53. #Step two: continue to installing the optional programs programs
  54. echo $'Now let\'s install the optional programs.'
  55. ./Optional_Programs/Optional_Programs_Install_Menue.sh
  56. exit
  57. return 0
  58. }
  59.  
  60. function ConnectToNetwork {
  61. echo $'We cannot find an active internet connection. Please connect to the network then try again? Y/N\n'
  62. while true; do
  63. read -p "" yn
  64. case $yn in
  65. [Yy]* ) TestInternet
  66. exit
  67. break;;
  68. [Nn]* ) echo "Okay bye then."
  69. exit
  70. break;;
  71. * ) echo $'Please connect to the network then try again? Y/N\n'
  72. esac
  73. done
  74. return 0
  75. }
  76.  
  77. function InstallWirelessCard {
  78. echo $'Your wireless card is inactive, do you wish to try run the install for it? Y/N\n'
  79. while true; do
  80. read -p "" yn
  81. case $yn in
  82. [Yy]* ) ./Setup_Fedora_Install_Wireless_Card.sh
  83. break;;
  84. [Nn]* ) echo 'Okay bye.'
  85. break;;
  86. * ) echo $'\nDo you wish to try to run the install of your wireless card? Y/N\n';;
  87. esac
  88. done
  89. return 0
  90. }
  91.  
  92. function TestEthernet {
  93. echo "Checking the status of your ethernet card."
  94. #Check if eno1 Network Card Is Available
  95. ECARD_STATUS=$(ifconfig eno1 | grep UP |wc -l)
  96. if [ $ECARD_STATUS = 1 ]
  97. then
  98. TestInternetSpecial
  99. else
  100. InstallWirelessCard
  101. fi
  102. return 0
  103. }
  104.  
  105. function TestInternetSpecial {
  106. #Test for internet connection
  107. TEST=$(ping -c 1 74.125.21.14|wc -l)
  108. if [ $TEST -gt 5 2>&1 ]
  109. then
  110. Update
  111. PostInstallMenue
  112. else
  113. ConnectToNetwork
  114. fi
  115. return 0
  116. }
  117.  
  118. function TestWireless {
  119. #Check if wlo1 Network Card Is Available
  120. echo 'Checking the status of your wireless card'
  121. WCARD_STATUS=$(ifconfig wlo1 | grep UP |wc -l)
  122. if [ $WCARD_STATUS = 1 ]
  123. then
  124. echo 'We found that your wireless card is active, checking internet connection.'
  125. TestInternetSpecial
  126. else
  127. TestEthernet
  128. fi
  129. return 0
  130. }
  131.  
  132. function TestInternet {
  133. #Test for internet connection
  134. TEST=$(ping -c 1 74.125.21.14|wc -l)
  135. if [ $TEST -gt 5 2>&1 ]
  136. then
  137. Update
  138. PostInstallMenue
  139. else
  140. echo 'We have found that there is no active internet connection available. Wel will troubleshoot the issue.'
  141. TestWireless
  142. fi
  143. return 0
  144. }
  145.  
  146. function Main {
  147. #Clean The Screen
  148. clear
  149. Welcome
  150. echo 'This script operates under the impression that you have an active internet connection.'
  151. CopyRepoFiles
  152. return 0
  153. }
  154.  
  155. Main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement