-
Notifications
You must be signed in to change notification settings - Fork 11
/
upgrade-from-2.3.sh
executable file
·100 lines (73 loc) · 2.68 KB
/
upgrade-from-2.3.sh
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/sh
#
# AvantFAX install script
#
. rh-prefs.txt
## SETUP SMARTY (for AvantFAX 3.0)
chmod 0770 avantfax/includes/templates/admin_theme/templates_c/ avantfax/includes/templates/admin_theme/cache/ avantfax/includes/templates/main_theme/templates_c/ avantfax/includes/templates/main_theme/cache/
chown $HTTPDUSER:$HTTPDGROUP avantfax/includes/templates/admin_theme/templates_c/ avantfax/includes/templates/admin_theme/cache/ avantfax/includes/templates/main_theme/templates_c/ avantfax/includes/templates/main_theme/cache/
chmod 0755 avantfax/includes/faxcover.php avantfax/includes/faxrcvd.php avantfax/includes/notify.php avantfax/tools/update_contacts.php avantfax/tools/faxcover.php avantfax/includes/avantfaxcron.php avantfax/includes/dynconf.php
echo "Removing old AvantFAX files"
find $INSTDIR -name "*.php" -exec rm -f {} \;
find $INSTDIR -name "*.js" -exec rm -f {} \;
find $INSTDIR -name "*.css" -exec rm -f {} \;
echo "Upgrading to AvantFAX 3"
rsync -rvu ./avantfax/ $INSTDIR/
chown -R $HTTPDUSER:$HTTPDGROUP $INSTDIR/
chmod -R 0770 $INSTDIR/tmp $INSTDIR/faxes
chown -R $HTTPDUSER.uucp $INSTDIR/tmp $INSTDIR/faxes
echo "Upgrading PEAR libs"
pear channel-update pear.php.net
pear upgrade-all
pear install MDB2_driver_mysql
echo "Restarting Apache"
/sbin/service httpd restart
echo "Upgrading AvantFAX database schema"
mysql -u$USER -p$PASS $DB < db-update-300.sql
mysql -u$USER -p$PASS $DB < db-update-302.sql
mysql -u$USER -p$PASS $DB < db-update-306.sql
mysql -u$USER -p$PASS $DB < db-update-307.sql
mysql -u$USER -p$PASS $DB < db-update-311.sql
mysql -u$USER -p$PASS $DB < db-update-315.sql
mysql -u$USER -p$PASS $DB < db-update-316.sql
mysql -u$USER -p$PASS $DB < db-update-320.sql
# SYMLINK AVANTFAX SCRIPTS
ln -s $INSTDIR/includes/faxrcvd.php $SPOOL/bin/faxrcvd.php
ln -s $INSTDIR/includes/dynconf.php $SPOOL/bin/dynconf.php
ln -s $INSTDIR/includes/notify.php $SPOOL/bin/notify.php
# CONFIGURE MODEMS TO USE AVANTFAX
for i in `ls $SPOOL/etc/config.*`; do
if [ "$i" != "$SPOOL/etc/config.sav" ]; then
if [ "$i" != "$SPOOL/etc/config.devid" ]; then
tilde=`echo $i | grep '~'`
if [ "$?" -eq "1" ]; then
if [ ! -L $i ]; then
cat >> $i << EOF
#
## AvantFAX
#
FaxrcvdCmd: bin/faxrcvd.php
DynamicConfig: bin/dynconf.php
UseJobTSI: true
EOF
fi
fi
fi
fi
done
cat >> $SPOOL/etc/config << EOF
#
## AvantFAX
#
NotifyCmd: bin/notify.php
EOF
echo "Updating crontab"
crontab -l | grep -v remold > old-cron
crontab old-cron
rm -f old-cron
printf "0 0 * * *\t$INSTDIR/includes/avantfaxcron.php -t 2\n" > /etc/cron.d/avantfax
echo "Updating contacts"
cd $INSTDIR/tools
./update_contacts.php
echo "Your admin account is now called 'admin' with password 'password'"
echo Done