Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/bash
- cd ./Setup_Fedora_Sections
- function Welcome {
- #Opening Section
- 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.")
- echo $WELCOME
- echo $'\nDo you wish to continue? Y/N\n'
- while true; do
- read -p "" yn
- case $yn in
- [Yy]* ) echo ""
- break;;
- [Nn]* ) clear
- echo $WELCOME
- echo $'\nBye.'
- exit
- break;;
- * ) clear
- echo $WELCOME
- echo $'\nDo you wish to continue? Y/N\n';;
- esac
- done
- return 0
- }
- function CopyRepoFiles {
- echo $'Have the repository files been already copied over? Y/N\n'
- while true; do
- read -p "" yn
- case $yn in
- [Yy]* ) sudo cp -vf ./Outside_Required_Files/Repositories/*.repo /etc/yum.repos.d/
- TestInternet
- break;;
- [Nn]* ) TestInternet
- break;;
- * ) echo $'Have the repository files been already copied over? Y/N\n'
- esac
- done
- return 0
- }
- function Update {
- echo 'Time to update.'
- sudo dnf -y update
- return 0
- }
- function PostInstallMenue {
- #Step two: continue to installing the optional programs programs
- echo $'Now let\'s install the optional programs.'
- ./Optional_Programs/Optional_Programs_Install_Menue.sh
- exit
- return 0
- }
- function ConnectToNetwork {
- echo $'We cannot find an active internet connection. Please connect to the network then try again? Y/N\n'
- while true; do
- read -p "" yn
- case $yn in
- [Yy]* ) TestInternet
- exit
- break;;
- [Nn]* ) echo "Okay bye then."
- exit
- break;;
- * ) echo $'Please connect to the network then try again? Y/N\n'
- esac
- done
- return 0
- }
- function InstallWirelessCard {
- echo $'Your wireless card is inactive, do you wish to try run the install for it? Y/N\n'
- while true; do
- read -p "" yn
- case $yn in
- [Yy]* ) ./Setup_Fedora_Install_Wireless_Card.sh
- break;;
- [Nn]* ) echo 'Okay bye.'
- break;;
- * ) echo $'\nDo you wish to try to run the install of your wireless card? Y/N\n';;
- esac
- done
- return 0
- }
- function TestEthernet {
- echo "Checking the status of your ethernet card."
- #Check if eno1 Network Card Is Available
- ECARD_STATUS=$(ifconfig eno1 | grep UP |wc -l)
- if [ $ECARD_STATUS = 1 ]
- then
- TestInternetSpecial
- else
- InstallWirelessCard
- fi
- return 0
- }
- function TestInternetSpecial {
- #Test for internet connection
- TEST=$(ping -c 1 74.125.21.14|wc -l)
- if [ $TEST -gt 5 2>&1 ]
- then
- Update
- PostInstallMenue
- else
- ConnectToNetwork
- fi
- return 0
- }
- function TestWireless {
- #Check if wlo1 Network Card Is Available
- echo 'Checking the status of your wireless card'
- WCARD_STATUS=$(ifconfig wlo1 | grep UP |wc -l)
- if [ $WCARD_STATUS = 1 ]
- then
- echo 'We found that your wireless card is active, checking internet connection.'
- TestInternetSpecial
- else
- TestEthernet
- fi
- return 0
- }
- function TestInternet {
- #Test for internet connection
- TEST=$(ping -c 1 74.125.21.14|wc -l)
- if [ $TEST -gt 5 2>&1 ]
- then
- Update
- PostInstallMenue
- else
- echo 'We have found that there is no active internet connection available. Wel will troubleshoot the issue.'
- TestWireless
- fi
- return 0
- }
- function Main {
- #Clean The Screen
- clear
- Welcome
- echo 'This script operates under the impression that you have an active internet connection.'
- CopyRepoFiles
- return 0
- }
- Main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement