Symfony Plugin Install Script

This is a very short post.

Currently I am using Symfony 1.4.1 for my development but I have noticed that I could not install most if not all plug-ins through the PEAR packaging system. Since I am using Ubuntu I quickly wrote myself a short script to handle the download and unpacking of plug-ins that I want to install. When calling the script you just give it the URL to the .tgz package of the plug-in. Enjoy

#extract the package filename from the URL
package_name=$(echo $1 | sed 's/.*\///')
#extract the raw plug-in name (with version number)
plugin_raw=$(echo $package_name | sed 's/\(.*\?\)\.tgz/\1/')
#extract the actual name of the plug-in (without the version number)
plugin_name=$(echo $package_name | sed 's/\([^-]*\).*/\1/')

#go to the plug-in directory
cd plugins

#check if we already have downloaded the package. You may change the destination to anything you like.
#I store the packages in /usr/share
if [ -f /usr/share/$package_name ]
 sudo cp /usr/share/$package_name ./$package_name
 wget $1
 sudo cp ./$package_name /usr/share/$package_name

# untar
tar zxpf ./$package_name
mv ./$plugin_raw ./$plugin_name
sudo rm ./$package_name

# remove package.xml file
if [ -f ./package.xml ]
 rm package.xml

exit 0

One thought on “Symfony Plugin Install Script

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s