forked from winkj/httpup
-
Notifications
You must be signed in to change notification settings - Fork 1
/
httpup-repgen-old
executable file
·71 lines (61 loc) · 1.5 KB
/
httpup-repgen-old
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
# httpup-repgen - One way sync from an http server to a local directory
# Copyright 2003 (c) Johannes Winkelmann, [email protected]
# The repo file is place on the server. httpsync downloads it, makes the
# update and afterwards moves it to the REPOCURRENTFILE which keeps track
# of the files which have been checked out. The REPOCURRENTFILE contains
# only file names
REPOFILE=REPO
REPOCURRENTFILE=REPO.CURRENT
VERSION=0.5
function info(){
echo $*
}
function debug() {
return # echo $*
}
function printUsage() {
echo "httpup-repgen $VERSION"
echo " Copyright (c) 2003 Johannes Winkelmann"
echo ""
echo "Usage:"
echo " httpup-repgen [directory]"
exit -1
}
function generateRepoFile() {
dir="."
if [ ! "$1" = "" ]; then
dir=$1
fi
if [ ! -d $dir ]; then
echo "Can't generate repository for '$dir': No such directory"
exit -2
fi
echo "Generating repository for directory '$dir'"
OLDPWD=`pwd`
cd $dir
rm -f $REPOFILE || exit -3
touch $REPOFILE
if [ ! "$HS_IGNORE" = "" ]; then
ignore=$HS_IGNORE
ignore="-and $ignore"
debug "$ignore"
fi
for f in `find . -not -name \. $ignore`; do
f=`echo $f|sed -e 's/^\.\///'`
if [ "$f" == "$REPOFILE" ] || [ "$f" = "$REPOCURRENTFILE" ]; then
continue
elif [ -d $f ]; then
echo "d:$f" >> $REPOFILE
else
md5=`md5sum $f|awk '{print $1}'`
echo "f:$md5:$f" >> $REPOFILE
fi
done
cd $OLDPWD
}
if [ "$1" = "--help" ]; then
printUsage
else
generateRepoFile $1
fi