Tag Archive | sed
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
#!/bin/sh url=$1 #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 ] then sudo cp /usr/share/$package_name ./$package_name else wget $1 sudo cp ./$package_name /usr/share/$package_name fi # untar tar zxpf ./$package_name mv ./$plugin_raw ./$plugin_name sudo rm ./$package_name # remove package.xml file if [ -f ./package.xml ] then rm package.xml fi exit 0