source: main/trunk/greenstone3/bin/script/gs3-make-col-public.sh

Last change on this file was 28385, checked in by davidb, 11 years ago

Handy script for removing collectcions (such as the provided demo collections) off the home page

  • Property svn:executable set to *
File size: 1.3 KB
Line 
1#!/bin/bash
2
3#check that GSDL3HOME is set
4if [ -z "$GSDL3HOME" ] ; then
5 echo "You need to 'source gs3-setup.sh' in the greenstone3 directory before running this script" >&2
6 exit;
7fi
8
9if [ $# != 2 ] ; then
10 echo "Usage: gs3-make-col-private.sh <site-name> <collection-name>" >&2
11 exit;
12fi
13
14sitename=$1
15collectionname=$2
16
17collectdir="$GSDL3HOME/sites/$sitename/collect/$collectionname"
18collectconfigfile="$collectdir/etc/collectionConfig.xml"
19
20if [ ! -d "$collectdir" ] ; then
21 echo "Unable to find directory: \"$collectdir\"" >&2
22 exit
23fi
24
25if [ ! -f "$collectconfigfile" ] ; then
26 echo "Unable to find collection config file \"$collectconfigfile\"" >&2
27 exit
28fi
29
30# Want to find (and change) lines like:
31# <metadata lang="en" name="public">false</metadata>
32
33/bin/cp "$collectconfigfile" "$collectconfigfile.bak" \
34&& \
35cat "$collectconfigfile" \
36 | sed 's%\(<metadata[^>]\+name="public"[^>]*>\).\+\(</metadata>\)%\1true\2%g' \
37 > "$collectconfigfile.new" \
38&& \
39/bin/mv "$collectconfigfile.new" "$collectconfigfile"
40
41if [ $? = 0 ] ; then
42 echo "====="
43 echo "| Set collection metadata name 'public' to true"
44 echo "| Restart (or reconfigure) the web server for this change to take effect"
45 echo "====="
46else
47 echo "Failed to set collection metadata name 'public' to true" >&2
48 exit $?
49fi
50
51
52
53
54
55
Note: See TracBrowser for help on using the repository browser.