File:  [mozdev] / templates / gen_project.sh
Revision 1.19: download - view: text, annotated - select for diffs - revision graph
Tue Sep 11 15:19:54 2007 UTC (12 years, 3 months ago) by cdn
Branches: MAIN
CVS tags: HEAD
[NOTES is outdated and edit.html is a bad way to manage it]

#!/bin/sh

# $2 is new project name

if !(test $2)
then
  printf "\n\nuseage: $0 <project name> <path to project local repos>\n\n";
  printf "Example: $0 jslib /usr/src/jslib\n\n";
  exit;

else
  DEST=$2/www;
  tmpfile1=tmp0001;
  tmpfile2=tmp0002;

  printf "\ncopying template files for '$1'\n\n";

  mkdir -p $DEST

  mkdir $2/downloads
  cp README.downloads $2/downloads
  cp README.downloads $2/www

  mkdir $2/src

  mkdir $2/www/error
  cp www/error/404.html $2/www/error

  mkdir $2/www/protected
# cp www/protected/edit.html $2/www/protected

  cp www/* $DEST;
  rm -fr $DEST/error/CVS
  cp www/local.conf $DEST; # ?
  cd $DEST;

  for files in *.html
  do
      echo "modifying: $files";
      sed -e 's:PROJECT_NAME:'$1':g' "$files"  > $tmpfile1;
      sed -e 's:PROJECTNAME:'$1':g'  $tmpfile1 > $tmpfile2;
      sed -e 's:templates:'$1':g'   $tmpfile2 > $tmpfile1;
      sed -e 's:Templates:'$1':g'   $tmpfile1 > $tmpfile2;
      mv $tmpfile2 $files;
  done

  rm $tmpfile1;

  cd ..

  cvs add www
  wait;
  cvs add downloads src www/error www/protected
  wait;
  cvs add downloads/*.* www/*.* www/error/*.* www/protected/*.*
  wait;

  cvs ci -m 'adding templates'
  wait;

  printf "\n\nFinished adding project template files for '$1' . . . \n\n";

fi

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>