source: main/trunk/package-kits/linux/files/greenstone@ 29641

Last change on this file since 29641 was 29641, checked in by Jeremy Symon, 9 years ago

Setting greenstone library URL

  • Property svn:executable set to *
File size: 2.8 KB
Line 
1#!/bin/sh
2
3interactive=1
4sourced=1
5unset use_shell
6case $* in
7 *--no-interactive*)
8 unset interactive
9 ;;
10esac
11
12fail() {
13 echo $* >&2
14 exit 1
15}
16
17# make sure we are sourced, and not run
18if test "`basename $0`" = "greenstone" ; then
19# if $0 is "greenstone" we've been run... $0 is shellname if sourced.
20# One exception is zsh has an option to set it temporarily to the script name
21 if test -z "$ZSH_NAME" ; then
22 # we aren't using zsh
23 unset sourced
24 fi
25fi
26
27if test -z "$sourced" ; then
28 test -z "$interactive" && fail "Script must be sourced for non-interactive use"
29 echo "Script was not sourced" >&2
30 echo -n "Use a new shell? (y/[n]) " >&2
31 read use_shell
32 test "$use_shell" != "y" -a "$use_shell" != "Y" && fail "Script must either be sourced, or allowed to start an interactive shell"
33 use_shell=1
34fi
35
36GSDLHOME=%GREENSTONE_HOME%/gs2build
37export GSDLHOME
38
39GSDLOS=linux
40export GSDLOS
41
42# Establish cpu architecture
43# 32-bit or 64-bit?
44UNAME_HW_MACH=`uname -m`
45
46# Following test came from VirtualBox's Guest Additions autostart.sh
47# (adapted for use in Greenstone)
48case "$UNAME_HW_MACH" in
49i[3456789]86|x86|i86pc)
50 GSDLARCH='32'
51 ;;
52x86_64|amd64|AMD64)
53 GSDLARCH='64'
54 ;;
55*)
56 echo "Unknown architecture: $UNAME_HW_MACH" >&2
57 ;;
58esac
59
60# Only want non-trival GSDLARCH value set if there is evidence of
61# the installed bin (lib, ...) directories using linux32, linux64
62# (otherwise probably looking at an SVN compiled up version for single OS)
63if test ! -d "$GSDLHOME/bin/$GSDLOS$GSDLARCH" ;
64then
65 GSDLARCH=""
66fi
67
68export GSDLARCH
69
70# Workaround for perl >= 5.18
71PERL_PERTURB_KEYS=0
72export PERL_PERTURB_KEYS
73
74
75PATH="$GSDLHOME/bin/script:$GSDLHOME/bin/$GSDLOS$GSDLARCH:$PATH"
76export PATH
77LD_LIBRARY_PATH="$GSDLHOME/lib/$GSDLOS$GSDLARCH:$LD_LIBRARY_PATH"
78export LD_LIBRARY_PATH
79
80if test -n "$interactive" -a -z "$GSDL3HOME" ; then
81 echo "Where are the collections? [%WEB%]" >&2
82 echo -n " > " >&2
83 read GSDL3HOME
84fi
85if test -z "$GSDL3HOME" ; then
86 echo "Setting collections location to the default" >&2
87 GSDL3HOME=%WEB%
88fi
89export GSDL3HOME
90default_url='http://localhost:8080/greenstone3/library'
91if test -n "$interactive" -a -z "$GSDL_LIBRARY_URL" ; then
92 echo "What URL can the greenstone library be found at?" >&2
93 echo "[$default_url]" >&2
94 echo -n " > " >&2
95 read GSDL_LIBRARY_URL
96fi
97if test -z "$GSDL_LIBRARY_URL" ; then
98 echo "Setting library url to the default" >&2
99 GSDL_LIBRARY_URL="$default_url"
100fi
101export GSDL_LIBRARY_URL
102
103test -d "$GSDL3HOME/sites/localsite/collect" || mkdir -p "$GSDL3HOME/sites/localsite/collect"
104
105if test -n "$interactive" -a -n "$use_shell" ; then
106 test -z $SHELL && SHELL=sh
107 echo "Starting an interactive shell for GSDL management" >&2
108 $SHELL
109fi
Note: See TracBrowser for help on using the repository browser.