~fginther/charms/trusty/jenkins-remote-slave/pbuilder-slave-4

« back to all changes in this revision

Viewing changes to hooks/install

  • Committer: Francis Ginther
  • Date: 2014-11-24 18:02:29 UTC
  • Revision ID: francis.ginther@canonical.com-20141124180229-5io67tk2iuu79xph
Add pbuilder support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 
5
5
slave_name="$(config-get slave_name)"
6
6
master_url="$(config-get master_url)"
 
7
hook_name=`basename $0`
7
8
 
8
9
# Install the slave if it is not installed already.
9
10
install_slave () {
42
43
}
43
44
 
44
45
 
45
 
# Execute any hook overlay which may be provided
46
 
# by forks of this charm.
47
 
install_extra_hooks () {
48
 
    juju-log "Installing hooks..."
49
 
    if [[ -d hooks/install.d ]]
50
 
    then
51
 
        for i in $(ls -1 hooks/install.d/*)
52
 
        do
53
 
            if [[ -x $i ]]
54
 
            then
55
 
                source ./$i
56
 
            fi
57
 
        done
58
 
    else
59
 
        juju-log "No extra hooks found."
60
 
    fi
61
 
}
62
 
 
63
46
# Always refresh the apt db before installing any packages
64
47
# Use multiple attempts to avoid transient hash mismatch errors
65
48
apt-get update || apt-get update || apt-get update
66
49
 
 
50
 
 
51
# Create a cron entry to reset the jenkins workspace dir permission,
 
52
# workaround for https://issues.jenkins-ci.org/browse/JENKINS-7823
 
53
install --owner=root --group=root files/cron.jenkins \
 
54
        /etc/cron.d/jenkins.${slave_name}
 
55
sed -i -e "s!jenkins/workspace!jenkins/slaves/${slave_name}/workspace!" \
 
56
        "/etc/cron.d/jenkins.${slave_name}"
 
57
restart cron
 
58
 
 
59
 
67
60
# For config-changed, we want to ensure slave gets stopped and restarted
68
 
# FIXME: 20140926 fginther - check if the upstart job is running first
69
 
# https://app.asana.com/0/15652576021427/16759381549805
70
 
hooks/stop || true
 
61
hooks/stop
71
62
install_slave
72
63
modify_jenkins_settings
73
64
install_tools
74
 
install_extra_hooks
 
65
hooks/execute_extra_hooks "${hook_name}"
75
66
hooks/start
76
67
exit 0