root/main/trunk/package-kits/linux/greenstone @ 29474

Revision 29474, 2.5 KB (checked in by jts21, 5 years ago)

Got deb packages working

  • Property svn:executable set to *
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=/opt/greenstone/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/gs2build/lib/$GSDLOS$GSDLARCH:$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? [/srv/gsdl/]" >&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=/srv/gsdl
88fi
89export GSDL3HOME
90
91test -d "$GSDL3HOME/sites/localsite/collect" || mkdir -p "$GSDL3HOME/sites/localsite/collect"
92
93if test -n "$interactive" -a -n "$use_shell" ; then
94    test -z $SHELL && SHELL=sh
95    echo "Starting an interactive shell for GSDL management" >&2
96    $SHELL
97fi
Note: See TracBrowser for help on using the browser.