common.sh 551 Bytes
Newer Older
1 2 3 4 5
#!/bin/bash

set -x

# You may tune this section
6
SOFT_DIR="/data/software"
Matthieu Boileau's avatar
Matthieu Boileau committed
7 8 9
BASE_WORK_DIR=${SOFT_DIR}/sources
BASE_INSTALL_DIR=${SOFT_DIR}/install
BASE_MODULE_DIR=${SOFT_DIR}/modules
10 11
###

Matthieu Boileau's avatar
Matthieu Boileau committed
12 13 14
mkdir -p $BASE_WORK_DIR
mkdir -p $BASE_INSTALL_DIR
mkdir -p $BASE_MODULE_DIR
15

Matthieu Boileau's avatar
Matthieu Boileau committed
16 17 18 19 20 21 22 23
download()
{
if [[ ! -f $ARCHIVE ]]; then
  mkdir -p $WORK_DIR
  wget $URL -O $ARCHIVE || { echo 'Download failed' ; exit 1; }
fi
}

24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
clean_dir()
{
if [[ -d $1 ]]
then
  rm -rf $1
else
  echo "WARNING: $1 does not exist"
fi
}

clean_all()
{
  clean_dir $SRC_DIR
  clean_dir $BUILD_DIR
}