-
Notifications
You must be signed in to change notification settings - Fork 0
/
sf-upload.sh.in
60 lines (52 loc) · 1.44 KB
/
sf-upload.sh.in
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
#! /bin/sh
##########
# README #
##########
#
# Upload the generated Doxygen documentation to SF web page.
# Requires ``rsync'', ``which'' and basic shell features.
#
# To use this script, set the SF_USERNAME environement
# variable with your SF ID:
#
# $ setenv SF_USERNAME=X12345
# or
# $ export SF_USERNAME=X12345
# ...depending on the shell you use.
#
# Then launch the script. It will prompt for your password
# and upload the documentation in a @PACKAGE_TARNAME@ folder.
set -e
rsync=$(which rsync)
if test "x$rsync" = x; then
echo "rsync can not be found. Please add it to your path.";
exit 1
fi
if test "x$SF_USERNAME" = x; then
echo -n "SF_USERNAME environment variable not set, "
echo "please define it to your SourceForge ID.";
exit 2
fi
if test "x$VERSION" = x; then
echo "No version set, defaulting to \`\`HEAD''."
VERSION=HEAD
fi
rsync_cmd="$rsync -avP -e ssh"
localdir="@abs_top_builddir@/doc/doxygen-html/"
pkgname=$(echo '@PACKAGE_TARNAME@' | sed 's|^roboptim-||')
remotedir="htdocs/doc/$pkgname/$VERSION"
rsync_loghost="$SF_USERNAME,roboptim@web.sourceforge.net:"
echo "Fixing local rights.";
chmod 755 "$localdir"
find "$localdir" -type d -print0 | xargs -0 chmod 755
find "$localdir" -type f -print0 | xargs -0 chmod 644
echo "Uploading documentation to SourceForge server.";
$rsync_cmd "$localdir" "$rsync_loghost$remotedir"
ret="$?";
if test 0 -eq "$ret"; then
echo "Done. Exiting";
exit 0
else
echo "Upload has failed.";
fi;
exit $ret