Project

General

Profile

« Previous | Next » 

Revision b2e56eb8

Added by Andreas Kohlbecker almost 3 years ago

update script improved

View differences:

scripts/admin/update-dependencies.sh
1
#!/bin/bash
1
#!/bin/bash -x
2 2

  
3 3

  
4 4
# -- options
......
7 7
        -h|--help) print_help=1;;
8 8
        --mailto) MAILTO="$2"; shift ;;
9 9
        --deactivate-install) deactivate_install=1 ;;
10
        --multisite) multisite=1 ;;
10
        --multi-site) multi-site=1 ;;
11 11
        --site-url) site_url=$2; shift ;;
12 12
        *) echo "Unknown parameter passed: $1"; exit 1 ;;
13 13
    esac
......
15 15
done
16 16

  
17 17
if [[ -n "$site_url" ]]; then
18
    unset multisite
18
    unset multi-site
19 19
fi 
20 20

  
21 21
# -- help
22 22
if [[ "$print_help" == "1" ]]; then
23
	echo "USAGE: update-dependencies.sh [--deactivate-install] [--multisite] [--mailto <ADDRESS>]"
23
	echo "USAGE: update-dependencies.sh [--deactivate-install] [--multi-site] [--mailto <ADDRESS>]"
24 24
	echo "  --deactivate-install :  The install.php will be hidden by appending '.off' to the filename"
25 25
	echo "  -h, --help:  Print this help text"
26 26
	echo "  --mailto <ADDRESS>:  send a email to the ADDRESS with a log of the update process"
27
	echo "  --multisite:  Do a multisite update. Requires dataportals-drush. See https://dev.e-taxonomy.eu/svn/trunk/server-scripts/dataportal-admin/"
28
	echo "  --site-url:  The site url to be used with drush. This option disables the --multisite option"
27
	echo "  --multi-site:  Do a multi-site update. Requires dataportals-drush. See https://dev.e-taxonomy.eu/svn/trunk/server-scripts/dataportal-admin/"
28
	echo "  --site-url:  The site url to be used with drush. This option disables the --multi-site option"
29 29
	exit 0
30 30
fi
31 31

  
......
35 35
    exit -1
36 36
fi
37 37

  
38
# --- full backup before any modification
38
# --- backups before any modification
39 39
echo "creating full backup ..."
40 40
archive_file=../drupal-7-cdm-dataportal-backup-$(date -I).tar.gz
41 41
tar -czf $archive_file ./
42 42
echo "backup archive created at "$(readlink -f $archive_file)
43 43

  
44
# -- setup 
44
echo "back up of settings and config files to ${TMP} ..."
45
# backup modified files
46
cp -a web/.htaccess* ${TMP}/
47
# .htaccess.dist is provided by the drupal/drupal package und must not be in the backup
48
rm -f ${TMP}/.htaccess.dist
49
cp -a web/robots*.txt ${TMP}/
45 50

  
51
# -- setup 
46 52
TMP=$(mktemp -d)
47 53

  
48
if [[ "$multisite" == "1" ]]; then
54
if [[ "$multi-site" == "1" ]]; then
49 55
    DRUSH=$(which dataportals-drush) 
50 56
else 
51 57
    DRUSH=./vendor/drush/drush/drush
......
60 66
    DRUSH=$DRUSH" -l $site_url"
61 67
fi 
62 68

  
63
echo "back up of settings and config files to ${TMP} ..."
64
# backup modified files
65
cp -a web/.htaccess* ${TMP}/
66
# .htaccess.dist is provieded by the drupal/drupal package und must not be in the backup
67
rm -f ${TMP}/.htaccess.dist
68
cp -a web/robots*.txt ${TMP}/
69

  
70
exit 0 
69 71

  
70 72
echo "setting dataportals in update mode ..."
71
# set all portals into maintainance mode
73
# set all portals into maintenance mode
72 74
$DRUSH vset -y maintenance_mode 1
73 75

  
74
# turn clean urls off since .htaccess will be overwritten during the updatecode
76
# turn clean urls off since .htaccess will be overwritten during the update
75 77
$DRUSH vset clean_url -y 0
76 78

  
77 79
# turn off cdm_debug_mode in all sites
......
88 90
echo "-------------------------------------------------------------------"
89 91
echo "restoring settings and config files from temp backup ..."
90 92

  
91
# restore original settings and files and disable maintainance mode
93
# restore original settings and files and disable maintenance mode
92 94
rm -f .htaccess.dist
93 95
cp web/.htaccess web/.htaccess.dist
94 96
cp -a ${TMP}/.htaccess* web/

Also available in: Unified diff