prestdir=prest-0.003025 bwbin = BoreWiki.cgi borewiki-admin.sh bwcss = borewiki-draft.png borewiki.css files = $(bwbin) $(bwcss) $(prestdir) restf = Readme Readme.html Makefile bw-tester.cgi dot-htaccess VersionInfo cd= dd= usage: @sed -n 's/^#usage://p' Makefile #usage: #usage: Usage: make install cd=confdir dd=destdir #usage: #usage: To install this software enter the above command. Probably #usage: example: make install cd=$HOME/.borewiki dd=$HOME/public_html #usage: is enough to get this installed on your system. #usage: In addition to this you may need to configure httpd daemon, #usage: selinux policies, directory permissions and .htaccess file. #usage: There is (or will be in far future) information about these #usage: issues in Readme(.html) document. #usage: #usage: Command "make update dd=destdir" can be used to update current #usage: setup to newer version. #usage: #xxxxx: In addition to this you may need to configure httpd daemon, #xxxxx: selinux policies (for me only "setenforce 0" works, but you #xxxxx: may have better luck, and possibly AddCharset UTF-8 .html #xxxxx: in your .htaccess file. vars: @echo prestdir=$(prestdir) files="'$(files)'" allfiles: @echo files="'$(files) $(restf)'" functions.sh: exit 1 # this target is not to be run. : functions ee () { { echo; echo "$@"; echo; } >&2; exit 1; } isf () { ls "$1" >/dev/null 2>&1; } erun () { echo "$@" >&2; "$@"; } install: @{ echo cd="$(cd)" dd="$(dd)"; \ sed -n '/^functions.sh:/,/^ *$$/ p' Makefile | tail -n +3; \ sed -n '/^install.sh:/,/^ *$$/ p' Makefile | tail -n +3; } | sh #-nv install.sh: exit 1 # this target is not to be run. : eval `MAKELEVEL=0 make vars` test x"$cd" != x || ee cd not defined. case "$cd" in /*) ;; *) ee "'$cd'" does not start with "'/'" ;; esac isf "$cd" && ee File "'$cd'" already exists. test x"$dd" != x || ee dd not defined. test -d "$dd" || ee Directory "'$dd'" does not exist. for i in $files $prestdir/lib/Text/Restructured/default.css ; do isf "$i" || ee Internal error: File "'$i'" does not exist. done for i in $files default.css; do isf "$dd/$i" && ee File "'$dd/$i'" is on the way. done cp -pR $files "$dd" cp $prestdir/lib/Text/Restructured/default.css "$dd" echo '/^my $bwdotdir =/s|".*|"'"$cd"'";| /^my $prestdir =/s|".*|"'"$prestdir"'";|:w:q' | tr : '\012' \ | ed "$dd/BoreWiki.cgi" 2>/dev/null mkdir -p "$cd" "$cd/tmp" echo echo Borewiki Installation complete. echo Use "'$dd/borewiki-admin.sh newuser'" to add users to your system. echo update: @{ echo dd="$(dd)"; \ sed -n '/^functions.sh:/,/^ *$$/ p' Makefile | tail -n +3; \ sed -n '/^update.sh:/,/^ *$$/ p' Makefile | tail -n +3; } | sh #-nv update.sh: exit 1 # this target is not to be run. : eval `MAKELEVEL=0 make vars` test x"$dd" != x || ee dd not defined. test -d "$dd" || ee Directory "'$dd'" does not exist. test -d "$dd/0ld" && ee Directory "'$dd/0ld'" exists. test -x "$dd/BoreWiki.cgi" || File "'$dd/BoreWiki.cgi'" not executable. cd=`sed -n '/^my \$bwdotdir/ { s/.*["'"'"']\(.*\)["'"'"'].*/\1/p;q;}' \ "$dd/BoreWiki.cgi"` sp=`sed -n '/^my \$https_required_/ { s/.*= *//p; q; }' \ "$dd/BoreWiki.cgi"` test x"$cd" = x \ && ee Can not find config dir info from "'$dd/BoreWiki.cgi'". test -d "$cd" || ee Directory "'$cd'" does not exist. test -d "$cd-0ld" && ee Directory "'$cd-0ld'" is on the way. : action ( cd "$dd" defcss=default.css test -f default-draft.css && defcss="$defcss default-draft.css" erun tar zcf borewiki-update-backup.tar.gz $files $defcss "$cd" rm -rf $files $defcss ) mv "$cd" "$cd-0ld" MAKELEVEL=0 make install dd="$dd" cd="$cd" [ x"$sp" = x ] || { echo '/^my \$https_required_with_port/s|=.*|= '"$sp"'|:w:q' \ | tr : \\012 | ed "$dd/BoreWiki.cgi" 2>/dev/null } for i in "$cd"/* do isf "$cd-0ld/`basename "$i"`" || mv "$i" "$cd-0ld"; done rm -rf "$cd" mv "$cd-0ld" "$cd" echo Borewiki update complete '(hopefully)'. echo Old installation is backed up in $dd/borewiki-update-backup.tar.gz echo Readme.html: Readme perl -CSD -I$(prestdir)/lib $(prestdir)/script/prest Readme \ | tee Readme.html dist: Readme.html @{ sed -n '/^functions.sh:/,/^ *$$/ p' Makefile | tail -n +3; \ sed -n '/^dist.sh:/,/^ *$$/ p' Makefile | tail -n +3; } | sh -ve #nv dist.sh: exit 1 # this target is not to be run. : eval `MAKELEVEL=0 make allfiles` eval `sed -n -e '1,/Begin shared var.../d' -e '/End shared var.../q' \ -e 's/ *= */=/; s/^my \\$//p;' BoreWiki.cgi` echo Version: $version. fgrep "= v$version " borewiki-admin.sh >/dev/null \ || ee borewiki-admin.sh does not know this version. fgrep "* $version " VersionInfo >/dev/null \ || ee VersionInfo not updated to contain this version. [ x`fgrep -c Id: VersionInfo` = x1 ] \ || ee VersionInfo format mismatch: Too many "'Id:'"s. dd=borewiki-${version} [ -d $dd ] && ee $dd is on the way. trap 'rm -rf $dd' 0 mkdir $dd cp -pR $files $dd svnversion . > $dd/SvnVersion [ x"`sed 's/[0-9]*//' $dd/SvnVersion`" = x ] || { ndd=${dd}test-`cat $dd/SvnVersion`; mv $dd $ndd; dd=$ndd; } v1=`sed -n 's/ 200[6-9].*//; s/.*Id: VersionInfo //p' VersionInfo` v2=`cat $dd/SvnVersion` [ x"$v1" = x"$v2" ] || \ ee File VersionInfo does not document revision $v2 at Id line. echo ' /^my \$bwdotdir =/s|".*|"/var/tmp/.borewiki";| /^my \$https_required_with_port/s|=.*|= 0;| w:q' | tr : \\012 | ed "$dd/BoreWiki.cgi" 2>/dev/null tar zcvf $dd.tar.gz $dd pubdist: @{ sed -n '/^functions.sh:/,/^ *$$/ p' Makefile | tail -n +3; \ sed -n '/^pubdist.sh:/,/^ *$$/ p' Makefile | tail -n +3; } | sh -ve pubdist.sh: exit 1 # this target is not to be run. : a=`ls -1 borewiki-*.tar.gz | tail -1` isf ttmmpp && ee File ttmmpp is on the way. trap 'rm -rf ttmmpp' 0 mkdir ttmmpp tar -C ttmmpp -zxvf $a ad=`echo $a | sed 's/.tar.gz$//'` [ -d ttmmpp/$ad ] || ee Directory ttmmpp/$ad does not exist. rm -rf ttmmpp/$ad/prest* for i in ttmmpp/$ad/*.cgi; do mv $i ${i}txt; done cp ttmmpp/$ad/* . { echo Contents of '<'a href='"'$a'">'$a':' echo '
' tar ztvf "$a" echo '' echo Md5sums of '<'a href='"'$a'">'$a':' echo '
' # Requires tar 0.15.x or newer... gtar --to-command='md5sum | sed "s|-|$TAR_FILENAME|"' -xf $a echo '' } > README.html # XXX prest must be hand-made for now (by calling this target). # XXX Note also that this is independent of the prest definition in beginning. bwprest: @{ sed -n '/^functions.sh:/,/^ *$$/ p' Makefile | tail -n +3; \ sed -n '/^bwprest.sh:/,/^ *$$/ p' Makefile | tail -n +3; } | sh -ve bwprest.sh: exit 1 # this target is not to be run. : v=0.003025 f=Text-Restructured-$v s=82cffd7724e7bfb96f3b4b3aa1374e40 case `md5sum $f.tar.gz` in $s*) ;; *) ee File $f.tar.gz md5sum not $s. ;; esac [ -d prest-$v ] && ee prest-$v is on the way. delf () { rm -rf $f; } delf trap delf 0 tar zxf $f.tar.gz [ -d $f ] || ee Directory $f does not exist after $f.tar.gz extraction. ( cd $f perl Makefile.PL -k make rm -rf blib/arch blib/bin blib/man1 blib/man3 blib/lib/auto rm blib/lib/Text/.exists blib/script/.exists rm -rf blib/lib/Text/Restructured/Directive mv blib/lib/Text/Restructured/Writer/html.wrt . rm -f blib/lib/Text/Restructured/Writer/* mv html.wrt blib/lib/Text/Restructured/Writer cp COPYING.txt blib mv blib ../prest-$v ) #EOF