Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
[email protected] web/email now available. Want one? Go here.
Cannot use outlook/hotmail/live here to register as they blocking our mail servers. #microsoftdeez
Obey the Epel!

Paste

Pasted as Bash by registered user webref ( 14 years ago )
#!/bin/bash
# dmcad 2010
# some declarations
trap bashtrap INT
declare -a arg #declares arg as Array[]
# CMS urls
drupal_src='http://ftp.drupal.org/files/projects'
drupal_file='drupal-6.16.tar.gz'
wp_src='http://wordpress.org'
wp_file='latest.tar.gz'
joomla_src='http://joomlacode.org/gf/download/frsrelease/12193/49780'
joomla_file='Joomla_1.5.17-Stable-Full_Package.zip'
zend_src='wget http://framework.zend.com/releases/ZendFramework-1.10.3'
zend_file='ZendFramework-1.10.3-minimal.tar.gz'
# other vars
git_dir=/www/git
USERID=git
config_file=/etc/sympathy.conf
arg=("$@")
count=${#arg[@]}
export git_dir config_file arg list USERID drupal_src drupal_file wp_src wp_file joomla_src joomla_file zend_src zend_file


# Now administrative tasks.

function mkuser {
# If not exists git user create it
grep -i "^${USERID}:" /etc/passwd
if [! $? -eq 0 ]; then
echo 'Creando usuarios'
adduser --system --shell /bin/sh --gecos 'git version control' --group --disabled-password --home /www/git ${USERID}
echo 'Creando claves rsa'
sudo -H -u ${USERID} 'ssh-keygen -t rsa'
fi
}

function rmuser {
echo 'Borrando usuarios'
deluser ${USERID}
}

# Check for Git daemon if not exists obtain it
function install {
if [!-f /etc/service/git-daemon-run ]; then
echo 'Obtener demonio git'
apt-get git-daemon-run
#vi /etc/service/git-daemon/run
#exec git-daemon --verbose --strict-paths --reuseaddr --export-all --user=git --group=www-data --base-path=/www/git /www/git
fi
}

function cms_get {
mkdir -p /www/src
cd /www/src
case ${arg[1]} in
 drupal)  drupal;;
 wordpress) wordpress;;
 joomla)  joomla;;
 zend)  zend;;
esac
}


function drupal {
cd ${git_dir}/src
if [! -f ${drupal_file} ]; then
echo 'Obteniendo Drupal'
wget ${drupal_src}/${drupal_file}
echo 'extrayendo Drupal'
tar xvf /www/src/${drupal_file}
 else
echo 'Drupal ya ha sido preparado'
fi
}

function wordpress {
cd ${git_dir}/src
if [! -f ${wp_file} ]; then
echo 'Obteniendo Wordpress'
wget ${wp_src}/${wp_file}
echo 'extrayendo Wordpress'
tar xvf /www/src/${wp_file}
 else
echo 'Wordpress ya ha sido preparado'
fi
}

function joomla {
cd ${git_dir}/src
if [! -f ${joomla_file}; then
echo 'Obteniendo Joomla'
wget  ${joomla_src}/${joomla_file}
echo 'extrayendo Joomla'
unzip /www/src/${joomla_file}
 else
echo 'Joomla ya ha sido preparado'
fi
}

function zend {
cd ${git_dir}/src
if [! -f ${zend_file} ]; then 
echo 'Obteniendo Joomla'
wget  ${zend_src}/${zend_file}
echo 'extrayendo Joomla'
tar xvf /www/src/${zend_file}
 else
echo 'Zend ya ha sido preparado'
fi
}

function clearall {
echo 'Borrando /www/src/*'
rm -rf /www/src/*
}

#for (( i=0;i<$count;i++)); do
#    echo ${argv[${i}]}
#done 

function rep_create {
echo 'Creando repositorio'
if [!-d ${new_dir}]; then
mkdir ${git_dir}/${new_dir}.git -p
cd ${git_dir}/${new_dir}.git
chmod 755 ${git_dir}/${new_dir}.git/hooks/post-update
git init
git add .
git commit -m "Push inicial de '${new_dir}'"
git remote add origin file://${git_dir}/${new_dir}.git
git push origin HEADS
#git push origin master:refs/heads/master
git ls-remote origin
cd ..
fi
}

function rep_destroy {
echo 'Removiendo repositorio'
cd ${git_dir}
if [!-d ${new_dir}]; then
rm -rf ${new_dir}
fi
}

function ayuda {
echo 'gitscit has the next commands'
echo 'create $1 $2'
echo 'destroy $1 $2'
echo 'install drupal|wordpress|joomla|zend'
echo 'mkuser'
echo 'rmuser'
echo 'cms_get'
echo 'clearall'
echo 'ayuda'
}

if [ -z ${arg[0]} ]; then
 echo 'No parameters'
 exit 0
 else
case ${arg[0]}  in
  install) install;;
  create)  rep_create;;
  destroy) rep_destroy;;
  mkuser)  mkuser;;
  rmuser)  rmuser;;
  cmsget)  cms_get;;
  clearall) clearall;;
  ayuda)  ayuda;;
esac
fi

bashtrap()
{
    echo "CTRL+C Detected !...executing bash trap !"
 exit 0
}

 

Revise this Paste

Your Name: Code Language: