diff --git a/scripts/build.sh b/scripts/build.sh
index 67e1b6abb9f3a896014a3937f8ca061bb88febe5..688191b42bbc0c76158e22596ca944e6819fd7e6 100755
--- a/scripts/build.sh
+++ b/scripts/build.sh
@@ -11,31 +11,50 @@ NCORES=$(cat /proc/cpuinfo | grep processor | wc -l)
 # STORE=""
 STORE="--remote-store $ALIBUILD_WORK_DIR::rw"
 
+echo "CI_PROJECT_NAME=$CI_PROJECT_NAME"
 echo "CI_COMMIT_REF_NAME=$CI_COMMIT_REF_NAME"
 
-if [[ $CI_COMMIT_REF_NAME == master* ]];then
-  PACKAGE_NAME=mpdroot
-  # PACKAGE_VERSION=$(echo $CI_COMMIT_REF_NAME | cut -sd '-' -f2-)
-#  PACKAGE_DEFAULTS="--defaults mpd-dev"
-  PACKAGE_DEFAULTS=""
+if [[ $CI_COMMIT_REF_NAME == master ]];then
+  PACKAGE=$NICADIST_PACKAGE
 else
-  PACKAGE_NAME=$(echo $CI_COMMIT_REF_NAME | cut -sd '-' -f1)
-  PACKAGE_VERSION=$(echo $CI_COMMIT_REF_NAME | cut -sd '-' -f2-)
-  PACKAGE_DEFAULTS=""
+  PACKAGE=$CI_COMMIT_REF_NAME
 fi
-echo "PACKAGE_NAME=$PACKAGE_NAME"
-echo "PACKAGE_VERSION=$PACKAGE_VERSION"
 
-# echo $NICADIST
-# echo ln -sfn $NICADIST $ALIBUILD_BASE/alidist
-ln -sfn $NICADIST $ALIBUILD_BASE/alidist
-cd $ALIBUILD_BASE
-ls -la alidist/
+PACKAGE_NAME=$(echo $PACKAGE | cut -sd '-' -f1)
+PACKAGE_VERSION=$(echo $PACKAGE | cut -sd '-' -f2-)
+PACKAGE_DEFAULTS="$NICADIST_PACKAGE_DEFAULTS"
 
-time aliBuild --no-system $STORE build $PACKAGE_DEFAULTS -j$NCORES $PACKAGE_NAME
-alienv q
+echo "PACKAGE_NAME=$PACKAGE_NAME"
+echo "PACKAGE_VERSION=$PACKAGE_VERSION"
 
-# time aliBuild --no-system $STORE build --defaults mpd-dev -j$NCORES mpddev
-# aliBuild --dry-run --no-system --remote-store $ALIBUILD_BASE/sw::rw build --debug --defaults mpd-dev -j10 mpdroot 2>&1
+if [[ $PACKAGE_VERSION == *-tmp ]];then
+  if [[ $PACKAGE_NAME == mpdroot ]];then
+    PACKAGE_VERSION_TMP=$(echo $PACKAGE_VERSION | rev | cut -d '-' -f2- | rev)
+    if [[ $PACKAGE_VERSION_TMP == dev ]];then
+      PACKAGE_VERSION=dev
+    else
+      PACKAGE_VERSION=$(echo $PACKAGE_VERSION | rev | cut -d '-' -f2- | rev)
+    fi
+    source /cvmfs/nica.jinr.ru/sw/os/login.sh
+    module add mpddev
+    git clone https://git.jinr.ru/nica/mpdroot.git
+    git checkout $PACKAGE_VERSION
+    mkdir build
+    cd build
+    export MPDROOT="$CVMFS_DIR/tmp/$PACKAGE_NAME/$PACKAGE_VERSION"
+    rm -rf $MPDROOT
+    cmake ..
+    make install
+  else
+    echo "Package '$PACKAGE_NAME' is not supported !!!"
+    exit 1
+  fi
+else
+  ln -sfn $NICADIST $ALIBUILD_BASE/alidist
+  cd $ALIBUILD_BASE
+  ls -la alidist/
+  time aliBuild --no-system $STORE build $PACKAGE_DEFAULTS -j$NCORES $PACKAGE_NAME
+  alienv q
+fi
 
 $NICADIST/scripts/deployCVMFS.sh $ALIBUILD_WORK_DIR $NICADIST_ARCH $CVMFS_REPO $CVMFS_DIR