source: tags/confman-1.5.6a2/confsync.sh @ 168

Revision 168, 1.9 KB checked in by ccowart, 5 years ago (diff)

Assisting confman developers by allowing ./confman to source dev libs.

  • 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# Try loading a development library first
15if [ -r ./confmancommon.sh ] ; then
16    echo "Loading development library from current working directory." >&2
17    . ./confmancommon.sh
18elif [ -r /usr/local/rescomp/lib/confmancommon.sh ] ; then
19    . /usr/local/rescomp/lib/confmancommon.sh
20else
21    echo "Can't find confmancommon.sh. Exiting." >&2
22fi
23
24# If we're in debug mode, we should log stderr messages to the logger
25# as well. Otherwise, we send them to the bit bucket.
26if $DEBUG ; then
27    exec 1>&2
28else
29    exec 1>/dev/null
30fi
31
32# Set up our "Working Copy"
33tarball=$(conf_fetch)
34if ! [ -s $tarball ] ; then
35    echo "Could not fetch the tarball." >&2
36    exit 1
37fi
38
39tmpdir=$(mktemp -d -t confman)
40
41tar -xzf $tarball -C $tmpdir
42rm -rf $tarball
43WORK_PATH="$tmpdir"
44
45tar_revision=`conf_revision`
46sys_revision=`conf_sysrev`
47last_action=$(conf_lastact)
48
49if [ "x$last_action" = "xinstall" ] && [ $tar_revision -lt $sys_revision ]
50then
51    echo "Error: File system may be dirty." \
52        "A commit operation is recommended." >&2
53    echo "Error: $tarball is out of date. Exiting without making changes." >&2
54    conf_markdirty
55    rm -rf $tmpdir
56    exit 1
57fi
58
59if [ $tar_revision -lt $sys_revision ] ; then
60    echo "System is up to date." | conf_logger
61    rm -rf $tmpdir
62    exit 0
63fi
64
65echo "Sync operation started" | conf_logger
66for layer in $LAYERS ; do
67        echo "Rolling on $layer..."
68        conf_rollout $layer || conf_cleanExit
69done
70for file in $SINGULARITIES ; do
71    echo "Assembing singularity $file..."
72        conf_assemble_sing $file || conf_cleanExit
73done
74conf_markclean
75conf_recordAction sync
76echo "Sync operation finished successfully" | conf_logger
77
78rm -rf $tmpdir
79
Note: See TracBrowser for help on using the repository browser.