source: other-projects/nightly-tasks/crons-and-scripts/linux64/create-release.sh.unused@ 32402

Last change on this file since 32402 was 32402, checked in by sjm84, 6 years ago

Linux 64 VM scripts for generating release and nightly binaries

  • Property svn:executable set to *
File size: 3.7 KB
Line 
1#!/bin/bash
2
3# This script, create-release.sh, follows the instructions at
4# http://internal.greenstone.org/wiki/Generating_Caveats_and_Binaries:_Handy_instructions#Generating_the_64_bit_Linux_Caveat
5
6# IF ON DARWIN: sudo su - nzdl
7# IF ON LINUX: sudo su -
8# Then run this script with gs-release-version and rc-number
9
10# http://stackoverflow.com/questions/6482377/bash-shell-script-check-input-argument
11if [ $# -eq 0 ]; then
12 echo "Run as $0 <version> [release-candidate-number]"
13 echo "E.g. $0 3.06 rc1"
14 echo ""
15 exit
16fi
17
18# String comparisons http://tldp.org/LDP/abs/html/comparison-ops.html
19os=`uname`
20currmachine=$os
21arch=`uname -m`
22curruser=`whoami`
23if [ "$os" == "Linux" ] && [ "$curruser" != "root" ] ; then
24 echo "On linux release VMs, you need to first have run: sudo su -"
25 echo ""
26 exit
27elif [ "$os" == "Darwin" ] && [ "$curruser" != "nzdl" ] ; then
28 echo "On mac release machines, you need to first have run: sudo su - nzdl"
29 echo ""
30 exit
31fi
32
33
34version=$1
35if [ -n "$2" ]; then
36 versionextra=$2
37fi
38
39
40#######################################################################
41# variables that tend to be fixed for a release machine
42
43linuxpath=/home/sjm84
44darwinpath=/Volumes/Research/nzdl
45toro_relkit_path="${darwinpath}/release-kits"
46rata_relkit_path=/home/nzdl/release-kits
47
48
49#######################################################################
50
51majorversion=3
52# if prefixed with 2, then GS2. http://tldp.org/LDP/abs/html/comparison-ops.html
53if [[ $version == 2* ]]; then
54 majorversion=2;
55fi
56
57
58# Release foldername should use version without dot
59# http://www.linuxquestions.org/questions/linux-newbie-8/bash-command-for-removing-special-characters-from-string-644828/
60releasefolder=`echo ${version//[-._]/}`
61releasefolder=gs$releasefolder$versionextra
62
63
64if [ "$os" == "Linux" ]; then
65 source ./setup-env.sh
66 # 64 bit or 32 bit linux vm
67 # http://stackoverflow.com/questions/229551/string-contains-in-bash
68 if [[ $arch == *64 ]]; then
69 currmachine+="64"
70 #/bin/mount --bind /proc /opt/lsb-buildenv-x86_64/proc
71 #chroot /opt/lsb-buildenv-x86_64
72 #else
73 #/bin/mount --bind /proc /opt/lsb-buildenv-ia32/proc
74 #chroot /opt/lsb-buildenv-ia32
75 fi
76 export PATH="${linuxpath}/release-kits/bin:$PATH"
77 #echo "PATH : $PATH"
78 cd "${linuxpath}/snapshots"
79
80elif [ "$os" == "Darwin" ]; then
81 kernel_release_ver=`uname -r`
82 if [[ $kernel_release_ver == 12.5* ]]; then
83 # toro is 12.5.0
84 currmachine+="MountainLion"
85 export PATH=$toro_relkit_path/bin:$PATH
86 elif [[ $kernel_release_ver == 9.8* ]]; then
87 # rata is 9.8.0
88 currmachine+="Leopard"
89 export PATH="${rata_relkit_path}/bin:$PATH"
90 fi
91
92 cd "${darwinpath}/snapshots"
93else
94 # not a known OS
95 echo "Unknown OS $os. Cannot generate release-binary. Exitting."
96 echo ""
97 exit
98fi
99
100
101mkdir $releasefolder
102cd $releasefolder
103
104# create the rk properties file
105propfile="rk$majorversion"
106propfile+="-build.properties"
107touch $propfile
108
109echo "version:$version" > $propfile
110
111# http://stackoverflow.com/questions/3601515/how-to-check-if-a-variable-is-set-in-bash
112# boolean operators: http://www.tldp.org/LDP/abs/html/ops.html
113if [ -n "$versionextra" ] && [ "$versionextra" != "" ]; then
114 echo "version-extra:$versionextra" >> $propfile
115fi
116
117# os = Linux|Darwin. We wouldn't be here if the os was windows
118# if GS2, add property pointing to server.exe
119if [ "$majorversion" == "2" ]; then
120 echo "server.exe.location:http://www.greenstone.org/caveat-emptor/latest-server.exe" >> $propfile
121fi
122
123# Add in architecture, if 64-bit
124# http://stackoverflow.com/questions/229551/string-contains-in-bash
125if [[ $arch == *64 ]]; then
126 echo "x64:true" >> $propfile
127fi
128
129# add an empty line
130echo "" >> $propfile
131
132# run `rk3` or `rk2` from the releasefolder
133`rk$majorversion`
Note: See TracBrowser for help on using the repository browser.