Advertisement
ezarchproject

Ez-Arch-Installer-Dialog.sh

Jan 21st, 2015
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 4.40 KB | None | 0 0
  1. #!/bin/bash
  2. #-------------------------------------------------------------------------------
  3. # Script Created by Vincent - EZ-Arch Project (ezarchproject@gmail.com)
  4. # Distro Sourceforge - https://sourceforge.net/projects/ezarchlinux/
  5. # Distro Dailymotion -   http://www.dailymotion.com/ezarchproject
  6. #
  7. # I shall be using Dailymotion more for the videos instead of Youtube.
  8. #
  9. #-------------------------------------------------------------------------------
  10. #This program is free software: you can redistribute it and/or modify
  11. #it under the terms of the GNU General Public License as published by
  12. #the Free Software Foundation, either version 3 of the License, or
  13. #(at your option) any later version.
  14. #
  15. #This program is distributed in the hope that it will be useful,
  16. #but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18. #GNU General Public License for more details.
  19. #
  20. #You should have received a copy of the GNU General Public License
  21. #along with this program.  If not, see <http://www.gnu.org/licenses/>.
  22. #-------------------------------------------------------------------------------
  23. # Run this script after your first boot with archlinux (as root)
  24. #--------------------------------------------------------------------------------
  25. # Explaination of the Script:
  26. #
  27. # Console EZ-Arch Linux Installer using Dialog
  28. #
  29. #This is not complete but need to print it out at work
  30. ##########################################################################
  31.  
  32. PROGDIR=/home/vincent/Projects/EzCUDM/rootfs/usr/INSTALLER/EzCUDM #Testing
  33. #PROGDIR=/usr/INSTALLER/EzCUDM
  34. # Top program dir is used for testing
  35.  
  36. # Global Stuff
  37.  
  38. CONFIGFILE=$PROGDIR/etc/ezarchinstall.conf # Config File
  39.  
  40. if [[ -f $CONFIGFILE ]]; then
  41.   source $CONFIGFILE
  42. else
  43.   echo "Error missing file: ezarchinstall.conf - Required by program"
  44.   echo "Installer's Directory is $PROGDIR/etc"
  45.   exit 1
  46. fi
  47.  
  48. # Linux name and version is set in its own config file.
  49. VERSIONINFO=$PROGDIR/etc/distver.conf
  50.  
  51. if [[ -f $VERSIONINFO ]]; then
  52.   source $VERSIONINFO
  53. else
  54.   echo "Error missing file: distver.conf - Required by program"
  55.   echo "Installer's Directory is $PROGDIR/etc"
  56.   exit 1
  57. fi
  58.  
  59.  
  60. ### Program for making the UI
  61.  
  62. DIALOG=${DIALOG=dialog}
  63. #DIALOG=${DIALOG=Xdialog}
  64.  
  65. # Temp files
  66.  
  67. tempfile=`tempfile 2> /dev/null` || tempfile=/tmp/tmpfile$$
  68. trap "rm  -f $tempfile" 0 1 2 5 15
  69.  
  70. # Tasks
  71.  
  72. TASK1='-'
  73.  
  74. ##################################################################################
  75. #
  76. #               Menus and Menu options
  77. #              
  78. ##################################################################################
  79.  
  80.  
  81. installrootmenu()  # 1st Menu in the Installer
  82.  
  83. {
  84.    
  85.     while :
  86.     do
  87.         $DIALOG --backtitle "$DISTNAME $DISTVER " --no-shadow \
  88.         --ok-label 'Select' --cancel-label 'Exit' \
  89.         --title "$FUNCTION" --menu "Select a menu option" 20 78 16 \
  90.         "Keymap" "Select Keymap [$TASK1]" \
  91.         "Network" "Configure Network" \
  92.         "Disk Setup" "Disk Setup Menu ->" \
  93.         "Installation" "Installation Menu ->" \
  94.         "Fstab"     "Create Fstab" \
  95.         "Chroot"    "Chroot to installed System" \
  96.         "View Diskspace" "Shows disk spaces via df" \
  97.         "View System Info" "Shows information about your system" \
  98.         "Reboot" "Reboot System." \
  99.         "Power Off" "Power off the System" 2> $tempfile
  100.        
  101.        
  102.        
  103.         mmretval=$?
  104.        
  105.         choice=`cat $tempfile`
  106.        
  107.     case $mmretval in      
  108.     0)
  109.         echo "Selected $choice "
  110.         installrootmenuchoices
  111.     ;;
  112.  
  113.     1)
  114.     if $DIALOG --yesno "Do you wish to exit.\n" 10 20
  115.     then
  116.         exit 0
  117.     fi
  118.    
  119.     ;;
  120.     255)
  121.    # echo "ESC key pressed"
  122.    
  123.     ;;
  124.     esac
  125. done
  126. }
  127.  
  128. installrootmenuchoices()
  129.  
  130. {
  131.         case $choice in
  132.        
  133.             "Keymap")
  134.                     TASK1='X'
  135.             ;;
  136.             "Network")
  137.             ;;
  138.             "Disk Setup")
  139.             ;;
  140.             "Installation")
  141.             ;;
  142.             "Fstab")
  143.             ;;
  144.             "Chroot")
  145.             ;;
  146.             "View Diskspace")
  147.            
  148.             #df -h | grep "^/" > statsfile.$$
  149.             $DF -h  > $TMP/statsfile.$$
  150.             $DIALOG --backtitle "$DISTNAME $DISTVER" \
  151.                     --title "View Disk Spaces" \
  152.                     --textbox $TMP/statsfile.$$ 20 60
  153.             rm -f $TMP/statsfile.$$
  154.             ;;
  155.             "View System Info")
  156.             #-c 0 on Inxi disables Colors
  157.             #
  158.             inxi -F -c 0  > $TMP/statsfile.$$
  159.             $DIALOG --backtitle "$DISTNAME $DISTVER" \
  160.                     --title "View System Information" \
  161.                     --textbox $TMP/statsfile.$$ 30 100
  162.             rm -f $TMP/statsfile.$$
  163.            
  164.             ;;
  165.             "Reboot")
  166.             $REBOOT
  167.             ;;
  168.             "Power Off")
  169.             $POWEROFF
  170.             ;;
  171.            
  172.            
  173.         esac
  174. }
  175.  
  176.  
  177. installrootmenu
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement