Subversion Repositories DevTools

Rev

Rev 5506 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3613 dpurdie 1
#!/usr/local/bin/perl
2
########################################################################
3
# Copyright (C) 1998-2012 Vix Technology, All rights reserved
4
#
5
# Module name   : update_jats.pl
6
# Module type   : Makefile system
7
# Compiler(s)   : Perl
8
# Environment(s): None
9
#
10
# Description   :
11
#
12
# Task to be run by CRON enery night
13
# to update JATS version iff a new one has been marked to be processed
14
#
15
# Mark done by:
16
#   Creating a link to jats2_new
17
#
18
#......................................................................#
19
 
20
require 5.008_002;
21
use strict;
22
use warnings;
23
 
7379 dpurdie 24
my $DPKG_ARCHIVE = '/export/devl/dpkg_archive';
3613 dpurdie 25
my $TDIR;
26
my $markfile;
27
my $currentLink;
28
my $target;
29
 
30
$markfile = "$DPKG_ARCHIVE/core_devl/jats2_new";
31
if ( -l $markfile )
32
{
33
    $TDIR = readlink $markfile;
34
#    print "Link: $markfile,$TDIR\n";
35
    die ("update_jats: Marklink is empty\n") unless( $TDIR ) ;
36
    die ("update_jats: Markfile contains a '/' character\n") if ( $TDIR =~ m~/~ );
37
 
38
    $target = "$DPKG_ARCHIVE/core_devl/$TDIR";
39
    $currentLink = "$DPKG_ARCHIVE/core_devl/jats2_current";
40
 
41
    if ( -d $target )
42
    {
43
        unlink ( $currentLink ) if ( -l $currentLink );
44
        die ("update_jats: Cannot unlink $currentLink\n" ) if -e $currentLink;
45
        symlink ($TDIR, $currentLink) or die ("update_jats: Cannot create symlink $TDIR $currentLink\n");
46
        unlink $markfile;
47
        print "update_jats: JATS Symlink updated to $TDIR\n";
48
    }
49
    else
50
    {
51
        die "update_jats: Bad link: $target\n";
52
    }
53
}