From 29355a1653a12742928ce563e4c077a77f67c9f9 Mon Sep 17 00:00:00 2001
From: root
Date: Sun, 6 Sep 2009 04:26:13 -0700
Subject: Import of unversioned piny code.
---
etc/apache2/sites-available/001-piny | 56 ++++++++
etc/cgitrc | 100 ++++++++++++++
index.mdwn | 4 +-
srv/templates/aggregatepost.tmpl | 15 +++
srv/templates/archivepage.tmpl | 7 +
srv/templates/atomitem.tmpl | 48 +++++++
srv/templates/atompage.tmpl | 39 ++++++
srv/templates/autoindex.tmpl | 1 +
srv/templates/blogpost.tmpl | 16 +++
srv/templates/change.tmpl | 46 +++++++
srv/templates/comment.tmpl | 59 +++++++++
srv/templates/commentmoderation.tmpl | 29 ++++
srv/templates/editcomment.tmpl | 30 +++++
srv/templates/editconflict.tmpl | 7 +
srv/templates/editcreationconflict.tmpl | 9 ++
srv/templates/editfailedsave.tmpl | 10 ++
srv/templates/editpage.tmpl | 50 +++++++
srv/templates/editpagegone.tmpl | 7 +
srv/templates/feedlink.tmpl | 8 ++
srv/templates/googleform.tmpl | 6 +
srv/templates/inlinepage.tmpl | 74 +++++++++++
srv/templates/misc.tmpl | 37 ++++++
srv/templates/page.tmpl | 138 +++++++++++++++++++
srv/templates/passwordmail.tmpl | 15 +++
srv/templates/recentchanges.tmpl | 7 +
srv/templates/renamesummary.tmpl | 26 ++++
srv/templates/rssitem.tmpl | 29 ++++
srv/templates/rsspage.tmpl | 11 ++
srv/templates/searchform.tmpl | 5 +
srv/templates/searchquery.tmpl | 112 ++++++++++++++++
srv/templates/titlepage.tmpl | 1 +
usr/local/bin/addaccess | 2 +
usr/local/bin/createuser | 1 +
usr/local/bin/newrepo | 2 +
usr/local/bin/newuser | 2 +
usr/local/bin/pinyshell | 5 +
usr/local/bin/rmaccess | 2 +
usr/local/bin/rmrepo | 2 +
usr/local/sbin/addaccess | 39 ++++++
usr/local/sbin/newrepo | 226 ++++++++++++++++++++++++++++++++
usr/local/sbin/newuser | 129 ++++++++++++++++++
usr/local/sbin/rmaccess | 39 ++++++
usr/local/sbin/rmrepo | 64 +++++++++
43 files changed, 1512 insertions(+), 3 deletions(-)
create mode 100644 etc/apache2/sites-available/001-piny
create mode 100644 etc/cgitrc
create mode 100644 srv/templates/aggregatepost.tmpl
create mode 100644 srv/templates/archivepage.tmpl
create mode 100644 srv/templates/atomitem.tmpl
create mode 100644 srv/templates/atompage.tmpl
create mode 100644 srv/templates/autoindex.tmpl
create mode 100644 srv/templates/blogpost.tmpl
create mode 100644 srv/templates/change.tmpl
create mode 100644 srv/templates/comment.tmpl
create mode 100644 srv/templates/commentmoderation.tmpl
create mode 100644 srv/templates/editcomment.tmpl
create mode 100644 srv/templates/editconflict.tmpl
create mode 100644 srv/templates/editcreationconflict.tmpl
create mode 100644 srv/templates/editfailedsave.tmpl
create mode 100644 srv/templates/editpage.tmpl
create mode 100644 srv/templates/editpagegone.tmpl
create mode 100644 srv/templates/feedlink.tmpl
create mode 100644 srv/templates/googleform.tmpl
create mode 100644 srv/templates/inlinepage.tmpl
create mode 100644 srv/templates/misc.tmpl
create mode 100644 srv/templates/page.tmpl
create mode 100644 srv/templates/passwordmail.tmpl
create mode 100644 srv/templates/recentchanges.tmpl
create mode 100644 srv/templates/renamesummary.tmpl
create mode 100644 srv/templates/rssitem.tmpl
create mode 100644 srv/templates/rsspage.tmpl
create mode 100644 srv/templates/searchform.tmpl
create mode 100644 srv/templates/searchquery.tmpl
create mode 100644 srv/templates/titlepage.tmpl
create mode 100755 usr/local/bin/addaccess
create mode 120000 usr/local/bin/createuser
create mode 100755 usr/local/bin/newrepo
create mode 100755 usr/local/bin/newuser
create mode 100755 usr/local/bin/pinyshell
create mode 100755 usr/local/bin/rmaccess
create mode 100755 usr/local/bin/rmrepo
create mode 100755 usr/local/sbin/addaccess
create mode 100755 usr/local/sbin/newrepo
create mode 100755 usr/local/sbin/newuser
create mode 100755 usr/local/sbin/rmaccess
create mode 100755 usr/local/sbin/rmrepo
diff --git a/etc/apache2/sites-available/001-piny b/etc/apache2/sites-available/001-piny
new file mode 100644
index 0000000..e283977
--- /dev/null
+++ b/etc/apache2/sites-available/001-piny
@@ -0,0 +1,56 @@
+
+ ServerName piny.svcs.cs.pdx.edu
+
+ DocumentRoot /srv/www/piny.svcs.cs.pdx.edu
+
+
+ Options Indexes FollowSymLinks MultiViews
+ AllowOverride None
+
+
+ RedirectMatch 301 ^/$ http://piny.svcs.cs.pdx.edu/piny-web/
+
+
+
+ ServerName secure.piny.svcs.cs.pdx.edu
+ RedirectMatch 301 (.*) https://secure.piny.svcs.cs.pdx.edu$1
+
+
+
+ ServerName secure.piny.svcs.cs.pdx.edu
+ DocumentRoot /srv/www/secure.piny.svcs.cs.pdx.edu
+
+
+ Options Indexes FollowSymLinks MultiViews
+ AllowOverride None
+
+
+ RedirectMatch 301 ^/$ http://piny.svcs.cs.pdx.edu/piny-web/
+
+ SSLEngine On
+ SSLCertificateFile /etc/ssl/private/wildcard.piny.svcs.cs.pdx.edu.pem
+
+
+
+ ServerName cgi.piny.svcs.cs.pdx.edu
+ RedirectMatch 301 (.*) https://cgi.piny.svcs.cs.pdx.edu$1
+
+
+
+ ServerName cgi.piny.svcs.cs.pdx.edu
+ DocumentRoot /srv/www/cgi.piny.svcs.cs.pdx.edu
+
+
+ SSLRequireSSL
+ SetHandler cgi-script
+ AllowOverride None
+ Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
+
+
+ ScriptAlias /cgi-bin/cgit.cgi /usr/lib/cgi-bin/cgit.cgi
+
+ Include /etc/apache2/piny-enabled
+
+ SSLEngine On
+ SSLCertificateFile /etc/ssl/private/wildcard.piny.svcs.cs.pdx.edu.pem
+
diff --git a/etc/cgitrc b/etc/cgitrc
new file mode 100644
index 0000000..5ff681c
--- /dev/null
+++ b/etc/cgitrc
@@ -0,0 +1,100 @@
+# Enable caching of up to 1000 output entriess
+cache-size=1000
+
+
+# Specify some default clone prefixes
+clone-prefix=git://piny.svcs.cs.pdx.edu git+ssh://piny.svcs.cs.pdx.edu/srv/git
+
+# Specify the css url
+css=http://piny.svcs.cs.pdx.edu/piny-shared/cgit/cgit.css
+
+
+# Show extra links for each repository on the index page
+enable-index-links=1
+
+
+# Show number of affected files per commit on the log pages
+enable-log-filecount=1
+
+
+# Show number of added/removed lines per commit on the log pages
+enable-log-linecount=1
+
+
+# Add a cgit favicon
+#favicon=/cgit/favicon.ico
+
+
+# Use a custom logo
+logo=http://piny.svcs.cs.pdx.edu/piny-shared/cgit/cgit.png
+
+
+# Set the title and heading of the repository index page
+root-title=Piny git repositories
+
+
+# Set a subheading for the repository index page
+root-desc=For all your informational needs.
+
+
+# Include some more info about foobar.com on the index page
+#root-readme=/var/www/htdocs/about.html
+
+
+# Allow download of tar.gz, tar.bz and zip-files
+snapshots=tar.gz zip
+
+
+##
+## List of repositories.
+## PS: Any repositories listed when repo.group is unset will not be
+## displayed under a group heading
+## PPS: This list could be kept in a different file (e.g. '/etc/cgitrepos')
+## and included like this:
+include=/etc/cgitrepos
+##
+
+
+#repo.url=piny-web
+#repo.path=/srv/git/piny-web.git
+#repo.desc=piny-web
+#repo.owner=jrayhawk+piny.svcs.cs.pdx.edu@omgwallhack.org
+#repo.readme=info/web/about.html
+
+
+#repo.url=piny-shared
+#repo.path=/srv/git/piny-shared.git
+#repo.desc=piny-shared
+#repo.owner=jrayhawk+piny.svcs.cs.pdx.edu@omgwallhack.org
+#repo.readme=info/web/about.html
+
+
+# The next repositories will be displayed under the 'extras' heading
+
+#repo.url=baz
+#repo.path=/pub/git/baz.git
+#repo.desc=a set of extensions for bar users
+
+#repo.url=wiz
+#repo.path=/pub/git/wiz.git
+#repo.desc=the wizard of foo
+
+
+# Add some mirrored repositories
+#repo.group=mirrors
+
+
+#repo.url=git
+#repo.path=/pub/git/git.git
+#repo.desc=the dscm
+
+
+#repo.url=linux
+#repo.path=/pub/git/linux.git
+#repo.desc=the kernel
+
+# Disable adhoc downloads of this repo
+repo.snapshots=0
+
+# Disable line-counts for this repo
+repo.enable-log-linecount=0
diff --git a/index.mdwn b/index.mdwn
index ed6a228..0a762a4 100644
--- a/index.mdwn
+++ b/index.mdwn
@@ -1,6 +1,4 @@
-Welcome to your repo!
-
-[Ikiwiki usage](http://piny.svcs.cs.pdx.edu/piny-shared/ikiwiki/)
+The code behind piny.
Files:
[[!map pages="* and ! */*"]]
diff --git a/srv/templates/aggregatepost.tmpl b/srv/templates/aggregatepost.tmpl
new file mode 100644
index 0000000..8b89367
--- /dev/null
+++ b/srv/templates/aggregatepost.tmpl
@@ -0,0 +1,15 @@
+
+
+[[!tag ]]
+
+
+[[!meta title=""]]
+
+
+[[!meta permalink=""]]
+
+
+[[!meta copyright=""]]
+
+[[!meta author=""]]
+[[!meta authorurl=""]]
diff --git a/srv/templates/archivepage.tmpl b/srv/templates/archivepage.tmpl
new file mode 100644
index 0000000..6bc789d
--- /dev/null
+++ b/srv/templates/archivepage.tmpl
@@ -0,0 +1,7 @@
+
+
+
+Posted
+
+
+
diff --git a/srv/templates/atomitem.tmpl b/srv/templates/atomitem.tmpl
new file mode 100644
index 0000000..768695a
--- /dev/null
+++ b/srv/templates/atomitem.tmpl
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ " type="text/html" />
+
+
+ " type="application/atom+xml" />
+
+
diff --git a/srv/templates/atompage.tmpl b/srv/templates/atompage.tmpl
new file mode 100644
index 0000000..dcb89ab
--- /dev/null
+++ b/srv/templates/atompage.tmpl
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ikiwiki
+
+
+
diff --git a/srv/templates/autoindex.tmpl b/srv/templates/autoindex.tmpl
new file mode 100644
index 0000000..d5ec3b8
--- /dev/null
+++ b/srv/templates/autoindex.tmpl
@@ -0,0 +1 @@
+[[!map pages="/* and ! /*/*"]]
diff --git a/srv/templates/blogpost.tmpl b/srv/templates/blogpost.tmpl
new file mode 100644
index 0000000..7eeede6
--- /dev/null
+++ b/srv/templates/blogpost.tmpl
@@ -0,0 +1,16 @@
+
diff --git a/srv/templates/change.tmpl b/srv/templates/change.tmpl
new file mode 100644
index 0000000..0e61a80
--- /dev/null
+++ b/srv/templates/change.tmpl
@@ -0,0 +1,46 @@
+[[!meta author=""""""]]
+
+[[!meta authorurl=""""""]]
+
+[[!meta title="""change to on """]]
+
+[[!meta permalink=""]]
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/srv/templates/comment.tmpl b/srv/templates/comment.tmpl
new file mode 100644
index 0000000..fb76ea0
--- /dev/null
+++ b/srv/templates/comment.tmpl
@@ -0,0 +1,59 @@
+
diff --git a/srv/templates/commentmoderation.tmpl b/srv/templates/commentmoderation.tmpl
new file mode 100644
index 0000000..e91d314
--- /dev/null
+++ b/srv/templates/commentmoderation.tmpl
@@ -0,0 +1,29 @@
+
+
+
+
+
+No comments need moderation at this time.
+
+
diff --git a/srv/templates/editcomment.tmpl b/srv/templates/editcomment.tmpl
new file mode 100644
index 0000000..7590cdf
--- /dev/null
+++ b/srv/templates/editcomment.tmpl
@@ -0,0 +1,30 @@
+
diff --git a/srv/templates/editconflict.tmpl b/srv/templates/editconflict.tmpl
new file mode 100644
index 0000000..1252033
--- /dev/null
+++ b/srv/templates/editconflict.tmpl
@@ -0,0 +1,7 @@
+
+Your changes conflict with other changes made to the page.
+
+
+Conflict markers have been inserted into the page content. Reconcile the
+conflict and commit again to save your changes.
+
diff --git a/srv/templates/editcreationconflict.tmpl b/srv/templates/editcreationconflict.tmpl
new file mode 100644
index 0000000..c99102f
--- /dev/null
+++ b/srv/templates/editcreationconflict.tmpl
@@ -0,0 +1,9 @@
+
+While you were creating this page, someone else independently created a page
+with the same name.
+
+
+The edit box below contains the page's current content, followed by the
+content you entered previously, to allow you to merge the two
+together before saving.
+
diff --git a/srv/templates/editfailedsave.tmpl b/srv/templates/editfailedsave.tmpl
new file mode 100644
index 0000000..5184f7d
--- /dev/null
+++ b/srv/templates/editfailedsave.tmpl
@@ -0,0 +1,10 @@
+
+Failed to save your changes.
+
+
+Your changes were not able to be saved to disk. The system gave the error:
+
+
+
+Your changes are preserved below, and you can try again to save them.
+
diff --git a/srv/templates/editpage.tmpl b/srv/templates/editpage.tmpl
new file mode 100644
index 0000000..b1cf015
--- /dev/null
+++ b/srv/templates/editpage.tmpl
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+Page location:
+Page type:
+
+
+
+
+
+
+
+Optional comment about this change:
+
+
+
+
+
+Attachments
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/srv/templates/editpagegone.tmpl b/srv/templates/editpagegone.tmpl
new file mode 100644
index 0000000..2eed03a
--- /dev/null
+++ b/srv/templates/editpagegone.tmpl
@@ -0,0 +1,7 @@
+
+The page you were editing has disappeared.
+
+
+Perhaps someone else has deleted it or moved it. If you want to recreate
+this page with your text, click "Save Page" again.
+
diff --git a/srv/templates/feedlink.tmpl b/srv/templates/feedlink.tmpl
new file mode 100644
index 0000000..2963156
--- /dev/null
+++ b/srv/templates/feedlink.tmpl
@@ -0,0 +1,8 @@
+
diff --git a/srv/templates/googleform.tmpl b/srv/templates/googleform.tmpl
new file mode 100644
index 0000000..e2d4a1f
--- /dev/null
+++ b/srv/templates/googleform.tmpl
@@ -0,0 +1,6 @@
+
diff --git a/srv/templates/inlinepage.tmpl b/srv/templates/inlinepage.tmpl
new file mode 100644
index 0000000..3c0b933
--- /dev/null
+++ b/srv/templates/inlinepage.tmpl
@@ -0,0 +1,74 @@
+
diff --git a/srv/templates/misc.tmpl b/srv/templates/misc.tmpl
new file mode 100644
index 0000000..0de56ed
--- /dev/null
+++ b/srv/templates/misc.tmpl
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/srv/templates/page.tmpl b/srv/templates/page.tmpl
new file mode 100644
index 0000000..cda5c71
--- /dev/null
+++ b/srv/templates/page.tmpl
@@ -0,0 +1,138 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/srv/templates/passwordmail.tmpl b/srv/templates/passwordmail.tmpl
new file mode 100644
index 0000000..aa8a68c
--- /dev/null
+++ b/srv/templates/passwordmail.tmpl
@@ -0,0 +1,15 @@
+Someone[1], possibly you, requested that the password for
+ on [2] be reset.
+
+To change your password, visit the following url, and enter a new password:
+
+
+
+This url can only be used once to change your password, and it will also
+stop working the next time you successfully log in.
+
+--
+ikiwiki
+
+[1] Their IP address was
+[2] Located at
diff --git a/srv/templates/recentchanges.tmpl b/srv/templates/recentchanges.tmpl
new file mode 100644
index 0000000..340a157
--- /dev/null
+++ b/srv/templates/recentchanges.tmpl
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/srv/templates/renamesummary.tmpl b/srv/templates/renamesummary.tmpl
new file mode 100644
index 0000000..60f81b3
--- /dev/null
+++ b/srv/templates/renamesummary.tmpl
@@ -0,0 +1,26 @@
+
+
+Failed to rename to :
+
+
+
+
+Successfully renamed to .
+
+
+
+The following pages have been automatically modified to update their links to :
+
+
+
+
+The following pages still link to :
+
+
+
+
+
diff --git a/srv/templates/rssitem.tmpl b/srv/templates/rssitem.tmpl
new file mode 100644
index 0000000..a61b92b
--- /dev/null
+++ b/srv/templates/rssitem.tmpl
@@ -0,0 +1,29 @@
+-
+
+ :
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/srv/templates/rsspage.tmpl b/srv/templates/rsspage.tmpl
new file mode 100644
index 0000000..e54094a
--- /dev/null
+++ b/srv/templates/rsspage.tmpl
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
diff --git a/srv/templates/searchform.tmpl b/srv/templates/searchform.tmpl
new file mode 100644
index 0000000..afae2eb
--- /dev/null
+++ b/srv/templates/searchform.tmpl
@@ -0,0 +1,5 @@
+
diff --git a/srv/templates/searchquery.tmpl b/srv/templates/searchquery.tmpl
new file mode 100644
index 0000000..782b12c
--- /dev/null
+++ b/srv/templates/searchquery.tmpl
@@ -0,0 +1,112 @@
+$setmap{prefix,title,S}
+$setmap{prefix,link,XLINK}
+$set{thousand,$.}$set{decimal,.}$setmap{BN,,Any Country,uk,England,fr,France}
+${
+$def{PREV,
+$if{$ne{$topdoc,0}, ,
+ }
+}
+
+$def{NEXT,
+$if{$ne{$last,$msize}, ,
+ }
+}
+
+$def{P, }
+$def{PAGE,$if{$gt{$1,9},$if{$gt{$1,99},$P{$1,$div{$1,100}}}$P{$1,$mod{$div{$1,10},10}}}$P{$1,$mod{$1,10}}}
+
+$def{S, }
+$def{SPAGE,$if{$gt{$1,9},$if{$gt{$1,99},$S{$1,$div{$1,100}}}$S{$1,$mod{$div{$1,10},10}}}$S{$1,$mod{$1,10}}}
+}
+
+$def{PREV,$if{$ne{$topdoc,0}, }}
+
+$def{PAGE, }
+
+$def{SPAGE, }
+
+$def{NEXT,$if{$ne{$last,$msize}, }}
+
+
+
+
+
diff --git a/srv/templates/titlepage.tmpl b/srv/templates/titlepage.tmpl
new file mode 100644
index 0000000..f5cd5bc
--- /dev/null
+++ b/srv/templates/titlepage.tmpl
@@ -0,0 +1 @@
+
diff --git a/usr/local/bin/addaccess b/usr/local/bin/addaccess
new file mode 100755
index 0000000..6f734f6
--- /dev/null
+++ b/usr/local/bin/addaccess
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/bin/sudo /usr/local/sbin/addaccess "$@"
diff --git a/usr/local/bin/createuser b/usr/local/bin/createuser
new file mode 120000
index 0000000..e9d7937
--- /dev/null
+++ b/usr/local/bin/createuser
@@ -0,0 +1 @@
+newuser
\ No newline at end of file
diff --git a/usr/local/bin/newrepo b/usr/local/bin/newrepo
new file mode 100755
index 0000000..05ce120
--- /dev/null
+++ b/usr/local/bin/newrepo
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/bin/sudo /usr/local/sbin/newrepo "$@"
diff --git a/usr/local/bin/newuser b/usr/local/bin/newuser
new file mode 100755
index 0000000..841b47d
--- /dev/null
+++ b/usr/local/bin/newuser
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/bin/sudo /usr/local/sbin/newuser
diff --git a/usr/local/bin/pinyshell b/usr/local/bin/pinyshell
new file mode 100755
index 0000000..0db88a8
--- /dev/null
+++ b/usr/local/bin/pinyshell
@@ -0,0 +1,5 @@
+#!/bin/sh
+cd /srv/rbin
+export PATH=/srv/rbin
+
+exec /bin/rbash "$@"
diff --git a/usr/local/bin/rmaccess b/usr/local/bin/rmaccess
new file mode 100755
index 0000000..6c40690
--- /dev/null
+++ b/usr/local/bin/rmaccess
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/bin/sudo /usr/local/sbin/rmaccess "$@"
diff --git a/usr/local/bin/rmrepo b/usr/local/bin/rmrepo
new file mode 100755
index 0000000..53bf029
--- /dev/null
+++ b/usr/local/bin/rmrepo
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/bin/sudo /usr/local/sbin/rmrepo "$@"
diff --git a/usr/local/sbin/addaccess b/usr/local/sbin/addaccess
new file mode 100755
index 0000000..07cc893
--- /dev/null
+++ b/usr/local/sbin/addaccess
@@ -0,0 +1,39 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+my( $reponame, $uid, $gitowner);
+
+if ( ( ! scalar $ARGV[1] ) or ( scalar $ARGV[2] ) ) { # must have exactly two arguments
+ print( "Usage: addaccess USER REPONAME\n" );
+ exit( 1 );
+} elsif ( ( $ARGV[0] !~ /^[a-zA-Z0-9_.][a-zA-Z0-9_.-]+$/ ) or ( $ARGV[1] !~ /^[a-z0-9][a-z0-9+.-]+$/ ) ) { # Extra paranoid sanity checking
+ print( "Usage: addaccess USER REPONAME\n" );
+ print( " USER must consist only of letters, digits, underscores, periods, and dashes, and not start with a dash.\n" );
+ print( " REPONAME must consist only of lower case letters (a-z), digits (0-9), plus (+) and minus (-) signs, and periods (.).\n" );
+ print( " REPONAME must be at least two characters long and must start with an alphanumeric character.\n" );
+ exit( 1 );
+} else {
+ $reponame = $ARGV[1];
+};
+
+open (PASSWD, '/etc/passwd');
+while() {
+ if( $_ =~ /^$ENV{SUDO_USER}:.+?:(.+?):/ ) { $uid = $1; }; # grabbing uid.
+};
+close(PASSWD);
+
+unless( -d "/srv/git/$reponame.git" ) {
+ print( "/srv/git/$reponame.git doesn't exist!\n" );
+ exit( 2 );
+};
+
+$gitowner = (stat( "/srv/git/$reponame.git" ))[4]; # grab owner uid of repository
+
+if( ( $gitowner != $uid ) and ( $gitowner != 65534 ) ) {
+ print( "$reponame is not owned by you!\n" );
+ exit( 3 );
+};
+
+system( "/usr/sbin/adduser $ARGV[0] git-$reponame" );
diff --git a/usr/local/sbin/newrepo b/usr/local/sbin/newrepo
new file mode 100755
index 0000000..7988117
--- /dev/null
+++ b/usr/local/sbin/newrepo
@@ -0,0 +1,226 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+my( $errorto ) = 'jrayhawk+piny.svcs.cs.pdx.edu@omgwallhack.org'; # Email address to send horrible errors to.
+my( $reponame, $email, @errors, $wikilisttempfile, $cgitrctempfile);
+
+if ( ( ! scalar $ARGV[0] ) or ( scalar $ARGV[1] ) or ( $ARGV[0] !~ /^[a-z0-9][a-z0-9+.-]+$/ ) ) {
+ print( "Usage: newrepo REPONAME\n" );
+ print( " REPONAME must consist only of lower case letters (a-z), digits (0-9), plus (+) and minus (-) signs, and periods (.).\n" );
+ print( " REPONAME must be at least two characters long and must start with an alphanumeric character.\n" );
+ exit( 1 );
+} else {
+ $reponame = $ARGV[0];
+};
+
+# We want to check to see if
+# 1) $reponame already exists in some form so we don't try to create it, and
+# 2) $reponame is only partially created, in which case we want to email someone who can sanity check and fix it.
+open (PASSWD, '/etc/passwd');
+while() {
+ if( $_ =~ /^$ENV{SUDO_USER}:.+?:.+?:.+?:(.+?):/ ) { $email = $1; }; # While we're here, may as well grab the email address.
+ if( $_ =~ /^ikiwiki-$reponame:/ ) { push( @errors, "user ikiwiki-$reponame already exists!\n"); };
+};
+close(PASSWD);
+open (GROUP, '/etc/group');
+while() {
+ if( $_ =~ /^git-$reponame:/ ) { push( @errors, "group git-$reponame already exists!\n"); };
+};
+close(GROUP);
+if( -d "/srv/git/$reponame.git" ) { push( @errors, "/srv/git/$reponame.git already exists!\n"); };
+if( -d "/srv/ikiwiki/$reponame" ) { push( @errors, "/srv/ikiwiki/$reponame already exists!\n"); };
+if( -d "/srv/www/piny.svcs.cs.pdx.edu/$reponame" ) { push( @errors, "/srv/www/piny.svcs.cs.pdx.edu/$reponame already exists!\n"); };
+if( -d "/srv/www/cgi.piny.svcs.cs.pdx.edu/repos/$reponame" ) { push( @errors, "/srv/www/cgi.piny.svcs.cs.pdx.edu/repos/$reponame already exists!\n"); };
+if( -f "/etc/ikiwiki/piny/$reponame.setup" ) { push( @errors, "/etc/ikiwiki/piny/$reponame.setup already exists!\n"); };
+if( -f "/etc/ikiwiki/wikilist.d/$reponame" ) { push( @errors, "/etc/ikiwiki/wikilist.d/$reponame already exists!\n"); };
+if( -f "/etc/apache2/piny-available/$reponame" ) { push( @errors, "/etc/apache2/piny-available/$reponame already exists!\n"); };
+if( -f "/etc/cgitrc.d/$reponame" ) { push( @errors, "/etc/cgitrc.d/$reponame already exists!\n"); };
+
+if( @errors ) {
+ if( @errors == 10 ) { # Everything's fine, nothing is broken
+ print( "$reponame already exists!\n" );
+ } else { # IT'S ARMAGEDDON
+ open ( MAIL, "|/usr/lib/sendmail -t" );
+ print( MAIL "To: $errorto\n" );
+ print( MAIL "From: newrepo\@piny.svcs.cs.pdx.edu\n" );
+ print( MAIL "Subject: Piny error: $ENV{SUDO_USER} found inconsistent $reponame in the creation process!\n" );
+ print( MAIL "MIME-Version: 1.0\n" );
+ print( MAIL "Content-Type: text/plain; charset=us-ascii\n" );
+ print( MAIL "\n" );
+ print( MAIL "@errors\n" );
+ close( MAIL );
+ print( "$reponame already exists but is in an inconsistent state! The Piny admins probably screwed up; they have been notified and will take a look at it.\n" );
+ };
+ exit( 2 );
+};
+
+
+# CREATE USER/GROUPS
+unless( system( "mkdir /srv/git/$reponame.git" ) == 0 ) { # We need a locking or atomic operation as our first to check against simultaneous execution.
+ print( "I suspect that you are attempting to create the same repo multiple times simultaneously.\n" );
+ exit( 3 );
+};
+system( "/usr/sbin/addgroup --quiet git-$reponame" );
+system( "/usr/sbin/adduser --quiet --system --group --gecos $reponame ikiwiki-$reponame" );
+system( "/usr/sbin/adduser --quiet ikiwiki-$reponame git-$reponame | grep -v 'Adding user'" );
+system( "/usr/sbin/adduser --quiet $ENV{SUDO_USER} git-$reponame | grep -v 'Adding user '" );
+
+# CREATE REPO
+system( "GIT_DIR=/srv/git/$reponame.git /usr/bin/git init --template=/srv/git-template.git --quiet --shared" );
+open ( DESC, ">/srv/git/$reponame.git/description" );
+print( DESC "$reponame owned by $email" );
+close( DESC );
+# ln -f post-receive /srv/git/$reponame.git/hooks/ # turn on e-mail commit notices
+system( "/bin/chown -R $ENV{SUDO_USER}.git-$reponame /srv/git/$reponame.git/" );
+system( "/bin/chown -R ikiwiki-$reponame.ikiwiki-$reponame /srv/git/$reponame.git/hooks/" );
+system( "/bin/touch /srv/git/$reponame.git/git-daemon-export-ok" );
+
+# WRITE IKIWIKI SETUP FILE
+open ( SETUP, ">/etc/ikiwiki/piny/$reponame.setup" );
+print( SETUP
+'#!/usr/bin/perl
+# Configuration file for ikiwiki.
+# Passing this to ikiwiki --setup will make ikiwiki generate wrappers and
+# build the wiki.
+#
+# Remember to re-run ikiwiki --setup any time you edit this file.
+
+use IkiWiki::Setup::Standard {
+ wikiname => \'' . $reponame . '\', # PINY
+ adminemail => \'' . $email . '\', # PINY
+ srcdir => \'/srv/ikiwiki/' . $reponame . '\', # PINY
+ destdir => \'/srv/www/piny.svcs.cs.pdx.edu/' . $reponame . '\', # PINY
+ url => \'http://piny.svcs.cs.pdx.edu/' . $reponame . '\', # PINY
+ cgiurl => \'https://cgi.piny.svcs.cs.pdx.edu/repos/' . $reponame . '/ikiwiki.cgi\', # PINY
+ historyurl => \'https://cgi.piny.svcs.cs.pdx.edu/gitweb.cgi?p=' . $reponame . '.git;a=history;f=[[file]]\', # PINY
+ diffurl => \'https://cgi.piny.svcs.cs.pdx.edu/gitweb.cgi?p=' . $reponame . ';a=blobdiff;f=doc/[[file]];h=[[sha1_to]];hp=[[sha1_from]];hb=[[sha1_commit]];hpb=[[sha1_parent]]\', # PINY
+
+ templatedir => "/srv/templates",
+ underlaydir => "/etc/ikiwiki/share/underlay",
+
+ rcs => "git",
+ gitorigin_branch => "origin",
+ gitmaster_branch => "master",
+
+ wrappers => [
+ {
+ cgi => 1,
+ wrapper => \'/srv/www/cgi.piny.svcs.cs.pdx.edu/repos/' . $reponame . '/ikiwiki.cgi\', # PINY
+ wrappermode => "06755",
+ wrappergroup => \'git-' . $reponame . '\', # PINY
+ },
+ {
+ wrapper => \'/srv/git/' . $reponame . '.git/hooks/post-update\', # PINY
+ wrappermode => "06755",
+ wrappergroup => \'git-' . $reponame . '\', # PINY
+
+ notify => 0,
+ },
+ ],
+
+ # Generate rss feeds for blogs?
+ rss => 1,
+ # Generate atom feeds for blogs?
+ atom => 0,
+ # Include discussion links on all pages?
+ discussion => 0,
+ # To exclude files matching a regexp from processing. This adds to
+ # the default exclude list.
+ #exclude => qr/*\.wav/,
+ # To change the extension used for generated html files.
+ #htmlext => "htm",
+ # Time format (for strftime)
+ #timeformat => "%c",
+ # Locale to use. Must be a UTF-8 locale.
+ #locale => "en_US.UTF-8",
+ # Only send cookies over SSL connections.
+ sslcookie => 1,
+ # Logging settings:
+ verbose => 0,
+ syslog => 1,
+ # To link to user pages in a subdirectory of the wiki.
+ #userdir => "users",
+ # To create output files named page.html rather than page/index.html.
+ usedirs => 1,
+ # Simple spam prevention: require an account-creation password.
+ #account_creation_password => "example",
+ # Use new "!"-prefixed preprocessor directive syntax
+ prefix_directives => 1,
+ httpauth => 1,
+ # To add plugins, list them here.
+ add_plugins => [qw{sidebar toc meta table tag httpauth attachment rename remove autoindex map teximg version edittemplate}],
+ disable_plugins => [qw{openid passwordauth}],
+ teximg_prefix => \'\\documentclass{scrartcl}
+\\usepackage[version=3]{mhchem}
+\\usepackage{amsmath}
+\\usepackage{amsfonts}
+\\usepackage{amssymb}
+\\pagestyle{empty}
+\\newcommand{\unit}[1]{\\ensuremath{\\, \\mathrm{#1}}}
+\\begin{document}\',
+
+ teximg_dvipng => 1,
+
+ # For use with the tag plugin, make all tags be located under a
+ # base page.
+ tagbase => "tag",
+
+ # For use with the search plugin if your estseek.cgi is located
+ # somewhere else.
+ #estseek => "/usr/lib/estraier/estseek.cgi",
+}');
+close( SETUP );
+open ( WIKILIST, '>>/etc/ikiwiki/wikilist' );
+print( WIKILIST "ikiwiki-$reponame /etc/ikiwiki/piny/$reponame.setup\n" );
+close( WIKILIST );
+
+# WRITE APACHE CONFIG
+open ( APACHE, ">/etc/apache2/piny-available/$reponame" );
+print( APACHE '
+ AuthPAM_Enabled on
+ AuthGROUP_Enabled on
+ AuthPAM_FallThrough off
+ AuthBasicAuthoritative off
+ AuthType Basic
+ AuthName "User access to ' . $reponame . ' repository needed."
+ Require group git-' . $reponame . '
+ ' );
+close( APACHE );
+link( "/etc/apache2/piny-available/$reponame", "/etc/apache2/piny-enabled/$reponame");
+system( '/etc/init.d/apache2 reload | grep -v "Reloading web server config: apache2."' );
+
+
+# CREATE IKIWIKI WORKING DIR
+system( "/usr/bin/git clone --quiet /srv/git/$reponame /srv/ikiwiki/$reponame" );
+mkdir( "/srv/www/piny.svcs.cs.pdx.edu/$reponame" );
+mkdir( "/srv/www/cgi.piny.svcs.cs.pdx.edu/repos/$reponame" );
+system( "/bin/chown -R ikiwiki-$reponame /srv/ikiwiki/$reponame /srv/www/piny.svcs.cs.pdx.edu/$reponame /srv/www/cgi.piny.svcs.cs.pdx.edu/repos/$reponame" );
+
+open ( WIKILIST, ">/etc/ikiwiki/wikilist.d/$reponame" ); # Maybe someday ikiwiki will support wikilist.d.
+print( WIKILIST "ikiwiki-$reponame /etc/ikiwiki/piny/$reponame.setup\n" ); # In the meantime, we fake it.
+close( WIKILIST );
+$wikilisttempfile = `/bin/mktemp`;
+chomp( $wikilisttempfile );
+system( "/bin/cat /etc/ikiwiki/wikilist.d/* > $wikilisttempfile" );
+chmod ( 0644, $wikilisttempfile );
+system( "/bin/mv $wikilisttempfile /etc/ikiwiki/wikilist" ); # This is marginally racy, but the consequences are probably ignorable.
+
+open ( CGITRC, ">/etc/cgitrc.d/$reponame" ); # Maybe someday cgit will support cgitrc.d.
+print( CGITRC
+"repo.url=$reponame
+repo.path=/srv/git/$reponame.git
+repo.desc=$reponame
+repo.owner=$email
+
+" ); # In the meantime, we fake it.
+close( CGITRC );
+$cgitrctempfile = `/bin/mktemp`;
+chomp( $cgitrctempfile );
+system( "/bin/cat /etc/cgitrc.d/* > $cgitrctempfile" );
+chmod ( 0644, $cgitrctempfile );
+system( "/bin/mv $cgitrctempfile /etc/cgitrepos" ); # This is marginally racy, but the consequences are minor.
+
+# COMPILE
+system( "/usr/bin/sudo -u ikiwiki-$reponame /usr/bin/ikiwiki --setup /etc/ikiwiki/piny/$reponame.setup | grep -v 'successfully generated'" );
diff --git a/usr/local/sbin/newuser b/usr/local/sbin/newuser
new file mode 100755
index 0000000..e0b175b
--- /dev/null
+++ b/usr/local/sbin/newuser
@@ -0,0 +1,129 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Email::Valid::Loose qw( );
+
+# If they passed any arguments, complain and exit.
+if ( scalar @ARGV ) {
+ print "You can't pass any arguments to this script!\n";
+ exit 2;
+};
+
+# If they didn't provide a terminal definition, then assume xterm.
+# Everybody emulates xterm to at least a basic extent.
+if ( not exists $ENV{"TERM"} ) {
+ $ENV{"TERM"} = "xterm";
+ print "I don't know what terminal you're using; guessing xterm...\n";
+};
+
+# Disable buffering.
+$|++;
+
+# Configure the strictness of our email checks.
+my $checker = Email::Valid::Loose->new
+ ( "-fqdn" => 1
+ , "-fudge" => 0
+ , "-local_rules" => 0
+ , "-mxcheck" => 1
+ , "-tldcheck" => 0
+ );
+
+my ( $email, $username, $password1, $password2 );
+
+while ( 1 ) {
+
+ print "Your email address: ";
+ chomp ( $email = );
+
+ if ( $email eq "" ) {
+ print "You must provide an email address!\n";
+ next;
+ };
+
+ $email = $checker->address( $email );
+ if ( not defined $email ) {
+ print "Please, at least pretend to provide a valid email address.\n";
+ next;
+ };
+
+ last;
+
+};
+
+while ( 1 ) {
+
+ print "Desired username: ";
+ chomp ( $username = );
+
+ if ( $username eq "" ) {
+ print "You have to enter a username!\n";
+ next;
+ };
+
+ if ( $username =~ /^git-|^ikiwiki-/ ) {
+ print "Your username cannot start with git- or ikiwiki-!\n";
+ next
+ };
+
+ if ( $username !~ /^[a-zA-Z0-9_.][a-zA-Z0-9_.-]+$/ ) {
+ print( "Usernames must consist only of letters, digits, underscores, periods, and dashes, and not start with a dash. Usernames are case sensitive.\n" );
+ next
+ };
+
+ last;
+
+};
+
+while ( 1 ) {
+
+ system( "stty", "-echo" );
+ print "Desired password: ";
+ chomp ( $password1 = );
+ print "\nRetype password: ";
+ chomp ( $password2 = );
+ print "\n";
+ system( "stty", "echo" );
+
+ if ( $password1 ne $password2 ) {
+ print "Provided passwords do not match; try again.\n";
+ next;
+ };
+
+ if ( $password1 eq "" ) {
+ print "You have to enter a password!\n";
+ next;
+ };
+
+ last;
+
+};
+
+my @saltchars =
+ ( 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'
+ , 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
+ , '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'
+ , '.', '/'
+ );
+
+my $salt = "\$6\$";
+
+foreach my $n ( 1 .. 16 ) {
+ $salt .= $saltchars[int ( rand ( scalar @saltchars ) )];
+};
+
+$salt .= "\$";
+
+my $crypt = crypt( $password1, $salt );
+
+my $ret = system( "/usr/sbin/useradd", "-c", "$email", "-k", "/var/empty", "-g", "users", "-m", "-p", $crypt, "-s", "/usr/local/bin/pinyshell", $username );
+
+if ( $ret ) {
+ print "An error occured creating the user; most likely, that username is already taken.\n";
+ exit 1;
+};
+
+print "Your user has been created. Try logging in!\n";
+
+exit 0;
diff --git a/usr/local/sbin/rmaccess b/usr/local/sbin/rmaccess
new file mode 100755
index 0000000..2f7e06e
--- /dev/null
+++ b/usr/local/sbin/rmaccess
@@ -0,0 +1,39 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+my( $reponame, $uid, $gitowner);
+
+if ( ( ! scalar $ARGV[1] ) or ( scalar $ARGV[2] ) ) { # must have exactly two arguments
+ print( "Usage: rmaccess USER REPONAME\n" );
+ exit( 1 );
+} elsif ( ( $ARGV[0] !~ /^[a-zA-Z0-9_.][a-zA-Z0-9_.-]+$/ ) or ( $ARGV[1] !~ /^[a-z0-9][a-z0-9+.-]+$/ ) ) { # Extra paranoid sanity checking
+ print( "Usage: rmaccess USER REPONAME\n" );
+ print( " USER must consist only of letters, digits, underscores, periods, and dashes, and not start with a dash.\n");
+ print( " REPONAME must consist only of lower case letters (a-z), digits (0-9), plus (+) and minus (-) signs, and periods (.).\n" );
+ print( " REPONAME must be at least two characters long and must start with an alphanumeric character.\n" );
+ exit( 1 );
+} else {
+ $reponame = $ARGV[1];
+};
+
+open (PASSWD, '/etc/passwd');
+while() {
+ if( $_ =~ /^$ENV{SUDO_USER}:.+?:(.+?):/ ) { $uid = $1; }; # grabbing uid.
+};
+close(PASSWD);
+
+unless( -d "/srv/git/$reponame.git" ) {
+ print( "/srv/git/$reponame.git doesn't exist!\n" );
+ exit( 2 );
+};
+
+$gitowner = (stat( "/srv/git/$reponame.git" ))[4]; # grab owner uid of repository
+
+if( ( $gitowner != $uid ) and ( $gitowner != 65534 ) ) {
+ print( "$reponame is not owned by you!\n" );
+ exit( 3 );
+};
+
+system( "/usr/sbin/deluser $ARGV[0] git-$reponame" );
diff --git a/usr/local/sbin/rmrepo b/usr/local/sbin/rmrepo
new file mode 100755
index 0000000..3905412
--- /dev/null
+++ b/usr/local/sbin/rmrepo
@@ -0,0 +1,64 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+my( $reponame, $uid, $gitowner, $wikilisttempfile, $cgitrctempfile);
+
+if ( ( ! scalar $ARGV[0] ) or ( scalar $ARGV[1] ) or ( $ARGV[0] !~ /^[a-z0-9][a-z0-9+.-]+$/ ) ) {
+ print( "Usage: rmrepo REPONAME\n" );
+ exit( 1 );
+} else {
+ $reponame = $ARGV[0];
+};
+
+open (PASSWD, '/etc/passwd');
+while() {
+ if( $_ =~ /^$ENV{SUDO_USER}:.+?:(.+?):/ ) { $uid = $1; }; # grabbing uid.
+};
+close(PASSWD);
+
+unless( -d "/srv/git/$reponame.git" ) {
+ print( "/srv/git/$reponame.git doesn't exist!\n" );
+ exit( 2 );
+};
+
+$gitowner = (stat "/srv/git/$reponame.git")[4];
+
+if( ( $gitowner != $uid ) and ( $gitowner != 65534 ) ) {
+ print( "$reponame is not owned by you!\n" );
+ exit( 3 );
+};
+
+# We have to be careful about how we delete things; we don't want have post-update or ikiwiki.cgi thrashing, and we REALLY don't want to leave remappable owner UIDs around, but we're also keying security on /srv/git/$reponame
+system( "/bin/chown -R nobody.nogroup /srv/git/$reponame.git" );
+
+unlink( "/etc/ikiwiki/wikilist.d/$reponame" );
+$wikilisttempfile = `/bin/mktemp`;
+chomp ( $wikilisttempfile );
+system( "/bin/cat /etc/ikiwiki/wikilist.d/* > $wikilisttempfile" );
+chmod ( 0644, $wikilisttempfile );
+system( "/bin/mv $wikilisttempfile /etc/ikiwiki/wikilist" ); # This is marginally racy, but the consequences are probably ignorable.
+
+unlink( "/etc/cgitrc.d/$reponame" );
+$cgitrctempfile = `/bin/mktemp`;
+chomp ( $cgitrctempfile );
+system( "/bin/cat /etc/cgitrc.d/* > $cgitrctempfile" );
+chmod ( 0644, $cgitrctempfile );
+system( "/bin/mv $cgitrctempfile /etc/cgitrepos" ); # This is marginally racy, but the consequences are probably ignorable.
+
+system( "/bin/rm -r /srv/www/piny.svcs.cs.pdx.edu/$reponame" );
+system( "/bin/rm -r /srv/www/cgi.piny.svcs.cs.pdx.edu/repos/$reponame" );
+
+unlink( "/etc/ikiwiki/piny/$reponame.setup" );
+system( "/bin/rm -r /srv/ikiwiki/$reponame" );
+
+unlink( "/etc/apache2/piny-available/$reponame" );
+unlink( "/etc/apache2/piny-enabled/$reponame" );
+system( '/etc/init.d/apache2 reload | grep -v "Reloading web server config: apache2."' );
+
+system( "/usr/sbin/delgroup --quiet git-$reponame" );
+system( "/usr/sbin/deluser --quiet --remove-home ikiwiki-$reponame" );
+system( "/usr/sbin/delgroup --quiet ikiwiki-$reponame" );
+
+system( "/bin/rm -rf /srv/git/$reponame.git" );
--
cgit v1.2.3
+
+- Remove comment
+
+
+