svn_update.sh 1.92 KB
Newer Older
1 2
#!/bin/bash

3 4
echo -e "\033[0;31mThis is an unsupported script. You should use 'svn update' command instead\033[0m"

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

# 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
25
      svn update $p
26
    else
27
      svn checkout https://svn.erp5.org/repos/public/erp5/trunk/products/$p
28 29 30 31 32 33
    fi
  done

# Get latests Business Templates
echo ""
echo "----- Updating Business Templates -----"
34 35
wget -nv -N --no-host-directories -r --cut-dirs=2 --level=2 --relative \
  --no-parent --accept=bt5,bt5list http://www.erp5.org/dists/snapshot/bt5/
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 69 70 71
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

72
exit 0