initial commit
This commit is contained in:
commit
5b839e0543
174 changed files with 12261 additions and 0 deletions
33
werc/bin/aux/addwuser.rc
Executable file
33
werc/bin/aux/addwuser.rc
Executable file
|
@ -0,0 +1,33 @@
|
|||
#!/bin/rc
|
||||
|
||||
if(! ~ $#werc_root 0)
|
||||
cd $werc_root
|
||||
|
||||
fn usage {
|
||||
if(! ~ $#* 0)
|
||||
echo $0: $* >[1=2]
|
||||
echo 'Usage:' $0 'user_name user_password [groups ...]' >[1=2]
|
||||
exit usage
|
||||
}
|
||||
|
||||
if(! test -d etc/users/)
|
||||
usage 'Run for root of werc installation or set $werc_root'
|
||||
|
||||
user_name=$1
|
||||
shift
|
||||
user_pass=$1
|
||||
shift
|
||||
user_groups=$*
|
||||
|
||||
if(~ $"user_name '' || ~ $"user_pass '')
|
||||
usage
|
||||
|
||||
mkdir etc/users/$user_name
|
||||
echo $user_pass > etc/users/$user_name/password
|
||||
|
||||
if(! ~ $#user_groups 0)
|
||||
for(g in $user_groups) {
|
||||
mkdir -p etc/users/$g
|
||||
echo $user_name >> etc/users/$g/members
|
||||
}
|
||||
|
64
werc/bin/aux/bpst.rc
Executable file
64
werc/bin/aux/bpst.rc
Executable file
|
@ -0,0 +1,64 @@
|
|||
#!/bin/rc
|
||||
|
||||
path=( $PLAN9/bin $path )
|
||||
base=.
|
||||
|
||||
if(~ $#user 0)
|
||||
user=`{whoami}
|
||||
|
||||
file=(); title=();
|
||||
bloguser=$user
|
||||
while(! ~ $#* 0) {
|
||||
switch($1) {
|
||||
case -u
|
||||
base=/gsoc/www/people/$user/blog/
|
||||
case -b
|
||||
shift
|
||||
base=$1
|
||||
case -f
|
||||
shift
|
||||
file=$1
|
||||
}
|
||||
shift
|
||||
}
|
||||
|
||||
if(~ $"EDITOR '')
|
||||
EDITOR=vi
|
||||
|
||||
if(~ $#file 0 || ! test -f $file) {
|
||||
file=/tmp/blogtmp.$pid
|
||||
rm $file >[2]/dev/null
|
||||
touch $file
|
||||
}
|
||||
|
||||
$EDITOR $file
|
||||
aspell -c $file
|
||||
rm $file.bak >[2]/dev/null
|
||||
|
||||
fn mkbpost {
|
||||
umask 002 # Let group write
|
||||
bptext=$1
|
||||
if(! ~ $#2 0)
|
||||
bpid=`{echo -n '-'^$"bpid | sed 's/'$forbidden_uri_chars'+/_/g; 1q'}
|
||||
d=`{/bin/date +%F|sed 's,-,/,g'}
|
||||
|
||||
ddir=$blagh_root^$d^'/'
|
||||
n=`{ls $ddir >[2]/dev/null |wc -l}
|
||||
|
||||
mkdir -p $ddir/$"n^$"bpid/
|
||||
{
|
||||
# TODO: Enable metadata
|
||||
#echo '* Posted:' `{date}
|
||||
#if(! ~ $#logged_user 0)
|
||||
# echo '* Author: '$logged_user
|
||||
cat $bptext
|
||||
}> $ddir/$"n^$"bpid/index.md
|
||||
}
|
||||
|
||||
forbidden_uri_chars='[^a-zA-Z0-9_+\-\/\.]'
|
||||
blagh_root=$base
|
||||
|
||||
if(test -s $file)
|
||||
mkbpost $file
|
||||
if not
|
||||
echo Empty file!
|
14
werc/bin/aux/gensitemaptxt.rc
Executable file
14
werc/bin/aux/gensitemaptxt.rc
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/rc
|
||||
# DEPRECATED: sitemap.tpl now generates and updates a sitemap.txt when requested, and is also more smart than this simplistic script.
|
||||
|
||||
for(d in sites/*/) {
|
||||
echo $d
|
||||
9 du -a $d | awk '/\.(md|html)$/ { print $2 }; {}' | 9 sed -e 's/\.(md|html)$//' -e 's,/index$,/,' -e 's,^sites/,http://,' > $d/sitemap.txt
|
||||
|
||||
if(! test -f $d/robots.txt) {
|
||||
echo generating missing robots.txt for $d
|
||||
echo $d|sed 's,sites/,Sitemap: http://,; s/$/sitemap.txt/;' > $d/robots.txt
|
||||
cat $d/robots.txt
|
||||
}
|
||||
|
||||
}
|
16
werc/bin/aux/runtsts.rc
Executable file
16
werc/bin/aux/runtsts.rc
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/rc
|
||||
|
||||
tstdom='http://test.cat-v.org'
|
||||
|
||||
cd sites/tst.cat-v.org
|
||||
|
||||
tstfiles=`{du -a |awk '/\.tst$/ { print $2 }; {} ' | sed 's/^\.//; s/\.tst$//'}
|
||||
|
||||
for(f in $tstfiles) {
|
||||
ifs='
|
||||
' { tsts=`{cat ./$f.tst} }
|
||||
|
||||
for(t in $tsts) {
|
||||
echo tst $t
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue