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