Mercurial > illumos > wpa
changeset 13043:131c7bfc0522
6971730 Legacy location's files are stored in the wrong place
author | Anurag S. Maskey <Anurag.Maskey@Oracle.COM> |
---|---|
date | Fri, 06 Aug 2010 13:42:40 -0400 |
parents | acf659bebd08 |
children | d05925eeffc9 |
files | usr/src/cmd/svc/milestone/net-loc usr/src/cmd/svc/milestone/net-nwam |
diffstat | 2 files changed, 26 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/cmd/svc/milestone/net-loc Sat Aug 07 01:15:29 2010 +0800 +++ b/usr/src/cmd/svc/milestone/net-loc Fri Aug 06 13:42:40 2010 -0400 @@ -667,10 +667,11 @@ # may not have a writable filesystem in net-nwam. So here we move the # components and rewrite the script to point at the writable filesystem. # - $CP -r $SCRIPT_PATH/Legacy $LEGACY_LOC_PATH + $CP -r $SCRIPT_PATH/Legacy /etc/nwam/loc $MV $SCRIPT_PATH/create_loc_legacy $SCRIPT_PATH/vcreate_loc_legacy - $SED -e's,/etc/svc/volatile/nwam/Legacy,/etc/nwam/loc/Legacy,' \ + $SED -e's,$SCRIPT_PATH/Legacy,$LEGACY_LOC_PATH,' \ $SCRIPT_PATH/vcreate_loc_legacy >$SCRIPT_PATH/create_loc_legacy + $RM -f $SCRIPT_PATH/vcreate_loc_legacy $NWAMCFG -f $SCRIPT_PATH/create_loc_legacy loc_ver=`$SVCPROP -c -p location_upgrade/version $LOCATION_FMRI \ 2>/dev/null`
--- a/usr/src/cmd/svc/milestone/net-nwam Sat Aug 07 01:15:29 2010 +0800 +++ b/usr/src/cmd/svc/milestone/net-nwam Fri Aug 06 13:42:40 2010 -0400 @@ -65,30 +65,33 @@ # Path to directories # We don't have a writable file system so we write to /etc/svc/volatile and # then later copy anything interesting to /etc/nwam. -LEGACY_PATH=/etc/svc/volatile/nwam/Legacy +VOL_NWAM_PATH=/etc/svc/volatile/nwam +VOL_LEGACY_PATH=$VOL_NWAM_PATH/Legacy +PERM_LEGACY_PATH=/etc/nwam/loc/Legacy NIS_BIND_PATH=/var/yp/binding # # copy_to_legacy_loc <file> # # Copies the file to the Legacy location directory +# (in /etc/svc/volatile/nwam/Legacy) # copy_to_legacy_loc() { - $MKDIR -p $LEGACY_PATH + $MKDIR -p $VOL_LEGACY_PATH if [ -f "$1" ]; then - $CP -p $1 $LEGACY_PATH + $CP -p $1 $VOL_LEGACY_PATH fi } # # copy_from_legacy_loc <destination file> # -# Copies file with the same name from Legacy location to the given -# destination file +# Copies file with the same name from Legacy location +# (in /etc/nwam/loc/Legacy) to the given destination file # copy_from_legacy_loc () { DEST_DIR=`/usr/bin/dirname $1` - SRC_FILE="$LEGACY_PATH/`$BASENAME $1`" + SRC_FILE="$PERM_LEGACY_PATH/`$BASENAME $1`" # Make destination directory if needed if [ ! -d "$DEST_DIR" ]; then @@ -133,7 +136,7 @@ # Creates Legacy location from the current configuration # create_legacy_loc () { - CREATE_LOC_LEGACY_FILE=/etc/svc/volatile/nwam/create_loc_legacy + CREATE_LOC_LEGACY_FILE=$VOL_NWAM_PATH/create_loc_legacy # # Write nwamcfg commands to create Legacy location to @@ -159,7 +162,7 @@ # Copy /etc/nsswitch.conf file copy_to_legacy_loc /etc/nsswitch.conf - NAMESERVICES_CONFIG_FILE="$LEGACY_PATH/nsswitch.conf" + NAMESERVICES_CONFIG_FILE="$VOL_LEGACY_PATH/nsswitch.conf" # Gather DNS info from resolv.conf if present. if [ -f /etc/resolv.conf ]; then @@ -341,7 +344,7 @@ copy_from_legacy_loc /etc/nsswitch.conf # DNS - copy resolv.conf to /etc/resolv.conf - if [ -f "$LEGACY_PATH/resolv.conf" ]; then + if [ -f "$PERM_LEGACY_PATH/resolv.conf" ]; then copy_from_legacy_loc /etc/resolv.conf $SVCADM enable dns/client fi @@ -369,7 +372,7 @@ fi # LDAP - copy ldap_client_file to /var/ldap/ldap_client_file - if [ -f "$LEGACY_PATH/ldap_client_file" ]; then + if [ -f "$PERM_LEGACY_PATH/ldap_client_file" ]; then copy_from_legacy_loc /var/ldap/ldap_client_file $SVCADM enable ldap/client fi @@ -457,8 +460,10 @@ $SVCADM disable $IPFILTER_FMRI fi - # Remove the Legacy directory and location - $RM -rf $LEGACY_PATH + # Remove the Legacy directories, script and location + $RM -rf $VOL_LEGACY_PATH + $RM -rf $PERM_LEGACY_PATH + $RM -f $VOL_NWAM_PATH/create_loc_legacy $NWAMCFG destroy loc Legacy } @@ -472,8 +477,8 @@ # # Create nwam directory in /etc/svc/volatile # -if [ ! -d /etc/svc/volatile/nwam ]; then - $MKDIR -m 0755 /etc/svc/volatile/nwam +if [ ! -d $VOL_NWAM_PATH ]; then + $MKDIR -m 0755 $VOL_NWAM_PATH fi case "$1" in @@ -493,9 +498,9 @@ # create a dummy background process to preserve contract lifetime. smf_configure_ip if [ $? = "1" ] ; then - $RM -f /etc/svc/volatile/nwam/nwam_blocked - $MKFIFO /etc/svc/volatile/nwam/nwam_blocked - ($CAT </etc/svc/volatile/nwam/nwam_blocked >/dev/null) & + $RM -f $VOL_NWAM_PATH/nwam_blocked + $MKFIFO $VOL_NWAM_PATH/nwam_blocked + ($CAT <$VOL_NWAM_PATH/nwam_blocked >/dev/null) & exit $SMF_EXIT_OK fi @@ -575,7 +580,7 @@ # We need to make the dummy process we created above stop. smf_configure_ip if [ $? = "1" ] ; then - echo "stop" > /etc/svc/volatile/nwam/nwam_blocked + echo "stop" > $VOL_NWAM_PATH/nwam_blocked exit $SMF_EXIT_OK fi