From 1e9d26432aafd4ee55111d4b66a314fb2ff634e9 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Fri, 4 Jan 2013 22:00:47 -0600 Subject: [PATCH] * VRFS-188 done for now. type sudo start jam-web or sudo stop jam-web to start/stop on ubuntu --- build | 14 +++++++++++++- script/package/jam-web.conf | 9 --------- script/package/passenger.sh | 6 ------ script/package/post-install.sh | 2 +- script/package/post-uninstall.sh | 8 ++++---- 5 files changed, 18 insertions(+), 21 deletions(-) delete mode 100755 script/package/passenger.sh diff --git a/build b/build index e4f453426..004b2a564 100755 --- a/build +++ b/build @@ -64,6 +64,18 @@ if [ -n "$PACKAGE" ]; then echo "BUILD NUMBER is not defined" exit 1 fi + + type -P dpkg-architecture > /dev/null + + + if [ "$?" = "0" ]; then + ARCH=`dpkg-architecture -qDEB_HOST_ARCH` + else + echo "WARN: unable to determine architecture." + ARCH=`all` + fi + + set -e # cache all gems local, and tell bundle to use local gems only bundle install --path vendor/bundle --local @@ -72,7 +84,7 @@ if [ -n "$PACKAGE" ]; then bundle exec rake assets:precompile RAILS_ENV=production # create debian using fpm - bundle exec fpm -s dir -t deb -p target/deb/jam-web_0.1.${BUILD_NUMBER}_amd64.deb -n "jam-web" -v "0.1.$BUILD_NUMBER" --prefix /var/lib/jam-web --after-install $DIR/script/package/post-install.sh --before-install $DIR/script/package/pre-install.sh --before-remove $DIR/script/package/pre-uninstall.sh --after-remove $DIR/script/package/post-uninstall.sh --exclude $DIR/.git . + bundle exec fpm -s dir -t deb -p target/deb/jam-web_0.1.${BUILD_NUMBER}_${ARCH}.deb -n "jam-web" -v "0.1.$BUILD_NUMBER" --prefix /var/lib/jam-web --after-install $DIR/script/package/post-install.sh --before-install $DIR/script/package/pre-install.sh --before-remove $DIR/script/package/pre-uninstall.sh --after-remove $DIR/script/package/post-uninstall.sh --exclude $DIR/.git . fi diff --git a/script/package/jam-web.conf b/script/package/jam-web.conf index 1c5a347ec..d3caa8853 100755 --- a/script/package/jam-web.conf +++ b/script/package/jam-web.conf @@ -4,13 +4,4 @@ start on startup start on runlevel [2345] stop on runlevel [016] - -#expect daemon -#expect fork -env BUILD_NUMBER=1 - -#chdir /var/lib/jam-web - -#exec /usr/local/rbenv/shims/bundle exec unicorn_rails -E production -c config/unicorn.rb >> /tmp/loggie -#exec /var/lib/jam-web/script/package/upstart-run.sh exec start-stop-daemon --start --chdir /var/lib/jam-web --exec /var/lib/jam-web/script/package/upstart-run.sh diff --git a/script/package/passenger.sh b/script/package/passenger.sh deleted file mode 100755 index 810673e30..000000000 --- a/script/package/passenger.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -export BUILD_NUMBER=1 - -exec "/usr/local/rbenv/versions/1.9.3-p327/bin/ruby" "$@" - diff --git a/script/package/post-install.sh b/script/package/post-install.sh index c0483840e..fa04fc2c5 100755 --- a/script/package/post-install.sh +++ b/script/package/post-install.sh @@ -8,6 +8,6 @@ USER="$NAME" GROUP="$NAME" # copy upstart file -cp /var/lib/$NAME/script/package/jam-web.conf /etc/init/jam-web.conf +cp /var/lib/$NAME/script/package/$NAME.conf /etc/init/$NAME.conf chown -R $USER:$GROUP /var/lib/$NAME diff --git a/script/package/post-uninstall.sh b/script/package/post-uninstall.sh index db2afa2df..a4014a177 100755 --- a/script/package/post-uninstall.sh +++ b/script/package/post-uninstall.sh @@ -9,11 +9,11 @@ if [ "$1" = "remove" ] then set +e # stop the process, if any is found. we don't want this failing to cause an error, though. - start-stop-daemon --stop -u jam-web -o --retry 5 - set -e + sudo stop $NAME + set -e - if [ -f /etc/init/jam-web.conf ]; then - rm /etc/init/jam-web.conf + if [ -f /etc/init/$NAME.conf ]; then + rm /etc/init/$NAME.conf fi fi