📄 upgrade_client
字号:
EXP_KVM_DIR_K3=$EXP_KVM_DIR/$OLD_RELEASE_STR3_ADD OLD_RELEASE_STR3="$AARCH.$OLD_RELEASE_STR3_ADD" fi $GREP -v "$SUN4M_RELEASE$" $sun4m_RELEASE_LST > $SUN4M_REMOVE_LSTfi$CAT $sun4_RELEASE_LST $sun4c_RELEASE_LST $sun4m_RELEASE_LST | $SORT -u > $RELEASE_LSTif $NEED1 ; then# Upgrade the $KARCH1 kvm &sys if [ $KVMPATH1 = "/usr/kvm" ]; then K1_SAVE=$KVMPATH1 K1_FILE=$sun4_RELEASE_LST elif [ $KARCH1 = $KARCH ]; then K1_SAVE="/usr/kvm" K1_FILE=$sun4_RELEASE_LST KVMPATH1=$EXP_KVM_DIR/$KARCH1.sunos.$TO_RELEASE else log_echo "Upgrade kvm and sys files for the $KARCH1" upgrade_package kvm $EXP_KVM_DIR_K1 $KARCH1 $SUN4_RELEASE is_sys_loaded \ $INSDIR/media_file.$OLD_RELEASE_STR1 if [ $? = 0 ] ; then upgrade_package sys $EXP_KVM_DIR_K1 $KARCH1 $SUN4_RELEASE elif [ -s $SUN4_REMOVE_LST ]; then for str in `$CAT $SUN4_REMOVE_LST`; do is_sys_loaded \ $INSDIR/media_file.$AARCH.$KARCH1.sunos.$str if [ $? = 0 ]; then get_package sys $EXP_KVM_DIR_K1 $KARCH1 add_sys $INSDIR/media_file.$AARCH.$KARCH1.sunos.$SUN4_RELEASE break fi done fi K1_SAVE=$EXP_KVM_DIR_K1 K1_FILE=$SUN4_REMOVE_LST KVMPATH1=$EXP_KVM_DIR/$KARCH1.sunos.$TO_RELEASE fi if [ -s $K1_FILE ]; then for str in `$CAT $K1_FILE`; do OLD_RELEASE="$AARCH.$KARCH1.sunos.$str" SOFT_INFO=$INSDIR/soft_info.$OLD_RELEASE [ -s $SOFT_INFO ] && \ KVMPATH_K1=`$NAWK -F= ' {if ($1 == "kvm_path") print $2}' $SOFT_INFO` if [ $KVMPATH_K1 = "/usr/kvm" ]; then : else EXP_KVM=$EXP_KVM_DIR/$KARCH1.sunos.$str upgrade_save kvm $EXP_KVM $KARCH1 $str $K1_SAVE is_sys_loaded \ $INSDIR/media_file.$OLD_RELEASE if [ $? = 0 ] ; then upgrade_save sys $EXP_KVM $KARCH1 $str $K1_SAVE fi fi done fifiif $NEED2 ; then# Upgrade the $KARCH2 kvm &sys if [ $KVMPATH2 = "/usr/kvm" ]; then K2_SAVE=$KVMPATH2 K2_FILE=$sun4c_RELEASE_LST elif [ $KARCH2 = $KARCH ]; then K2_SAVE="/usr/kvm" K2_FILE=$sun4c_RELEASE_LST KVMPATH2=$EXP_KVM_DIR/$KARCH2.sunos.$TO_RELEASE else log_echo "Upgrade kvm and sys files for the $KARCH2" upgrade_package kvm $EXP_KVM_DIR_K2 $KARCH2 $SUN4C_RELEASE is_sys_loaded \ $INSDIR/media_file.$OLD_RELEASE_STR2 if [ $? = 0 ] ; then upgrade_package sys $EXP_KVM_DIR_K2 $KARCH2 $SUN4C_RELEASE elif [ -s $SUN4C_REMOVE_LST ]; then for str in `$CAT $SUN4C_REMOVE_LST`; do is_sys_loaded \ $INSDIR/media_file.$AARCH.$KARCH2.sunos.$str if [ $? = 0 ]; then get_package sys $EXP_KVM_DIR_K2 $KARCH2 add_sys $INSDIR/media_file.$AARCH.$KARCH2.sunos.$SUN4C_RELEASE break fi done fi K2_SAVE=$EXP_KVM_DIR_K2 K2_FILE=$SUN4C_REMOVE_LST KVMPATH2=$EXP_KVM_DIR/$KARCH2.sunos.$TO_RELEASE fi if [ -s $K2_FILE ]; then for str in `$CAT $K2_FILE`; do OLD_RELEASE="$AARCH.$KARCH2.sunos.$str" SOFT_INFO=$INSDIR/soft_info.$OLD_RELEASE [ -s $SOFT_INFO ] && \ KVMPATH_K2=`$NAWK -F= ' {if ($1 == "kvm_path") print $2}' $SOFT_INFO` if [ $KVMPATH_K2 = "/usr/kvm" ]; then : else EXP_KVM=$EXP_KVM_DIR/$KARCH2.sunos.$str upgrade_save kvm $EXP_KVM $KARCH2 $str $K2_SAVE is_sys_loaded \ $INSDIR/media_file.$OLD_RELEASE if [ $? = 0 ] ; then upgrade_save sys $EXP_KVM $KARCH2 $str $K2_SAVE fi fi done fifiif $NEED3 ; then# Upgrade the $KARCH3 kvm &sys on 4.1.1 if [ $KVMPATH3 = "/usr/kvm" ]; then K3_SAVE=$KVMPATH3 K3_FILE=$sun4m_RELEASE_LST elif [ $KARCH3 = $KARCH ]; then K3_SAVE="/usr/kvm" K3_FILE=$sun4m_RELEASE_LST KVMPATH3=$EXP_KVM_DIR/$KARCH3.sunos.$TO_RELEASE else log_echo "Upgrade kvm and sys files for the $KARCH3" upgrade_package kvm $EXP_KVM_DIR_K3 $KARCH3 $SUN4M_RELEASE is_sys_loaded \ $INSDIR/media_file.$OLD_RELEASE_STR3 if [ $? = 0 ] ; then upgrade_package sys $EXP_KVM_DIR_K3 $KARCH3 $SUN4M_RELEASE elif [ -s $SUN4M_REMOVE_LST ]; then for str in `$CAT $SUN4M_REMOVE_LST`; do is_sys_loaded \ $INSDIR/media_file.$AARCH.$KARCH3.sunos.$str if [ $? = 0 ]; then get_package sys $EXP_KVM_DIR_K3 $KARCH3 add_sys $INSDIR/media_file.$AARCH.$KARCH3.sunos.$SUN4M_RELEASE break fi done fi K3_SAVE=$EXP_KVM_DIR_K3 K3_FILE=$SUN4M_REMOVE_LST KVMPATH3=$EXP_KVM_DIR/$KARCH3.sunos.$TO_RELEASE fi if [ -s $K3_FILE ]; then for str in `$CAT $K3_FILE`; do OLD_RELEASE="$AARCH.$KARCH3.sunos.$str" SOFT_INFO=$INSDIR/soft_info.$OLD_RELEASE [ -s $SOFT_INFO ] && \ KVMPATH_K3=`$NAWK -F= ' {if ($1 == "kvm_path") print $2}' $SOFT_INFO` if [ $KVMPATH_K3 = "/usr/kvm" ]; then : else EXP_KVM=$EXP_KVM_DIR/$KARCH3.sunos.$str upgrade_save kvm $EXP_KVM $KARCH3 $str $K3_SAVE is_sys_loaded \ $INSDIR/media_file.$OLD_RELEASE if [ $? = 0 ] ; then upgrade_save sys $EXP_KVM $KARCH3 $str $K3_SAVE fi fi done fifi## Upgrade and rename /export/exec/proto.root.sunos.4.1.1 (or 4.1.2) # to /export/exec/proto.root.sunos.$TO_RELEASE#RENAMED=falser_str=""if [ -d /export/exec/proto.root.sunos.$TO_RELEASE ]; then RENAMED=true r_str=$TO_RELEASEfiif [ $RENAMED = false ] && [ -d /export/exec/proto.root.sunos.$FROM_RELEASE ]; then upgrade_package root /export/exec/proto.root.sunos.$FROM_RELEASE log_echo "Rename /export/exec/proto.root.sunos.$FROM_RELEASE to\ /export/exec/proto.root.sunos.$TO_RELEASE" r_str=$FROM_RELEASE RENAMED=true if $DUMMY ; then : else $MV /export/exec/proto.root.sunos.$FROM_RELEASE \ /export/exec/proto.root.sunos.$TO_RELEASE fifiif [ -s $RELEASE_LST ]; thenfor str in `$CAT $RELEASE_LST` ; doif $RENAMED && [ -d /export/exec/proto.root.sunos.$str ] && [ $str != $r_str ]; then upgrade_save root /export/exec/proto.root.sunos.$str $KARCH $str /export/exec/proto.root.sunos.$TO_RELEASE log_echo "Remove /export/exec/proto.root.sunos.$str" if $DUMMY ; then : else $RM -rf /export/exec/proto.root.sunos.$str fielif [ $RENAMED = false ] && [ -d /export/exec/proto.root.sunos.$str ]; then upgrade_package root /export/exec/proto.root.sunos.$str $KARCH $str log_echo "Rename /export/exec/proto.root.sunos.$str to\ /export/exec/proto.root.sunos.$TO_RELEASE" r_str=$str RENAMED=true if $DUMMY ; then : else $MV /export/exec/proto.root.sunos.$str \ /export/exec/proto.root.sunos.$TO_RELEASE fifidonefi# All systems go: we have a list of clients and a valid kernel.# Do it to it.#for client in $CLIENTS; do log_echo log_echo Upgrading client $client ... THE_KARCH=`what_karch $client` THE_RELEASE=`what_release $client` ROOT=`find_root $client` upgrade_package root $ROOT $THE_KARCH $THE_RELEASE if [ $THE_KARCH = $KARCH1 ]; then KVMPATH=$KVMPATH1 NEW_RELEASE_STR=$NEW_RELEASE_STR1 elif [ $THE_KARCH = $KARCH2 ]; then KVMPATH=$KVMPATH2 NEW_RELEASE_STR=$NEW_RELEASE_STR2 elif [ $THE_KARCH = $KARCH3 ]; then KVMPATH=$KVMPATH3 NEW_RELEASE_STR=$NEW_RELEASE_STR3 else log_echo "Unknown arch $THE_KARCH" fi log_tab; log_echo 'Updating fstab' fix_fstab $ROOT $THE_RELEASE log_tab; log_echo 'Updating /tftpboot links' fix_tftpboot $client $THE_KARCH log_tab; log_echo 'Updating installation records' fix_installfiles $client $KVMPATH $NEW_RELEASE_STR fix_again $client $NEW_RELEASE_STRdone## Fix client_list.sun4.sun4.sunos.4.1.1 (or 4.1.2)# and client_list.sun4.sun4c.sunos.4.1.1 (or 4.1.2)# and client_list.sun4.sun4m.sunos.4.1.1 (or 4.1.2)#for ckarch in $KARCH1 $KARCH2 $KARCH3; do RENAMED=falser_str=""if [ -f $INSDIR/client_list.sun4.$ckarch.sunos.$TO_RELEASE ]; then RENAMED=true r_str=$TO_RELEASEfi[ $ckarch = $KARCH1 ] && filename=$sun4_RELEASE_LST[ $ckarch = $KARCH2 ] && filename=$sun4c_RELEASE_LST[ $ckarch = $KARCH3 ] && filename=$sun4m_RELEASE_LSTif [ $RENAMED = false ] && [ -f $INSDIR/client_list.sun4.$ckarch.sunos.$FROM_RELEASE ]; then log_echo "Rename $INSDIR/client_list.sun4.$ckarch.sunos.$FROM_RELEASE to \ $INSDIR/client_list.sun4.$ckarch.sunos.$TO_RELEASE" r_str=$FROM_RELEASE RENAMED=true if $DUMMY ; then : else $MV $INSDIR/client_list.sun4.$ckarch.sunos.$FROM_RELEASE \ $INSDIR/client_list.sun4.$ckarch.sunos.$TO_RELEASE 2>/dev/null fifiif [ -s $filename ]; then for strng in `$CAT $filename`; doif [ $strng != $TO_RELEASE ]; thenif [ $RENAMED = false ] && [ -f $INSDIR/client_list.sun4.$ckarch.sunos.$strng ] ; then log_echo "Rename $INSDIR/client_list.sun4.$ckarch.sunos.$strng to\ $INSDIR/client_list.sun4.$ckarch.sunos.$TO_RELEASE" r_str=$strng RENAMED=true if $DUMMY ; then : else $MV $INSDIR/client_list.sun4.$ckarch.sunos.$strng \ $INSDIR/client_list.sun4.$ckarch.sunos.$TO_RELEASE 2>/dev/null fielif $RENAMED && [ -f $INSDIR/client_list.sun4.$ckarch.sunos.$strng ] \&& [ $strng != $r_str ]; then log_echo "Cat and then remove $INSDIR/client_list.sun4.$ckarch.sunos.$strng" if $DUMMY ; then : else $CAT $INSDIR/client_list.sun4.$ckarch.sunos.$strng >> \ $INSDIR/client_list.sun4.$ckarch.sunos.$TO_RELEASE 2>/dev/null $RM -rf $INSDIR/client_list.sun4.$ckarch.sunos.$strng fififidonefidone## upgrade_bootblocks will be called after all kvm upgrade#upgrade_bootblocks(){log_echo "Create the /tftpboot/boot.$KARCH.sunos.$TO_RELEASE for $KARCH" if $DUMMY ; then : else $CP /export/exec/kvm/$KARCH/stand/boot.$KARCH \ /tftpboot/boot.$KARCH.sunos.$TO_RELEASE if [ $? = 0 ]; then $RM /tftpboot/boot.$KARCH.sunos.$FROM_RELEASE fi fiif $NEED1 ; then# Upgrade the /tftpboot/boot.$KARCH1.sunos.$*_RELEASE log_echo "Create the /tftpboot/boot.$KARCH1.sunos.$TO_RELEASE for the $KARCH1 clients" if $DUMMY ; then : else $CP /export/exec/kvm/$KARCH1/stand/boot.$KARCH1 \ /tftpboot/boot.$KARCH1.sunos.$TO_RELEASE if [ $? = 0 ] && [ -s $sun4_RELEASE_LST ]; then for strng in `$CAT $sun4_RELEASE_LST`; do if [ -f /tftpboot/boot.$KARCH1.sunos.$strng ] && [ $strng != $TO_RELEASE ]; then $RM /tftpboot/boot.$KARCH1.sunos.$strng fi done fi fifiif $NEED2 ; then# Upgrade the /tftpboot/boot.$KARCH2.sunos.$*_RELEASE log_echo "Create the /tftpboot/boot.$KARCH2.sunos.$TO_RELEASE for the $KARCH2 clients" if $DUMMY ; then : else $CP /export/exec/kvm/$KARCH2/stand/boot.$KARCH2 \ /tftpboot/boot.$KARCH2.sunos.$TO_RELEASE if [ $? = 0 ] && [ -s $sun4c_RELEASE_LST ]; then for strng in `$CAT $sun4c_RELEASE_LST`; do if [ -f /tftpboot/boot.$KARCH2.sunos.$strng ] && [ $strng != $TO_RELEASE ]; then $RM /tftpboot/boot.$KARCH2.sunos.$strng fi done fi fifiif $NEED3 ; then# Upgrade the /tftpboot/boot.$KARCH3.sunos.$*_RELEASE log_echo "Create the /tftpboot/boot.$KARCH3.sunos.$TO_RELEASE for the $KARCH3 clients" if $DUMMY ; then : else $CP /export/exec/kvm/$KARCH3/stand/boot.$KARCH3 \ /tftpboot/boot.$KARCH3.sunos.$TO_RELEASE if [ $? = 0 ] && [ -s $sun4m_RELEASE_LST ]; then for strng in `$CAT $sun4m_RELEASE_LST`; do if [ -f /tftpboot/boot.$KARCH3.sunos.$strng ] && [ $strng != $TO_RELEASE ]; then $RM /tftpboot/boot.$KARCH3.sunos.$strng fi done fi fifi}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -