unixwz0r

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

Jan 23rd, 2015
388
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.82 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 Stuff
  36. UPDATEPACMAN="sudo pacman -Syy"
  37. CATALYST="yaourt -S catalyst-test"
  38. NVIDIA="yaourt -S nvidia nvidia-utils"
  39. MULTILIB="sudo nano /etc/pacman.conf"
  40. STH="setup-tuxhat"
  41. TITLENAME="Tux Hat Linux Video Setup"
  42. DIALOGRC=${DIALOGRC}
  43. DISTNAME='Tux Hat Linux '
  44. DISTVER='v3.4'
  45. DASH='-'
  46. SCRIPTNAME='Video Setup Script'
  47. MNT=/mnt
  48. CONFIGFILE=/home/gary/Test/setup-tuxhat.conf
  49.  
  50. if [[ -f $CONFIGFILE ]]; then
  51.   source $CONFIGFILE
  52. else
  53.   echo "Error missing file: setup-tuxhat.conf - Required by program"
  54.   exit 1
  55. fi
  56.  
  57. ### Program for making the UI
  58.  
  59. DIALOG=${DIALOG=dialog}
  60. #DIALOG=${DIALOG=Xdialog}
  61.  
  62. # Temp files
  63.  
  64. tmpfile=`tmpfile 2> /dev/null` || tmpfile=/tmp/tmpfile$$
  65. trap "rm  -f $tmpfile" 0 1 2 5 15
  66.  
  67. ###############
  68. # Video-Setup #
  69. ###############
  70. videosetupmenuchoices()
  71.  
  72. {      
  73.         case $choice in
  74.        
  75.             "1")
  76.             $MULTILIB
  77.             videosetupmenu                     
  78.             ;;
  79.             "2")
  80.             $UPDATEPACMAN
  81.             videosetupmenu
  82.             ;;
  83.             "3")
  84.             $CATALYST
  85.             videosetupmenu
  86.             ;;
  87.             "4")
  88.             $NVIDIA
  89.             setuptuxhatmenu
  90.             ;;
  91.                        
  92.         esac
  93. }
  94.  
  95. videosetupmenu()  # Video Setup Main Menu
  96.  
  97. {
  98.    
  99.     while :
  100.     do
  101.         DIALOGRC="$DIALOGRC" $DIALOG --backtitle "$DISTNAME$DISTVER $DASH $SCRIPTNAME " --no-shadow \
  102.         --ok-label 'Select' --cancel-label 'Exit' \
  103.         --title "$TITLENAME" --menu "Select Task 1-4 to Setup Video Drivers" 11 55 26 \
  104.         "1." "Uncomment multilib in pacman for 32 bit apps" \
  105.         "2." "Update Pacman" \
  106.         "3." "AMD Catalyst Lastest Test Drivers" \
  107.         "4." "nVidia Latest Drivers + Utils" 2> $tmpfile
  108.            
  109.         mmretval=$?
  110.         choice=`cat $tmpfile`
  111.                
  112.     case $mmretval in      
  113.     0)
  114.       archlinuxmenuchoices
  115.     ;;
  116.  
  117.     1)
  118.     if DIALOGRC="$DIALOGRC" $DIALOG --yesno "Do you want to exit?\n" 5 24
  119.     then
  120.         exit 0
  121.     fi
  122.    
  123.     ;;
  124.     255)
  125.    # echo "ESC key pressed"
  126.    
  127.     ;;
  128.     esac
  129. done
  130. }
  131.  
  132. ########################################################################
  133. #
  134. #          End of Script -- Tux Hat Linux Development -- UNIXwz0r
  135. #
  136. ########################################################################
  137.  
  138. videosetupmenu
Advertisement
Add Comment
Please, Sign In to add comment