Permalink
Browse files

Improve head of startGroovy. Now handles existing JAVA_HOME.

  • Loading branch information...
1 parent 42bf05d commit 70c1206dec38b82e3ad3b75842e5e7b08633f5f7 @marc0der marc0der committed Sep 16, 2012
Showing with 5 additions and 8 deletions.
  1. +5 −8 bin/groovy2deb
View
@@ -27,22 +27,19 @@ mv -v "${PACKAGE}-${VERSION}" "$WORK_FOLDER"
ORIG_TAR_FILE="${PACKAGE}-${VERSION}_${RELEASE}.orig.tar.gz"
tar zcf "${ORIG_TAR_FILE}" "${WORK_FOLDER}"
chmod -w "${ORIG_TAR_FILE}"
-git clone "git://github.com/freshgroovy/${PACKAGE}-ubuntu.git" "tmp"
+git clone -b "$VERSION" "git://github.com/freshgroovy/${PACKAGE}-ubuntu.git" "tmp"
mv -v "tmp/debian" "$WORK_FOLDER"
-mv -v "tmp/.git" "$WORK_FOLDER"
-mv -v "tmp/.gitignore" "$WORK_FOLDER"
+mv -v "tmp/head" "$WORK_FOLDER"
-rm -rvf tmp
+rm -rf tmp
CAPITALISED_PACKAGE=$(echo $PACKAGE | sed 's/^./\u&/')
UPPER_PACKAGE=$(echo $PACKAGE | sed 's/\(.*\)/\U\1/')
START_SCRIPT="start${CAPITALISED_PACKAGE}"
TMP_START_SCRIPT="/tmp/${START_SCRIPT}"
-echo "# Added by groovy-dev for Ubuntu PPA" > "$TMP_START_SCRIPT"
-echo "export ${UPPER_PACKAGE}_HOME=/usr/share/${PACKAGE}/${VERSION}" >> "$TMP_START_SCRIPT"
-echo "export JAVA_HOME=\$(update-alternatives --query java | grep Value | sed 's_^Value: __g' | sed 's_/jre/bin/java__g')" >> "$TMP_START_SCRIPT"
-echo "" >> "$TMP_START_SCRIPT"
+find "${WORK_FOLDER}/head" -type f | xargs sed -i "s/VERSION/${VERSION}/g"
+cat "$WORK_FOLDER/head" > "$TMP_START_SCRIPT"
cat "$WORK_FOLDER/bin/${START_SCRIPT}" >> "$TMP_START_SCRIPT"
mv "$TMP_START_SCRIPT" "${WORK_FOLDER}/bin/${START_SCRIPT}"

0 comments on commit 70c1206

Please sign in to comment.