* VRFS-188 in progress

This commit is contained in:
Seth Call 2012-12-29 10:12:05 -06:00
parent c576bada56
commit e2cb402704
5 changed files with 64 additions and 0 deletions

6
build
View File

@ -44,7 +44,13 @@ else
exit 1
fi
if [ -n "$PACKAGE" ]; then
# cache all gems local, and tell bundle to use local gems only
DIR=.
bundle install --path vendor/bundle --local
bundle exec fpm -s dir -t deb -n "jam-web" -v "0.1.$BUILD_NUMBER" . --post-install $DIR/script/package/post-install.sh --pre-install $DIR/script/package/pre-install.sh --pre-uninstall $DIR/script/package/pre-uninstall.sh --post-uninstall $DIR/script/package/post-install.sh
fi
echo "build complete"

11
script/package/post-install.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
set -eu
NAME="jam-web"
USER="$NAME"
GROUP="$NAME"
chown $USER:$GROUP /var/lib/$NAME
chown $USER:$GROUP /var/log/$NAME

View File

@ -0,0 +1,11 @@
#!/bin/sh
set -e
NAME="jam-web"
if [ "$1" = "purge" ]
then
rm -rf /var/lib/$NAME
userdel $NAME
fi

36
script/package/pre-install.sh Executable file
View File

@ -0,0 +1,36 @@
#!/bin/sh
set -eu
NAME="jam-web"
HOME="/var/lib/$NAME"
USER="$NAME"
GROUP="$NAME"
# if NIS is used, then errors can occur but be non-fatal
if which ypwhich >/dev/null 2>&1 && ypwhich >/dev/null 2>&1
then
set +e
fi
if ! getent group $GROUP >/dev/null
then
addgroup --system $GROUP >/dev/null
fi
# creating user if it isn't already there
if ! getent passwd $USER >/dev/null
then
adduser \
--system \
--home $HOME \
--shell /bin/false \
--disabled-login \
--ingroup $GROUP \
--gecos "$USER server" \
$USER >/dev/null
fi
# NISno longer a possible problem; stop ignoring errors
set -e

View File