-
Notifications
You must be signed in to change notification settings - Fork 6
/
build
executable file
·79 lines (70 loc) · 2.15 KB
/
build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
# Declare vars
TIMESTAMP=`date +%Y%m%d%H%M%S`
BASE=/var/www/openprinting.org/openprinting
echo "Removing Cache and Template Cache Directories from $BASE"
rm -rf $BASE/templates_c/*
rm -rf $BASE/cache/*
echo
# Prepare Foomatic-based backend scripts
SITEURL=http://www.openprinting.org
# Work directory for Foomatic-based backend scripts
WORKDIR=$BASE/foomatic
# Directory for Perl libraries of Foomatic
LIBDIR=foomatic-db-engine/lib
ALIBDIR="$WORKDIR/$LIBDIR"
# Directory of the Foomatic utilities
FOOUTILDIR=foomatic-db-engine
# File download area
DOWNLOADDIR=$BASE/download
# Download area for driver packages
DRIVERDIR=$DOWNLOADDIR/printdriver
# URL for driver package download
DRIVERDIRURL="/download/printdriver"
# URL for PPD file download
PPDDIRURL="/foomatic-db/db/source/"
# Directory for administrative scripts
SCRIPTDIR=.
ASCRIPTDIR="$WORKDIR/$SCRIPTDIR"
# PHP site config file
SITECONFPHP="../inc/siteconf.php"
( cd $WORKDIR
ln -sf `pwd`/foomatic-db ..
echo 'Index for available driver packages ...'
( cd $DRIVERDIR
ls -1 RPMS/*/*.rpm debian/dists/*/*/*/*.deb > index.txt
)
echo "Config file for MySQL database access ..."
php ../dump_mysql_config.php > mysql.conf
mkdir -p $FOOUTILDIR/etc
cp mysql.conf $FOOUTILDIR/etc
echo 'Substitutions:'
for file in *.in; do
rm -f ${file%.in}
cat $file | \
perl -p -e "s,\@SITEURL\@,$SITEURL," | \
perl -p -e "s:\@DRIVERDIR\@:$DRIVERDIR:" | \
perl -p -e "s:\@DRIVERDIRURL\@:$DRIVERDIRURL:" | \
perl -p -e "s:\@PPDDIRURL\@:$PPDDIRURL:" | \
perl -p -e "s:\@LIBDIR\@:$ALIBDIR:" > ${file%.in}
chmod +x ${file%.in}
done
)
# Creating symlinks
( cd $BASE
rm -f query.cgi
ln -s query.php query.cgi
)
# Create upload directory
mkdir -p $BASE/upload
# Chown files
#echo "Chown files..."
#sudo chown -R $OWNER:$GROUP $BASE
#sudo chmod -R g+w $BASE
#find $BASE -type d | xargs sudo chmod g+s
#sudo chown -R www-data:$GROUP $BASE/templates_c
#sudo chown -R www-data:$GROUP $BASE/cache
#sudo chown -R www-data:$GROUP $BASE/upload
#sudo chown -R www-data:$GROUP $BASE/inc/siteconf.php
#sudo chmod 644 $BASE/inc/siteconf.php
echo "Build completed on ${TIMESTAMP}"