unixwz0r

UNIXwz0r - network-setup (re-written with dialog)

Jan 22nd, 2015
377
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.63 KB | None | 0 0
  1. #!/bin/bash
  2. #----------------------------------------------------------------------------------------
  3. # Script Created by Gary Perreault - Tux Hat Linux Project ([email protected])
  4. # IRC Freenode #bsdgeekclub @UNIXwz0r @Vincent0ne-
  5. # Distro Sourceforge - https://sourceforge.net/projects/tuxhatlinux/
  6. # Distro Youtube - https://www.youtube.com/channel/UCDXUtAdTuZSRDFgBHC2gaGA
  7. # Distro Pastebin - http://pastebin.com/u/unixwz0r
  8. # Distro Deviantart -http://ipodpunker.deviantart.com/
  9. # Distro Dailymotion - http://www.dailymotion.com/tuxhatlinux
  10. #----------------------------------------------------------------------------------------
  11. #This program is free software: you can redistribute it and/or modify
  12. #it under the terms of the GNU General Public License as published by
  13. #the Free Software Foundation, either version 3 of the License, or
  14. #(at your option) any later version.
  15. #
  16. #This program is distributed in the hope that it will be useful,
  17. #but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19. #GNU General Public License for more details.
  20. #
  21. #You should have received a copy of the GNU General Public License
  22. #along with this program.  If not, see <http://www.gnu.org/licenses/>.
  23. #----------------------------------------------------------------------------------------
  24. # Run this script after your first boot with archlinux (as root)
  25. #----------------------------------------------------------------------------------------
  26. # Explaination of the Script:
  27. #
  28. # Setup-Tuxhat using Dialog. The main menu script has like 8 seperate setup scripts.
  29. #
  30. # Scripts are listed in # Scripts below
  31. ##########################################################################################
  32.  
  33. # Top program dir is used for testing
  34.  
  35. #Global Settings
  36.  
  37. SYSTEMCTL1="systemctl enable NetworkManager.service"
  38. SYSTEMCTL2="systemctl start NetworkManager.service"
  39. STH="setup-tuxhat"
  40.  
  41.  
  42. TITLENAME="Tux Hat Linux Network Setup"
  43. DIALOGRC=${DIALOGRC}
  44. DISTNAME='Tux Hat Linux '
  45. DISTVER='v3.4'
  46. DASH='-'
  47. SCRIPTNAME='Network Setup Script'
  48. MNT=/mnt
  49. CONFIGFILE=/home/gary/Test/setup-tuxhat.conf
  50.  
  51. if [[ -f $CONFIGFILE ]]; then
  52.   source $CONFIGFILE
  53. else
  54.   echo "Error missing file: setup-tuxhat.conf - Required by program"
  55.   exit 1
  56. fi
  57.  
  58. ### Program for making the UI
  59.  
  60. DIALOG=${DIALOG=dialog}
  61. #DIALOG=${DIALOG=Xdialog}
  62.  
  63. # Temp files
  64.  
  65. tmpfile=`tmpfile 2> /dev/null` || tmpfile=/tmp/tmpfile$$
  66. trap "rm  -f $tmpfile" 0 1 2 5 15
  67.  
  68. #########$#######
  69. # Network-Setup #
  70. #################
  71. networksetupmenuchoices()
  72.  
  73. {      
  74.         case $choice in
  75.            
  76.             "1")
  77.             network_interface
  78.             networksetupmenu
  79.             ;;
  80.             "2")
  81.             setuptuxhatmenu
  82.             ;;
  83.            
  84.         esac
  85. }
  86.  
  87. networksetupmenu()  # Arch Linux Base Main Menu Setup
  88.  
  89. {
  90.    
  91.     while :
  92.     do
  93.         DIALOGRC="$DIALOGRC" $DIALOG --backtitle "$DISTNAME$DISTVER $DASH $SCRIPTNAME " --no-shadow \
  94.         --ok-label 'Select' --cancel-label 'Exit' \
  95.         --title "$TITLENAME" --menu "Select Task 1-2 for Network Setup" 9 41 10 \
  96.         "1" "Setup DHCP Systemctl" \
  97.         "2" "Setup NetworkManager Systemctl" 2> $tmpfile
  98.        
  99.         mmretval=$?
  100.         choice=`cat $tmpfile`
  101.                
  102.     case $mmretval in      
  103.     0)
  104.       networksetupmenuchoices
  105.     ;;
  106.  
  107.     1)
  108.     if DIALOGRC="$DIALOGRC" $DIALOG --yesno "Do you want to exit?\n" 5 24
  109.     then
  110.         exit 0
  111.     fi
  112.    
  113.     ;;
  114.     255)
  115.    # echo "ESC key pressed"
  116.    
  117.     ;;
  118.     esac
  119. done
  120. }
  121.  
  122. ########################################################################
  123. #
  124. #          End of Script -- Tux Hat Linux Development -- UNIXwz0r
  125. #
  126. ########################################################################
  127.  
  128. networksetupmenu
Advertisement
Add Comment
Please, Sign In to add comment