source: src-sh/pc-installdialog/pc-installdialog.sh @ 2033649

releng/10.0releng/10.0.1releng/10.0.2releng/10.0.3releng/10.1
Last change on this file since 2033649 was 2033649, checked in by Kris Moore <kris@…>, 11 months ago

Improve the text-installer, add the ability to set dataset options
via dialog menus

  • Property mode set to 100755
File size: 17.9 KB
Line 
1#!/bin/sh
2# License: BSD
3# Author: Kris Moore (kris@pcbsd.org)
4########################################################
5# This script is fairly linear, it will walk through a series of questions
6# and when finished, generate a pc-sysinstall script
7
8# Source our functions
9. /usr/local/share/pcbsd/scripts/functions.sh
10
11# Dialog menu title
12TITLE="PC-BSD Install Dialog"
13
14# pc-sysinstall config file to write out to
15CFGFILE="/tmp/sys-install.cfg"
16
17# Default ZFS layout
18ZFSLAYOUT="/,/root,/tmp(compress=lz4),/usr(canmount=off),/usr/home,/usr/jails,/usr/obj(compress=lz4),/usr/pbi,/usr/ports(compress=lz4),/usr/ports/distfiles(compress=off),/usr/src(compress=lz4),/var(canmount=off),/var/audit(compress=lz4),/var/log(compress=lz4),/var/tmp(compress=lz4)"
19
20# Ugly master list of settable ZFS properties
21ZPROPS="aclinherit(discard|noallow|restricted|passthrough|passthrough-x),aclmode(discard|groupmask|passthrough|restricted),atime(on|off),canmount(on|off|noauto),checksum(on|off|fletcher2|fletcher4|sha256),compress(on|off|lzjb|gzip|zle|lz4),copies(1|2|3),dedup(on|off|verify|sha256),exec(on|off),primarycache(all|none|metadata),readonly(on|off),secondarycache(all|none|metadata),setuid(on|off),sharenfs(on|off),logbias(latency|throughput),snapdir(hidden|visible),sync(standard|always|disabled),jailed(off|on)"
22
23PCSYS="/usr/local/sbin/pc-sysinstall"
24
25change_zfs()
26{
27  get_zfs_layout
28  gen_pc-sysinstall_cfg
29}
30
31get_zfs_layout()
32{
33  while :
34  do
35    dOpts="done \"Exit dataset menu\" add \"New ZFS dataset\""
36    for z in `echo $ZFSLAYOUT | sed 's|,| |g'`
37    do
38       d=`echo $z | cut -d '(' -f 1`
39       echo "$z" | grep -q '('
40       if [ $? -eq 0 ] ; then
41         desc="(`echo $z | cut -d '(' -f 2`"
42       else
43         desc=""
44       fi
45       dOpts="$dOpts $d \"$desc\""
46    done
47    get_dlg_ans "--menu \"Select dataset to edit\" 22 78 15 ${dOpts}"
48    if [ -z "$ANS" ] ; then
49       exit_err "Invalid dataset selected!"
50    fi
51    case $ANS in
52       done) break ;;
53        add) add_dataset ;;
54          *) edit_dataset "$ANS" ;;
55    esac
56  done
57}
58
59get_zfs_dset_opt()
60{
61  local changeOpt="$1"
62  dOpts=""
63
64  # Build a list of dataset options to display
65  for z in `echo $ZPROPS | sed 's|,| |g'`
66  do
67    zOpt=`echo $z | cut -d '(' -f 1`
68    if [ "$zOpt" != "$changeOpt" ] ; then continue ; fi
69
70    zOps=`echo $z | cut -d '(' -f 2 | cut -d ')' -f 1`
71    for o in `echo $zOps | sed 's,|, ,g'`
72    do
73       d="$o" 
74       desc="($o)"
75       dOpts="$dOpts $d \"$desc\""
76    done
77    break
78  done
79
80  # Ask what to do on this dataset
81  get_dlg_ans "--menu \"Set option for $changeOpt on $2\" 22 50 15 unset 'Unset this option' cancel 'Cancel' ${dOpts}"
82  if [ -z "$ANS" ] ; then
83     exit_err "Invalid option selected!"
84  fi
85
86  if [ "$ANS" = "unset" ] ; then ANS="" ; fi
87  if [ "$ANS" = "cancel" ] ; then ANS="CANCELED" ; fi
88  VAL=$ANS ; export VAL
89}
90
91edit_dataset()
92{
93
94  dOpts=""
95
96  # Pull a list of dataset options from the users layout
97  for z in `echo $ZFSLAYOUT | sed 's|,| |g'`
98  do
99     d=`echo $z | cut -d '(' -f 1`
100     if [ "$d" != "$1" ] ; then continue ; fi
101     curOpts="`echo $z | cut -d '(' -f 2 | cut -d ')' -f 1`"
102  done
103
104  # Build a list of dataset options to display
105  for z in `echo $ZPROPS | sed 's|,| |g'`
106  do
107    d=`echo $z | cut -d '(' -f 1`
108    desc="(unset)"
109    for o in `echo $curOpts | sed 's,|, ,g'`
110    do
111       _opt="`echo $o | cut -d '=' -f 1`"
112       if [ "$_opt" != "$d" ] ; then continue ; fi
113       desc="(`echo $o | cut -d '=' -f 2`)"
114    done
115    dOpts="$dOpts $d \"$desc\""
116  done
117
118  # Ask what to do on this dataset
119  get_dlg_ans "--menu \"Editing dataset: ${1}\" 22 50 15 delete 'Remove the dataset' cancel 'Cancel' ${dOpts}"
120  if [ -z "$ANS" ] ; then
121     exit_err "Invalid dataset selected!"
122  fi
123  case $ANS in
124    cancel) return ;;
125    delete) NEWLAYOUT=""
126            for z in `echo $ZFSLAYOUT | sed 's|,| |g'`
127            do
128              d=`echo $z | cut -d '(' -f 1` 
129              if [ "$d" = "$1" ] ; then continue ; fi
130              if [ -z "$NEWLAYOUT" ] ; then
131                NEWLAYOUT="${z}"
132              else
133                NEWLAYOUT="$NEWLAYOUT,${z}"
134              fi
135            done
136            ZFSLAYOUT="$NEWLAYOUT"
137            ;;
138         *) cOpt=$ANS 
139            get_zfs_dset_opt "$cOpt" "$1"
140            newOpt="$VAL"
141            if [ "$newOpt" = "CANCELED" ] ; then return ; fi
142
143            NEWLAYOUT=""
144            for z in `echo $ZFSLAYOUT | sed 's|,| |g'`
145            do
146               d=`echo $z | cut -d '(' -f 1`
147               if [ "$d" != "$1" ] ; then
148                 if [ -z "$NEWLAYOUT" ] ; then
149                   NEWLAYOUT="${z}"
150                 else
151                   NEWLAYOUT="$NEWLAYOUT,${z}"
152                 fi
153                 continue
154               fi
155               
156               # Add this option to our optList
157               NEWOPTLIST=""
158               optList="`echo $z | cut -d '(' -f 2 | cut -d ')' -f 1`"
159               if [ "$optList" = "$z" ] ; then optList="" ; fi
160               addedOpt=0
161               for o in `echo $optList | sed 's,|, ,g'`
162               do
163                  _opt="`echo $o | cut -d '=' -f 1`"
164                  if [ "$_opt" != "$cOpt" ] ; then
165                     if [ -z "$NEWOPTLIST" ] ; then
166                        NEWOPTLIST="${o}"
167                     else
168                        NEWOPTLIST="$NEWOPTLIST|${o}"
169                     fi
170                     continue
171                  fi
172                  addedOpt=1
173                  # If the user unset this opt, lets skip adding it
174                  if [ -z "$newOpt" ] ; then continue ; fi
175                  if [ -z "$NEWOPTLIST" ] ; then
176                     NEWOPTLIST="${cOpt}=${newOpt}"
177                  else
178                     NEWOPTLIST="$NEWOPTLIST|${cOpt}=${newOpt}"
179                  fi
180               done
181
182               # If we need to add the opt fresh
183               if [ $addedOpt -eq 0 ] ; then
184                  if [ -z "$NEWOPTLIST" ] ; then
185                     NEWOPTLIST="${cOpt}=${newOpt}"
186                  else
187                     NEWOPTLIST="$NEWOPTLIST|${cOpt}=${newOpt}"
188                  fi
189               fi
190
191               opt=""
192               if [ -n "$NEWOPTLIST" ] ; then opt="($NEWOPTLIST)"; fi
193               if [ -z "$NEWLAYOUT" ] ; then
194                  NEWLAYOUT="${d}${opt}"
195               else
196                  NEWLAYOUT="$NEWLAYOUT,${d}${opt}"
197               fi
198            done
199            ZFSLAYOUT="$NEWLAYOUT"
200            ;;
201  esac
202}
203
204add_dataset()
205{
206    get_dlg_ans "--inputbox 'Enter dataset mountpoint' 8 40"
207    if [ -z "$ANS" ] ; then
208       exit_err "Invalid dataset entered!"
209    fi
210
211    # Make sure it starts with a /
212    echo $ANS | grep -q "^/" 
213    if [ $? -ne 0 ] ; then
214       return
215    fi
216
217    # Check for duplicates
218    for z in `echo $ZFSLAYOUT | sed 's|,| |g'`
219    do
220       d=`echo $z | cut -d '(' -f 1`
221       if [ "$d" = "$ANS" ] ; then
222          echo "Error, this dataset already exists!"
223          rtn
224          return
225       fi
226    done
227
228    # Save the dataset
229    ZFSLAYOUT="$ZFSLAYOUT,$ANS"
230}
231
232get_dlg_ans()
233{
234  TANS="/tmp/.pcinsdialog.$$"
235  if [ -e "$TANS" ] ; then rm ${TANS}; fi
236  if [ -e "$TANS.dlg" ] ; then rm ${TANS}.dlg; fi
237  while :
238  do
239    echo "dialog --title \"$TITLE\" ${@}" >${TANS}.dlg
240    sh ${TANS}.dlg 2>${TANS}
241    if [ $? -ne 0 ] ; then
242      dialog --title "$TITLE" --yesno 'Exit the installer?' 8 30
243      if [ $? -eq 0 ] ; then exit_err "User canceled install" ; fi
244      continue
245    fi
246
247    if [ ! -e "$TANS" ] ; then
248       ANS=""
249       return
250    fi
251    ANS=`cat ${TANS}`
252    return
253  done
254}
255
256
257get_sys_type()
258{
259  # First ask the system type
260  get_dlg_ans "--radiolist \"System type\" 12 50 5 desktop \"PC-BSD Desktop\" on server \"TrueOS / FreeBSD Server\" off"
261  if [ -z "$ANS" ] ; then
262     exit_err "Invalid system type"
263  fi
264  SYSTYPE="$ANS"
265
266  # If on a desktop, lets just set DHCP
267  if [ "$SYSTYPE" = "desktop" ] ; then
268     SYSNIC="AUTO-DHCP-SLAAC"
269  fi
270}
271
272get_sys_bootmanager()
273{
274  # Ask the boot-manager
275  get_dlg_ans "--radiolist \"Boot Manager\" 12 50 5 GRUB \"GRUB - Recommended\" on BSD \"FreeBSD Boot-Loader\" off none \"No boot-loader\" off"
276  if [ -z "$ANS" ] ; then
277     exit_err "Invalid bootmanager type"
278  fi
279  SYSBOOTMANAGER="$ANS"
280}
281
282get_target_disk()
283{
284  # Now we prompt for the disk to install on
285  dOpts=""
286  ${PCSYS} disk-list > /tmp/.dList.$$
287  while read i
288  do
289     fOpt="on"
290     d=`echo $i | cut -d ':' -f 1`
291     desc=`echo $i | cut -d ':' -f 2`
292     dOpts="$dOpts $d \"$desc\" $fOpt" 
293     if [ -z "$fOpt" ] ; then fOpt="off"; fi
294  done < /tmp/.dList.$$
295  rm /tmp/.dList.$$
296  get_dlg_ans "--radiolist \"Select target disk\" 12 50 5 ${dOpts}"
297  if [ -z "$ANS" ] ; then
298     exit_err "Invalid disk selected!"
299  fi
300  SYSDISK="$ANS"
301}
302
303get_target_part()
304{
305  # Now prompt for the full-disk or partition to install onto
306  ${PCSYS} disk-part $SYSDISK > /tmp/.dList.$$
307  dOpts="ALL \"Use entire disk\" on"
308  dFmt=`grep "$SYSDISK-format:" /tmp/.dList.$$ | awk '{print $2}'` 
309  if [ "$dFmt" = "MBR" ] ; then
310    dChar="s"
311    DISKFORMAT="MBR"
312  else
313    dChar="p"
314    DISKFORMAT="GPT"
315  fi
316  i=1
317  while :
318  do
319     partRAW="${dChar}${i}"
320     part="${SYSDISK}${dChar}${i}"
321     [ -e "/dev/${part}" ] || break
322     desc="`cat /tmp/.dList.$$ | grep ^${part}-label | cut -d ':' -f 2`"
323     mb="`cat /tmp/.dList.$$ | grep ^${part}-sizemb | awk '{print $2}'`"
324     dOpts="$dOpts $partRAW \"${mb}MB -$desc\" off" 
325     i="`expr $i + 1`"
326  done
327  rm /tmp/.dList.$$
328  get_dlg_ans "--radiolist \"Select target partition\" 12 80 5 ${dOpts}"
329  if [ -z "$ANS" ] ; then
330     exit_err "Invalid disk selected!"
331  fi
332  DISKPART="$ANS"
333}
334
335get_root_pw()
336{
337  while :
338  do
339    get_dlg_ans "--passwordbox 'Enter the root password' 8 30"
340    if [ -z "$ANS" ] ; then
341       exit_err "Invalid password entered!"
342    fi
343    ROOTPW="$ANS"
344    get_dlg_ans "--passwordbox 'Confirm root password' 8 30"
345    if [ -z "$ANS" ] ; then
346       exit_err "Invalid password entered!"
347    fi
348    ROOTPWCONFIRM="$ANS"
349    if [ "$ROOTPWCONFIRM" = "$ROOTPW" ] ; then break; fi
350    dialog --title "$TITLE" --yesno 'Password Mismatch, try again?' 8 30
351    if [ $? -eq 0 ] ; then continue ; fi
352    exit_err "Failed setting root password!"
353  done
354}
355
356get_user_pw()
357{
358  while :
359  do
360    get_dlg_ans "--passwordbox \"Enter the password for $USERNAME\" 8 40"
361    if [ -z "$ANS" ] ; then
362       exit_err "Invalid password entered!"
363    fi
364    USERPW="$ANS"
365    get_dlg_ans "--passwordbox 'Confirm password' 8 40"
366    if [ -z "$ANS" ] ; then
367       exit_err "Invalid password entered!"
368    fi
369    USERPWCONFIRM="$ANS"
370    if [ "$USERPWCONFIRM" = "$USERPW" ] ; then break; fi
371    dialog --title "$TITLE" --yesno 'Password Mismatch, try again?' 8 30
372    if [ $? -eq 0 ] ; then continue ; fi
373    exit_err "Failed setting password!"
374  done
375}
376
377get_user_name()
378{
379    get_dlg_ans "--inputbox 'Enter a username' 8 40"
380    if [ -z "$ANS" ] ; then
381       exit_err "Invalid username entered!"
382    fi
383    USERNAME="$ANS"
384}
385
386get_user_realname()
387{
388    get_dlg_ans "--inputbox \"Enter the real name for $USERNAME\" 8 40"
389    if [ -z "$ANS" ] ; then
390       exit_err "Invalid real name entered!"
391    fi
392    USERREALNAME="$ANS"
393}
394
395get_user_shell()
396{
397    get_dlg_ans "--menu \"Select the users shell\" 12 45 10 /bin/sh SH /bin/csh CSH /bin/tcsh TCSH /bin/bash BASH"
398    if [ -z "$ANS" ] ; then
399       exit_err "Invalid SHELL entered!"
400    fi
401    USERSHELL="$ANS"
402}
403
404get_hostname()
405{
406    get_dlg_ans "--inputbox 'Enter a system Hostname' 8 40"
407    if [ -z "$ANS" ] ; then
408       exit_err "Invalid hostname entered!"
409    fi
410    SYSHOSTNAME="$ANS"
411}
412
413get_sshd()
414{
415  SYSSSHD=""
416  dialog --title "$TITLE" --yesno 'Enable SSH?' 8 30
417  if [ $? -ne 0 ] ; then return ; fi
418  SYSSSHD="YES"
419}
420
421get_netconfig()
422{
423  SYSNIC=""
424  SYSNICIP=""
425  SYSNICDNS=""
426  SYSNICMASK=""
427  SYSNICROUTE=""
428
429  dialog --title "$TITLE" --yesno 'Enable networking?' 6 30
430  if [ $? -ne 0 ] ; then return ; fi
431
432  dOpts="auto \"Automatic DHCP\" on"
433  ${PCSYS} detect-nics > /tmp/.dList.$$
434  while read i
435  do
436     d="`echo $i | cut -d ':' -f 1`"
437     desc="`echo $i | cut -d '<' -f 2 | cut -d '>' -f 1`"
438     dOpts="$dOpts $d \"$desc\" off"
439  done < /tmp/.dList.$$
440  rm /tmp/.dList.$$
441  get_dlg_ans "--radiolist \"Select network card to configure\" 12 50 5 ${dOpts}"
442  if [ -z "$ANS" ] ; then
443     exit_err "Invalid NIC selected!"
444  fi
445  SYSNIC="$ANS"
446  if [ "$SYSNIC" = "auto" ] ; then
447     SYSNIC="AUTO-DHCP-SLAAC"
448     return
449  fi
450
451  get_dlg_ans "--inputbox \"Enter the IP address for $SYSNIC\" 8 40"
452  if [ -z "$ANS" ] ; then
453     exit_err "Invalid IP entered!"
454  fi
455  SYSNICIP="$ANS"
456
457  get_dlg_ans "--inputbox \"Enter the Netmask for $SYSNIC\" 8 40"
458  if [ -z "$ANS" ] ; then
459     exit_err "Invalid real name entered!"
460  fi
461  SYSNICMASK="$ANS"
462
463  get_dlg_ans "--inputbox \"Enter the DNS address for $SYSNIC\" 8 40"
464  if [ -z "$ANS" ] ; then
465     exit_err "Invalid real name entered!"
466  fi
467  SYSNICDNS="$ANS"
468
469  get_dlg_ans "--inputbox \"Enter the Gateway address for $SYSNIC\" 8 40"
470  if [ -z "$ANS" ] ; then
471     exit_err "Invalid real name entered!"
472  fi
473  SYSNICROUTE="$ANS"
474
475}
476
477gen_pc-sysinstall_cfg()
478{
479   # Start the header information
480   echo "# Auto-Generated pc-sysinstall configuration" >${CFGFILE}
481   echo "installInteractive=no" >>${CFGFILE}
482   echo "installMode=fresh" >>${CFGFILE}
483   if [ "$SYSTYPE" = "desktop" ] ; then
484     echo "installType=PCBSD" >>${CFGFILE}
485   else
486     echo "installType=FreeBSD" >>${CFGFILE}
487   fi
488   echo "packageType=dist" >> ${CFGFILE}
489   if [ "`uname -m`" = "amd64" ] ; then
490     echo "distFiles=base doc games kernel lib32" >> ${CFGFILE}
491   else
492     echo "distFiles=base doc games kernel" >> ${CFGFILE}
493   fi
494   echo "installMedium=local" >>${CFGFILE}
495   echo "localPath=/dist" >>${CFGFILE}
496
497   if [ -n "$SYSHOSTNAME" ] ; then
498      echo "" >> ${CFGFILE}
499      echo "hostname=$SYSHOSTNAME" >> ${CFGFILE}
500   fi
501   if [ -n "$SYSNIC" ] ; then
502      echo "" >> ${CFGFILE}
503      echo "netSaveDev=$SYSNIC" >> ${CFGFILE}
504      if [ "$SYSNIC" != "AUTO-DHCP-SLAAC" ] ; then
505        echo "netSaveIP_${SYSNIC}=$SYSNICIP" >> ${CFGFILE}
506        echo "netSaveMask_${SYSNIC}=$SYSNICMASK" >> ${CFGFILE}
507        echo "netSaveNameServer_${SYSNIC}=$SYSNICDNS" >> ${CFGFILE}
508        echo "netSaveDefaultRouter_${SYSNIC}=$SYSNICROUTE" >> ${CFGFILE}
509      fi
510   fi
511
512
513   # Now do the disk block
514   echo "" >> ${CFGFILE}
515   echo "# Disk Setup for $SYSDISK" >> ${CFGFILE}
516   echo "disk0=$SYSDISK" >> ${CFGFILE}
517   echo "partition=$DISKPART" >> ${CFGFILE}
518   echo "bootManager=${SYSBOOTMANAGER}" >> ${CFGFILE}
519   echo "partscheme=$DISKFORMAT" >> ${CFGFILE}
520   echo "commitDiskPart" >> ${CFGFILE}
521
522   # Now the partition block
523   echo "" >> ${CFGFILE}
524   echo "# Partition Setup for ${SYSDISK}($DISKPART)" >> ${CFGFILE}
525   echo "# All sizes are expressed in MB" >> ${CFGFILE}
526   echo "# Avail FS Types, UFS, UFS+S, UFS+SUJ, UFS+J, ZFS, SWAP" >> ${CFGFILE}
527   echo "# UFS.eli, UFS+S.eli, UFS+SUJ, UFS+J.eli, ZFS.eli, SWAP.eli" >> ${CFGFILE}
528   echo "disk0-part=ZFS 0 ${ZFSLAYOUT}" >> ${CFGFILE}
529   echo "disk0-part=SWAP 2000 none" >> ${CFGFILE}
530   echo "commitDiskLabel" >> ${CFGFILE}
531   echo "" >> ${CFGFILE}
532
533   # Now the packages
534   if [ "$SYSTYPE" = "desktop" ] ; then
535     echo "installPackages=pcbsd-base pcbsd-meta-kde pcbsd-meta-kde-accessibility pcbsd-meta-kde-artwork pcbsd-meta-kde-graphics pcbsd-meta-kde-multimedia pcbsd-meta-kde-network pcbsd-meta-kde-pim" >> ${CFGFILE}
536     echo "" >> ${CFGFILE}
537     # Set our markers for desktop to run the first-time boot wizards
538     echo "runCommand=sh /usr/local/share/pcbsd/scripts/sys-init.sh desktop en_US" >> ${CFGFILE}
539     echo "runCommand=touch /var/.runxsetup" >> ${CFGFILE}
540     echo "runCommand=touch /var/.pcbsd-firstboot" >> ${CFGFILE}
541     echo "runCommand=touch /var/.pcbsd-firstgui" >> ${CFGFILE}
542   else
543     echo "installPackages=trueos-base" >> ${CFGFILE}
544     echo "" >> ${CFGFILE}
545     echo "runCommand=sh /usr/local/share/pcbsd/scripts/sys-init.sh server" >> ${CFGFILE}
546     echo "" >> ${CFGFILE}
547
548     # Since on TrueOS, lets save username / passwords
549     echo "rootPass=${ROOTPW}" >> ${CFGFILE}
550     echo "" >> ${CFGFILE}
551     echo "userName=${USERNAME}" >> ${CFGFILE}
552     echo "userPass=${USERPW}" >> ${CFGFILE}
553     echo "userShell=${USERSHELL}" >> ${CFGFILE}
554     echo "userHome=/home/${USERNAME}" >> ${CFGFILE}
555     echo "userGroups=wheel,operator" >> ${CFGFILE}
556     echo "commitUser" >> ${CFGFILE}
557   fi
558
559   # Last cleanup stuff
560   echo "" >> ${CFGFILE}
561   echo "runExtCmd=/root/save-config.sh" >> ${CFGFILE}
562   echo "runCommand=newaliases" >> ${CFGFILE}
563
564   # Are we enabling SSHD?
565   if [ "$SYSSSHD" = "YES" ] ; then
566     echo "runCommand=echo 'sshd_enable=\"YES\"' >> /etc/rc.conf" >> ${CFGFILE}
567   fi
568
569}
570
571change_disk_selection() {
572  get_target_disk
573  get_target_part
574  get_sys_bootmanager
575  gen_pc-sysinstall_cfg
576}
577
578start_full_wizard() 
579{
580  # Start the wizard
581  get_sys_type
582  get_target_disk
583  get_target_part
584  get_sys_bootmanager
585
586  # If doing a server setup, need to prompt for some more details
587  if [ "$SYSTYPE" = "server" ] ; then
588     get_root_pw
589     get_user_name
590     get_user_pw
591     get_user_realname
592     get_user_shell
593  fi
594  gen_pc-sysinstall_cfg
595}
596
597# Adjust network options
598change_networking() {
599  get_hostname
600  get_netconfig
601  get_sshd
602  gen_pc-sysinstall_cfg
603}
604
605start_menu_loop()
606{
607
608  while :
609  do
610    dialog --title "PC-BSD Text Install" --menu "Please select from the following options:" 18 40 10 wizard "Run install wizard" disk "Change disk ($SYSDISK)" zfs "Change ZFS layout" network "Change networking" view "View install script" edit "Edit install script" install "Start the installation" quit "Quit install wizard" 2>/tmp/answer
611    if [ $? -ne 0 ] ; then break ; fi
612
613    ANS="`cat /tmp/answer`"
614
615    case $ANS in
616     wizard) start_full_wizard
617             rtn
618             ;;
619       disk) change_disk_selection
620             rtn
621             ;;
622    network) change_networking
623             ;;
624        zfs) change_zfs
625             ;;
626       view) more ${CFGFILE}
627             rtn
628             ;;
629       edit) vi ${CFGFILE}
630             rtn
631             ;;
632    install) echo "This will begin the installation, continue?"
633             echo -e "(y/n)\c"
634             read tmp
635             if [ "$tmp" = "y" -o "$tmp" = "Y" ] ; then
636                ${PCSYS} -c ${CFGFILE}
637                rtn
638             fi
639             ;;
640       quit) break ;;
641          *) ;;
642    esac
643  done
644
645}
646
647
648
649if [ ! -e "$CFGFILE" ] ; then
650   cp ${CFGFILE} ${CFGFILE}.bak
651   rm ${CFGFILE}
652fi
653
654start_full_wizard
655start_menu_loop
656
657exit 0
Note: See TracBrowser for help on using the repository browser.