File: my-regular-update.example

package info (click to toggle)
fcm 2021.05.01-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 7,788 kB
  • sloc: perl: 26,014; sh: 10,510; javascript: 4,043; f90: 774; python: 294; ansic: 29; makefile: 14; cpp: 5
file content (43 lines) | stat: -rwxr-xr-x 1,442 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (C) 2006-2021 British Crown (Met Office) & Contributors.
#
# This file is part of FCM, tools for managing and building source code.
#
# FCM is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# FCM is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with FCM. If not, see <http://www.gnu.org/licenses/>.
#-------------------------------------------------------------------------------
set -eu
LOCK=/path/to/lock
WC_OF_PROJECT=/path/to/working/copy/of/project

if [[ -e $LOCK ]]; then
    exit
fi

mkdir -p $LOCK
echo "$(whoami)@$(hostname):$$" >$LOCK/info # info on who created the lock

while true; do
    UPDATED=$(cd $WC_OF_PROJECT && svn update | sed '$d' | cut -c6-)
    if [[ -z $UPDATED ]]; then
        break
    fi
    if [[ -n $(echo "$UPDATED" | grep '^foo/bar/[^/]*\.baz$') ]]; then
        : # Performs some update if foo/bar/*.baz has changed
    fi
done

rm $LOCK/info
rmdir $LOCK
exit