source: tags/confman-1.5.1/confsync.sh @ 123

Revision 123, 1.5 KB checked in by ccowart, 5 years ago (diff)

Developed the pull mechanism for confman. It's ready to go into production!

  • Property svn:executable set to *
  • Property svn:keywords set to Id
Line 
1#! /bin/bash
2
3##
4# This script obtains the latest "export" from confman and installs
5# it onto the system. It is intended to be used in crons as the
6# configuration pulling mechanism.
7#
8# Author:   Chris Cowart <ccowart@rescomp.berkeley.edu>
9#           4 December 2006
10#
11# $Id$
12##
13
14#. /usr/local/rescomp/lib/confmancommon.sh
15. $HOME/src/sysadmin/confman/confmancommon.sh
16
17# If we're in debug mode, we should log stderr messages to the logger
18# as well. Otherwise, we send them to the bit bucket.
19if $DEBUG ; then
20    exec 1>&2
21else
22    exec 1>/dev/null
23fi
24
25# Set up our "Working Copy"
26tarball=$(conf_fetch)
27tmpdir=$(mktemp -d -t confman)
28
29tar -xzf $tarball -C $tmpdir
30rm -rf $tarball
31WORK_PATH="$tmpdir"
32
33tar_revision=`conf_revision`
34sys_revision=`conf_sysrev`
35last_action=$(conf_lastact)
36
37if [ "x$last_action" = "xinstall" ] && [ $tar_revision -lt $sys_revision ]
38then
39    echo "Error: File system may be dirty." \
40        "A commit operation is recommended." >&2
41    echo "Error: $tarball is out of date. Exiting without making changes." >&2
42    conf_markdirty
43    rm -rf $tmpdir
44    exit 1
45fi
46
47if [ $tar_revision -lt $sys_revision ] ; then
48    exit 0
49fi
50
51exit
52
53echo "Sync operation started" >&2
54for layer in $LAYERS ; do
55        echo "Rolling on $layer..."
56        conf_rollout $layer || conf_cleanexit
57done
58for file in $SINGULARITIES ; do
59    echo "Assembing singularity $file..."
60        conf_assemble_sing $file || conf_cleanexit
61done
62conf_markclean
63conf_recordAction sync
64echo "Sync operation finished successfully" >&2
65
66rm -rf $tmpdir
67
Note: See TracBrowser for help on using the repository browser.