source: trunk/build.sh @ 771

Revision 771, 1.8 KB checked in by r2, 10 months ago (diff)

1.8 final

  • Property svn:executable set to *
Line 
1#!/bin/bash
2
3VERSION=$1;
4TO_DIR=$2;
5TO_DIR_DEFAULT='/home/r2/www/icms_build';
6
7SRC_DIR='/home/r2/www/icms';
8DISTR_NAME='instantCMS_'`date +%Y%m%d`'_v'$VERSION'.zip';
9
10if [[ $VERSION = "" ]]
11then
12        echo "Usage:    build.sh VERSION [TARGET_PATH]";
13        echo "Example:  build.sh 1.2.1 /var/www/icms_build";
14        echo "";
15        exit 1;
16fi
17
18if [[ $TO_DIR = "" ]]
19then
20        TO_DIR=$TO_DIR_DEFAULT;
21fi
22
23echo "";
24echo "Building version:  $VERSION";
25echo "Building to:       $TO_DIR";
26echo "";
27
28echo "Copying files...";
29cp -R $SRC_DIR/. $TO_DIR/. && chmod -R 777 $TO_DIR
30
31echo "Deleting SVN folders...";
32find $TO_DIR -type d -iname '.svn' -print0 | xargs -0 rm -rf
33
34echo "Deleting .tmp files...";
35find $TO_DIR -type f -iname '*.tmp' -print0 | xargs -0 rm -f
36
37echo "Deleting configuration file...";
38rm -f $TO_DIR/includes/config.inc.php
39
40echo "Deleting cache...";
41rm -f $TO_DIR/cache/*;
42
43echo "Deleting backups...";
44rm -f $TO_DIR/backups/*.sql;
45rm -f $TO_DIR/backups/*.sql~;
46
47echo "Deleting RSS cache...";
48rm -f $TO_DIR/includes/rss/cache/*;
49
50echo "Deleting files in root...";
51find $TO_DIR -maxdepth 1 -mindepth 1 -type f -not -name cron.php -not -name .htaccess -not -name url_rewrite.php -not -name readme.txt -not -name version_log.txt -not -name license.txt -not -name license.rus.win.txt -not -name license.rus.utf.txt -not -name index.php -not -name $DISTR_NAME -print0 | xargs -0 rm -f;
52echo "";
53
54echo "Building archive...";
55cd $TO_DIR;
56zip -r -q $TO_DIR/distr.zip * .htaccess;
57
58echo "Renaming archive to $DISTR_NAME...";
59mv $TO_DIR/distr.zip $TO_DIR/$DISTR_NAME;
60
61echo "Cleaning target directory...";
62find $TO_DIR -maxdepth 1 -mindepth 1 -type d -print0 | xargs -0 rm -rf;
63find $TO_DIR -maxdepth 1 -mindepth 1 -type f -not -name $DISTR_NAME -print0 | xargs -0 rm -f;
64
65echo "";
66echo "Finished.";
67echo "";
68
69nautilus $TO_DIR &> /dev/null &
Note: See TracBrowser for help on using the repository browser.