svn_update.sh 1.78 KB
Newer Older
1 2 3 4
#!/bin/bash

# Modules to get from the SVN
PRODUCTS="CMFActivity CMFCategory ERP5 ERP5Catalog ERP5Form \
Kevin Deldycke's avatar
Kevin Deldycke committed
5 6
          ERP5OOo ERP5Security ERP5Subversion ERP5SyncML    \
          ERP5Type ZSQLCatalog"
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22

# System user and group that own Zope product files
USER="zope"
GROUP="zope"

# Define paths
ZOPE_PRODUCTS="/var/lib/zope/Products"
EXTENSIONS_FOLDER="/var/lib/zope/Extensions"
BT5_FOLDER="/var/lib/zope/bt5"

# Update each product
for p in $PRODUCTS
  do
    echo ""
    echo "----- Updating $p -----"
    if ls $ZOPE_PRODUCTS/$p > /dev/null 2>&1 /dev/null; then
23
      svn update $p
24
    else
25
      svn checkout https://svn.erp5.org/repos/public/erp5/trunk/products/$p
26 27 28 29 30 31
    fi
  done

# Get latests Business Templates
echo ""
echo "----- Updating Business Templates -----"
Jérome Perrin's avatar
Jérome Perrin committed
32
wget -nv -N --no-host-directories -r --level=2 --relative --no-parent --accept=bt5,bt5list http://torrent.erp5.org/dists/snapshot/bt5/
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
rm -f robots.txt

# Restore good right
chown -R $USER.$GROUP .

# Replace symlinks installed by the default ERP5 installation by the new ones
update_symlink() {
  BASE=$1
  SOURCE=$2
  DESTINATION=$3
  # If a previous symlink exist delete it
  cd $BASE
  if test -h $SOURCE; then
    rm -f $SOURCE
  fi
  # If there is no $SOURCE file, create a symlink
  if [ ! -e $SOURCE ]; then
    ln -s $DESTINATION
    echo ""
    echo "----- Symlink updated: $BASE/$SOURCE -> $DESTINATION"
  fi
}

for p in $PRODUCTS
  do
    if test $p = "ZSQLCatalog"; then
      echo `update_symlink $EXTENSIONS_FOLDER zsqlbrain.py ../Products/ZSQLCatalog/zsqlbrain.py`
    fi
    if test $p = "ERP5"; then
      echo `update_symlink $EXTENSIONS_FOLDER InventoryBrain.py ../Products/ERP5/Extensions/InventoryBrain.py`
    fi
    if test $p = "bt5"; then
      echo `update_symlink $BT5_FOLDER erp5_bt5 ../Products/bt5`
    fi
  done

69
exit 0