source: src-sh/pc-thinclient/resources/scripts/tcsinstall.sh @ ae0a5c8

9.2-releasereleng/10.0releng/10.0.1releng/10.0.2
Last change on this file since ae0a5c8 was ae0a5c8, checked in by Kris Moore <kris@…>, 12 months ago

Update pc-thinclient to install pcbsd-utils which includes the up2date
pc-sysinstall for install servers.

  • Property mode set to 100755
File size: 2.6 KB
Line 
1#!/bin/sh
2# Script to provide menu-driven installation of systems
3
4do_installwiz() {
5
6  installChoices=""
7  for i in `ls /installscripts`
8  do
9     installChoices="$installChoices $i $i"
10  done
11
12  dialog --menu 'Select install script' 15 55 10 'back' 'Go back' ${installChoices} 2>/tmp/ans
13  ANS=`cat /tmp/ans`
14  case $ANS in
15       back) return ;;
16        *) echo "Ready to begin installation using command:"
17           echo "/usr/local/sbin/pc-sysinstall -c /installscripts/${ANS}" 
18           echo -e "Continue? (y/n) \c"
19           read tmp
20           if [ "$tmp" = "y" -o "$tmp" = "Y" ] ; then
21              /usr/local/sbin/pc-sysinstall -c /installscripts/${ANS}
22           fi
23           ;;
24  esac
25}
26
27# Function which determines if a nic is active / up
28is_nic_active()
29{
30  ifconfig ${1} | grep -q "status: active" 2>/dev/null
31  if [ $? -eq 0 ] ; then
32    return 0
33  else
34    return 1
35  fi
36}
37
38# Find the active nic
39get_active_nic()
40{
41  for i in $(ifconfig -l); do
42    case "${i%%[0-9]*}" in
43      lo|fwe|fwip|plip|pfsync|pflog|tun)
44      continue
45      ;;
46    esac
47    is_nic_active "${i}"
48    if [ $? -eq 0 ] ; then
49       echo "$i"
50       return 0
51    fi
52  done
53  return 1
54}
55
56# Get the mac address of a target NIC
57get_nic_mac()
58{
59  FOUNDMAC="`ifconfig ${1} | grep 'ether' | tr -d '\t' | cut -d ' ' -f 2`"
60  echo $FOUNDMAC
61}
62
63# Check for MAC address config file
64NIC=$(get_active_nic)
65MAC=$(get_nic_mac "$NIC")
66
67# Detect auto-install scripts
68ASCRIPT=""
69if [ -e "/installscripts/unattended.cfg" ] ; then
70   ASCRIPT="/installscripts/unattended.cfg"
71fi
72if [ -e "/installscripts/${MAC}.cfg" ] ; then
73   ASCRIPT="/installscripts/${MAC}.cfg"
74fi
75
76# Are we doing an automated install?
77if [ -n "${ASCRIPT}" ] ; then
78
79  echo "Preparing to install using: ${ASCRIPT}"
80  echo "Will automatically continue in 30 seconds."
81  echo "Press ENTER to cancel"
82
83  read -t30s ans
84  if [ $? -eq 1 ] ; then
85    pc-sysinstall -c ${ASCRIPT}
86    if [ $? -eq 0 ] ; then
87      echo "Install finished! Shutting down system now!"
88      halt -p
89      exit 0
90    fi
91
92    echo "Install failed! Full log of installation: /tmp/.pc-sysinstall/pc-sysinstall.log" 
93    echo "Press ENTER to continue"
94    read tmp
95  fi
96fi
97
98# Run the interactive menu
99while :
100do
101  dialog --menu 'Select install option' 15 55 10 'install' 'Start install wizard' 'shell' 'Run emergency shell' 'close' 'Close and Reboot' 2>/tmp/ans
102  ANS=`cat /tmp/ans`
103  case $ANS in
104   install) do_installwiz
105            echo "[Press Enter to Continue]"
106            read tmp
107            ;;
108     shell) /bin/csh
109            echo "[Press Enter to Continue]"
110            read tmp
111            ;;
112     close) reboot
113            exit
114            ;;
115         *) ;;
116   esac
117done
118
119
Note: See TracBrowser for help on using the repository browser.