source: tags/confman-1.5.4.1/confsync.sh @ 152

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

Typo for file descriptor.

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