unixwz0r

UNIXwz0r - vbox-guest-setup (re-written dialog)

Jan 22nd, 2015
372
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 7.67 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. UPDATEPACMAN="pacman -Syy"
  37. VBOXGUESTPKG="pacman -S --noconfirm virtualbox-guest-modules virtualbox-guest-utils"
  38. VBOXMODPROBE="modprobe -a vboxguest vboxsf vboxvideo"
  39. STH="setup-tuxhat"
  40. TITLENAME="Tux Hat Linux Virtualbox Guest Setup"
  41. DIALOGRC=${DIALOGRC}
  42. DISTNAME='Tux Hat Linux '
  43. DISTVER='v3.4'
  44. DASH='-'
  45. SCRIPTNAME='Virtualbox Guest Setup Script'
  46. PACSTRAPDEFAULTS="base base-devel"
  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. # Vbox-Setup #
  69. ##############
  70. vboxsetupmenuchoices()
  71.  
  72. {      
  73.         case $choice in
  74.        
  75.         "1")
  76.         $UPDATEPACMAN
  77.         vboxsetupmenu
  78.         ;;
  79.         "2")
  80.         $VBOXGUESTPKG
  81.         vboxsetupmenu
  82.         ;;
  83.         "3")
  84.         $VBOXMODPROBE
  85.         setuptuxhatmenu
  86.         ;;
  87.            
  88.         esac
  89. }
  90.  
  91. vboxsetupmenu()  # Virtualbox Guest Setup
  92.  
  93. {
  94.    
  95.     while :
  96.     do
  97.         DIALOGRC="$DIALOGRC" $DIALOG --backtitle "$DISTNAME$DISTVER $DASH $SCRIPTNAME " --no-shadow \
  98.         --ok-label 'Select' --cancel-label 'Exit' \
  99.         --title "$TITLENAME" --menu "Select Task 1-3 to setup Virtualbox Guest" 10 46 26 \
  100.         "1." "Update Pacman" \
  101.         "2." "Install Virtualbox Guest additions" \
  102.         "3." "Load Virtualbox Guest Modules" 2> $tmpfile
  103.            
  104.         mmretval=$?
  105.         choice=`cat $tmpfile`
  106.                
  107.     case $mmretval in      
  108.     0)
  109.       vboxsetupmenuchoices
  110.     ;;
  111.  
  112.     1)
  113.     if DIALOGRC="$DIALOGRC" $DIALOG --yesno "Do you want to exit?\n" 5 24
  114.     then
  115.         exit 0
  116.     fi
  117.    
  118.     ;;
  119.     255)
  120.    # echo "ESC key pressed"
  121.    
  122.     ;;
  123.     esac
  124. done
  125. }
  126.  
  127. ########################################################################
  128. #
  129. #          End of Script -- Tux Hat Linux Development -- UNIXwz0r
  130. #
  131. ########################################################################
  132.  
  133. vboxsetupmenu
  134. #!/bin/bash
  135. #----------------------------------------------------------------------------------------
  136. # Script Created by Gary Perreault - Tux Hat Linux Project ([email protected])
  137. # IRC Freenode #bsdgeekclub @UNIXwz0r @Vincent0ne-
  138. # Distro Sourceforge - https://sourceforge.net/projects/tuxhatlinux/
  139. # Distro Youtube - https://www.youtube.com/channel/UCDXUtAdTuZSRDFgBHC2gaGA
  140. # Distro Pastebin - http://pastebin.com/u/unixwz0r
  141. # Distro Deviantart -http://ipodpunker.deviantart.com/
  142. # Distro Dailymotion - http://www.dailymotion.com/tuxhatlinux
  143. #----------------------------------------------------------------------------------------
  144. #This program is free software: you can redistribute it and/or modify
  145. #it under the terms of the GNU General Public License as published by
  146. #the Free Software Foundation, either version 3 of the License, or
  147. #(at your option) any later version.
  148. #
  149. #This program is distributed in the hope that it will be useful,
  150. #but WITHOUT ANY WARRANTY; without even the implied warranty of
  151. #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  152. #GNU General Public License for more details.
  153. #
  154. #You should have received a copy of the GNU General Public License
  155. #along with this program.  If not, see <http://www.gnu.org/licenses/>.
  156. #----------------------------------------------------------------------------------------
  157. # Run this script after your first boot with archlinux (as root)
  158. #----------------------------------------------------------------------------------------
  159. # Explaination of the Script:
  160. #
  161. # Setup-Tuxhat using Dialog. The main menu script has like 8 seperate setup scripts.
  162. #
  163. # Scripts are listed in # Scripts below
  164. ##########################################################################################
  165.  
  166. # Top program dir is used for testing
  167.  
  168. #Global Settings
  169. UPDATEPACMAN="pacman -Syy"
  170. VBOXGUESTPKG="pacman -S --noconfirm virtualbox-guest-modules virtualbox-guest-utils"
  171. VBOXMODPROBE="modprobe -a vboxguest vboxsf vboxvideo"
  172. STH="setup-tuxhat"
  173. TITLENAME="Tux Hat Linux Virtualbox Guest Setup"
  174. DIALOGRC=${DIALOGRC}
  175. DISTNAME='Tux Hat Linux '
  176. DISTVER='v3.4'
  177. DASH='-'
  178. SCRIPTNAME='Virtualbox Guest Setup Script'
  179. PACSTRAPDEFAULTS="base base-devel"
  180. MNT=/mnt
  181. CONFIGFILE=/home/gary/Test/setup-tuxhat.conf
  182.  
  183. if [[ -f $CONFIGFILE ]]; then
  184.   source $CONFIGFILE
  185. else
  186.   echo "Error missing file: setup-tuxhat.conf - Required by program"
  187.   exit 1
  188. fi
  189.  
  190. ### Program for making the UI
  191.  
  192. DIALOG=${DIALOG=dialog}
  193. #DIALOG=${DIALOG=Xdialog}
  194.  
  195. # Temp files
  196.  
  197. tmpfile=`tmpfile 2> /dev/null` || tmpfile=/tmp/tmpfile$$
  198. trap "rm  -f $tmpfile" 0 1 2 5 15
  199.  
  200. ##############
  201. # Vbox-Setup #
  202. ##############
  203.  
  204. vboxsetupmenu()  # Virtualbox Guest Setup
  205.  
  206. {
  207.    
  208.     while :
  209.     do
  210.         DIALOGRC="$DIALOGRC" $DIALOG --backtitle "$DISTNAME$DISTVER $DASH $SCRIPTNAME " --no-shadow \
  211.         --ok-label 'Select' --cancel-label 'Exit' \
  212.         --title "$TITLENAME" --menu "Select Task 1-3 to setup Virtualbox Guest" 10 46 26 \
  213.         "1." "Update Pacman" \
  214.         "2." "Install Virtualbox Guest additions" \
  215.         "3." "Load Virtualbox Guest Modules" 2> $tmpfile
  216.            
  217.         mmretval=$?
  218.         choice=`cat $tmpfile`
  219.                
  220.     case $mmretval in      
  221.     0)
  222.       vboxsetupmenuchoices
  223.     ;;
  224.  
  225.     1)
  226.     if DIALOGRC="$DIALOGRC" $DIALOG --yesno "Wanna Exit?\n" 10 20
  227.     then
  228.         exit 0
  229.     fi
  230.    
  231.     ;;
  232.     255)
  233.    # echo "ESC key pressed"
  234.    
  235.     ;;
  236.     esac
  237. done
  238. }
  239. ##### Arch Linux Base Choices Responses
  240.  
  241. vboxsetupmenuchoices()
  242.  
  243. {      
  244.         case $choice in
  245.        
  246.         "Update Pacman")
  247.         $UPDATEPACMAN
  248.         vboxsetupmenu
  249.         ;;
  250.         "Install Virtualbox Guest additions")
  251.         $VBOXGUESTPKG
  252.         vboxsetupmenu
  253.         ;;
  254.         "Load Virtualbox Guest Modules")
  255.         $VBOXMODPROBE
  256.         setuptuxhatmenu
  257.         ;;
  258.            
  259.         esac
  260. }
  261.  
  262. ########################################################################
  263. #
  264. #          End of Script -- Tux Hat Linux Development -- UNIXwz0r
  265. #
  266. ########################################################################
  267.  
  268. vboxsetupmenu
Advertisement
Add Comment
Please, Sign In to add comment