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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 181 - (show annotations)
Tue Mar 21 16:14:16 2006 UTC (15 years, 4 months ago) by gregoa
File size: 4653 byte(s)
Load /tmp/tmp.Qx79BG/nanobloggertrackback-0.2.1 into
debian/nanobloggertrackback/branches/upstream/current.

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 PASSWORD=
31 EMAIL=
32 CSS=
33
34 # get config
35 while [ -z "$CGIDIR" ]; do
36 echo -n "cgi-bin directory (e.g. /home/sepp/public_html/cgi-bin): "
37 read CGIDIR
38 done
39
40 echo "You have to make sure that scripts can be executed there."
41 read -p "Press return to continue" DUMMY
42
43 while [ -z "$CGIURL" ]; do
44 echo -n "cgi-bin URL (e.g. http://info.example.org/~sepp/cgi-bin): "
45 read CGIURL
46 done
47
48 while [ -z "$BLOGDIR" ]; do
49 echo -n "nanoblogger directory (e.g. /home/sepp/public_html/blog): "
50 read BLOGDIR
51 done
52
53 echo "This script will create a /tb and /tb/data and /tb/rss directories
54 there. The user under which your webserver is running must have write
55 permissions in the latter two. Please check after the end of this script."
56 read -p "Press return to continue" DUMMY
57
58 while [ -z "$PASSWORD" ]; do
59 echo -n "password for managing trackback entries (use a new one; stored in plaintext): "
60 read -s PASSWORD; echo ""
61 done
62
63 while [ -z "$EMAIL" ]; do
64 echo -n "email address for mail notifies (e.g. <user@host.example>): "
65 read EMAIL
66 done
67
68
69 # test
70 echo -n "Checking user input ... "
71 ( [ ! -d $CGIDIR ] || [ ! -w $CGIDIR ] ) && echo "$CGIDIR does not exist or is no directory or is not writeable." && exit 1
72 ( [ ! -d $BLOGDIR ] || [ ! -w $BLOGDIR ] ) && echo "$BLOGDIR does not exist or is no directory or is not writeable." && exit 1
73 ( [ ! -d $BLOGDIR/styles ] || [ ! -w $BLOGDIR/styles ] ) && echo "$BLOGDIR/styles does not exist or is no directory or is not writeable." && exit 1
74 ( [ ! -d $BLOGDIR/templates ] || [ ! -w $BLOGDIR/templates ] ) && echo "$BLOGDIR/templates does not exist or is no directory or is not writeable." && exit 1
75 echo "OK"
76
77 # backup
78 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. ... "
79 cp -ar $BLOGDIR $HOME/nb.bak || exit 1
80 echo "OK"
81
82 # create dirs
83 echo -n "Creating directories ... "
84 mkdir -m 6775 -p $BLOGDIR/tb || exit 1
85 mkdir -m 6777 -p $BLOGDIR/tb/data || exit 1
86 mkdir -m 6777 -p $BLOGDIR/tb/rss || exit 1
87 mkdir -p $BLOGDIR/tb/pings || exit 1
88 echo "OK"
89
90 # add css
91 echo -n "Adding css ... "
92 CSS=$(perl -ne 'print $1 if /BLOG_CSS="styles\/(.+)"/' $BLOGDIR/blog.conf) || exit 1
93 cat $CURDIR/nb_tb.css >> $BLOGDIR/styles/$CSS || exit 1
94 echo "OK"
95
96 # copy cgi and change
97 echo -n "Copying and changing cgi script ... "
98 cp --preserve=mode $CURDIR/tb.cgi $CGIDIR/ || exit 1
99 perl -pi -e "s~BLOGDIR~$BLOGDIR~; s~PASSWORD~$PASSWORD~; s~EMAIL~$EMAIL~;" $CGIDIR/tb.cgi || exit 1
100 echo "OK"
101
102 # copy footer/header
103 echo -n "Copying header und footer ... "
104 cp $CURDIR/header.txt $BLOGDIR/tb/ || exit 1
105 cp $CURDIR/footer.txt $BLOGDIR/tb/ || exit 1
106 echo "OK"
107
108 # change entry.htm
109 echo -n "Changing entry.htm ... "
110 patch --quiet $BLOGDIR/templates/entry.htm $CURDIR/entry.diff || exit 1
111 echo "OK"
112
113 # change blog.conf
114 echo -n "Adding TB_PATH to blog.conf ... "
115 echo "# Trackback CGI" >> $BLOGDIR/blog.conf || exit 1
116 echo "TB_PATH=\"$CGIURL/tb.cgi\"" >> $BLOGDIR/blog.conf || exit 1
117 echo "OK"
118
119 echo -n "Adding SEND_TRACKBACK_PING to blog.conf ... "
120 echo "# Send trackback pings automatically" >> $BLOGDIR/blog.conf || exit 1
121 echo "SEND_TRACKBACK_PING=\"1\"" >> $BLOGDIR/blog.conf || exit 1
122 echo "OK"
123
124 # change absolute links in blog.conf
125 echo -n "Turning on absolute links in blog.conf ... "
126 perl -pi -e "s/.*/ABSOLUTE_LINKS=\"1\"/ if /ABSOLUTE_LINKS/" $BLOGDIR/blog.conf || exit 1
127 echo "OK"
128
129 # the end
130 echo ""
131 echo "Finished!"
132 echo ""
133 echo "Enjoy the new possibilities - view the trackback links in your entries, send trackback pings with $CGIURL/tb.cgi?__mode=send_form, etc."
134 echo ""
135 echo "And don't forget to run 'nb -b $BLOGDIR -u all' NOW."
136 echo ""
137 echo "(Have you deleted $HOME/nb.bak already?)"
138
139 CURDIR=
140 CGIDIR=
141 CGIURL=
142 BLOGDIR=
143 PASSWORD=
144 EMAIL=
145 CSS=
146
147 exit 0

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26