]> git.pld-linux.org Git - packages/EMCpower.git/blob - EMCpower.enable
- raw from EMCpower-5.0.1/enable
[packages/EMCpower.git] / EMCpower.enable
1 #!/bin/sh
2 #
3 # Enable a newly installed package to run or enable an existing package
4 # to run after a kernal upgrade.
5 #
6
7 init_I18N()
8 {
9     type -P gettext.sh > /dev/null 2>&1 && \
10         type -p gettext >/dev/null  2>&1
11
12     if [ $? -ne 0 ]; then
13         gettext()
14         {
15             printf "$*"
16         }
17         eval_gettext()
18         {
19             eval printf "$*"
20         }
21     else
22         . gettext.sh
23
24         TEXTDOMAIN=EMCpower
25         export TEXTDOMAIN
26         TEXTDOMAINDIR=$PPBASE/i18n/catalog
27         export TEXTDOMAINDIR
28         export RPM_INSTALL_PREFIX
29     fi
30 }
31
32 report_error()
33 {
34     eval_gettext "$*"
35     echo
36 }
37
38 error_exit()
39 {
40     exit 1
41 }
42
43 ########
44 ### DO NOT REMOVE THE FOLLOWING LINE
45 #####################################################################
46 ### Start of Global variable section.
47 #####################################################################
48
49 # Temp directory used by the %pre section.  (Before $PP_I_DIR exists.)
50 #
51 PRE_TMP=/var/tmp
52 #
53 # Default installation directory for emcpower
54 #
55 PP_I_DIR=/etc/opt/emcpower
56 #
57 # The file name of the device file used to control the power path drivers
58 #
59 # created by sysfs in 2.6.
60 #POWER_DEV=/dev/emcpower
61 #
62 # Installation log file
63 #
64 POWER_LOG=$PP_I_DIR/log
65 #
66 # Installation temporary file directory.
67 #
68 POWER_TMP_DIR=$PP_I_DIR/.tmp
69 #
70 # Backup archives used in case an installation is aborted in mid-stream
71 #
72 POWER_BACKUP_ARCHIVE=$PP_I_DIR/.archive.tar
73 POWER_BACKUP_ARCHIVE_NEW=$PP_I_DIR/.archive_NEW.tar
74 archive_dir=$RPM_INSTALL_PREFIX/etc/emc/archive
75 #
76 # Patch log file in case of patch errors
77 #
78 PATCH_LOG=$PP_I_DIR/patch.log
79
80 #
81 # local modprobe file
82 modprobe_file=/etc/modprobe.conf.pp
83 #####################################################################
84 ### End of Global variable section.
85 #####################################################################
86 ########
87
88 #-----------------------------------------------------------------------
89 # Restore system to the state that existed before this script ran.
90 # First, execute the commands in the undo list in reverse order, then
91 # untar archived files.
92 #-----------------------------------------------------------------------
93 rollback()
94 {
95     awk '{print NR,$0}' $POWER_TMP_DIR/undolist | \
96         sort -nr | \
97         cut -d' ' -f2- > $POWER_TMP_DIR/undo.sh
98     sh $POWER_TMP_DIR/undo.sh
99
100     tar -x --absolute-names --file $POWER_TMP_DIR/rollbackfiles.tar
101 }
102
103 #-----------------------------------------------------------------------
104 # Delete the files containing rollback information
105 #-----------------------------------------------------------------------
106 rollback_reset()
107 {
108     rm -f $POWER_TMP_DIR/rollbackfiles.tar
109     rm -f $POWER_TMP_DIR/undolist
110     rm -f $POWER_TMP_DIR/undo.sh
111 }
112
113 #-----------------------------------------------------------------------
114 # Save a directory and contained files in the rollback archive
115 #-----------------------------------------------------------------------
116 save_dirtree_for_rollback()
117 {
118     local pathname
119     case "$1" in
120         /*) pathname=$1 ;;
121          *) pathname=`pwd`/$1 
122     esac
123    tar --append --preserve-permissions --absolute-names \
124        --file $POWER_TMP_DIR/rollbackfiles.tar $pathname
125 }
126
127 #-----------------------------------------------------------------------
128 # Save a file or directory in the rollback archive
129 #-----------------------------------------------------------------------
130 save_for_rollback()
131 {
132     local pathname
133     case "$1" in
134         /*) pathname=$1 ;;
135          *) pathname=`pwd`/$1 
136     esac
137     tar --append --preserve-permissions --absolute-names \
138     --no-recursion --file $POWER_TMP_DIR/rollbackfiles.tar $pathname
139 }
140
141 #-----------------------------------------------------------------------
142 # Add a shell command, for execution during rollback, to the undo list
143 #-----------------------------------------------------------------------
144 add_to_undolist()
145 {
146     echo "cd `pwd`; $*" >> $POWER_TMP_DIR/undolist
147 }
148
149 #-----------------------------------------------------------------------
150 # Move a file in such a way that the original source and destination
151 # files are restored by rollback.
152 #-----------------------------------------------------------------------
153 move_file()
154 {
155     save_for_rollback $1
156     local dest
157     if [ -d "$2" ]; then
158         dest=$2/`basename $1`
159     else
160         dest=$2
161     fi
162     if [ -f "$dest" ]; then
163         save_for_rollback $dest
164     else
165         add_to_undolist rm -f "$dest"
166     fi
167     mv -f $1 $dest
168 }
169
170 #-----------------------------------------------------------------------
171 # Copy a new file over an old one,in such a way that the old file
172 # can be restored during rollback. 
173 #-----------------------------------------------------------------------
174 copy_file()
175 {
176     local dest
177     if [ -d "$2" ]; then
178         dest=$2/`basename $1`
179     else
180         dest=$2
181     fi
182     if [ -f "$dest" ]; then
183         save_for_rollback $dest
184     else
185         add_to_undolist rm -f "$dest"
186     fi
187     cp -pf $1 $2
188 }
189
190 #-----------------------------------------------------------------------
191 # Save a file in the rollback archive and then delete it.
192 #-----------------------------------------------------------------------
193 remove_file()
194 {
195     if [ -f "$1" ]; then
196         save_for_rollback $1
197         rm -f $1
198     fi
199 }
200
201 #-----------------------------------------------------------------------
202 # Save a directory and contained files in the rollback archive and then
203 # delete them.
204 #-----------------------------------------------------------------------
205 remove_dirtree()
206 {
207     if [ -d "$1" ]; then
208         save_dirtree_for_rollback $1
209         rm -rf $1
210     fi
211 }
212
213 #-----------------------------------------------------------------------
214 # Make a directory in such a way that it will be removed during rollback.
215 # All non-existent directories in the given path are created.  If the
216 # directory already exists, do nothing.
217 #-----------------------------------------------------------------------
218 make_dir()
219 {
220     if [ ! -d "$1" ]; then
221         make_dir2 $1 && chmod 755 $1 && chown root:root $1
222     fi
223 }
224
225 make_dir2()
226 {
227     if test ! -d "$1" && make_dir2 `dirname $1`;  then
228         add_to_undolist rmdir $1
229         mkdir $1
230     fi
231 }
232
233 #-----------------------------------------------------------------------
234 # Copy a kernel module and set file pwermissions, group and owner
235 #-----------------------------------------------------------------------
236 copy_mod()
237 {
238     copy_file "$1" "$2" && chmod 644 "$2" && chown root:root "$2"
239 }
240
241 #-----------------------------------------------------------------------
242 # Compare the vermagic string of the pp base driver to the vermagic string
243 # of the scsi_mod driver.
244 # input: path to PowerPath base driver, in package area.
245 # return 0 for matching strings.
246 #-----------------------------------------------------------------------
247
248 verify_driver_vermagic()
249 {
250     local pp_drv_path=$1
251     local ref_driver
252     local ref_mod_version
253     local pp_mod_version
254
255     ref_driver=`lsmod | cut -d' ' -f1 | tail -1`
256     ref_mod_version=`modinfo $ref_driver | \
257         sed -n '/^vermagic:/s/^vermagic:  *//p'`
258     pp_mod_version=`modinfo $pp_drv_path | \
259         sed -n '/^vermagic:/s/^vermagic:  *//p'`
260     ref_mod_version=`echo $ref_mod_version | cut -d' ' -f2-`
261     pp_mod_version=`echo $pp_mod_version | cut -d' ' -f2-`
262     if [ "$pp_mod_version" = "$ref_mod_version" ]
263     then
264         true
265     else
266         false
267     fi
268 }
269
270 #-----------------------------------------------------------------------
271 # Recursively load all modules on the command line, in the order given.
272 # If any module fails to load, all previously loaded modules are unloaded
273 # and a non-zero status is returned.  After all modules are loaded, emcpioc
274 # is unloaded.
275 #-----------------------------------------------------------------------
276
277 load_all_modules()
278 {
279     local mod=`basename "$1" .ko`
280     shift 1
281
282     if [ -z "$mod" ]
283     then
284         if lsmod | grep emcpioc > /dev/null
285         then
286             modprobe -r emcpioc
287         fi
288         return 0
289     fi
290     if modprobe -q $mod
291     then
292         load_all_modules $*
293         if [ $? -ne 0 ]
294         then
295             modprobe -r $mod
296             return 1
297         fi
298     else
299         report_error 'PowerPath could not load module $mod'
300         return 1
301     fi
302 }
303
304 #-----------------------------------------------------------------------
305 # Run "preinstall" checks to make sure the running system is compatible
306 # with this package.
307 #-----------------------------------------------------------------------
308 validate_install_target()
309 {
310 ## Check - Require effective UID of root
311
312     if [ $EUID != 0 ]; then
313         report_error "You must be root to install PowerPath."
314         error_exit
315     fi
316
317 ## Check - Only install on a 2.6 kernel
318
319     expr `uname -r` : '2\.6' > /dev/null
320     if [ $? -ne 0 ]; then
321         report_error "This PowerPath package does not support this kernel."
322         error_exit
323     fi
324
325 ## Check vendor
326
327     if expr \( "$EXPECTED_VENDOR" : ".*$VENDOR" \) = 0 >/dev/null; then
328         report_error 'This package requires a $VENDOR_NAME Platform.'
329         error_exit
330     fi
331
332 ## Check vendor rev.
333
334     check_vendor_rev $EXPECTED_OS_REV
335     if [ $? != 0 ]; then
336         report_error 'This package requires $VENDOR_NAME $VENDOR_OS_NAME.'
337         error_exit
338     fi
339
340 ## Check hardware platform
341
342     if [ "`uname -m`" != "$EXPECTED_ISA" ]; then
343         report_error \
344             'This package requires the $VENDOR_NAME $EXPECTED_ISA kernel.'
345         error_exit
346     fi
347
348 ## Check - Make sure no devices are in use.
349
350     if [ "`/sbin/lsmod | grep -w emcp`" != "" ]; then
351         /sbin/powermt save > /dev/null 2>&1
352         /sbin/powermt remove dev=all > /dev/null 2>&1
353         if [ "`powermt display dev=all 2>&1 | grep "not found"`" = "" ]; then
354             report_error \
355                 "Unable to remove devices from the PowerPath configuration."
356             report_error \
357                 "Please make sure no PowerPath devices are in use and retry."
358             /sbin/powermt config > /dev/null 2>&1
359             /sbin/powermt load > /dev/null 2>&1
360             error_exit
361         fi
362         /sbin/powermt config > /dev/null 2>&1
363         /sbin/powermt load > /dev/null 2>&1
364     fi
365
366 ## Do we have modules that work with this kernel?
367
368     TAG=`identify_platform \`uname -r\``
369     if [ -z "$TAG" ]; then
370         report_error "This PowerPath package does not support this kernel."
371         report_error '$PPBASE'
372         error_exit
373     fi
374
375 ## Check driver vermagic
376
377     verify_driver_vermagic $PPBASE/bin/driver/$TAG/emcp.ko
378     if [ $? != 0 ]; then
379         report_error 'PowerPath driver version magic mismatch'
380         error_exit
381     fi
382 }
383
384 #-----------------------------------------------------------------------
385 # Compare the version recorded in the saved powermt.custom file with the
386 # version in $1.  If the two versions match, return true.
387 #-----------------------------------------------------------------------
388 matching_saved_config_version()
389 {
390     local saved
391     local Mmp
392     if [ -f $archive_dir/powermt.custom.saved ]; then
393         Mmp=`expr "$1" : '\([0-9]\.[0-9]\.[0-9]\)'`
394         saved=`head -1 $archive_dir/powermt.custom.saved | cut -d: -f3`
395         if [ "$saved" = "$Mmp" ]; then
396             /bin/true
397         else
398             /bin/false
399         fi
400     else
401         /bin/false
402     fi
403 }
404
405 #-----------------------------------------------------------------------
406 # Move files from the PowerPath archive directory to their normal
407 # installed locations.
408 #-----------------------------------------------------------------------
409 restore_configuration_files()
410 {
411     for file in /etc/emc/mpaa.lams \
412         /etc/emc/mpaa.excluded \
413         /etc/emcp_registration
414     do
415       if [ -f $archive_dir/`basename $file`.saved ]; then
416           move_file $archive_dir/`basename $file`.saved $file
417       fi
418     done
419
420     if test "$PP_VERSION" || \
421                 matching_saved_config_version $NEW_PP_VERSION; then
422         for file in /etc/powermt.custom \
423             /etc/emcp_devicesDB.dat \
424             /etc/emcp_devicesDB.idx
425         do
426           if [ -f $archive_dir/`basename $file`.saved ]; then
427               move_file $archive_dir/`basename $file`.saved $file
428           fi
429         done
430
431         if [ -f $archive_dir/*.FCS ]; then
432             for file in $archive_dir/*.FCS
433               do
434               move_file $file /etc
435             done
436         fi
437     fi
438 }
439
440 #-----------------------------------------------------------------------
441 # tps_managed_classes - Return a true status if third party software
442 # is installed to manage the array named in $1.  Otherwise return a
443 # false status.
444 #-----------------------------------------------------------------------
445 tps_managed()
446 {
447 case "$1" in
448     hitachi)
449         test -d /opt/DynamicLinkManager/bin
450         ;;
451     hpxp)
452         test -d /usr/src/Autopath
453         ;;
454     ess)
455         test -d /opt/IBMsdd/bin
456         ;;
457     hphsx)
458         test -d /etc/CPQswsp/modules
459         ;;
460     *)
461         /bin/false
462         ;;
463 esac
464 }
465
466 #-----------------------------------------------------------------------
467 # prev_unmanaged - Return a true status if the array named in $2
468 # is marked "unmanaged" in the mpaa.lams file named in $1
469 #-----------------------------------------------------------------------
470 prev_unmanaged()
471 {
472   grep -w $2 $1 2>/dev/null | grep -w unmanaged > /dev/null 2>&1
473 }
474
475 #-----------------------------------------------------------------------
476 # If no mpaa.lams file exists, create one.  Otherwise create a temporary
477 # mpaa.lams file, compare it to the existing file and replace the
478 # existing file with the temporary one if the two files differ. Also,
479 # create an empty mpaa.excluded if one doesn't exist
480 #-----------------------------------------------------------------------
481 update_lams_files()
482 {
483     local lams_file="/etc/emc/mpaa.lams"
484     local lams_excluded_file="/etc/emc/mpaa.excluded"
485     local lams_new
486
487     if [ -f "$lams_file" ]; then
488         lam_ref=$lams_file
489         lams_new=${lams_file}.tmp
490     else
491         lam_ref=/dev/null
492         lams_new=$lams_file
493     fi
494
495     echo  "global:version:$PP_VERSION" > $lams_new
496     for array in symm clariion hpxp hitachi hphsx ess invista
497     do
498         if tps_managed $array || prev_unmanaged $lam_ref $array
499         then
500             echo "unmanaged:$array" >> $lams_new
501         else
502             echo "managed:$array" >> $lams_new
503         fi
504     done
505
506     if [ "$lams_new" = "${lams_file}.tmp" ]; then
507         if /usr/bin/diff -q $lams_file $lams_new >/dev/null 2>&1; then
508             rm -f $lams_new
509         else
510             mv -f $lams_new $lams_file
511         fi
512     else
513         add_to_undolist rm -f $lams_file
514     fi
515
516     if [ ! -f "$lams_excluded_file" ]; then
517         echo  "global:version:$PP_VERSION" > $lams_excluded_file
518         add_to_undolist rm -f $lams_excluded_file
519     fi
520 }
521
522 #-----------------------------------------------------------------------
523 # Add lines to /etc/modprobe.conf.pp to coordinate filter driver, hba
524 # driver and emcp loading
525 #-----------------------------------------------------------------------
526 modprobe_add_pp_lines()
527 {
528     local begin_tag='#begin-hba-'
529     local end_tag='#end-hba-'
530     local install_hba
531
532     if test "$1"; then
533        modprobe_hba=' /sbin/modprobe pp_hba;'
534        install_hba=
535        for hba in $*
536        do
537          install_hba="$install_hba /sbin/modprobe $hba;"
538        done
539     fi
540
541     if grep "^${begin_tag}$1" $modprobe_file > /dev/null; then
542         return  # Lines for this hba are already in place
543     else
544         # Lines indented with tab!!
545         cat <<-EOF  >> $modprobe_file
546         ${begin_tag}${hba}
547         install emcp /sbin/modprobe pp_hba; /sbin/modprobe emcp --ignore-install
548         install pp_hba ${install_hba}
549         ${end_tag}${hba}
550         EOF
551     fi
552 }
553
554 #-----------------------------------------------------------------------
555 # Create dependencies between HBA drivers and power path drivers.
556 #-----------------------------------------------------------------------
557 create_hba_dependencies()
558 {
559     local added_dependency=FALSE
560     local searchDir=/lib/modules/`uname -r`
561     local qlaHbaName
562     local emulexHbaName
563
564     qlaHbaName=`find /proc/scsi -name qla2xxx | sed -e 's/\/proc\/scsi\///'`
565     emulexHbaName=`find /proc/scsi -name lpfc* | sed -e 's/\/proc\/scsi\///'`
566     if [ "$qlaHbaName" ]; then
567         qla_hbas=`lsmod | cut -d' ' -f1 | grep qla | grep  -v qla2xxx`
568         modprobe_add_pp_lines $qla_hbas
569         added_dependency=TRUE
570     fi
571
572     # We no longer support mixed vendor types, so we will not add the
573     # emulex driver if the qla driver exists.
574
575     if [ "$emulexHbaName" != "" -a "$added_dependency" = FALSE ]; then
576             emulexHbaName=lpfcdd
577             modloc=`find $searchDir -name ${emulexHbaName}.ko -print`
578             if [ "$modloc" != "" ]; then
579                 modprobe_add_pp_lines $emulexHbaName
580             fi
581     fi
582 }
583
584 #-----------------------------------------------------------------------
585 # Add PowerPath parameters to modprobe.conf.pp file
586 #-----------------------------------------------------------------------
587 update_driver_parameters()
588 {
589     local lams_file="/etc/emc/mpaa.lams"
590     local lams_excluded_file="/etc/emc/mpaa.excluded"
591
592     ## Attach the PP file to modprobe.conf
593
594    grep '^##*BEGINPP' /etc/modprobe.conf >/dev/null 2>&1
595     if [ $? -ne 0 ]; then
596         save_for_rollback /etc/modprobe.conf
597         cat <<-EOF >> /etc/modprobe.conf  ## Lines indented with tabs!!!
598         ###BEGINPP
599         include /etc/modprobe.conf.pp
600         ###ENDPP
601         EOF
602     fi
603
604     copy_file $PPBASE/modprobe.conf.pp $modprobe_file
605
606     ## Update the managedclass parameter line
607
608     mng_class=`awk -F: '$1 ~ /^managed$/ {print $2}' $lams_file | \
609                xargs | \
610                sed -e 's/ /,/g' \
611                    -e 's/^/options emcp managedclass=/'`
612
613     grep "options emcp managedclass" $modprobe_file > /dev/null 2>&1
614     if test $? -ne 0 ; then
615         echo "$mng_class" >> $modprobe_file
616     else
617         sed -i "s/^options emcp managedclass=.*/${mng_class}/" \
618             $modprobe_file 
619     fi
620
621     ## Update the excludedvolumes parameter line.
622
623     if [ `wc -l $lams_excluded_file | awk '{print $1}'` -gt 1 ] ; then
624         excluded=`awk -F: '{print $2","}' $lams_excluded_file |\
625                   grep -v version |\
626                   sed '$s/.$//' |\
627                   tr -d '\012'`
628         if [ "$excluded" ] ; then
629             if grep "options emcp excludedvolumes" \
630                      $modprobe_file > /dev/null 2>&1 ; then
631                 sed -i "/excludedvolumes/c\
632                     options emcp excludedvolumes=$excluded" $modprobe_file
633             else
634                 echo "options emcp excludedvolumes=$excluded" >> $modprobe_file
635             fi
636         fi
637
638     fi
639
640     ## Link hba drivers and powerpath drivers
641
642     create_hba_dependencies
643 }
644
645 #-----------------------------------------------------------------------
646 # update_boot_logic - Tie PowerPath start into system startup logic.
647 #-----------------------------------------------------------------------
648 update_boot_logic()
649 {
650     case "$VENDOR" in
651         suse)
652           MDFILE=/etc/init.d/boot.md
653           grep boot.powerpath $MDFILE >> /dev/null 2>>/dev/null 
654           if [ $? -eq 1 ]; then
655               save_for_rollback $MDFILE
656               string=`grep "# Required-Start:" $MDFILE`
657               sed --in-place -e "s/$string/$string boot.powerpath/" $MDFILE
658               if [ -x /sbin/insserv ]; then
659                   /sbin/insserv
660               fi
661           fi
662         ;;
663         redhat|asianux)
664           ETCFILE=/etc/rc.d/rc.sysinit
665           grep BEGINPP $ETCFILE  >> /dev/null 2>>/dev/null
666           if [ $? -eq 1 ]; then
667               save_for_rollback $ETCFILE
668               sed --in-place -e '/remount,rw \//a \
669                 ###BEGINPP\
670                 # Configure and initialize PowerPath.\
671                 if [ -f /etc/init.d/PowerPath ]; then\
672                    /etc/init.d/PowerPath start\
673                 fi\
674                 ###ENDPP' $ETCFILE
675           fi
676         ;;
677     esac
678 }
679
680 #-----------------------------------------------------------------------
681 # Delete old modules in all /lib/modules subdirectories, then install
682 # the new modules.
683 #-----------------------------------------------------------------------
684 install_driver_modules()
685 {
686 for os in /lib/modules/*
687 do
688   case $os in
689       /lib/modules/`uname -r`)
690           for modpath in $os/powerpath/*
691           do
692             remove_file $modpath
693           done
694           ;;
695       *)
696           remove_dirtree $os/powerpath
697           ;;
698   esac
699   for modpath in $os/extra/emcp*
700   do
701     remove_file $modpath
702   done
703 done
704
705 ## Install new modules.
706
707 MODULE_BASE=/lib/modules/`uname -r`
708
709 test -d $MODULE_BASE/powerpath || make_dir $MODULE_BASE/powerpath
710
711 for mod in `ls $PPBASE/bin/driver/$TAG`
712 do
713   copy_mod $PPBASE/bin/driver/$TAG/$mod $MODULE_BASE/powerpath/$mod
714 done
715
716 depmod
717 }
718
719 ##-------------------------------- Main ------------------------------##
720
721 PATH=/sbin:/usr/sbin:/bin:/usr/bin; export PATH
722
723 cmd_path=`dirname $0`
724 PPBASE=`(cd $cmd_path;pwd)`
725
726 test -f $PP_I_DIR/.pp_version && PP_VERSION=`cat $PP_I_DIR/.pp_version`
727 test -f $PP_I_DIR/.new_pp_version && \
728                           NEW_PP_VERSION=`cat $PP_I_DIR/.new_pp_version`
729 test -f $PP_I_DIR/.os_version && OS_VERSION=`cat $PP_I_DIR/.os_version`
730
731 VENDOR=`rpm --showrc | awk '$2 == "_vendor" {print $3}'`
732
733 ###
734 ### DO NOT REMOVE THE FOLLOWING LINE
735 # SuSE x86_64 specific:
736 #
737
738 EXPECTED_VENDOR=suse
739 VENDOR_NAME=Suse
740 VENDOR_OS_NAME=SLES10SP1
741 EXPECTED_ISA=x86_64
742 EXPECTED_OS_REV=10sp1
743 MIN_UPGRADE_REV=5.0.0
744
745 check_vendor_rev()
746 {
747 if [ "`cat /etc/SuSE-release | awk '$1 == "PATCHLEVEL" {print $3}'`" ==  "1" ]
748 then
749    sles_version=$EXPECTED_OS_REV
750 else
751    sles_version=""
752 fi
753 test "$1" = "$sles_version"
754 }
755
756 #-----------------------------------------------------------------------
757 # identify_platform -
758 # Determine the set of drivers files compatible with the /lib/modules
759 # subdirectory passed as an argument and echo the tag for that set of
760 # drivers to stdout.
761 #-----------------------------------------------------------------------
762
763 identify_platform()
764 {
765     local platform=
766
767     case "$1" in
768         *-smp) platform=sles${EXPECTED_OS_REV}smp_x8664 ;;
769         *-xen) platform=sles${EXPECTED_OS_REV}xensmp_x8664 ;;
770         *)
771           if [ "$1" = `uname -r` ]
772           then
773               pre_error "This PowerPath package only supports the SuSE SLES x86_64 smp kernel"
774               cleanup_error_exit
775           fi
776           ;;
777     esac
778
779     test "$platform" && echo $platform
780 }
781 ###
782
783 init_I18N
784
785 rollback_reset
786
787 validate_install_target
788
789 make_dir /etc/emc/ppme
790
791 test "$NEW_PP_VERSION" && restore_configuration_files
792
793 update_lams_files
794
795 update_driver_parameters
796
797 install_driver_modules
798
799 ## Load new modules.  Emcplib and emcp first, emcpdm and emcpioc last
800 ## with everything else in between.
801
802 load_all_modules `ls $PPBASE/bin/driver/$TAG | \
803                   awk '/^emcplib.ko$/ {order[$1]=1; next}
804                        /^emcp.ko$/    {order[$1]=2; next}
805                        /^emcpdm.ko$/  {order[$1]=4; next}
806                        /^emcpioc.ko$/ {order[$1]=5; next}
807                        /^emcp/        {order[$1]=3; next}
808                        END { for (mod in order) print order[mod],mod;}' |\
809                   sort -n | \
810                   cut -d' ' -f2`
811
812 ## If error loading modules, roll back everything done to this point and
813 ## return an error status.
814
815 if [ $? -ne 0 ]
816 then
817    report_error "Error loading PowerPath kernel modules"
818    rollback
819    rollback_reset
820    depmod
821    error_exit
822 fi
823
824 ## If kernel has changed make sure PowerPath will still start at boot time
825
826 if [ "$OS_VERSION" != `uname -r` ]; then
827     update_boot_logic    
828 fi
829
830 if [ $? -ne 0 ]
831 then
832    report_error "Error installing PowerPath"
833    rollback
834    rollback_reset
835    error_exit
836 fi
837
838 ## Update state info in /etc/opt/emcpower
839
840 rm -f $PP_I_DIR/.os_version
841 uname -r > $PP_I_DIR/.os_version
842 rm -f $PP_I_DIR/.prev_pp_version
843 if [ -f $PP_I_DIR/.new_pp_version ]
844 then
845     test -f $PP_I_DIR/.pp_version && \
846         mv -f $PP_I_DIR/.pp_version $PP_I_DIR/.prev_pp_version
847     mv $PP_I_DIR/.new_pp_version $PP_I_DIR/.pp_version
848 fi
This page took 0.174933 seconds and 3 git commands to generate.