postinstall revision da14cebe459d3275048785f25bd869cb09b5307f
ac4e70ff8955669341f435bc0a734a17c01af124Mark Andrews#
885f47576842cf3c569315b9a48bd9f0ca03f203Automatic Updater# CDDL HEADER START
71bd43eebd9d6e42dbcae62b730f5b6508d5acd8Automatic Updater#
59528addd704f8d5757b54e540520f74e588a7c7Automatic Updater# The contents of this file are subject to the terms of the
59528addd704f8d5757b54e540520f74e588a7c7Automatic Updater# Common Development and Distribution License (the "License").
2bb3422dc683c013db7042f5736240de6b86f182Automatic Updater# You may not use this file except in compliance with the License.
0bddff542cf2ae1b6595020f2f72ca482c6b438fAutomatic Updater#
75b70a68aefaa17ac4e768d5ed85d2f50d471490Automatic Updater# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
59528addd704f8d5757b54e540520f74e588a7c7Automatic Updater# or http://www.opensolaris.org/os/licensing.
ea854b585041ad19f70f7af15e08144ef2c2bd1bMark Andrews# See the License for the specific language governing permissions
78cb74fab4665da2e2641ba909c6f59f74cc4193Automatic Updater# and limitations under the License.
c89d02f2fb4c06168236d600e86831cff324f763Mark Andrews#
90ff38a0d8deaf5f9c2aa5916d99b2e572d28738Automatic Updater# When distributing Covered Code, include this CDDL HEADER in each
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
ac4e70ff8955669341f435bc0a734a17c01af124Mark Andrews# If applicable, add the following below this CDDL HEADER, with the
6c6a121295b30772cbf3dd75a51fb9d883051a0eAutomatic Updater# fields enclosed by brackets "[]" replaced with your own identifying
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# information: Portions Copyright [yyyy] [name of copyright owner]
9cd5eb6fe0f26d65724b99216cb31dcdd12e4afdAutomatic Updater#
bc0a53583d92309bebcf93c408e2f3247ebd3d3cAutomatic Updater# CDDL HEADER END
56874aef380a64a2c183b7c282c3e7a361d67fa1Automatic Updater#
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
96713299d08c0735c18ebe8772dd2cc1ecd4356aAutomatic Updater# Use is subject to license terms.
3cc98b8ecedcbc8465f1cf2740b966b315662430Automatic Updater#
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews#
96713299d08c0735c18ebe8772dd2cc1ecd4356aAutomatic Updater# Convert datalink configuration into a series of dladm(1M) commands and
80faf1588895fd26490f82f95a7a1b771df1c324Automatic Updater# keep them in an upgrade script. This script will then be run in the
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# network-physical service.
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater#
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrews# Note that we cannot use the /var/svc/profile/upgrade script because
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater# that script is run during manifest-import which is too late for
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson# datalink configuration.
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater#
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic UpdaterUPGRADE_SCRIPT=/var/svc/profile/upgrade_datalink
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic UpdaterAGGR_CONF=/etc/aggregation.conf
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic UpdaterORIG=$BASEDIR/$AGGR_CONF
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updaterif [ ! -f "${ORIG}" ]; then
aa9c561961e9d877946ebaa8795fa2be054ab7bfEvan Hunt # Try the alternate location.
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater AGGR_CONF=/etc/dladm/aggregation.conf
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater ORIG=$BASEDIR/$AGGR_CONF
aa9c561961e9d877946ebaa8795fa2be054ab7bfEvan Huntfi
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater# Now upgrade aggregation.conf to the new format.
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updaterif [ -f "${ORIG}" ]; then
aa9c561961e9d877946ebaa8795fa2be054ab7bfEvan Hunt # Strip off comments, then each remaining line defines an
2d2dc37599979c83495510f8af8d1756753aa2c5Automatic Updater # aggregation the admnistrator configured on the old system.
2d2dc37599979c83495510f8af8d1756753aa2c5Automatic Updater # Each line corresponds to one dladm command that is appended
aa9c561961e9d877946ebaa8795fa2be054ab7bfEvan Hunt # to the upgrade script.
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater cat $ORIG | grep '^[^#]' | while read line; do
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater echo $line | while read aggr_index rest
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater do
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater policy=`echo $rest | /usr/bin/awk '{print $1}'`
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater nports=`echo $rest | /usr/bin/awk '{print $2}'`
cdfc81e048bd34c1d628380247bda6b80a89e20eAutomatic Updater ports=`echo $rest | /usr/bin/awk '{print $3}'`
cdfc81e048bd34c1d628380247bda6b80a89e20eAutomatic Updater mac=`echo $rest | /usr/bin/awk '{print $4}'`
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater lacp_mode=`echo $rest | /usr/bin/awk '{print $5}'`
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater lacp_timer=`echo $rest | /usr/bin/awk '{print $6}'`
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater dladm_string="dladm create-aggr -P $policy -l \
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater $lacp_mode -T $lacp_timer"
eabc9c3c07cd956d3c436bd7614cb162dabdda76Mark Andrews # A fixed MAC address
eabc9c3c07cd956d3c436bd7614cb162dabdda76Mark Andrews if [ "${mac}" != "auto" ]; then
eabc9c3c07cd956d3c436bd7614cb162dabdda76Mark Andrews dladm_string="$dladm_string -u $mac"
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington fi
9cd5eb6fe0f26d65724b99216cb31dcdd12e4afdAutomatic Updater i=1
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews while [ $i -le "${nports}" ]; do
59528addd704f8d5757b54e540520f74e588a7c7Automatic Updater device=`echo $ports | cut -d, -f$i`
80faf1588895fd26490f82f95a7a1b771df1c324Automatic Updater # Older aggregation.conf files have the format
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews # of device_name/port_number. We don't need
59528addd704f8d5757b54e540520f74e588a7c7Automatic Updater # the port number, so get rid of it if it is
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews # there.
db5b7e2cdf150c46e8242d3e2e3ad3f5c7300258Automatic Updater device=`echo $device | cut -d/ -f1`
80faf1588895fd26490f82f95a7a1b771df1c324Automatic Updater i=`expr $i + 1`
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews dladm_string="$dladm_string -d $device"
1a06700908f5a1d9f4a8d51285a0fd971e2f9117Automatic Updater done
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews dladm_string="$dladm_string $aggr_index"
db5b7e2cdf150c46e8242d3e2e3ad3f5c7300258Automatic Updater echo $dladm_string >> \
4b2cb1422c7c600fbc13b1cb06a8b4693bc11af8Mark Andrews ${PKG_INSTALL_ROOT}/$UPGRADE_SCRIPT
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews done
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater done
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson # no longer needed, get rid of it.
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater rm -f $ORIG
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater removef $PKGINST $AGGR_CONF > /dev/null
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrews removef -f $PKGINST > /dev/null 2>&1
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updaterfi
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater# Upgrade linkprop.conf
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic UpdaterORIG=$BASEDIR/etc/dladm/linkprop.conf
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updaterif [ -f "${ORIG}" ]; then
dd65eb1efb40b1c47d57963192bfc54873b219beAutomatic Updater # Strip off comments, then each remaining line lists properties
dd65eb1efb40b1c47d57963192bfc54873b219beAutomatic Updater # the administrator configured for a particular interface.
9174e44c14b1cb91a651fa1dc29470438c246ab9Automatic Updater # Each line includes several properties, but we can only set
55e03fc54708d97917bf26639b987f759bdc1f44Automatic Updater # one property per dladm invocation.
9174e44c14b1cb91a651fa1dc29470438c246ab9Automatic Updater cat $ORIG | grep '^[^#]' | while read line; do
9174e44c14b1cb91a651fa1dc29470438c246ab9Automatic Updater echo $line | while read link rest
2a31bd531072824ef252c18303859d6af7451b00Francis Dupont do
52367885450d8f61d4f2d63292beb15ba8f39ac7Automatic Updater while [ -n "${rest}" ]; do
133e6d43fa82e80d3798be4de00f4540f485ec6cAutomatic Updater linkprop=`echo $rest | cut -d";" -f1`
2a31bd531072824ef252c18303859d6af7451b00Francis Dupont rest=`echo $rest | cut -d";" -f2-`
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews echo dladm set-linkprop -p $linkprop $link >> \
52367885450d8f61d4f2d63292beb15ba8f39ac7Automatic Updater ${PKG_INSTALL_ROOT}/$UPGRADE_SCRIPT
9174e44c14b1cb91a651fa1dc29470438c246ab9Automatic Updater done
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews done
dd65eb1efb40b1c47d57963192bfc54873b219beAutomatic Updater done
dd65eb1efb40b1c47d57963192bfc54873b219beAutomatic Updater # no longer needed, get rid of it
dd65eb1efb40b1c47d57963192bfc54873b219beAutomatic Updater rm -f $ORIG
dd65eb1efb40b1c47d57963192bfc54873b219beAutomatic Updater removef $PKGINST /etc/dladm/linkprop.conf > /dev/null
133e6d43fa82e80d3798be4de00f4540f485ec6cAutomatic Updater removef -f $PKGINST > /dev/null 2>&1
133e6d43fa82e80d3798be4de00f4540f485ec6cAutomatic Updaterfi
133e6d43fa82e80d3798be4de00f4540f485ec6cAutomatic Updater
133e6d43fa82e80d3798be4de00f4540f485ec6cAutomatic Updater# Convert hostname.xxx and zonecfg vlan entries
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrewshost_ifs=`ls -1 $rootprefix/etc | egrep -e '^hostname.|^hostname6.|^dhcp.'| \
885f47576842cf3c569315b9a48bd9f0ca03f203Automatic Updater cut -d . -f2 | sort -u`
ae7e54b14c946e0984c191554db9abb4893f9349Automatic Updater
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrewszones=`zoneadm list -c | grep -v global`
ae7e54b14c946e0984c191554db9abb4893f9349Automatic Updaterfor zone in $zones
9cd5eb6fe0f26d65724b99216cb31dcdd12e4afdAutomatic Updaterdo
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater zonecfg -z $zone info ip-type | grep exclusive >/dev/null
cdfc81e048bd34c1d628380247bda6b80a89e20eAutomatic Updater if [ $? -eq 0 ]; then
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater zif=`zonecfg -z $zone info net | grep physical | \
fe80a4909bf62b602feaf246866e9d29f7654194Automatic Updater nawk '{print $2}'`
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater zone_ifs="$zone_ifs $zif"
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater fi
fe80a4909bf62b602feaf246866e9d29f7654194Automatic Updaterdone
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic UpdaterORIG=$BASEDIR/etc/dladm/datalink.conf
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafssonfor ifname in $host_ifs $zone_ifs
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updaterdo
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews grep $ifname $ORIG >/dev/null
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson if [ $? != 0 ]; then
dd65eb1efb40b1c47d57963192bfc54873b219beAutomatic Updater phys=`echo $ifname | sed "s/[0-9]*$//"`
dd65eb1efb40b1c47d57963192bfc54873b219beAutomatic Updater devnum=`echo $ifname | sed "s/$phys//g"`
dd65eb1efb40b1c47d57963192bfc54873b219beAutomatic Updater if [ "$phys$devnum" != $ifname -o \
133e6d43fa82e80d3798be4de00f4540f485ec6cAutomatic Updater -n "`echo $devnum | tr -d '[0-9]'`" ]; then
133e6d43fa82e80d3798be4de00f4540f485ec6cAutomatic Updater echo "skipping invalid interface $ifname"
133e6d43fa82e80d3798be4de00f4540f485ec6cAutomatic Updater continue
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater fi
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater vid=`expr $devnum / 1000`
d145b64cacc8d9cda51f9924ec70cd4661c3e2cfAutomatic Updater inst=`expr $devnum % 1000`
0df8ead472f207020f8da22a185fe4b945248ab8Automatic Updater
e8c7dc2a5ce48f11c07a67c9923eeb8f419ff19fEvan Hunt if [ "$vid" != "0" ]; then
0ce87e5749aabb8eef1e0a37e4bd6e6ffa1d7196Automatic Updater echo dladm create-vlan -l $phys$inst -v $vid \
0ce87e5749aabb8eef1e0a37e4bd6e6ffa1d7196Automatic Updater $ifname >> ${PKG_INSTALL_ROOT}/$UPGRADE_SCRIPT
0df8ead472f207020f8da22a185fe4b945248ab8Automatic Updater fi
2bb3422dc683c013db7042f5736240de6b86f182Automatic Updater fi
59528addd704f8d5757b54e540520f74e588a7c7Automatic Updaterdone
0df8ead472f207020f8da22a185fe4b945248ab8Automatic Updater
3b6e4c84a525b0b3fc9e8affd8bb9fa5c000345fAutomatic Updater#
19b3dc94bce93fa76bd7e066f9298630dbc9dcb4Automatic Updater# Change permissions of public IKE certificates and CRLs
d145b64cacc8d9cda51f9924ec70cd4661c3e2cfAutomatic Updater# that may have been incorrectly created as private
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater# PKCS#11 hints files must be left root-only readable.
59528addd704f8d5757b54e540520f74e588a7c7Automatic Updater# Make sure this files starts with "30 82"
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater#
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updaterfor file in `ls ${PKG_INSTALL_ROOT}/etc/inet/ike/crls/* \
0df8ead472f207020f8da22a185fe4b945248ab8Automatic Updater ${PKG_INSTALL_ROOT}/etc/inet/ike/publickeys/* 2>/dev/null`; do
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater if dd if=$file count=2 bs=1 2>/dev/null | cat -v | \
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater grep "0M-^B" >/dev/null 2>&1
bc0a53583d92309bebcf93c408e2f3247ebd3d3cAutomatic Updater then
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater chmod 644 $file
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater fi
59528addd704f8d5757b54e540520f74e588a7c7Automatic Updaterdone
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updaterexit 0
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater