redink / redink_toys

redink's codes for fun
3 stars 0 forks source link

make relup under rebar #10

Open redink opened 7 years ago

redink commented 7 years ago
#!/usr/bin/env bash

while getopts ":n:v:" o; do
   case "${o}" in
       n)
           RELEASE_NAME=${OPTARG}
           ;;
       v)
           VERSION=${OPTARG}
           ;;
       *)
           usage
           ;;
   esac
done
shift $((OPTIND-1))

RUNNER_SCRIPT_DIR=$(cd ${0%/*} && pwd)
ROOT=$(echo $RUNNER_SCRIPT_DIR | sed -e "s/\(.*${RELEASE_NAME}\).*$/\1/")
REBAR=$ROOT/rebar
REL_ROOT=$ROOT/rel

cd $ROOT

$REBAR compile

if [ ! $? -eq 0 ]; then
    echo "compile error\n"
    exit 1
fi

cd $REL_ROOT

$REBAR generate target_dir=update_tmp_${VERSION}/$RELEASE_NAME
$REBAR generate-appups target_dir=update_tmp_${VERSION}/$RELEASE_NAME previous_release=../$RELEASE_NAME
$REBAR generate-upgrade target_dir=update_tmp_${VERSION}/$RELEASE_NAME previous_release=../$RELEASE_NAME

echo ${RELEASE_NAME}_${VERSION}.tar.gz

echo done