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
|
#!/bin/bash
set -eu
juju-log "===================================================================";
juju-log "Begin: hooks/install";
juju-log "===================================================================";
juju-log ">> Installing or updating system packages & other required pkgs needed to run hooks";
export EXTRA_APT_FLAGS=`config-get extra-apt-flags`;
export CHARM_ROOT=`pwd`;
add-apt-repository -y ppa:juju/pkgs
add-apt-repository -y ppa:charmers/charm-helpers
apt-get -ym $EXTRA_APT_FLAGS update; apt-get -ym $EXTRA_APT_FLAGS dist-upgrade; apt-get -ym $EXTRA_APT_FLAGS install debconf-utils php5-cli;
juju-log ">> Base System Packages Update Complete";
juju-log "===================================================================";
juju-log ">> Ensuring Charm's Persistent Local Elements, Charm Transient Items,";
juju-log ">> & Other Local Charm Elements needed to exist as assumed by hooks.";
## the directory and files in /var/lib/nginx-charm is used for any
## persistent local storage, intended mostly to CYA backups or past revisions
## prior to automatic edits in case a change in introduced by a newer package and
## the automatic edit fails or otherwise barfs, ideal situation changes are all tested before hand,
## but real world is far from ideal and this is just to `possibly` help out in a
## 'oh sh*t' moment NOT in replace of regular backups and pre-testing deploys
mkdir -p /var/lib/nginx-charm/configs/bak;
mkdir -p /mnt/logs/;
debconf-get-selections > /var/lib/nginx-charm/configs/bak/debconf-selections-`date +%Y%m%d-%H%M%S`;
juju-log "===================================================================";
juju-log "call our install routines for the real app now that the charm env is prepared.";
/usr/bin/php ./hooks/lib/install
juju-log "==================================================================="
juju-log "Complete: hooks/install"
|