]> git.pld-linux.org Git - packages/EMCpower.git/blob - EMCpower.enable
- add PLDized enable script, R: diff
[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 echo "$*"
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.gz`
280         if [ "$1" ]; then
281                 shift 1
282         fi
283
284     if [ -z "$mod" ]
285     then
286         if lsmod | grep emcpioc > /dev/null
287         then
288             modprobe -r emcpioc
289         fi
290         return 0
291     fi
292     if modprobe -q $mod
293     then
294         load_all_modules $*
295         if [ $? -ne 0 ]
296         then
297             modprobe -r $mod
298             return 1
299         fi
300     else
301         report_error 'PowerPath could not load module $mod'
302         return 1
303     fi
304 }
305
306 #-----------------------------------------------------------------------
307 # Run "preinstall" checks to make sure the running system is compatible
308 # with this package.
309 #-----------------------------------------------------------------------
310 validate_install_target()
311 {
312 ## Check - Require effective UID of root
313
314     if [ $(id -u) != 0 ]; then
315         report_error "You must be root to install PowerPath."
316         error_exit
317     fi
318
319 ## Check - Only install on a 2.6 kernel
320
321     expr `uname -r` : '2\.6' > /dev/null
322     if [ $? -ne 0 ]; then
323         report_error "This PowerPath package does not support this kernel."
324         error_exit
325     fi
326
327 ## Check vendor
328
329     if expr \( "$EXPECTED_VENDOR" : ".*$VENDOR" \) = 0 >/dev/null; then
330         report_error 'This package requires a $VENDOR_NAME Platform.'
331         error_exit
332     fi
333
334 ## Check vendor rev.
335
336     check_vendor_rev $EXPECTED_OS_REV
337     if [ $? != 0 ]; then
338         report_error 'This package requires $VENDOR_NAME $VENDOR_OS_NAME.'
339         error_exit
340     fi
341
342 ## Check hardware platform
343
344     if [ "`uname -m`" != "$EXPECTED_ISA" ]; then
345         report_error \
346             'This package requires the $VENDOR_NAME $EXPECTED_ISA kernel.'
347         error_exit
348     fi
349
350 ## Check - Make sure no devices are in use.
351
352     if [ "`/sbin/lsmod | grep -w emcp`" != "" ]; then
353         /sbin/powermt save > /dev/null 2>&1
354         /sbin/powermt remove dev=all > /dev/null 2>&1
355         if [ "`powermt display dev=all 2>&1 | grep "not found"`" = "" ]; then
356             report_error \
357                 "Unable to remove devices from the PowerPath configuration."
358             report_error \
359                 "Please make sure no PowerPath devices are in use and retry."
360             /sbin/powermt config > /dev/null 2>&1
361             /sbin/powermt load > /dev/null 2>&1
362             error_exit
363         fi
364         /sbin/powermt config > /dev/null 2>&1
365         /sbin/powermt load > /dev/null 2>&1
366     fi
367
368 ## Check driver vermagic
369
370     verify_driver_vermagic /lib/modules/$(uname -r)/kernel/drivers/block/emcp.ko.gz
371     if [ $? != 0 ]; then
372         report_error 'PowerPath driver version magic mismatch'
373         error_exit
374     fi
375 }
376
377 #-----------------------------------------------------------------------
378 # Compare the version recorded in the saved powermt.custom file with the
379 # version in $1.  If the two versions match, return true.
380 #-----------------------------------------------------------------------
381 matching_saved_config_version()
382 {
383     local saved
384     local Mmp
385     if [ -f $archive_dir/powermt.custom.saved ]; then
386         Mmp=`expr "$1" : '\([0-9]\.[0-9]\.[0-9]\)'`
387         saved=`head -1 $archive_dir/powermt.custom.saved | cut -d: -f3`
388         if [ "$saved" = "$Mmp" ]; then
389             /bin/true
390         else
391             /bin/false
392         fi
393     else
394         /bin/false
395     fi
396 }
397
398 #-----------------------------------------------------------------------
399 # Move files from the PowerPath archive directory to their normal
400 # installed locations.
401 #-----------------------------------------------------------------------
402 restore_configuration_files()
403 {
404     for file in /etc/emc/mpaa.lams \
405         /etc/emc/mpaa.excluded \
406         /etc/emcp_registration
407     do
408       if [ -f $archive_dir/`basename $file`.saved ]; then
409           move_file $archive_dir/`basename $file`.saved $file
410       fi
411     done
412
413     if test "$PP_VERSION" || \
414                 matching_saved_config_version $NEW_PP_VERSION; then
415         for file in /etc/powermt.custom \
416             /etc/emcp_devicesDB.dat \
417             /etc/emcp_devicesDB.idx
418         do
419           if [ -f $archive_dir/`basename $file`.saved ]; then
420               move_file $archive_dir/`basename $file`.saved $file
421           fi
422         done
423
424         if [ -f $archive_dir/*.FCS ]; then
425             for file in $archive_dir/*.FCS
426               do
427               move_file $file /etc
428             done
429         fi
430     fi
431 }
432
433 #-----------------------------------------------------------------------
434 # tps_managed_classes - Return a true status if third party software
435 # is installed to manage the array named in $1.  Otherwise return a
436 # false status.
437 #-----------------------------------------------------------------------
438 tps_managed()
439 {
440 case "$1" in
441     hitachi)
442         test -d /opt/DynamicLinkManager/bin
443         ;;
444     hpxp)
445         test -d /usr/src/Autopath
446         ;;
447     ess)
448         test -d /opt/IBMsdd/bin
449         ;;
450     hphsx)
451         test -d /etc/CPQswsp/modules
452         ;;
453     *)
454         /bin/false
455         ;;
456 esac
457 }
458
459 #-----------------------------------------------------------------------
460 # prev_unmanaged - Return a true status if the array named in $2
461 # is marked "unmanaged" in the mpaa.lams file named in $1
462 #-----------------------------------------------------------------------
463 prev_unmanaged()
464 {
465   grep -w $2 $1 2>/dev/null | grep -w unmanaged > /dev/null 2>&1
466 }
467
468 #-----------------------------------------------------------------------
469 # If no mpaa.lams file exists, create one.  Otherwise create a temporary
470 # mpaa.lams file, compare it to the existing file and replace the
471 # existing file with the temporary one if the two files differ. Also,
472 # create an empty mpaa.excluded if one doesn't exist
473 #-----------------------------------------------------------------------
474 update_lams_files()
475 {
476     local lams_file="/etc/emc/mpaa.lams"
477     local lams_excluded_file="/etc/emc/mpaa.excluded"
478     local lams_new
479
480     if [ -f "$lams_file" ]; then
481         lam_ref=$lams_file
482         lams_new=${lams_file}.tmp
483     else
484         lam_ref=/dev/null
485         lams_new=$lams_file
486     fi
487
488     echo  "global:version:$PP_VERSION" > $lams_new
489     for array in symm clariion hpxp hitachi hphsx ess invista
490     do
491         if tps_managed $array || prev_unmanaged $lam_ref $array
492         then
493             echo "unmanaged:$array" >> $lams_new
494         else
495             echo "managed:$array" >> $lams_new
496         fi
497     done
498
499     if [ "$lams_new" = "${lams_file}.tmp" ]; then
500         if /usr/bin/diff -q $lams_file $lams_new >/dev/null 2>&1; then
501             rm -f $lams_new
502         else
503             mv -f $lams_new $lams_file
504         fi
505     else
506         add_to_undolist rm -f $lams_file
507     fi
508
509     if [ ! -f "$lams_excluded_file" ]; then
510         echo  "global:version:$PP_VERSION" > $lams_excluded_file
511         add_to_undolist rm -f $lams_excluded_file
512     fi
513 }
514
515 #-----------------------------------------------------------------------
516 # Add lines to /etc/modprobe.conf.pp to coordinate filter driver, hba
517 # driver and emcp loading
518 #-----------------------------------------------------------------------
519 modprobe_add_pp_lines()
520 {
521     local begin_tag='#begin-hba-'
522     local end_tag='#end-hba-'
523     local install_hba
524
525     if test "$1"; then
526        modprobe_hba=' /sbin/modprobe pp_hba;'
527        install_hba=
528        for hba in $*
529        do
530          install_hba="$install_hba /sbin/modprobe $hba;"
531        done
532     fi
533
534     if grep "^${begin_tag}$1" $modprobe_file > /dev/null; then
535         return  # Lines for this hba are already in place
536     else
537         # Lines indented with tab!!
538         cat <<-EOF  >> $modprobe_file
539         ${begin_tag}${hba}
540         install emcp /sbin/modprobe pp_hba; /sbin/modprobe emcp --ignore-install
541         install pp_hba ${install_hba}
542         ${end_tag}${hba}
543         EOF
544     fi
545 }
546
547 #-----------------------------------------------------------------------
548 # Create dependencies between HBA drivers and power path drivers.
549 #-----------------------------------------------------------------------
550 create_hba_dependencies()
551 {
552     local added_dependency=FALSE
553     local searchDir=/lib/modules/`uname -r`
554     local qlaHbaName
555     local emulexHbaName
556
557     qlaHbaName=`find /proc/scsi -name qla2xxx | sed -e 's/\/proc\/scsi\///'`
558     emulexHbaName=`find /proc/scsi -name lpfc* | sed -e 's/\/proc\/scsi\///'`
559     if [ "$qlaHbaName" ]; then
560         qla_hbas=`lsmod | cut -d' ' -f1 | grep qla | grep  -v qla2xxx`
561         modprobe_add_pp_lines $qla_hbas
562         added_dependency=TRUE
563     fi
564
565     # We no longer support mixed vendor types, so we will not add the
566     # emulex driver if the qla driver exists.
567
568     if [ "$emulexHbaName" != "" -a "$added_dependency" = FALSE ]; then
569             emulexHbaName=lpfcdd
570             modloc=`find $searchDir -name ${emulexHbaName}.ko -print`
571             if [ "$modloc" != "" ]; then
572                 modprobe_add_pp_lines $emulexHbaName
573             fi
574     fi
575 }
576
577 #-----------------------------------------------------------------------
578 # Add PowerPath parameters to modprobe.conf.pp file
579 #-----------------------------------------------------------------------
580 update_driver_parameters()
581 {
582     local lams_file="/etc/emc/mpaa.lams"
583     local lams_excluded_file="/etc/emc/mpaa.excluded"
584
585     ## Attach the PP file to modprobe.conf
586
587    grep '^##*BEGINPP' /etc/modprobe.conf >/dev/null 2>&1
588     if [ $? -ne 0 ]; then
589         save_for_rollback /etc/modprobe.conf
590         cat <<-EOF >> /etc/modprobe.conf  ## Lines indented with tabs!!!
591         ###BEGINPP
592         include /etc/modprobe.conf.pp
593         ###ENDPP
594         EOF
595     fi
596
597     copy_file /etc/modprobe.d/$(uname -r)/EMCpower.conf $modprobe_file
598
599     ## Update the managedclass parameter line
600
601     mng_class=`awk -F: '$1 ~ /^managed$/ {print $2}' $lams_file | \
602                xargs | \
603                sed -e 's/ /,/g' \
604                    -e 's/^/options emcp managedclass=/'`
605
606     grep "options emcp managedclass" $modprobe_file > /dev/null 2>&1
607     if test $? -ne 0 ; then
608         echo "$mng_class" >> $modprobe_file
609     else
610         sed -i "s/^options emcp managedclass=.*/${mng_class}/" \
611             $modprobe_file 
612     fi
613
614     ## Update the excludedvolumes parameter line.
615
616     if [ `wc -l $lams_excluded_file | awk '{print $1}'` -gt 1 ] ; then
617         excluded=`awk -F: '{print $2","}' $lams_excluded_file |\
618                   grep -v version |\
619                   sed '$s/.$//' |\
620                   tr -d '\012'`
621         if [ "$excluded" ] ; then
622             if grep "options emcp excludedvolumes" \
623                      $modprobe_file > /dev/null 2>&1 ; then
624                 sed -i "/excludedvolumes/c\
625                     options emcp excludedvolumes=$excluded" $modprobe_file
626             else
627                 echo "options emcp excludedvolumes=$excluded" >> $modprobe_file
628             fi
629         fi
630
631     fi
632
633     ## Link hba drivers and powerpath drivers
634
635     create_hba_dependencies
636 }
637
638 #-----------------------------------------------------------------------
639 # update_boot_logic - Tie PowerPath start into system startup logic.
640 #-----------------------------------------------------------------------
641 update_boot_logic()
642 {
643     case "$VENDOR" in
644         suse)
645           MDFILE=/etc/init.d/boot.md
646           grep boot.powerpath $MDFILE >> /dev/null 2>>/dev/null 
647           if [ $? -eq 1 ]; then
648               save_for_rollback $MDFILE
649               string=`grep "# Required-Start:" $MDFILE`
650               sed --in-place -e "s/$string/$string boot.powerpath/" $MDFILE
651               if [ -x /sbin/insserv ]; then
652                   /sbin/insserv
653               fi
654           fi
655         ;;
656         redhat|asianux)
657           ETCFILE=/etc/rc.d/rc.sysinit
658           grep BEGINPP $ETCFILE  >> /dev/null 2>>/dev/null
659           if [ $? -eq 1 ]; then
660               save_for_rollback $ETCFILE
661               sed --in-place -e '/remount,rw \//a \
662                 ###BEGINPP\
663                 # Configure and initialize PowerPath.\
664                 if [ -f /etc/init.d/PowerPath ]; then\
665                    /etc/init.d/PowerPath start\
666                 fi\
667                 ###ENDPP' $ETCFILE
668           fi
669         ;;
670     esac
671 }
672
673 #-----------------------------------------------------------------------
674 # Delete old modules in all /lib/modules subdirectories, then install
675 # the new modules.
676 #-----------------------------------------------------------------------
677 install_driver_modules()
678 {
679         return # already cames from rpm package
680 for os in /lib/modules/*
681 do
682   case $os in
683       /lib/modules/`uname -r`)
684           for modpath in $os/powerpath/*
685           do
686             remove_file $modpath
687           done
688           ;;
689       *)
690           remove_dirtree $os/powerpath
691           ;;
692   esac
693   for modpath in $os/extra/emcp*
694   do
695     remove_file $modpath
696   done
697 done
698
699 ## Install new modules.
700
701 MODULE_BASE=/lib/modules/`uname -r`
702
703 test -d $MODULE_BASE/powerpath || make_dir $MODULE_BASE/powerpath
704
705 for mod in `ls $PPBASE/bin/driver/$TAG`
706 do
707   copy_mod $PPBASE/bin/driver/$TAG/$mod $MODULE_BASE/powerpath/$mod
708 done
709
710 depmod
711 }
712
713 ##-------------------------------- Main ------------------------------##
714
715 PATH=/sbin:/usr/sbin:/bin:/usr/bin; export PATH
716
717 cmd_path=`dirname $0`
718 PPBASE=`(cd $cmd_path;pwd)`
719
720 test -f $PP_I_DIR/.pp_version && PP_VERSION=`cat $PP_I_DIR/.pp_version`
721 test -f $PP_I_DIR/.new_pp_version && \
722                           NEW_PP_VERSION=`cat $PP_I_DIR/.new_pp_version`
723 test -f $PP_I_DIR/.os_version && OS_VERSION=`cat $PP_I_DIR/.os_version`
724
725 VENDOR=`rpm --showrc | awk '$2 == "_vendor" {print $3}'`
726
727 ###
728 ### DO NOT REMOVE THE FOLLOWING LINE
729 # SuSE x86_64 specific:
730 #
731
732 EXPECTED_VENDOR=pld
733 VENDOR_NAME=PLD
734 VENDOR_OS_NAME=SLES10SP1
735 EXPECTED_ISA=x86_64
736 EXPECTED_OS_REV=ac
737 MIN_UPGRADE_REV=5.0.0
738
739 check_vendor_rev()
740 {
741 if [ "`awk '/Ac/{print 1}' /etc/pld-release`" ==  "1" ]
742 then
743    sles_version=$EXPECTED_OS_REV
744 else
745    sles_version=""
746 fi
747 test "$1" = "$sles_version"
748 }
749
750 #-----------------------------------------------------------------------
751 # identify_platform -
752 # Determine the set of drivers files compatible with the /lib/modules
753 # subdirectory passed as an argument and echo the tag for that set of
754 # drivers to stdout.
755 #-----------------------------------------------------------------------
756
757 identify_platform()
758 {
759     local platform=
760
761     case "$1" in
762         *-smp) platform=sles${EXPECTED_OS_REV}smp_x8664 ;;
763         *-xen) platform=sles${EXPECTED_OS_REV}xensmp_x8664 ;;
764         *)
765           if [ "$1" = `uname -r` ]
766           then
767               pre_error "This PowerPath package only supports the SuSE SLES x86_64 smp kernel"
768               cleanup_error_exit
769           fi
770           ;;
771     esac
772
773     test "$platform" && echo $platform
774 }
775 ###
776
777 init_I18N
778
779 rollback_reset
780
781 validate_install_target
782
783 make_dir /etc/emc/ppme
784
785 test "$NEW_PP_VERSION" && restore_configuration_files
786
787 update_lams_files
788
789 update_driver_parameters
790
791 install_driver_modules
792
793 ## Load new modules.  Emcplib and emcp first, emcpdm and emcpioc last
794 ## with everything else in between.
795
796 load_all_modules `cd /lib/modules/$(uname -r)/kernel/drivers/block/; ls emc* | \
797                   awk '/^emcplib.ko.gz$/ {order[$1]=1; next}
798                        /^emcp.ko.gz$/    {order[$1]=2; next}
799                        /^emcpdm.ko.gz$/  {order[$1]=4; next}
800                        /^emcpioc.ko.gz$/ {order[$1]=5; next}
801                        /^emcp/        {order[$1]=3; next}
802                        END { for (mod in order) print order[mod],mod;}' |\
803                   sort -n | \
804                   cut -d' ' -f2`
805
806 ## If error loading modules, roll back everything done to this point and
807 ## return an error status.
808
809 if [ $? -ne 0 ]
810 then
811    report_error "Error loading PowerPath kernel modules"
812    rollback
813    rollback_reset
814    depmod
815    error_exit
816 fi
817
818 ## If kernel has changed make sure PowerPath will still start at boot time
819
820 if [ "$OS_VERSION" != `uname -r` ]; then
821     update_boot_logic    
822 fi
823
824 if [ $? -ne 0 ]
825 then
826    report_error "Error installing PowerPath"
827    rollback
828    rollback_reset
829    error_exit
830 fi
831
832 ## Update state info in /etc/opt/emcpower
833
834 rm -f $PP_I_DIR/.os_version
835 uname -r > $PP_I_DIR/.os_version
836 rm -f $PP_I_DIR/.prev_pp_version
837 if [ -f $PP_I_DIR/.new_pp_version ]
838 then
839     test -f $PP_I_DIR/.pp_version && \
840         mv -f $PP_I_DIR/.pp_version $PP_I_DIR/.prev_pp_version
841     mv $PP_I_DIR/.new_pp_version $PP_I_DIR/.pp_version
842 fi
This page took 0.123762 seconds and 3 git commands to generate.