author | Alasdair Lumsden <al@everycity.co.uk> |
Tue, 16 Aug 2011 20:54:07 +0000 | |
branch | oi_151a |
changeset 1398 | 3cd5b2156d4c |
parent 872 | 8b098e92c2a9 |
permissions | -rw-r--r-- |
517
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
516
diff
changeset
|
1 |
#!/bin/ksh |
240
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
2 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
3 |
# CDDL HEADER START |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
4 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
5 |
# The contents of this file are subject to the terms of the |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
6 |
# Common Development and Distribution License (the "License"). |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
7 |
# You may not use this file except in compliance with the License. |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
8 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
9 |
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
10 |
# or http://www.opensolaris.org/os/licensing. |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
11 |
# See the License for the specific language governing permissions |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
12 |
# and limitations under the License. |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
13 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
14 |
# When distributing Covered Code, include this CDDL HEADER in each |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
15 |
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
16 |
# If applicable, add the following below this CDDL HEADER, with the |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
17 |
# fields enclosed by brackets "[]" replaced with your own identifying |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
18 |
# information: Portions Copyright [yyyy] [name of copyright owner] |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
19 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
20 |
# CDDL HEADER END |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
21 |
# |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
707
diff
changeset
|
22 |
# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. |
240
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
23 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
24 |
# Description: |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
25 |
# It contains common functions used by create-client and |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
26 |
# setup-tftp-links, which is used by when the user issues |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
27 |
# installadm create-service. |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
28 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
29 |
# Files potentially changed on server: |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
30 |
# /etc/inetd.conf - to turn on tftpboot daemon |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
31 |
# /etc/vfstab - Entry added to mount the image as a lofs device |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
32 |
# /tftpboot/menu.lst - menu.lst file corresponding to the service/client |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
33 |
|
537
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
34 |
AWK=/bin/awk |
522
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
35 |
GREP=/bin/grep |
537
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
36 |
IFCONFIG=/usr/sbin/ifconfig |
522
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
37 |
MV=/bin/mv |
513
fb717173396b
7218 intalladm needs to move service data into SMF
Evan Layton <Evan.Layton@Sun.COM>
parents:
485
diff
changeset
|
38 |
SED=/usr/bin/sed |
521
0d5a79e513d3
7148 installadm should give correct dhcp macro for the subnet being configured on the server
Evan Layton <Evan.Layton@Sun.COM>
parents:
517
diff
changeset
|
39 |
SVCCFG=/usr/sbin/svccfg |
537
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
40 |
|
1398
3cd5b2156d4c
imported patch oi-branding-cmd-gui-install
Alasdair Lumsden <al@everycity.co.uk>
parents:
872
diff
changeset
|
41 |
DEFAULT_GRUB_TITLE="OpenIndiana" |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
707
diff
changeset
|
42 |
VERSION="Solaris" |
240
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
43 |
HTTP_PORT=5555 |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
44 |
|
400
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
45 |
SPARC_IMAGE="sparc_image" |
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
46 |
X86_IMAGE="x86_image" |
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
47 |
DOT_RELEASE=".release" |
517
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
516
diff
changeset
|
48 |
DOT_IMAGE_INFO=".image_info" |
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
516
diff
changeset
|
49 |
GRUB_TITLE_KEYWORD="GRUB_TITLE" |
700
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
50 |
GRUB_MIN_MEM64="GRUB_MIN_MEM64" |
707
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
51 |
GRUB_DO_SAFE_DEFAULT="GRUB_DO_SAFE_DEFAULT" |
400
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
52 |
CGIBIN_WANBOOTCGI="cgi-bin/wanboot-cgi" |
547
22a12173b10f
8262 'installadm create-service' shouldn't overwrite /etc/netboot/wanboot.conf for Sparc, but notify user instead
Jan Damborsky <jan.damborsky@sun.com>
parents:
537
diff
changeset
|
53 |
NETBOOTDIR="/etc/netboot" |
22a12173b10f
8262 'installadm create-service' shouldn't overwrite /etc/netboot/wanboot.conf for Sparc, but notify user instead
Jan Damborsky <jan.damborsky@sun.com>
parents:
537
diff
changeset
|
54 |
WANBOOT_CONF_FILE="wanboot.conf" |
22a12173b10f
8262 'installadm create-service' shouldn't overwrite /etc/netboot/wanboot.conf for Sparc, but notify user instead
Jan Damborsky <jan.damborsky@sun.com>
parents:
537
diff
changeset
|
55 |
SPARC_INSTALL_CONF="install.conf" |
22a12173b10f
8262 'installadm create-service' shouldn't overwrite /etc/netboot/wanboot.conf for Sparc, but notify user instead
Jan Damborsky <jan.damborsky@sun.com>
parents:
537
diff
changeset
|
56 |
WANBOOT_CONF_SPEC="${NETBOOTDIR}/${WANBOOT_CONF_FILE}" |
521
0d5a79e513d3
7148 installadm should give correct dhcp macro for the subnet being configured on the server
Evan Layton <Evan.Layton@Sun.COM>
parents:
517
diff
changeset
|
57 |
SMF_INST_SERVER="svc:/system/install/server:default" |
468
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
58 |
AIWEBSERVER="aiwebserver" |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
59 |
SERVICE_ADDRESS_UNKNOWN="unknown" |
400
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
60 |
|
240
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
61 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
62 |
# get_host_ip |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
63 |
# |
516
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
64 |
# Purpose : Use getent(1M) to get the IP address for the given host name |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
65 |
# or IP. NOTE: this function will return the first entry |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
66 |
# returned from getent(1M) in cases were multiple entries |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
67 |
# are yielded. |
240
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
68 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
69 |
# Arguments : |
516
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
70 |
# $1 - Hostname or IP address. |
240
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
71 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
72 |
# Returns IP address |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
73 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
74 |
get_host_ip() |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
75 |
{ |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
76 |
hname=$1 |
516
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
77 |
if [ -z "$hname" ]; then |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
78 |
return |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
79 |
fi |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
80 |
|
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
81 |
HOST_IP=`getent hosts ${hname} | head -1 | nawk '{ print $1 }'` |
240
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
82 |
echo "$HOST_IP" |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
83 |
} |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
84 |
|
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
85 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
86 |
# get_server_ip |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
87 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
88 |
# Purpose : Get the IP address of the machine where this program is running. |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
89 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
90 |
# Arguments : |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
91 |
# None |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
92 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
93 |
# Returns IP address of the current host. |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
94 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
95 |
get_server_ip() |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
96 |
{ |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
97 |
SERVER=`uname -n` |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
98 |
SERVER_IP=`get_host_ip $SERVER` |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
99 |
echo "$SERVER_IP" |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
100 |
} |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
101 |
|
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
102 |
# |
516
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
103 |
# get_ip_netmask |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
104 |
# |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
105 |
# Purpose : Get the netmask set for the given IP address on the current host. |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
106 |
# Assumes IP address is currently set on an interface. |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
107 |
# |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
108 |
# Arguments : |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
109 |
# $1 - IP address |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
110 |
# |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
111 |
# Returns netmask in hexidecimal notation (e.g. ffffff00) |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
112 |
# |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
113 |
get_ip_netmask() |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
114 |
{ |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
115 |
ipaddr=$1 |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
116 |
|
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
117 |
if [ -z "$ipaddr" ]; then |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
118 |
return |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
119 |
fi |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
120 |
|
537
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
121 |
$IFCONFIG -a | grep broadcast | awk '{print $2, $4}' | \ |
516
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
122 |
while read t_ipaddr t_netmask ; do |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
123 |
if [ "$t_ipaddr" = "$ipaddr" ]; then |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
124 |
echo "$t_netmask" |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
125 |
break |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
126 |
fi |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
127 |
done |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
128 |
} |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
129 |
|
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
130 |
# |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
131 |
# get_network |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
132 |
# |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
133 |
# Purpose : Determine the network number given an IP addres and the netmask. |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
134 |
# |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
135 |
# Arguments : |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
136 |
# $1 - IP address |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
137 |
# $2 - netmask in hexidecimal notation (e.g. ffffff00) |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
138 |
# |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
139 |
# Returns network number |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
140 |
# |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
141 |
get_network() |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
142 |
{ |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
143 |
if [ $# -ne 2 ]; then |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
144 |
return |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
145 |
fi |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
146 |
|
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
147 |
NETWORK=`echo | nawk -v ipaddr=$1 -v netmask=$2 ' |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
148 |
function bitwise_and(x, y) { |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
149 |
|
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
150 |
# This function ands together the lower four bits of the two decimal |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
151 |
# values passed in, and returns the result as a decimal value. |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
152 |
|
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
153 |
a[4] = x % 2; |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
154 |
x -= a[4]; |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
155 |
a[3] = x % 4; |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
156 |
x -= a[3] |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
157 |
a[2] = x % 8; |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
158 |
x -= a[2]; |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
159 |
a[1] = x; |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
160 |
|
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
161 |
b[4] = y % 2; |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
162 |
y -= b[4]; |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
163 |
b[3] = y % 4; |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
164 |
y -= b[3] |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
165 |
b[2] = y % 8; |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
166 |
y -= b[2]; |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
167 |
b[1] = y; |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
168 |
|
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
169 |
for (j = 1; j <= 4; j++) |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
170 |
if (a[j] != 0 && b[j] != 0) |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
171 |
ans[j] = 1; |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
172 |
else |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
173 |
ans[j] = 0; |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
174 |
|
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
175 |
return(8*ans[1] + 4*ans[2] + 2*ans[3] + ans[4]); |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
176 |
} |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
177 |
|
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
178 |
BEGIN { |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
179 |
ip=ipaddr |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
180 |
netm=netmask |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
181 |
|
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
182 |
# set up the associative array for mapping hexidecimal numbers |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
183 |
# to decimal fields. |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
184 |
|
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
185 |
hex_to_dec["0"]=0 |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
186 |
hex_to_dec["1"]=1 |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
187 |
hex_to_dec["2"]=2 |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
188 |
hex_to_dec["3"]=3 |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
189 |
hex_to_dec["4"]=4 |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
190 |
hex_to_dec["5"]=5 |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
191 |
hex_to_dec["6"]=6 |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
192 |
hex_to_dec["7"]=7 |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
193 |
hex_to_dec["8"]=8 |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
194 |
hex_to_dec["9"]=9 |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
195 |
hex_to_dec["a"]=10 |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
196 |
hex_to_dec["b"]=11 |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
197 |
hex_to_dec["c"]=12 |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
198 |
hex_to_dec["d"]=13 |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
199 |
hex_to_dec["e"]=14 |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
200 |
hex_to_dec["f"]=15 |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
201 |
hex_to_dec["A"]=10 |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
202 |
hex_to_dec["B"]=11 |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
203 |
hex_to_dec["C"]=12 |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
204 |
hex_to_dec["D"]=13 |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
205 |
hex_to_dec["E"]=14 |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
206 |
hex_to_dec["F"]=15 |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
207 |
|
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
208 |
# split the netmask into an array of 8 4-bit numbers |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
209 |
for (i = 1; i <= 8; i++) |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
210 |
nm[i]=hex_to_dec[substr(netm, i, 1)] |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
211 |
|
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
212 |
# split the ipaddr into its four decimal fields |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
213 |
split(ip, df, ".") |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
214 |
|
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
215 |
# now, for each decimal field, split the 8-bit number into its |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
216 |
# high and low 4-bit fields, and do a bit-wise AND of those |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
217 |
# fields with the corresponding fields from the netmask. |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
218 |
|
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
219 |
for (i = 1; i <= 4; i++) { |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
220 |
lo=df[i] % 16; |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
221 |
hi=(df[i] - lo)/16; |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
222 |
|
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
223 |
res_hi[i] = bitwise_and(hi, nm[2*i - 1]) |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
224 |
res_lo[i] = bitwise_and(lo, nm[2*i]) |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
225 |
} |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
226 |
|
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
227 |
printf("%d.%d.%d.%d", |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
228 |
res_hi[1]*16 + res_lo[1], |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
229 |
res_hi[2]*16 + res_lo[2], |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
230 |
res_hi[3]*16 + res_lo[3], |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
231 |
res_hi[4]*16 + res_lo[4]); |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
232 |
}'` |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
233 |
|
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
234 |
echo "$NETWORK" |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
235 |
} |
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
236 |
|
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
237 |
|
2c7c89cca927
5589 AI Can setup incorrecly network in dhcp if network is not just whole C class
Ethan Quach <Ethan.Quach@sun.com>
parents:
513
diff
changeset
|
238 |
# |
400
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
239 |
# get_image_type |
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
240 |
# |
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
241 |
# Purpose : Determine if image is sparc or x86 |
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
242 |
# |
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
243 |
# Arguments : |
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
244 |
# $1 - path to image |
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
245 |
# |
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
246 |
# Returns: "sparc_image" or "x86_image" |
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
247 |
# |
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
248 |
get_image_type() |
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
249 |
{ |
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
250 |
image_path=$1 |
412
3e8e42610970
5787 microroot name shouldn't be ISA specific
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
403
diff
changeset
|
251 |
if [ -d ${image_path}/platform/sun4v ]; then |
400
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
252 |
image_type="${SPARC_IMAGE}" |
412
3e8e42610970
5787 microroot name shouldn't be ISA specific
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
403
diff
changeset
|
253 |
elif [ -d ${image_path}/platform/i86pc ]; then |
400
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
254 |
image_type="${X86_IMAGE}" |
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
255 |
else |
1398
3cd5b2156d4c
imported patch oi-branding-cmd-gui-install
Alasdair Lumsden <al@everycity.co.uk>
parents:
872
diff
changeset
|
256 |
echo "Unable to determine OpenIndiana install image type" |
400
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
257 |
exit 1 |
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
258 |
fi |
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
259 |
echo "$image_type" |
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
260 |
} |
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
261 |
|
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
262 |
# |
240
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
263 |
# clean_entry |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
264 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
265 |
# Purpose : Cleanup the /tftpboot files corresponding the entry |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
266 |
# we are trying to create for this service/ethernet address |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
267 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
268 |
# Arguments : |
403
763ab176522c
6055 changes to create-client from 4194 codereview
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
400
diff
changeset
|
269 |
# $1 - client or server |
763ab176522c
6055 changes to create-client from 4194 codereview
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
400
diff
changeset
|
270 |
# $2 - Boot File Name |
240
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
271 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
272 |
clean_entry() |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
273 |
{ |
403
763ab176522c
6055 changes to create-client from 4194 codereview
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
400
diff
changeset
|
274 |
type=$1 |
763ab176522c
6055 changes to create-client from 4194 codereview
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
400
diff
changeset
|
275 |
bname=$2 |
240
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
276 |
# See if there's a cleanup file corresponding to the passed |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
277 |
# boot file |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
278 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
279 |
if [ "X${bname}" != "X" -a \ |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
280 |
-f "${Bootdir}/rm.${bname}" ] ; then |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
281 |
CLEAN=${Bootdir}/rm.${bname} |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
282 |
fi |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
283 |
|
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
284 |
# If a cleanup file exists, source it |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
285 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
286 |
if [ -f ${CLEAN} ]; then |
403
763ab176522c
6055 changes to create-client from 4194 codereview
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
400
diff
changeset
|
287 |
if [ "${type}" = "client" ]; then |
763ab176522c
6055 changes to create-client from 4194 codereview
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
400
diff
changeset
|
288 |
echo "Cleaning up preexisting install client \"${bname}\"" |
763ab176522c
6055 changes to create-client from 4194 codereview
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
400
diff
changeset
|
289 |
fi |
240
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
290 |
. ${CLEAN} |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
291 |
fi |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
292 |
|
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
293 |
rm -f ${CLEAN} |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
294 |
} |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
295 |
|
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
296 |
# |
517
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
516
diff
changeset
|
297 |
# get_grub_title |
365
77fcb1a28262
4111 having multiple install services all said "Opensolaris" in grub menu
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
327
diff
changeset
|
298 |
# |
517
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
516
diff
changeset
|
299 |
# Purpose: Get the line used in the title line of the grub menu. |
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
516
diff
changeset
|
300 |
# If the <image>/.image_info file contains the GRUB_TITLE line |
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
516
diff
changeset
|
301 |
# specifying the grub title to be used, the string will be returned. |
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
516
diff
changeset
|
302 |
# Otherwise, use the first line of the <image>/.release file as the |
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
516
diff
changeset
|
303 |
# title of the grub menu. If the <image>/.release file does not |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
707
diff
changeset
|
304 |
# exist, return the value of $DEFAULT_GRUB_TITLE. |
365
77fcb1a28262
4111 having multiple install services all said "Opensolaris" in grub menu
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
327
diff
changeset
|
305 |
# |
77fcb1a28262
4111 having multiple install services all said "Opensolaris" in grub menu
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
327
diff
changeset
|
306 |
# Arguments: |
77fcb1a28262
4111 having multiple install services all said "Opensolaris" in grub menu
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
327
diff
changeset
|
307 |
# $1 - path to image |
77fcb1a28262
4111 having multiple install services all said "Opensolaris" in grub menu
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
327
diff
changeset
|
308 |
# |
517
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
516
diff
changeset
|
309 |
# Returns: String specified with the GRUB_TITLE keyward in <image>/.image_info |
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
516
diff
changeset
|
310 |
# file. If no GRUB_TITLE is specified or if <image>/.image_info |
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
516
diff
changeset
|
311 |
# does not exist, the first line of the <image>/.release file will |
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
516
diff
changeset
|
312 |
# be returned. If <image>/.release file is not found, the value of |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
707
diff
changeset
|
313 |
# $DEFAULT_GRUB_TITLE will be returned. |
365
77fcb1a28262
4111 having multiple install services all said "Opensolaris" in grub menu
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
327
diff
changeset
|
314 |
# |
517
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
516
diff
changeset
|
315 |
get_grub_title() |
365
77fcb1a28262
4111 having multiple install services all said "Opensolaris" in grub menu
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
327
diff
changeset
|
316 |
{ |
517
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
516
diff
changeset
|
317 |
|
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
516
diff
changeset
|
318 |
grub_title="" |
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
516
diff
changeset
|
319 |
|
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
516
diff
changeset
|
320 |
image_info_path=$1/${DOT_IMAGE_INFO} |
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
516
diff
changeset
|
321 |
if [ -f ${image_info_path} ] ; then |
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
516
diff
changeset
|
322 |
while read line ; do |
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
516
diff
changeset
|
323 |
if [[ "${line}" == ~(E)^${GRUB_TITLE_KEYWORD}=.* ]] |
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
516
diff
changeset
|
324 |
then |
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
516
diff
changeset
|
325 |
grub_title="${line#*=}" |
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
516
diff
changeset
|
326 |
fi |
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
516
diff
changeset
|
327 |
done < ${image_info_path} |
365
77fcb1a28262
4111 having multiple install services all said "Opensolaris" in grub menu
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
327
diff
changeset
|
328 |
fi |
517
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
516
diff
changeset
|
329 |
|
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
516
diff
changeset
|
330 |
if [ "X${grub_title}" == "X" ] ; then |
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
516
diff
changeset
|
331 |
releasepath=$1/${DOT_RELEASE} |
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
516
diff
changeset
|
332 |
if [ -f ${releasepath} ]; then |
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
516
diff
changeset
|
333 |
grub_title=`head -1 ${releasepath}` |
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
516
diff
changeset
|
334 |
else |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
707
diff
changeset
|
335 |
grub_title=$DEFAULT_GRUB_TITLE |
517
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
516
diff
changeset
|
336 |
fi |
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
516
diff
changeset
|
337 |
fi |
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
516
diff
changeset
|
338 |
echo "$grub_title" |
365
77fcb1a28262
4111 having multiple install services all said "Opensolaris" in grub menu
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
327
diff
changeset
|
339 |
} |
77fcb1a28262
4111 having multiple install services all said "Opensolaris" in grub menu
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
327
diff
changeset
|
340 |
|
77fcb1a28262
4111 having multiple install services all said "Opensolaris" in grub menu
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
327
diff
changeset
|
341 |
# |
700
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
342 |
# get_grub_min_mem64 |
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
343 |
# |
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
344 |
# Purpose: Get minimum memory required to boot network AI in 64 bit mode. |
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
345 |
# GRUB menu.lst is then populated with 'min_mem64' option accordingly. |
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
346 |
# If that parameter can't be obtained, return 1536 (1,5GB) for backward |
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
347 |
# compatibility. |
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
348 |
# |
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
349 |
# Arguments: |
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
350 |
# $1 - path to image |
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
351 |
# |
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
352 |
# Returns: String specified with the GRUB_MIN_MEM64 keyword |
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
353 |
# in <image>/.image_info file. If no GRUB_MIN_MEM64 is specified or if |
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
354 |
# <image>/.image_info does not exist, return 1536 (1,5GB). |
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
355 |
# |
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
356 |
get_grub_min_mem64() |
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
357 |
{ |
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
358 |
|
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
359 |
grub_min_mem64="" |
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
360 |
|
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
361 |
image_info_path=$1/${DOT_IMAGE_INFO} |
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
362 |
if [ -f ${image_info_path} ] ; then |
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
363 |
while read line ; do |
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
364 |
if [[ "${line}" == ~(E)^${GRUB_MIN_MEM64}=.* ]] |
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
365 |
then |
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
366 |
grub_min_mem64="${line#*=}" |
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
367 |
fi |
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
368 |
done < ${image_info_path} |
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
369 |
fi |
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
370 |
|
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
371 |
if [ -z "$grub_min_mem64" ] ; then |
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
372 |
grub_min_mem64="1536" |
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
373 |
fi |
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
374 |
|
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
375 |
echo "$grub_min_mem64" |
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
376 |
} |
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
377 |
|
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
378 |
# |
707
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
379 |
# get_grub_do_safe_default |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
380 |
# |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
381 |
# Purpose: Get flag from the image indicating whether or not the grub menu |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
382 |
# should be created with a safe default entry (i.e. a default entry |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
383 |
# that does not start an automated install.) |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
384 |
# |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
385 |
# Arguments: |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
386 |
# $1 - path to image |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
387 |
# |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
388 |
# Returns: |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
389 |
# true - if GRUB_DO_SAFE_DEFAULT is set to true in the |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
390 |
# <image>/.image_info file. |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
391 |
# false - otherwise |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
392 |
# |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
393 |
get_grub_do_safe_default() |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
394 |
{ |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
395 |
grub_do_safe_default="" |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
396 |
|
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
397 |
image_info_path=$1/${DOT_IMAGE_INFO} |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
398 |
if [ -f ${image_info_path} ] ; then |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
399 |
while read line ; do |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
400 |
if [[ "${line}" == ~(E)^${GRUB_DO_SAFE_DEFAULT}=.* ]] |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
401 |
then |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
402 |
grub_do_safe_default="${line#*=}" |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
403 |
fi |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
404 |
done < ${image_info_path} |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
405 |
fi |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
406 |
|
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
407 |
if [ -z "$grub_do_safe_default" -o \ |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
408 |
"$grub_do_safe_default" != "true" ] ; then |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
409 |
grub_do_safe_default="false" |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
410 |
fi |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
411 |
|
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
412 |
echo "$grub_do_safe_default" |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
413 |
} |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
414 |
|
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
415 |
# |
468
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
416 |
# get_service_address |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
417 |
# |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
418 |
# Purpose: Get the service location (machine ip and port nuber) |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
419 |
# for given service name. Common service database is |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
420 |
# looked up for this information. |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
421 |
# |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
422 |
# |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
423 |
# Arguments: |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
424 |
# $1 - service name |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
425 |
# |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
426 |
# Returns: service address in format <machine_ip>:<port_number> |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
427 |
# if service not found in database, "unknown" is returned |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
428 |
# |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
429 |
# |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
430 |
get_service_address() |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
431 |
{ |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
432 |
# |
521
0d5a79e513d3
7148 installadm should give correct dhcp macro for the subnet being configured on the server
Evan Layton <Evan.Layton@Sun.COM>
parents:
517
diff
changeset
|
433 |
# Search for the txt_record in the AI service's SMF properties. |
0d5a79e513d3
7148 installadm should give correct dhcp macro for the subnet being configured on the server
Evan Layton <Evan.Layton@Sun.COM>
parents:
517
diff
changeset
|
434 |
# The data is stored as a property of the AI service's property group. |
468
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
435 |
# |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
436 |
# ... |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
437 |
# txt_record=aiwebserver=<machine_hostname>:<machine_port> |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
438 |
# ... |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
439 |
# |
521
0d5a79e513d3
7148 installadm should give correct dhcp macro for the subnet being configured on the server
Evan Layton <Evan.Layton@Sun.COM>
parents:
517
diff
changeset
|
440 |
srv_location=`$SVCCFG -s $SMF_INST_SERVER listprop \ |
0d5a79e513d3
7148 installadm should give correct dhcp macro for the subnet being configured on the server
Evan Layton <Evan.Layton@Sun.COM>
parents:
517
diff
changeset
|
441 |
AI$1/txt_record` |
0d5a79e513d3
7148 installadm should give correct dhcp macro for the subnet being configured on the server
Evan Layton <Evan.Layton@Sun.COM>
parents:
517
diff
changeset
|
442 |
srv_location="${srv_location#*=}" |
468
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
443 |
|
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
444 |
# if location of service can't be obtained, return with "unknown" |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
445 |
if [ -z "$srv_location" ] ; then |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
446 |
echo "$SERVICE_ADDRESS_UNKNOWN" |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
447 |
return 0 |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
448 |
fi |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
449 |
|
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
450 |
srv_address_hostname=`echo "$srv_location" | cut -f 1 -d ":"` |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
451 |
srv_address_ip=`get_host_ip "$srv_address_hostname"` |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
452 |
srv_address_port=`echo "$srv_location" | cut -f 2 -d ":"` |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
453 |
|
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
454 |
# if port or IP can't be determined, return with "unknown" |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
455 |
if [ -n "$srv_address_ip" -a -n "$srv_address_port" ] ; then |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
456 |
echo "$srv_address_ip:$srv_address_port" |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
457 |
else |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
458 |
echo "$SERVICE_ADDRESS_UNKNOWN" |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
459 |
fi |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
460 |
|
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
461 |
return 0 |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
462 |
} |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
463 |
|
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
464 |
# |
240
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
465 |
# create_menu_lst_file |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
466 |
# |
400
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
467 |
# Purpose : Create the menu.lst file so that the x86 client can get the |
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
468 |
# information about the netimage and download the necessary files. |
412
3e8e42610970
5787 microroot name shouldn't be ISA specific
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
403
diff
changeset
|
469 |
# It also adds location of the kernel, boot_archive and other options. |
240
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
470 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
471 |
# Arguments : |
400
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
472 |
# None, but it is expected that: |
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
473 |
# $Menufile is set to the correct file. |
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
474 |
# $IMAGE_PATH is set to the absolute path of the image. |
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
475 |
# $SERVICE_NAME is set to the service name. |
468
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
476 |
# $SERVICE_ADDRESS is set to the location of given service. |
400
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
477 |
# $IMAGE_IP is set to the IP of the server hosting the image. |
707
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
478 |
# $BARGLIST is set to the comma separated list of boot properties |
240
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
479 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
480 |
create_menu_lst_file() |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
481 |
{ |
400
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
482 |
|
707
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
483 |
# temporary files used to create separate entries |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
484 |
# |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
485 |
tmpent1="/tmp/ent1.$$" |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
486 |
tmpent2="/tmp/ent2.$$" |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
487 |
|
240
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
488 |
# create the menu.lst.<bootfile> file |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
489 |
# |
400
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
490 |
tmpmenu=${Menufile}.$$ |
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
491 |
|
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
492 |
printf "default=0\n" > ${tmpmenu} |
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
493 |
printf "timeout=30\n" >> ${tmpmenu} |
700
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
494 |
|
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
495 |
# get min_mem64 entry |
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
496 |
min_mem64=`get_grub_min_mem64 "$IMAGE_PATH"` |
194c6c516a71
13393 min_mem64=1536 in AI GRUB menu should be revisited
Jan Damborsky <jan.damborsky@sun.com>
parents:
638
diff
changeset
|
497 |
printf "min_mem64=$min_mem64\n" >> ${tmpmenu} |
240
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
498 |
|
400
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
499 |
# get release info and strip leading spaces |
517
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
516
diff
changeset
|
500 |
grub_title_string=`get_grub_title ${IMAGE_PATH}` |
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
516
diff
changeset
|
501 |
title=`echo title ${grub_title_string} | $SED -e 's/ //g'` |
400
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
502 |
|
707
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
503 |
# get flag indicating whether or not to create a safe default |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
504 |
# entry in the menu (i.e. a default entry that does not start |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
505 |
# an automated install) |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
506 |
grub_do_safe_default=`get_grub_do_safe_default ${IMAGE_PATH}` |
240
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
507 |
|
707
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
508 |
if [ "$grub_do_safe_default" = "true" ]; then |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
509 |
ENT_FILES="${tmpent1} ${tmpent2}" |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
510 |
else |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
511 |
ENT_FILES="${tmpent2}" |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
512 |
fi |
468
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
513 |
|
707
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
514 |
if [ "$grub_do_safe_default" = "true" ] ; then |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
515 |
# title and kernel lines for safe default entry. |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
516 |
printf "${title} boot image \n" >> ${tmpent1} |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
517 |
printf "\tkernel\$ /${BootLofs}/platform/i86pc/kernel/\$ISADIR/unix -B ${BARGLIST}" >> ${tmpent1} |
468
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
518 |
|
707
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
519 |
# append to automated install entry. |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
520 |
title="${title} Automated Install" |
468
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
521 |
fi |
78cbeb8904af
6320 'No valid AI service found' error if AI client and server are on different subnets
Jan Damborsky <jan.damborsky@sun.com>
parents:
445
diff
changeset
|
522 |
|
707
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
523 |
# title and kernel lines for the automated install entry. |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
524 |
printf "${title} \n" >> ${tmpent2} |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
525 |
printf "\tkernel\$ /${BootLofs}/platform/i86pc/kernel/\$ISADIR/unix -B ${BARGLIST}" >> ${tmpent2} |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
526 |
|
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
527 |
# add the install bootarg, only to the automated install entry. |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
528 |
printf "install=true," >> ${tmpent2} |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
529 |
|
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
530 |
# remaning common lines. |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
531 |
for ent in ${ENT_FILES} ; do |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
532 |
# add install media path and service name |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
533 |
# |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
534 |
printf "install_media=" >> ${ent} |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
535 |
printf "http://${IMAGE_IP}:${HTTP_PORT}" >> ${ent} |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
536 |
printf "${IMAGE_PATH}" >> ${ent} |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
537 |
|
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
538 |
printf ",install_service=" >> ${ent} |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
539 |
printf "${SERVICE_NAME}" >> ${ent} |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
540 |
|
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
541 |
# |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
542 |
# add service location |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
543 |
# it can be either provided by the caller or set to "unknown" |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
544 |
# |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
545 |
# If set to "unknown", try to look up this information |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
546 |
# in service configuration database right now |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
547 |
# |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
548 |
[ "$SERVICE_ADDRESS" = "$SERVICE_ADDRESS_UNKNOWN" ] && |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
549 |
SERVICE_ADDRESS=`get_service_address ${SERVICE_NAME}` |
638
1230668ca471
7966 setting 'livemode=text' is no-op for AI, should be removed from installadm(1M)
Jan Damborsky <jan.damborsky@sun.com>
parents:
636
diff
changeset
|
550 |
|
707
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
551 |
if [ "$SERVICE_ADDRESS" != "$SERVICE_ADDRESS_UNKNOWN" ] ; then |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
552 |
echo "Service discovery fallback mechanism set up" |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
553 |
|
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
554 |
printf ",install_svc_address=" >> ${ent} |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
555 |
printf "$SERVICE_ADDRESS" >> ${ent} |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
556 |
else |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
557 |
echo "Couldn't determine service location, fallback " \ |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
558 |
"mechanism will not be available" |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
559 |
fi |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
560 |
|
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
561 |
printf "\n" >> ${ent} |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
562 |
|
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
563 |
# |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
564 |
# for backwards compatibility, inspect layout of boot archive and |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
565 |
# generate GRUB 'module' entry accordingly. Two scenarios are covered: |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
566 |
# |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
567 |
# [1] combined boot archive (contains both 32 and 64 bit stuff) |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
568 |
# <ai_image>/boot/x86.microroot |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
569 |
# [2] separate 32 and 64 bit boot archives |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
570 |
# <ai_image>/platform/i86pc/$ISADIR/boot_archive |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
571 |
# |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
572 |
if [ -f ${IMAGE_PATH}/boot/x86.microroot ]; then |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
573 |
printf "\tmodule /${BootLofs}/x86.microroot\n" >> ${ent} |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
574 |
else |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
575 |
printf "\tmodule$ /${BootLofs}/platform/i86pc/\$ISADIR/boot_archive\n" >> ${ent} |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
576 |
fi |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
577 |
done |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
578 |
|
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
579 |
if [ "$grub_do_safe_default" = "true" ] ; then |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
580 |
cat ${tmpent1} >> ${tmpmenu} |
415
968ac60fbd68
6143 x86 AI 11/08 install fails if you use SUNWinstalladm-tools from 0109
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
412
diff
changeset
|
581 |
fi |
707
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
582 |
cat ${tmpent2} >> ${tmpmenu} |
636
cac9378cd3f8
6092 Rename bootroot to boot_archive in DC
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
547
diff
changeset
|
583 |
|
400
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
584 |
mv ${tmpmenu} ${Menufile} |
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
585 |
|
707
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
586 |
rm ${ENT_FILES} >/dev/null |
2274294287c2
14082 bootarg for booting automated installs over the network
Ethan Quach <Ethan.Quach@sun.com>
parents:
700
diff
changeset
|
587 |
|
400
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
588 |
return 0 |
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
589 |
|
240
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
590 |
} |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
591 |
|
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
592 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
593 |
# mount_lofs_boot |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
594 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
595 |
# Purpose : Create the loopback mount of the boot directory of the netimage |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
596 |
# under /tftpboot. Also updates /etc/vfstab so that they are always |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
597 |
# mounted. |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
598 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
599 |
# Arguments : |
400
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
600 |
# None. But it is expected that $IMAGE_PATH is set to the netimage |
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
601 |
# and $Bootdir is set to /tftpboot |
240
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
602 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
603 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
604 |
mount_lofs_boot() |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
605 |
{ |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
606 |
# lofs mount /boot directory under /tftpboot |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
607 |
# First, check if it is already mounted |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
608 |
# |
400
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
609 |
IMAGE_BOOTDIR=${IMAGE_PATH}/boot |
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
610 |
line=`grep "^${IMAGE_BOOTDIR}[ ]" /etc/vfstab` |
240
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
611 |
if [ $? = 0 ]; then |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
612 |
# already mounted |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
613 |
mountpt=`echo $line | cut -d ' ' -f3` |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
614 |
BootLofs=`basename "${mountpt}"` |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
615 |
BootLofsdir=`dirname "${mountpt}"` |
415
968ac60fbd68
6143 x86 AI 11/08 install fails if you use SUNWinstalladm-tools from 0109
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
412
diff
changeset
|
616 |
if [ ${BootLofsdir} != ${Bootdir} ]; then printf "${myname}: ${IMAGE_BOOTDIR} mounted at" |
240
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
617 |
printf " ${mountpt}\n" |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
618 |
printf "${myname}: retry after unmounting and deleting" |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
619 |
printf " entry form /etc/vfstab\n" |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
620 |
exit 1 |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
621 |
fi |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
622 |
|
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
623 |
# Check to see if the mount is sane, if not, kick it. |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
624 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
625 |
# Note: One might think that the case when kicking the |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
626 |
# mounpoint won't work should then be handled, but |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
627 |
# if that were the case, the code path for no existing |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
628 |
# mount would have been taken resulting in a new |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
629 |
# mountpoint being created. |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
630 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
631 |
if [ ! -f $mountpt/multiboot ]; then |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
632 |
umount $mountpt |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
633 |
mount $mountpt |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
634 |
fi |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
635 |
else |
400
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
636 |
# Not mounted. Get a new directory name and mount IMAGE_BOOTDIR |
240
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
637 |
max=0 |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
638 |
for i in ${Bootdir}/I86PC.${VERSION}* ; do |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
639 |
max_num=`expr $i : ".*boot.I86PC.${VERSION}-\(.*\)"` |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
640 |
if [ "$max_num" -gt $max ]; then |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
641 |
max=$max_num |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
642 |
fi |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
643 |
done |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
644 |
max=`expr $max + 1` |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
645 |
|
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
646 |
BootLofs=I86PC.${VERSION}-${max} |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
647 |
mkdir -p ${Bootdir}/${BootLofs} |
400
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
648 |
mount -F lofs -o ro ${IMAGE_BOOTDIR} ${Bootdir}/${BootLofs} |
240
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
649 |
if [ $? != 0 ]; then |
400
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
650 |
echo "${myname}: failed to mount ${IMAGE_BOOTDIR} on" \ |
240
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
651 |
"${Bootdir}/${BootLofs}" |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
652 |
exit 1 |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
653 |
fi |
400
f7861b6d6614
4194 need to make installadm tool changes for SPARC
Sue Sohn <Susan.Sohn@Sun.COM>
parents:
365
diff
changeset
|
654 |
printf "${IMAGE_BOOTDIR} - ${Bootdir}/${BootLofs} " >> /etc/vfstab |
240
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
655 |
printf "lofs - yes ro\n" >> /etc/vfstab |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
656 |
fi |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
657 |
} |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
658 |
|
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
659 |
# |
522
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
660 |
# Remove the entry for the service mountpoint from vfstab |
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
661 |
# |
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
662 |
# Arguments: |
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
663 |
# $1 - Service name |
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
664 |
# |
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
665 |
# Returns: |
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
666 |
# None |
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
667 |
# |
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
668 |
remove_vfstab_entry() |
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
669 |
{ |
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
670 |
name=$1 |
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
671 |
|
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
672 |
# Read the image_path from the smf database |
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
673 |
IMAGE_PATH=`${SVCCFG} -s svc:/system/install/server:default listprop \ |
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
674 |
AI${name} | ${GREP} image_path | ${AWK} '{print $3}'` |
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
675 |
if [ "X${IMAGE_PATH}" == "X" ] ; then |
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
676 |
# Didn't exist so there is nothing to remove |
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
677 |
return |
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
678 |
fi |
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
679 |
IMAGE_BOOTDIR=${IMAGE_PATH}/boot |
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
680 |
|
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
681 |
# Check to see if the entry is in /etc/vfstab. |
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
682 |
# If it's not, there's nothing to do so just return |
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
683 |
${GREP} "^${IMAGE_BOOTDIR}[ ]" /etc/vfstab |
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
684 |
if [ $? -ne 0 ]; then |
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
685 |
return |
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
686 |
fi |
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
687 |
while read line ; do |
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
688 |
# grab the device field |
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
689 |
device=`echo ${line} | ${AWK} '{print $1}'` |
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
690 |
# If the device is our image boot dir don't write it out |
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
691 |
if [ "${device}" != "${IMAGE_BOOTDIR}" ] ; then |
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
692 |
printf "${line}\n" >> /tmp/vfstab.$$ |
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
693 |
fi |
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
694 |
done < /etc/vfstab |
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
695 |
${MV} /tmp/vfstab.$$ /etc/vfstab |
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
696 |
} |
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
697 |
|
094f1d3299e5
5813 installadm delete-service does not remove entry from vfstab
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
521
diff
changeset
|
698 |
# |
240
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
699 |
# start tftpd if needed |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
700 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
701 |
start_tftpd() |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
702 |
{ |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
703 |
|
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
704 |
INETD_CONF="/etc/inetd.conf" |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
705 |
TMP_INETD_CONF="/tmp/inetd.conf.$$" |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
706 |
|
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
707 |
# see if tftp is in the /etc/inetd.conf file. If it is there |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
708 |
# and commented out, need to uncomment it. If it isn't there |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
709 |
# at all, need to add it. |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
710 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
711 |
convert=0 |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
712 |
if grep '^#tftp[ ]' ${INETD_CONF} > /dev/null ; then |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
713 |
# Found it commented out, so it must be disabled. Use |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
714 |
# sed to uncomment. |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
715 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
716 |
convert=1 |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
717 |
echo "enabling tftp in /etc/inetd.conf" |
513
fb717173396b
7218 intalladm needs to move service data into SMF
Evan Layton <Evan.Layton@Sun.COM>
parents:
485
diff
changeset
|
718 |
$SED '/^#tftp/ s/#//' ${INETD_CONF} > ${TMP_INETD_CONF} |
240
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
719 |
else |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
720 |
cp ${INETD_CONF} ${TMP_INETD_CONF} |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
721 |
grep -s '^tftp[ ]' ${TMP_INETD_CONF} > /dev/null |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
722 |
if [ $? -eq 1 ] ; then |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
723 |
# No entry, so add it. |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
724 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
725 |
convert=1 |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
726 |
echo "adding tftp to /etc/inetd.conf" |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
727 |
cat >> ${TMP_INETD_CONF} <<-EOF |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
728 |
# TFTPD - tftp server (primarily used for booting) |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
729 |
tftp dgram udp6 wait root /usr/sbin/in.tftpd in.tftpd -s /tftpboot |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
730 |
EOF |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
731 |
fi |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
732 |
fi |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
733 |
|
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
734 |
if [ $convert -eq 1 ]; then |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
735 |
# Copy the modified tmp file to the real thing |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
736 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
737 |
cp ${TMP_INETD_CONF} ${INETD_CONF} |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
738 |
|
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
739 |
# If the "network/tftp/udp6" service doesn't |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
740 |
# already exist, convert it. |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
741 |
/usr/bin/svcprop -q network/tftp/udp6 > /dev/null 2>&1 |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
742 |
if [ $? != 0 ]; then |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
743 |
echo "Converting /etc/inetd.conf" |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
744 |
/usr/sbin/inetconv >/dev/null 2>&1 |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
745 |
fi |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
746 |
fi |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
747 |
|
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
748 |
rm -f ${TMP_INETD_CONF} |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
749 |
|
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
750 |
} |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
751 |
|
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
752 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
753 |
# tftp_file_name |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
754 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
755 |
# Purpose : Determine the name to use for installing a file in ${Bootdir}. |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
756 |
# Use an existing file if there is one that matches, otherwise |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
757 |
# make up a new name with a version number suffix. |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
758 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
759 |
# Arguments : |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
760 |
# $1 - the file to be installed |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
761 |
# $2 - the prefix to use for forming a name |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
762 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
763 |
# Results : |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
764 |
# Filename written to standard output. |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
765 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
766 |
tftp_file_name() |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
767 |
{ |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
768 |
SRC=$1 |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
769 |
BASE=$2 |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
770 |
file_to_use= |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
771 |
|
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
772 |
I86PC="I86PC" |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
773 |
|
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
774 |
# Determine the name to use for the file in bootdir. |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
775 |
# Either use an existing file or make up a new name with a version |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
776 |
# number appended. |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
777 |
for i in ${Bootdir}/${BASE}.${I86PC}.${VERSION}* ; do |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
778 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
779 |
# avoid symbolic links, or we can end up with |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
780 |
# inconsistent references |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
781 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
782 |
if [ -h $i ]; then |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
783 |
continue |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
784 |
fi |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
785 |
|
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
786 |
if cmp -s $SRC $i; then |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
787 |
file_to_use=$i |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
788 |
break |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
789 |
fi |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
790 |
done |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
791 |
|
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
792 |
if [ "$file_to_use" ]; then |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
793 |
file_to_use=`basename $file_to_use` |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
794 |
else |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
795 |
# Make this name not a subset of the old style names, so old style |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
796 |
# cleanup will work. |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
797 |
|
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
798 |
max=0 |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
799 |
for i in ${Bootdir}/${BASE}.${I86PC}.${VERSION}* ; do |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
800 |
max_num=`expr $i : ".*${BASE}.${I86PC}.${VERSION}-\(.*\)"` |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
801 |
|
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
802 |
if [ "$max_num" -gt $max ]; then |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
803 |
max=$max_num |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
804 |
fi |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
805 |
done |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
806 |
|
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
807 |
max=`expr $max + 1` |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
808 |
|
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
809 |
file_to_use=${BASE}.${I86PC}.${VERSION}-${max} |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
810 |
fi |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
811 |
echo $file_to_use |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
812 |
} |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
813 |
|
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
814 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
815 |
# setup_tftp |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
816 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
817 |
# Purpose : Create a link from one filename to another. Also store a |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
818 |
# command in the cleanup file to remove the created link. |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
819 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
820 |
# Arguments : |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
821 |
# $1 - the link target |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
822 |
# $2 - the link source |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
823 |
# |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
824 |
setup_tftp() |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
825 |
{ |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
826 |
target=$1 |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
827 |
source=$2 |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
828 |
|
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
829 |
echo "rm /tftpboot/${target}" >> ${CLEAN} |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
830 |
|
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
831 |
if [ -h /tftpboot/${target} ]; then |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
832 |
# save it, and append the cleanup command |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
833 |
mv /tftpboot/${target} /tftpboot/${target}- |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
834 |
echo "mv /tftpboot/${target}- /tftpboot/${target}" >> ${CLEAN} |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
835 |
fi |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
836 |
|
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
837 |
ln -s ${source} /tftpboot/${target} |
8a1045ae9dd9
3641 installadm tools to manage clients
sundar.yamunachari@sun.com
parents:
diff
changeset
|
838 |
} |
537
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
839 |
|
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
840 |
# |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
841 |
# find_network_attr |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
842 |
# |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
843 |
# Purpose : Given an IP address, figure out which network on this |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
844 |
# server it belongs to, or its netmask, depending on $2. |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
845 |
# Workhorse function for find_network(), find_network_nmask() and |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
846 |
# find_network_baseIP() |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
847 |
# |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
848 |
# Parameters : |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
849 |
# $1 - IP address |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
850 |
# $2 - what gets returned: one of "network", "netmask" or "netIPaddr" |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
851 |
# - "network" specifies that this function returns the network |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
852 |
# corresponding to the IP address (IP addr & netmask) |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
853 |
# - "netmask" specifies that this function returns the netmask |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
854 |
# of the network corresponding to the IP address |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
855 |
# - "netIPaddr" specifies that this function returns the base IP |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
856 |
# address of the network corresponding to the IP address |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
857 |
# Returns : |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
858 |
# Network for IP address passed in. |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
859 |
# |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
860 |
find_network_attr() |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
861 |
{ |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
862 |
typeset ipaddr=$1 |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
863 |
typeset attr=$2 |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
864 |
|
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
865 |
if [ -z "$ipaddr" ] ; then |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
866 |
return |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
867 |
fi |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
868 |
|
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
869 |
# Iterate through the interfaces to figure what the possible |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
870 |
# networks are (in case this is a multi-homed server). |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
871 |
# For each network, use its netmask with the given IP address |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
872 |
# to see if resulting network matches. |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
873 |
$IFCONFIG -a | grep broadcast | awk '{print $2, $4}' | \ |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
874 |
while read t_ipaddr t_netmask ; do |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
875 |
|
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
876 |
# get network of this interface |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
877 |
if_network=`get_network $t_ipaddr $t_netmask` |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
878 |
if [ -z $if_network ]; then |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
879 |
continue |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
880 |
fi |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
881 |
|
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
882 |
# get network for passed in ipaddr based |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
883 |
# on this interfaces's netmask |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
884 |
ip_network=`get_network $ipaddr $t_netmask` |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
885 |
if [ -z $ip_network ]; then |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
886 |
continue |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
887 |
fi |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
888 |
|
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
889 |
# if networks match, this is the network that |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
890 |
# the passed in ipaddr belongs to. |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
891 |
if [ "$if_network" = "$ip_network" ] ; then |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
892 |
case $attr in |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
893 |
"network" ) |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
894 |
echo "$if_network" |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
895 |
;; |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
896 |
"netmask" ) |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
897 |
echo "$t_netmask" |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
898 |
;; |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
899 |
"netIPaddr" ) |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
900 |
echo "$t_ipaddr" |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
901 |
;; |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
902 |
esac |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
903 |
break |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
904 |
fi |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
905 |
done |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
906 |
} |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
907 |
|
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
908 |
# |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
909 |
# find_network |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
910 |
# |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
911 |
# Purpose : Given an IP address, figure out which network on this |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
912 |
# server it belongs to. |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
913 |
# |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
914 |
# Parameters : |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
915 |
# $1 - IP address |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
916 |
# |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
917 |
# Returns : |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
918 |
# Network for IP address passed in. |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
919 |
# |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
920 |
find_network() |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
921 |
{ |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
922 |
echo `find_network_attr $1 "network"` |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
923 |
} |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
924 |
|
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
925 |
# |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
926 |
# find_network_nmask() |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
927 |
# |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
928 |
# Purpose : Given an IP address, figure out which network on this server it |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
929 |
# belongs to, and return that network's netmask. |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
930 |
# |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
931 |
# Parameters : |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
932 |
# $1 - IP address |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
933 |
# |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
934 |
# Returns : |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
935 |
# Netmask for IP address passed in. |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
936 |
# |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
937 |
find_network_nmask() |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
938 |
{ |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
939 |
echo `find_network_attr $1 "netmask"` |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
940 |
} |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
941 |
|
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
942 |
# |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
943 |
# find_network_baseIP() |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
944 |
# |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
945 |
# Purpose : Given an IP address, figure out which network on this server it |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
946 |
# belongs to, and return that network's base IP address. |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
947 |
# |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
948 |
# Parameters : |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
949 |
# $1 - IP address |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
950 |
# |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
951 |
# Returns : |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
952 |
# Netmask for IP address passed in. |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
953 |
# |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
954 |
find_network_baseIP() |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
955 |
{ |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
956 |
echo `find_network_attr $1 "netIPaddr"` |
3b5b3a3a0fe9
6252 /etc/nsswitch.dns issues with AI setup if you install from livecd
Jack Schwartz <Jack.A.Schwartz@Sun.COM>
parents:
522
diff
changeset
|
957 |
} |