The script below is a basic script that I use in conjunction with RPMs that I have created to install WebWork. Eventually I will figure out how to have this actions occur inside of the RPM.
mkdir /opt/webwork/courses
mkdir /opt/webwork/libraries
cd /opt/webwork/webwork2/courses.dist
cp *.lst /opt/webwork/courses/
rsync -a --exclude '.svn' modelCourse /opt/webwork/courses/
cd /opt/webwork/pg
chmod -R u+rwX,go+rX .
cd /opt/webwork/webwork2
chmod -R u+rwX,go+rX .
groupadd wwdata
cd /opt/webwork/webwork2/
chgrp -R wwdata DATA ../courses htdocs/tmp logs tmp
chmod -R g+w DATA ../courses htdocs/tmp logs tmp
find DATA/ ../courses/ htdocs/tmp logs/ tmp/ -type d -a ! \( -name .svn -prune \) -exec chmod g+s {} \;
newgrp wwdata
/opt/webwork/webwork2/bin/addcourse --db-layout=sql_single --users=adminClasslist.lst --professors=admin