/[debian]/nanobloggertrackback/branches/upstream/0.2.4/nb_tb-setup
ViewVC logotype

Contents of /nanobloggertrackback/branches/upstream/0.2.4/nb_tb-setup

Parent Directory Parent Directory | Revision Log Revision Log


Revision 678 - (show annotations)
Sun Apr 1 11:39:37 2007 UTC (14 years, 3 months ago) by gregoa
File size: 4803 byte(s)
[svn-upgrade] Tagging new upstream version, nanobloggertrackback (0.2.4)
1 #!/bin/sh
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16 #
17 # Copyright: gregor herrmann <gregor+debian@comodo.priv.at>, 2005
18
19 ###debug
20 ###set -x
21
22 set -e
23
24 RPATH=$(/usr/bin/realpath $0)
25 CURDIR=$(/usr/bin/dirname $RPATH)
26
27 CGIDIR=
28 CGIURL=
29 BLOGDIR=
30 BLOGURL=
31 PASSWORD=
32 EMAIL=
33 CSS=
34
35 # get config
36 while [ -z "$CGIDIR" ]; do
37 echo -n "cgi-bin directory (e.g. /home/jane/public_html/cgi-bin): "
38 read CGIDIR
39 done
40
41 echo "You have to make sure that scripts can be executed there."
42 read -p "Press return to continue" DUMMY
43
44 while [ -z "$CGIURL" ]; do
45 echo -n "cgi-bin URL (e.g. http://info.example.org/~jane/cgi-bin): "
46 read CGIURL
47 done
48
49 while [ -z "$BLOGURL" ]; do
50 echo -n "blog URL (e.g. http://info.example.org/~jane/blog): "
51 read CGIURL
52 done
53
54 while [ -z "$BLOGDIR" ]; do
55 echo -n "nanoblogger directory (e.g. /home/jane/public_html/blog): "
56 read BLOGDIR
57 done
58
59 echo "This script will create a /tb and /tb/data and /tb/rss directories
60 there. The user under which your webserver is running must have write
61 permissions in the latter two. Please check after the end of this script."
62 read -p "Press return to continue" DUMMY
63
64 while [ -z "$PASSWORD" ]; do
65 echo -n "password for managing trackback entries (use a new one; stored in plaintext): "
66 read -s PASSWORD; echo ""
67 done
68
69 while [ -z "$EMAIL" ]; do
70 echo -n "email address for mail notifies (e.g. <user@host.example>): "
71 read EMAIL
72 done
73
74
75 # test
76 echo -n "Checking user input ... "
77 ( [ ! -d $CGIDIR ] || [ ! -w $CGIDIR ] ) && echo "$CGIDIR does not exist or is no directory or is not writeable." && exit 1
78 ( [ ! -d $BLOGDIR ] || [ ! -w $BLOGDIR ] ) && echo "$BLOGDIR does not exist or is no directory or is not writeable." && exit 1
79 ( [ ! -d $BLOGDIR/styles ] || [ ! -w $BLOGDIR/styles ] ) && echo "$BLOGDIR/styles does not exist or is no directory or is not writeable." && exit 1
80 ( [ ! -d $BLOGDIR/templates ] || [ ! -w $BLOGDIR/templates ] ) && echo "$BLOGDIR/templates does not exist or is no directory or is not writeable." && exit 1
81 echo "OK"
82
83 # backup
84 echo -n "A backup of $BLOGDIR will be copied to $HOME/nb.bak. If this script breaks you may want to use it, otherwise please delete it afterwards. ... "
85 cp -ar $BLOGDIR $HOME/nb.bak || exit 1
86 echo "OK"
87
88 # create dirs
89 echo -n "Creating directories ... "
90 mkdir -m 6775 -p $BLOGDIR/tb || exit 1
91 mkdir -m 6777 -p $BLOGDIR/tb/data || exit 1
92 mkdir -m 6777 -p $BLOGDIR/tb/rss || exit 1
93 mkdir -p $BLOGDIR/tb/pings || exit 1
94 echo "OK"
95
96 # add css
97 echo -n "Adding css ... "
98 CSS=$(perl -ne 'print $1 if /BLOG_CSS="styles\/(.+)"/' $BLOGDIR/blog.conf) || exit 1
99 cat $CURDIR/nb_tb.css >> $BLOGDIR/styles/$CSS || exit 1
100 echo "OK"
101
102 # copy cgi and change
103 echo -n "Copying and changing cgi script ... "
104 cp --preserve=mode $CURDIR/tb.cgi $CGIDIR/ || exit 1
105 perl -pi -e "s~BLOGDIR~$BLOGDIR~; s~BLOGURL~$BLOGURL~; s~PASSWORD~$PASSWORD~; s~EMAIL~$EMAIL~;" $CGIDIR/tb.cgi || exit 1
106 echo "OK"
107
108 # copy footer/header
109 echo -n "Copying header und footer ... "
110 cp $CURDIR/header.txt $BLOGDIR/tb/ || exit 1
111 cp $CURDIR/footer.txt $BLOGDIR/tb/ || exit 1
112 echo "OK"
113
114 # change entry.htm
115 echo -n "Changing entry.htm ... "
116 patch --quiet $BLOGDIR/templates/entry.htm $CURDIR/entry.diff || exit 1
117 echo "OK"
118
119 # change blog.conf
120 echo -n "Adding TB_PATH to blog.conf ... "
121 echo "# Trackback CGI" >> $BLOGDIR/blog.conf || exit 1
122 echo "TB_PATH=\"$CGIURL/tb.cgi\"" >> $BLOGDIR/blog.conf || exit 1
123 echo "OK"
124
125 echo -n "Adding SEND_TRACKBACK_PING to blog.conf ... "
126 echo "# Send trackback pings automatically" >> $BLOGDIR/blog.conf || exit 1
127 echo "SEND_TRACKBACK_PING=\"1\"" >> $BLOGDIR/blog.conf || exit 1
128 echo "OK"
129
130 # change absolute links in blog.conf
131 echo -n "Turning on absolute links in blog.conf ... "
132 perl -pi -e "s/.*/ABSOLUTE_LINKS=\"1\"/ if /ABSOLUTE_LINKS/" $BLOGDIR/blog.conf || exit 1
133 echo "OK"
134
135 # the end
136 echo ""
137 echo "Finished!"
138 echo ""
139 echo "Enjoy the new possibilities - view the trackback links in your entries, send trackback pings with $CGIURL/tb.cgi?__mode=send_form, etc."
140 echo ""
141 echo "And don't forget to run 'nb -b $BLOGDIR -u all' NOW."
142 echo ""
143 echo "(Have you deleted $HOME/nb.bak already?)"
144
145 CURDIR=
146 CGIDIR=
147 CGIURL=
148 BLOGDIR=
149 BLOGURL=
150 PASSWORD=
151 EMAIL=
152 CSS=
153
154 exit 0

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26