Advertisement
unixwz0r

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

Jan 21st, 2015
416
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.93 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. TITLENAME="Arch Linux Base Setup"
  37. DIALOGRC=${DIALOGRC}
  38. DISTNAME='Tux Hat Linux '
  39. DISTVER='v3.4'
  40. DASH='-'
  41. SCRIPTNAME='Arch Setup Script'
  42. PACSTRAPDEFAULTS="base base-devel"
  43. MNT=/mnt
  44. CONFIGFILE=/home/gary/Test/setup-tuxhat.conf
  45. if [[ -f $CONFIGFILE ]]; then
  46.   source $CONFIGFILE
  47. else
  48.   echo "Error missing file: setup-tuxhat.conf - Required by program"
  49.   exit 1
  50. fi
  51.  
  52. ### Program for making the UI
  53.  
  54. DIALOG=${DIALOG=dialog}
  55. #DIALOG=${DIALOG=Xdialog}
  56.  
  57. # Temp files
  58.  
  59. tmpfile=`tmpfile 2> /dev/null` || tmpfile=/tmp/tmpfile$$
  60. trap "rm  -f $tmpfile" 0 1 2 5 15
  61.  
  62. ##############
  63. # Arch-Setup #
  64. ##############
  65. archlinuxmenuchoices(){      
  66.         case $choice in
  67.        
  68.             "1")
  69.             SelectDisk
  70.             archlinuxmenu                      
  71.             ;;
  72.             "2")
  73.             PartitionDisks
  74.             archlinuxmenu
  75.             ;;
  76.             "3")
  77.             formatrootpart
  78.             archlinuxmenu
  79.             ;;
  80.             "4")
  81.             /home/gary/Test/test
  82.             ;;
  83.             "5")
  84.             pacstrap $MNT $PACSTRAPDEFAULTS
  85.             archlinuxmenu
  86.             ;;
  87.             "6")
  88.             genfstab -U -p $MNT >> $MNT/etc/fstab
  89.             archlinuxmenu
  90.             ;;
  91.             "7")
  92.             arch-chroot $MNT
  93.             ;;
  94.            
  95.         esac
  96. }
  97.  
  98. archlinuxmenu()  # Arch Linux Base Main Menu Setup
  99.  
  100. {
  101.    
  102.     while :
  103.     do
  104.         DIALOGRC="$DIALOGRC" $DIALOG --backtitle "$DISTNAME$DISTVER $DASH $SCRIPTNAME " --no-shadow \
  105.         --ok-label 'Select' --cancel-label 'Exit' \
  106.         --title "$TITLENAME" --menu "Select Task 1-7 to Setup Arch Linux Base" 14 45 26 \
  107.         "1" "Select Disk" \
  108.         "2" "Partition Selected Disk" \
  109.         "3" "Format & Mount Root Partition" \
  110.         "4" "Copy Live ISO Skel to Disk" \
  111.         "5" "Pacstrap base base-devel /mnt" \
  112.         "6" "Generate Fstab" \
  113.         "7" "Chroot in to the new root" 2> $tmpfile
  114.            
  115.         mmretval=$?
  116.         choice=`cat $tmpfile`
  117.                
  118.     case $mmretval in      
  119.     0)
  120.       archlinuxmenuchoices
  121.     ;;
  122.  
  123.     1)
  124.     if DIALOGRC="$DIALOGRC" $DIALOG --yesno "Do you want to exit?\n" 5 24
  125.     then
  126.         exit 0
  127.     fi
  128.    
  129.     ;;
  130.     255)
  131.    # echo "ESC key pressed"
  132.    
  133.     ;;
  134.     esac
  135. done
  136. }
  137.  
  138.  
  139. ########################################################################
  140. #
  141. #          End of Script -- Tux Hat Linux Development -- UNIXwz0r
  142. #
  143. ########################################################################
  144.  
  145. archlinuxmenu
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement