ship/mkdist.sh
author Dirk Haun <dirk@haun-online.de>
Sat, 07 Nov 2009 12:57:44 +0100
branchHEAD
changeset 44 ca95b928d283
parent 39 b66c0b4e8555
child 48 8ba060e1bb41
permissions -rwxr-xr-x
On a Mac, check that we don't ship any files that have xattr set (bug #0001021)
     1 #!/bin/bash
     2 #
     3 # mkdist.sh - make a Geeklog distribution from a local Mercurial repository
     4 #
     5 # Usage: mkdist.sh new-version old-version
     6 # e.g. ./mkdist.sh 1.3.9rc1 1.3.8-1sr4 [repository-dir]
     7 
     8 if [ -z "$1" ]; then
     9   echo "Usage: $0 new-version-number old-version-number [repository-dir]"
    10   exit
    11 fi
    12 
    13 if [ -z "$2" ]; then
    14   echo "Need another version number ..."
    15   exit
    16 fi
    17 
    18 if [ -z "$3" ]; then
    19   repository="geeklog"
    20 else
    21   repository="$3"
    22 fi
    23 
    24 NEWVERSION="geeklog-$1"
    25 OLDVERSION="geeklog-$2"
    26 
    27 echo "Creating $NEWVERSION from $repository"
    28 
    29 cd dist
    30 
    31 if [ -d $NEWVERSION ]; then
    32   rm -rf $NEWVERSION
    33 fi
    34 
    35 # use tar to create a copy without the .hg directory
    36 cd ../geeklog
    37 tar cf gl-temp.tar '--exclude=\.hg' $repository
    38 mv gl-temp.tar ../dist/
    39 cd ../dist
    40 tar xf gl-temp.tar
    41 rm -f gl-temp.tar
    42 mv $repository $NEWVERSION
    43 
    44 cp -r -p ../pear-1.3/pear/* $NEWVERSION/system/pear/
    45 # remove PHP_Compat package
    46 rm -rf $NEWVERSION/system/pear/PHP
    47 
    48 cd $NEWVERSION
    49 
    50 # Blaine's test file ...
    51 rm -f public_html/blaine.php
    52 
    53 # accidental early GSoC commits ...
    54 rm -f sql/pgsql_tableanddata.php
    55 rm -f system/databases/pgsql.class.php
    56 
    57 # don't ship MT-Blacklist modules any more
    58 rm -f plugins/spamx/MTBlackList.Examine.class.php
    59 rm -f plugins/spamx/Import.Admin.class.php
    60 # only used by the Import class
    61 rm -rf plugins/spamx/magpierss
    62 rm -f plugins/spamx/rss.inc.php
    63 # you'd need to set up a honeypot to use it
    64 rm -f plugins/spamx/ProjectHoneyPot.Examine.class.php
    65 
    66 # old upgrade files (from pre-1.3 versions)
    67 rm -f sql/updates/*.sql
    68 rm -f sql/updates/1.2.5-1_to_1.3.NOTES
    69 
    70 # PEAR buildpackage files
    71 rm -f plugins/calendar/buildpackage.php
    72 rm -f plugins/links/buildpackage.php
    73 rm -f plugins/polls/buildpackage.php
    74 rm -f plugins/spamx/buildpackage.php
    75 rm -f plugins/staticpages/buildpackage.php
    76 rm -rf system/build
    77 
    78 rm -rf pdfs
    79 rm -f public_html/pdfgenerator.php
    80 rm -rf public_html/layout/professional/pdfgenerator
    81 
    82 # about time we clean up the install directory ...
    83 rm -f public_html/admin/install/addindex.php
    84 
    85 mv db-config.php.dist db-config.php
    86 mv public_html/siteconfig.php.dist public_html/siteconfig.php
    87 
    88 # lib-custom.php.dist is the actual lib-custom.php file now ...
    89 mv system/lib-custom.php.dist system/lib-custom.php
    90 
    91 find . -type f -name '.*' -exec rm \{\} \;
    92 #find . -name CVS -exec rm -r \{\} \; 2>/dev/null
    93 
    94 # if on a Mac, check that we don't have any of those pesky xattributes set
    95 xattr=`which xattr`
    96 if [ -n "$xattr" ]; then
    97   xa=`xattr -r .`
    98   if [ -n "$xa" ]; then
    99     echo "xattr found:"
   100     echo $xa
   101     exit
   102   fi
   103 fi
   104 
   105 find . -type f -exec chmod a-x \{\} \;
   106 chmod a+x emailgeeklogstories
   107 
   108 # set the default permissions
   109 chmod 775 backups
   110 chmod 775 data
   111 chmod 775 logs
   112 chmod 664 logs/*log
   113 # chmod 775 pdfs
   114 chmod 775 public_html/backend
   115 chmod 644 public_html/backend/*.rss
   116 chmod 775 public_html/images/articles
   117 chmod 664 public_html/images/articles/*
   118 chmod 775 public_html/images/topics
   119 chmod 664 public_html/images/topics/*
   120 chmod 775 public_html/images/userphotos
   121 chmod 664 public_html/images/userphotos/*
   122 
   123 cd ..
   124 
   125 diff -b -B --brief --recursive -N $OLDVERSION $NEWVERSION | grep -v 'system.pear' | cut -f 4 -d' ' >changed-files
   126 # diff -b -B --brief --recursive -N $OLDVERSION $NEWVERSION | grep -v layout | grep -v docs | cut -f 4 -d' ' >changed-files
   127 mv changed-files $NEWVERSION/public_html/docs/
   128 
   129 if [ -f $NEWVERSION.tar ]; then
   130   rm $NEWVERSION.tar
   131 fi
   132 
   133 tar cf $NEWVERSION.tar $NEWVERSION
   134 
   135 if [ -f $NEWVERSION.tar.gz ]; then
   136   rm $NEWVERSION.tar.gz
   137 fi
   138 
   139 gzip $NEWVERSION.tar
   140 
   141 md5 $NEWVERSION.tar.gz
   142