Last change
on this file since 31085 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
|
---|
4 | if [ -z "$GSDL3HOME" ] ; then
|
---|
5 | echo "You need to 'source gs3-setup.sh' in the greenstone3 directory before running this script" >&2
|
---|
6 | exit;
|
---|
7 | fi
|
---|
8 |
|
---|
9 | if [ $# != 2 ] ; then
|
---|
10 | echo "Usage: gs3-make-col-private.sh <site-name> <collection-name>" >&2
|
---|
11 | exit;
|
---|
12 | fi
|
---|
13 |
|
---|
14 | sitename=$1
|
---|
15 | collectionname=$2
|
---|
16 |
|
---|
17 | collectdir="$GSDL3HOME/sites/$sitename/collect/$collectionname"
|
---|
18 | collectconfigfile="$collectdir/etc/collectionConfig.xml"
|
---|
19 |
|
---|
20 | if [ ! -d "$collectdir" ] ; then
|
---|
21 | echo "Unable to find directory: \"$collectdir\"" >&2
|
---|
22 | exit
|
---|
23 | fi
|
---|
24 |
|
---|
25 | if [ ! -f "$collectconfigfile" ] ; then
|
---|
26 | echo "Unable to find collection config file \"$collectconfigfile\"" >&2
|
---|
27 | exit
|
---|
28 | fi
|
---|
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 | && \
|
---|
35 | cat "$collectconfigfile" \
|
---|
36 | | sed 's%\(<metadata[^>]\+name="public"[^>]*>\).\+\(</metadata>\)%\1true\2%g' \
|
---|
37 | > "$collectconfigfile.new" \
|
---|
38 | && \
|
---|
39 | /bin/mv "$collectconfigfile.new" "$collectconfigfile"
|
---|
40 |
|
---|
41 | if [ $? = 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 "====="
|
---|
46 | else
|
---|
47 | echo "Failed to set collection metadata name 'public' to true" >&2
|
---|
48 | exit $?
|
---|
49 | fi
|
---|
50 |
|
---|
51 |
|
---|
52 |
|
---|
53 |
|
---|
54 |
|
---|
55 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.