Guest User

My Origional Script For Optional Programs

a guest
Sep 5th, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 5.96 KB | None | 0 0
  1. #!/usr/bin/bash
  2.  
  3. cd ./Setup_Fedora_Sections
  4.  
  5. #Clean The Screen
  6. clear
  7.  
  8. #Opening Section
  9. 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.")
  10.  
  11. echo $WELCOME
  12.  
  13. echo $'\nDo you wish to continue? Y/N\n'
  14. while true; do
  15.     read -p "" yn
  16.     case $yn in
  17.         [Yy]* ) echo ""
  18.             break;;
  19.         [Nn]* ) clear
  20.             echo $WELCOME
  21.             echo $'\nBye.'
  22.             exit
  23.             break;;
  24.         * ) clear
  25.             echo $WELCOME
  26.             echo $'\nDo you wish to continue? Y/N\n';;
  27.     esac
  28. done
  29.  
  30. #Check if the system is already updated
  31. echo 'This script operates under the impression that you have an active internet connection.'
  32.  
  33. TEST=$(ping -c 1 74.125.21.14|wc -l)
  34. if [ $TEST -gt 5 2>&1 ]
  35.     then
  36.         echo 'Time to update.'
  37.         sudo dnf -y update
  38.         #Step two: continue to installing the optional programs programs
  39.         echo $'Now let\'s install the optional programs.'
  40.        ./Optional_Programs/Optional_Programs_Install_Menue.sh
  41.        exit
  42.    else
  43.        echo 'We have found that there is no active internet connection available. Wel will troubleshoot the issue.'
  44.        #Check network card status
  45.        WCARD_STATUS=$(ifconfig wlo1 | grep UP |wc -l)
  46.        if [ $WCARD_STATUS = 1 ]
  47.            then
  48.                echo 'We found that your wireless card is active, checking internet connection.'
  49.                TEST=$(ping -c 1 74.125.21.14|wc -l)
  50.                if [ $TEST -gt 5 2>&1 ]
  51.                    then
  52.                        echo 'We found an active internet connection, the system will now update..'
  53.                        sudo dnf -y update
  54.                        #Step two: continue to installing the optional programs programs
  55.                        echo $'Now let\'s install the optional programs programs.'
  56.                        ./Optional_Programs/Optional_Programs_Install_Menue.sh
  57.                        exit
  58.                    else
  59.                        echo $'We cannot find an active internet connection. Please connect to the network then try again? Y/N\n'
  60.                        while true; do
  61.                            read -p "" yn
  62.                            case $yn in
  63.                                [Yy]* ) ./Setup_Fedora_Optional_Programs.sh
  64.                                        exit
  65.                                        break;;
  66.                                [Nn]* ) echo "Okay bye then."
  67.                                        exit
  68.                                        break;;
  69.                                * ) echo $'Please connect to the network then try again? Y/N\n'
  70.                            esac
  71.                        done
  72.                fi
  73.            else
  74.                echo $'Your wireless card is inactive, do you wish to try run the install for it? Y/N\n'
  75.                while true; do
  76.                    read -p "" yn
  77.                    case $yn in
  78.                        [Yy]* ) ./Setup_Fedora_Install_Wireless_Card.sh
  79.                                break;;
  80.                        [Nn]* ) break;;
  81.                        * ) echo $'\nDo you wish to try to run the install of your wireless card? Y/N\n';;
  82.                    esac
  83.                done
  84.                echo "Checking the status of your ethernet card."
  85.                #Check if eno1 Network Card Is Available
  86.                ECARD_STATUS=$(ifconfig eno1 | grep UP |wc -l)
  87.                if [ $ECARD_STATUS = 1 ]
  88.                    then
  89.                        echo 'We found that your ethernet card is active, checking internet connection.'
  90.                                        TEST=$(ping -c 1 74.125.21.14|wc -l)
  91.                if [ $TEST -gt 5 2>&1 ]
  92.                    then
  93.                        echo 'We found an active internet connection, the system will now update..'
  94.                        sudo dnf -y update
  95.                        #Step two: continue to installing the optional programs programs
  96.                        echo $'Now let\'s install the optional programs programs.'
  97.                        ./Optional_Programs/Optional_Programs_Install_Menue.sh
  98.                        exit
  99.                    else
  100.                        echo $'We cannot find an active internet connection. Please connect to the network then try again? Y/N\n'
  101.                        while true; do
  102.                            read -p "" yn
  103.                            case $yn in
  104.                                [Yy]* ) ./Setup_Fedora_Optional_Programs.sh
  105.                                        exit
  106.                                        break;;
  107.                                [Nn]* ) echo "Okay bye then."
  108.                                        exit
  109.                                        break;;
  110.                                * ) echo $'Please connect to the network then try again? Y/N\n'
  111.                            esac
  112.                        done
  113.                fi
  114.                    else
  115.                        echo $'We found that your ethernet card is also inactive, do you wish to try to run the install of your wireless card? Y/N\n'
  116.                        while true; do
  117.                            read -p "" yn
  118.                            case $yn in
  119.                                [Yy]* ) ./Setup_Fedora_Install_Wireless_Card.sh
  120.                                        exit
  121.                                        break;;
  122.                                [Nn]* ) echo $'\nBye.'
  123.                                        exit
  124.                                        break;;
  125.                                * ) echo $'\nDo you wish to try to run the install of your wireless card? Y/N\n';;
  126.                        esac
  127.                    done
  128.                        
  129.                fi
  130.        fi
  131. fi
  132. exit
Advertisement
Add Comment
Please, Sign In to add comment