--- /dev/null
+# Citylink Mirror
+#deb http://ftp.nz.debian.org/debian/ sarge main non-free
+#deb-src http://ftp.nz.debian.org/debian/ sarge main
+deb http://debian.catalyst.net.nz/debian/ sarge main non-free
+deb-src http://debian.catalyst.net.nz/debian/ sarge main
+
+# Catalyst Packages
+deb http://debian.catalyst.net.nz/catalyst stable catalyst
+
+# Security Updates
+deb http://security.debian.org/ sarge/updates main
+deb-src http://security.debian.org/ sarge/updates main
+
+# To match manage.eduforge.org
+deb http://www.backports.org/debian sarge-backports main contrib non-free
+deb http://volatile.debian.net/debian-volatile sarge/volatile main contrib non-free
--- /dev/null
+# ~/.bashrc: executed by bash(1) for non-login shells.
+# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
+# for examples
+shopt -s histappend
+
+. /etc/bash_completion
+# If not running interactively, don't do anything
+[ -z "$PS1" ] && return
+
+# don't put duplicate lines in the history. See bash(1) for more options
+export HISTCONTROL=ignoredups
+
+# check the window size after each command and, if necessary,
+# update the values of LINES and COLUMNS.
+shopt -s checkwinsize
+
+# make less more friendly for non-text input files, see lesspipe(1)
+[ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"
+
+# set variable identifying the chroot you work in (used in the prompt below)
+if [ -z "$debian_chroot" -a -r /etc/debian_chroot ]; then
+ debian_chroot=$(cat /etc/debian_chroot)
+fi
+
+# set a fancy prompt (non-color, unless we know we "want" color)
+case "$TERM" in
+xterm-color)
+ PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
+ ;;
+*)
+ PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
+ ;;
+esac
+
+[ -x ~/.sh_prompt ] && . ~/.sh_prompt
+
+
+# enable color support of ls and also add handy aliases
+if [ "$TERM" != "dumb" ]; then
+ eval "`dircolors -b`"
+ alias ls='ls --color=auto'
+ #alias dir='ls --color=auto --format=vertical'
+ #alias vdir='ls --color=auto --format=long'
+fi
+
+# some more ls aliases
+#alias ll='ls -l'
+#alias la='ls -A'
+#alias l='ls -CF'
+
+# enable programmable completion features (you don't need to enable
+# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
+# sources /etc/bash.bashrc).
+#if [ -f /etc/bash_completion ]; then
+# . /etc/bash_completion
+#fi
+
+[ -r ~/.sh_aliases ] && . ~/.sh_aliases
+[ -r ~/.sh_env ] && . ~/.sh_env
+[ -r ~/.sh_func ] && . ~/.sh_func
--- /dev/null
+*:*:*:gforge:wahP8xoo
--- /dev/null
+alias ..='cd ..'
+alias ...='cd ../..'
+alias acs='apt-cache search'
+alias agi='sudo aptitude install'
+alias agu='sudo aptitude update'
+alias cgd='cg-diff'
+alias cgfixtags='cg-restore -f tags'
+alias cgl='cg-log'
+alias cgs='cg-status'
+alias cp='cp -v'
+alias df='df -h'
+alias dotdirs='perl -e '\''$,="\n"; print grep { -d && /\.[^. ]+/ } <.*>; print "\n";'\'''
+alias du='du -h'
+alias florida='lftp sftp://luke@florida.wgtn.cat-it.co.nz'
+alias gk2w='gitk --all --since=2.weeks.ago'
+alias grep='egrep'
+alias home='ssh -Xt 60.234.149.239'
+alias la='ls -AXF --color=always'
+alias ll='ls -lhXF --color=always'
+alias lla='ll -hAXF --color=always'
+alias ls='ls -XF --color=always'
+alias mach='ssh mach.catalyst.net.nz'
+alias mv='mv -v'
+alias now='date +"%Y%m%d-%H%M%S"'
+alias phtags='ctags --langmap=php:+.inc.html.class -R *'
+alias rm='rm -v'
+alias silence='sudo mount -t smbfs -o guest //silence/music /media/silence'
+alias ~='cd ~'
+alias kgd='GIT_EXTERNAL_DIFF=~/bin/fakediff cgd'
+#alias ssh='bcvim --wrap-ssh --'
+alias mdinfo='grep -e '\''^\$CFG->db'\'' config.php'
+alias gs='git-status'
+alias gl='git-log'
+alias gd='git-diff'
+alias gco='git-checkout'
--- /dev/null
+# git development env
+export GIT_AUTHOR_NAME=Luke\ Hudson
+export GIT_COMMITTER_NAME=Luke\ Hudson
+export GIT_COMMITTER_EMAIL=luke@catalyst.net.nz
+export GIT_AUTHOR_EMAIL=luke@catalyst.net.nz
+export PATH=$PATH:~/bin:~/code/perl:~/code/perl/pgtools:~/code/perl/moodle
+
+export EDITOR=/usr/bin/vim
+export KARMDIR=~/.kde/share/apps/karm
+
+export CVS_RSH=ssh
+
+export GITSSH='git+ssh://git.catalyst.net.nz/var/git'
+export GITHTTP='http://git.catalyst.net.nz/git'
+
+export PAPERSIZE="a4"
+export PAPERCONF="/etc/papersize"
--- /dev/null
+function sbackup() {
+ if [ $# -eq 0 ]
+ then
+ echo -e "Usage:\n\tbackup(file)"
+ return
+ fi
+ bkp="$1.`now`"
+ sudo cp -v "$1" "$bkp"
+}
+
+function backup() {
+ if [ $# -eq 0 ]
+ then
+ echo -e "Usage:\n\tbackup(file)"
+ return
+ fi
+ bkp="$1.`now`"
+ cp -v "$1" "$bkp"
+}
+
+function cgc() {
+ if [ $# -lt 2 ]
+ then
+ echo -e "Uasge:\n\tcgc gitfile#branch targetdir"
+ return
+ fi
+ branch=$1
+ dir=$2
+ # echo "cloning from $branch to $dir"
+ cg-clone "git+ssh://git.catalyst.net.nz/var/git/$branch" "$dir"
+}
+
+function q() {
+ [ $# -eq 0 ] && echo "Usage: q command" && return
+ $* >/dev/null 2>&1 &
+}
+
+function finame () {
+ find . -iname '*'"$1"'*'
+}
+function firegex() {
+ find . -regextype egrep -regex "$1"
+}
+
--- /dev/null
+set history:50 " keep 50 lines of command line history
+set ruler " show the cursor position all the time
+set incsearch " do incremental searching
+set number " Line numbering
+set mouse=a " Full mouse usage
+" Tabstuff
+set expandtab
+set shiftwidth:4
+set tabstop:4
+set guifont:Bitstream\ Vera\ Sans\ Mono\ Bold\ 10
+set vb " Visual bell instead of annoying beeps
+set shellcmdflag=-ic
+set nowrapscan
+
+if !has("gui_running")
+ set bg=dark
+else
+ colorscheme darkblue
+endif
+
+syntax on
+
+" Only do this part when compiled with support for autocommands.
+if has("autocmd")
+ " Enable file type detection.
+ " Use the default filetype settings, so that mail gets 'tw' set to 72,
+ " 'cindent' is on in C files, etc.
+ " Also load indent files, to automatically do language-dependent indenting.
+ filetype plugin indent on
+
+ " Put these in an autocmd group, so that we can delete them easily.
+ augroup vimrcEx
+ au!
+
+ " For all text files set 'textwidth' to 78 characters.
+ autocmd FileType text setlocal textwidth=78
+
+ " When editing a file, always jump to the last known cursor position.
+ " Don't do it when the position is invalid or when inside an event handler
+ " (happens when dropping a file on gvim).
+ autocmd BufReadPost *
+ \ if line("'\"") > 0 && line("'\"") <= line("$") |
+ \ exe "normal g`\"" |
+ \ endif
+
+ augroup END
+else
+ set autoindent " always set autoindenting on
+endif " has("autocmd")
+
+" Don't use Ex mode, use Q for formatting
+map Q gq
+
+" Movement mapping
+imap \e[1;5D \ fb
+" Maps C-LEFT to back-word in insert mode and cmdline etc.
+imap \e[1;5C \ fw
+" Maps C-RIGHT to fwd-word in insert mode and cmdline etc.
+map \e[1;5D b
+" Maps C-LEFT to back-word in normal mode
+map \e[1;5C w
+" Maps C-RIGHT to fwd-word in normal mode
+
+map \e[1;5A \e[5~
+" Ctrl+Up == PageUp
+map \e[1;5B \e[6~
+" C+Down = PageDn
+map \e[1;5H gg
+" C+Home = go-begin
+map \e[1;5F G
+" C+End = go-end
+imap \e[1;5A \e[5~
+" Ctrl+Up == PageUp
+imap \e[1;5B \e[6~
+" C+Down = PageDn
+imap \e[1;5H \ fgg
+" C+Home = go-begin
+imap \e[1;5F \ fG
+" C+End = go-end
+
+" map F5 to save+execute current file
+"map <F5> \e:w\r\e:execute '!clear;' . getcwd() . '/' . bufname('%')\r
+"imap <F5> \e:w\r\e:execute '!clear;' . getcwd() . '/' . bufname('%')\r
+
+" Use F6 and C-F6 to move between files
+"map <F6> :bn\r
+"map [17;5~ :bp\r
+"map! [17;5~ \e:bp\r
+"map! <F6> \e:bn\r
+
+" Control+S saves, due to long habit
+imap \13 \ f:w\r
+map \13 \e:w\r
+
+" F12 shows browser window
+"map <F12> :call VE()\r
+"imap <F12> \ f:call VE()
+
+" F3 does what I expect (find next)
+"cmap <F3> \rn
+"map <F3> n
+
+" F10 shows list of sub's in current file
+map <silent> <F10> :execute "grep sub ".bufname('%')^M^M:cw^M
+" Alt+Insert toggles mouse on/off
+
+map <silent> \e[2;3~ :call ToggleMouse()\r
+map! <silent> \e[2;3~ \e:call ToggleMouse()\r
+
+" Another long habit - Ctrl+Space for completion
+imap <Nul> \ e
+
+
+"--------------------------------------------------------------------------------
+" Functions and commands
+"--------------------------------------------------------------------------------
+"
+command Rz :call Resolve()
+
+function VE()
+ let g:explVertical=1
+ let g:explStartRight=1
+ let g:explWinSize=45
+ S
+ let g:explVertical=0
+ let g:explStartRight=0
+ let g:explWinSize=15
+endfu
+
+function ToggleMouse()
+ if &mouse=="a"
+ let &mouse=""
+ echo "Mouse disabled"
+ else
+ let &mouse="a"
+ echo "Mouse enabled"
+ endif
+endfu
+
+function SplitSwitch()
+ let path=bufname("%")
+endfu
+
+function Resolve()
+ let orig=substitute( bufname('%'), '.rej','','')
+ execute ':sp ' . orig
+ set ft:php
+endfu
+
+
+function Comment()
+ '<,'>s/^/#/
+endfu
+
+
+set t_Co=88
+
+"if has("terminfo")
+" set t_Co=16
+" set t_AB=\e[%?%p1%{8}%<%t%p1%{40}%+%e%p1%{92}%+%;%dm
+" set t_AF=\e[%?%p1%{8}%<%t%p1%{30}%+%e%p1%{82}%+%;%dm
+"else
+" set t_Co=16
+" set t_Sf=\e[3%dm
+" set t_Sb=\e[4%dm
+"endif
--- /dev/null
+/home/luke/eduforge.pgdump
\ No newline at end of file
--- /dev/null
+/home/luke/eduforge_wiki.pgdump
\ No newline at end of file
--- /dev/null
+#!/bin/bash
+
+cd /root
+mkdir out
+chmod a+rwX -R out
+cd out
+pg_restore -Ox ../eduforge.pgdump -f eduforge.sql
+/root/fix1252 eduforge.sql eduforge_fixed.sql
+
+sudo -u postgres psql template1 -c "update pg_shadow set usesuper=true where usename='gforge'"
+
+psql -U gforge eduforge -f eduforge_fixed.sql 2>&1 > /root/eduforge_restore.log
+
+pg_restore -Ox -U gforge -d eduforge_wiki /root/eduforge_wiki.pgdump 2>&1 > /root/eduforge_wiki_restore.log
+
+
+sudo -u postgres psql template1 -c "update pg_shadow set usesuper=false where usename='gforge'"
--- /dev/null
+eduforge.pgdump root
+eduforge_wiki.pgdump root
+fix1252 root
+restoredb.sh root
+.pgpass root
--- /dev/null
+sudo
+ssh
+curl
+locales
+less
+apache
+libapache-dbi-perl
+libapache-mod-choke
+libapache-mod-perl
+libapache-mod-ssl
+libapache-mod-php4
+php4
+libphp-jpgraph
+php4-cgi
+php4-cli
+php4-common
+php4-domxml
+php4-gd
+php4-imagick
+php4-ldap
+php4-mcrypt
+php4-mysql
+php4-pear
+php4-pgsql
+php4-xslt
+postgresql
+postgresql-client
+postgresql-contrib
+cronolog
+lsof
+
--- /dev/null
+# Add a /etc/hosts entry on the HostOS
+cat /etc/hosts > /etc/hosts.new
+echo "${VSIPADDR} ${VSNAME}.$(hostname -f) ${VSNAME}" >> /etc/hosts.new
+mv /etc/hosts.new /etc/hosts
+
+# Copy the user's password from the host
+grep -v "^${PROFILEOPTION_username}" ${VSROOT}/etc/shadow > /vserver/.shadow
+grep "^${PROFILEOPTION_username}" /etc/shadow >> /vserver/.shadow
+mv /vserver/.shadow ${VSROOT}/etc/shadow
+
--- /dev/null
+echo "${PROFILEOPTION_username} ALL=(ALL) ALL" >> /etc/sudoers
+DEBIAN_PRIORITY=critical; dpkg-reconfigure locales
+
+
+
+# Setup links to eduforge src
+ln -s /usr/share/eduforge/etc /etc/gforge
+ln -s /usr/share/eduforge/etc/httpd.conf /etc/apache/conf.d/gforge.httpd.conf
+ln -s /usr/share/eduforge /usr/lib/gforge
+
+
+# Setup db user and pg_hba.conf, and empty databases
+sudo -u postgres createuser -A -d gforge
+sudo -u postgres createdb -E UTF8 -O gforge eduforge
+sudo -u postgres createdb -E LATIN1 -O gforge eduforge_wiki
+
+# insert gforge user into pg_hba.conf, at line 91 (suits this version of file)
+sed -ri '88s/.*/\0\nlocal all gforge md5\n/' /etc/postgresql/pg_hba.conf
+/etc/init.d/postgresql restart
+
+# For command-line convenience
+sudo -u postgres createuser -a -d root
+sudo -u postgres createdb root -O root
+
+## In case tsearch2 needs adding -- shouldn't if doing pg_restore from eduforge db.
+# #(cd /usr/share/postgresql/7.4/main/contrib; sudo -u postgres psql eduforge < tsearch2.sql)
+
+# Enable apache mods
+apache-modconf apache enable mod_env
+apache-modconf apache enable mod_vhost_alias
+apache-modconf apache enable mod_ssl
+
+# Enable postgresql extension for php
+sed -ri '539s/.*/\0\nextension=pgsql.so\n/' /etc/php4/apache/php.ini
+sed -ri '539s/.*/\0\nextension=pgsql.so\n/' /etc/php4/cli/php.ini
+/etc/init.d/apache restart
+
+# Add gforge nix user etc.
+groupadd gforge
+useradd -g gforge -m gforge
+
+mkdir /home/groups
+mkdir /usr/share/eduforge/homedirs
+ln -s /home/groups /usr/share/eduforge/homedirs/groups
+
+(cd /usr/share/eduforge; ./setup)
+
+updatedb
+
+(cd /root; ./restoredb.sh)
+#pg_restore -Ox -U gforge -d eduforge /root/eduforge.pgdump 2>&1 >/root/eduforge_restore.log
+#pg_restore -Ox -U gforge -d eduforge_wiki /root/eduforge_wiki.pgdump 2>&1 > /root/eduforge_wiki_restore.log
+
+/etc/init.d/apache restart
+
+# Now set the password for gforge dbuser. This isn't done earlier so that pg_restores work (I hope)
+sudo -u postgres psql template1 -c "alter user gforge with encrypted password 'wahP8xoo';"
+
+
+echo '
+
+You will probably have to do the following manually inside the vserver.
+
+cd /root
+./restoredb.sh
+
+'
--- /dev/null
+mkdir /etc/vservers/${VSNAME}/scripts -p
+mkdir /vserver/${VSNAME}/data -p
+
+echo '/home' > /etc/vservers/${VSNAME}/namespace-cleanup-skip
+
+if [ -d /home/${PROFILEOPTION_username}/src/${VSNAME}/ ]; then
+ cat >/etc/vservers/${VSNAME}/scripts/pre-start << EOF
+ #!/bin/bash
+ mkdir -p /vserver/${VSNAME}/usr/share/${VSNAME}/
+ mount --bind /home/${PROFILEOPTION_username}/src/${VSNAME}/ /vserver/${VSNAME}/usr/share/${VSNAME}/
+
+EOF
+ chmod 755 /etc/vservers/${VSNAME}/scripts/pre-start
+
+ cat >/etc/vservers/${VSNAME}/scripts/post-stop << EOF
+ #!/bin/bash
+
+ umount /vserver/${VSNAME}/usr/share/${VSNAME}
+EOF
+ chmod 755 /etc/vservers/${VSNAME}/scripts/post-stop
+
+fi
--- /dev/null
+if [ "$VSRELEASE" = "sarge" ]; then
+ echo "running pwconv"
+ pwconv
+fi
+cp /usr/share/zoneinfo/NZ /etc/localtime
+echo "${VSIPADDR} ${VSNAME}" >> /etc/hosts
+echo 'locales locales/locales_to_be_generated select en_NZ ISO-8859-1, en_NZ.UTF-8 UTF-8' | debconf-set-selections
+
+
+echo 'debconf debconf/priority select critical' | debconf-set-selections
+echo 'exim4-config exim4/dc_eximconfig_configtype string mail sent by smarthost; no local mail' | debconf-set-selections
+echo 'exim4-config exim4/dc_smarthost string smtp.catalyst.net.nz' | debconf-set-selections
--- /dev/null
+parent =
+release = sarge
+mirror = http://debian.catalyst.net.nz/debian
+inherit-aptsources = yes
+inherit-packages = yes
+inherit-pre-vserver = yes
+inherit-pre-host = yes
+inherit-post-vserver = yes
+inherit-post-host = yes
+inherit-files = yes
+inherit-templates = yes
--- /dev/null
+# Remove /etc/hosts entry on the host OS
+grep -v "^${VSIPADDR}" /etc/hosts > /etc/hosts.new
+mv /etc/hosts.new /etc/hosts
+
+# this isn't set because we don't pass options to remove
+# USR=$PROFILEOPTION_username
+USR=penny
+
+grep -v "^${VSNAME}" /home/${USR}/.ssh/known_hosts > /home/${USR}/.ssh/known_hosts.new
+chown ${USR}:${USR} /home/${USR}/.ssh/known_hosts.new
+mv /home/${USR}/.ssh/known_hosts.new /home/${USR}/.ssh/known_hosts