3 . `dirname "$(readlink -f "$0")"`/run-library.sh
5 read -rd "\000" helpmessage <<EOF
6 $(basename $0): Build Arvados SSO server package
9 WORKSPACE=/path/to/arvados-sso $(basename $0) [options]
13 --build-bundle-packages (default: false)
14 Build package with vendor/bundle included
16 Output debug information (default: false)
18 Distribution to build packages for (default: debian7)
20 WORKSPACE=path Path to the Arvados SSO source tree to build packages from
25 DEBUG=${ARVADOS_DEBUG:-0}
26 BUILD_BUNDLE_PACKAGES=0
29 PARSEDOPTS=$(getopt --name "$0" --longoptions \
30 help,build-bundle-packages,debug,target: \
36 eval set -- "$PARSEDOPTS"
37 while [ $# -gt 0 ]; do
40 echo >&2 "$helpmessage"
50 --build-bundle-packages)
51 BUILD_BUNDLE_PACKAGES=1
55 echo >&2 "$0: unrecognized argument '$2'. Try: $0 --help"
63 STDOUT_IF_DEBUG=/dev/null
64 STDERR_IF_DEBUG=/dev/null
66 if [[ "$DEBUG" != 0 ]]; then
67 STDOUT_IF_DEBUG=/dev/stdout
68 STDERR_IF_DEBUG=/dev/stderr
89 echo -e "$0: Unknown target '$TARGET'.\n" >&2
94 if ! [[ -n "$WORKSPACE" ]]; then
95 echo >&2 "$helpmessage"
97 echo >&2 "Error: WORKSPACE environment variable not set"
102 if ! [[ -d "$WORKSPACE" ]]; then
103 echo >&2 "$helpmessage"
105 echo >&2 "Error: $WORKSPACE is not a directory"
111 fpm --version >/dev/null 2>&1
113 if [[ "$?" != 0 ]]; then
114 echo >&2 "$helpmessage"
116 echo >&2 "Error: fpm not found"
121 RUN_BUILD_PACKAGES_PATH="`dirname \"$0\"`"
122 RUN_BUILD_PACKAGES_PATH="`( cd \"$RUN_BUILD_PACKAGES_PATH\" && pwd )`" # absolutized and normalized
123 if [ -z "$RUN_BUILD_PACKAGES_PATH" ] ; then
124 # error; for some reason, the path is not accessible
125 # to the script (e.g. permissions re-evaled after suid)
129 debug_echo "$0 is running from $RUN_BUILD_PACKAGES_PATH"
130 debug_echo "Workspace is $WORKSPACE"
132 if [[ -f /etc/profile.d/rvm.sh ]]; then
133 source /etc/profile.d/rvm.sh
134 GEM="rvm-exec default gem"
139 if [[ "$TARGET" == "centos6" ]]; then
140 # CentOS6 comes with git 1.7.1, but we want at least 1.7.6
141 # because we use git status --ignore in fpm-info.sh
143 install_package libcurl-devel zlib-devel wget gettext
144 wget https://www.kernel.org/pub/software/scm/git/git-1.8.5.6.tar.gz
145 tar xzf git-1.8.5.6.tar.gz
148 ./configure --prefix=/usr --without-tcltk
153 # Make all files world-readable -- jenkins runs with umask 027, and has checked
154 # out our git tree here
155 chmod o+r "$WORKSPACE" -R
157 # More cleanup - make sure all executables that we'll package are 755
158 # No executables in the sso server package
159 #find -type d -name 'bin' |xargs -I {} find {} -type f |xargs -I {} chmod 755 {}
161 # Now fix our umask to something better suited to building and publishing
165 debug_echo "umask is" `umask`
167 if [[ ! -d "$WORKSPACE/packages/$TARGET" ]]; then
168 mkdir -p $WORKSPACE/packages/$TARGET
171 # Build the SSO server package
172 handle_rails_package arvados-sso-server "$WORKSPACE" \
173 "$WORKSPACE/LICENCE" --url="https://arvados.org" \
174 --description="Arvados SSO server - Arvados is a free and open source platform for big data science." \
175 --license="Expat license"