Monday, January 18, 2016

recursive pkgadd on solaris10 zone

 #!/usr/bin/bash  
   
 rm -rf *.gz  
 rm -rf *.zip  
   
 if [ -f /var/sadm/install/.lockfile ] ; then  
     echo "sadm pkgadd lockfile present"  
       
     read -r -p "delete? [y/N] " response  
         case $response in  
         [yY][eE][sS]|[yY])   
           
         rm -rf /var/sadm/install/.lockfile  
           
         ;;  
     *)  
         quit  
         ;;  
     esac  
 fi  
   
 if [ -f /tmp/.ai.pkg.zone.lock-* ] ; then  
     echo "zone pkgadd lockfile present"  
       
     read -r -p "delete? [y/N] " response  
         case $response in  
         [yY][eE][sS]|[yY])   
           
         rm -rf /tmp/.ai.pkg.zone.lock-*  
           
         ;;  
     *)  
         quit  
         ;;  
     esac  
 fi  
   
 if [ -f /var/sadm/install/.pkg.lock ] ; then  
     echo "pkgadd lockfile present"  
       
     read -r -p "delete? [y/N] " response  
         case $response in  
         [yY][eE][sS]|[yY])   
           
         rm -rf /var/sadm/install/.pkg.lock  
           
         ;;  
     *)  
         quit  
         ;;  
     esac  
 fi  
   
 for i in *local; do pkgadd -d $i; done  

No comments: