Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Sobota, 20. apríl 2024

Súbor: [Platon] / scripts / shell / cvs-watch / cvs-watch.sh (stiahnutie)

Revízia 1.2, Mon Aug 25 12:21:08 2003 UTC (20 years, 8 months ago) by nepto


Zmeny od 1.1: +2 -2 [lines]

Fixed typo.

#!/bin/sh

#
# cvs-watch.sh - script for watching anonymous CVS repositories
#
# Developed by Ondrej Jombik <nepto@platon.sk>
# Copyright (c) 2003 Platon SDG, http://platon.sk/
# Licensed under terms of GNU General Public License.
# All rights reserved.
#
# Changelog:
# 17/07/2003 - created
#

# $Platon: scripts/shell/cvs-watch/cvs-watch.sh,v 1.1 2003/07/17 10:45:51 nepto Exp $

REPOSITORIES_FILE="./REPOSITORIES";
DOT_CHECKOUT_FILE="DOT_CHECKOUT_DONE";

#
# Notice function
#

function notice()
{
    echo "$1";
}

#
# ChDir back function
#

function cd_back()
{
    dir=` echo "$1/" | sed 's/\/\+/\//g; s/\.\///g;' `;
    while [ "X" != "X$dir" ]; do
        echo $dir;
        cd ../;
        dir=` echo "$dir" | sed 's/^[^\/]*\///g;' `;
    done
}

if [ ! -r "$REPOSITORIES_FILE" ]; then
    notice "no '$REPOSITORIES_FILE' file found, aborting...";
    exit 1;
fi

while read line; do
    line=` echo "$line" | sed 's/^[     ]*//g; s/[     ]*$//g;' `;
    firstchar=` echo "$line" | sed 's/^\(.\).*$/\1/g;' `;
    if [ "X" = "X$firstchar" -o "X#" = "X$firstchar" ]; then
        continue;
    fi
    directory=` echo "$line" | sed 's/[     ]\+.*$//g;' `;
    authstring=` echo "$line" | sed 's/^[^     ]\+[     ]\+//g; s/[     ]\+.*$//g;' `;
    objects=` echo "$line" | sed 's/^[^     ]\+[     ]\+//g; s/^[^     ]\+[     ]*//g;' `;
    notice "PROCESSING $directory";
    if [ "X" = "X$objects" ]; then
        objects="$directory";
        directory="";
    else
        directory="$directory/";
    fi
    if [ "X$directory" != "X" ]; then
        if [ ! -e "$directory" ]; then
            notice "directory '$directory' does not exists, creating...";
            mkdir -p "$directory";
        fi
        if [ ! -d "$directory" ]; then
            notice "file '$directory' is not an accessible directory, skipping...";
            continue;
        fi
        cd $directory || continue;
    fi
    for i in $objects; do
        i=` echo "$i" | sed 's/\/*$//g' `;
        if [ ! -d "$i" -o \( "$i" = "." -a ! -f "$DOT_CHECKOUT_FILE" \) ]; then
            notice "perfoming an initial checkout for $directory$i";
            cvs -d "$authstring" checkout $i && (
                if [ "$i" = "." ]; then
                    > $DOT_CHECKOUT_FILE;
                fi );
        else
            notice "updating $directory$i";
            cd $i || continue;
            cvs -d "$authstring" update;
            cd_back "$i";
        fi
    done
    if [ "X$directory" != "X" ]; then
        cd_back $directory;
    fi
    #echo "$directory - $authstring - $objects";
done < $REPOSITORIES_FILE;


Platon Group <platon@platon.sk> http://platon.sk/
Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok