Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

deployment script
 
pale_ipis
Jr. Member
 
Total Posts:  12
Joined:  2009-11-05
 

doing updates in magento can cost a lot of time because of magento’s large structure. so i’ve written a bash script that can simplify the process of deployment by using svn to identify modified or added files in the dev server and package them in a neat tar ball archive for extracting to a production server.

#!/bin/bash

if $# -eq 0 ];
then
    
echo "Missing parameter... "
    
echo "Usage: magdeps.sh <tarfile> [-l logfile]"
    
exit
fi

if -$1 ];
then
    isnew
=false
else
    
isnew=true    
    
fi

#for i in $(svn status | cut -c 1,8-80); do
#for i in $(svn status | sed 's/^*//'); do
for i in $(svn status awk '/^/{print $1$2}'); do

    
flag=`echo $i | cut -c 1`
    case 
$flag in    
    M
|A)    
        
modfile=`echo $i | awk '{print "./"substr($1,2)}'`
        if 
$isnew ;
        
then
            
echo -"Add file $i ?"
            
read y
            
if [ $y != "y" ];
            
then
                
continue;
            else
                echo 
"Creating tar: $1"    
                
tar -cf $1 $modfile
                isnew
=false
            fi
        
else
            echo -
"Add file $i ?"
            
read y
            
if [ $y != "y" ];
            
then
                
continue;
            else
                echo 
"Adding: $modfile"    
                
tar -rf $1 $modfile
            fi
        fi
        
echo $modfile
        
;;
    ~|!|?)
        echo 
"$i is not yet in svn"    
        
;;
    *)
        
#echo "$i: unrecognized format"
        
;;
    
esac
done

# Add log file

if [[ $== "-l" && -$3 ]];
then
    
if ! $isnew ;
    
then
        
echo "Adding logfile $3"
        
tar -rvf $$3     
        
echo "finalizing"
        
gzip $1

    fi
fi 


echo "finalizing"
gzip $1
#a little crude but it does the job wink
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top