forked from hyphanet/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestnet-scripts-common
executable file
·88 lines (72 loc) · 2.53 KB
/
testnet-scripts-common
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash
#
# Contains default configuration values and shared utility functions.
#
# Target directory for generated files.
releaseDir="../FreenetReleased"
# Windows installer source location.
wininstallerDir="../wininstaller-staging"
# Path to Fred repository.
fredDir="../testnet-official"
# Path to configuration file.
defaultConfigPath="$HOME/.testnetrc"
configPath="$defaultConfigPath"
# Path to freenet-ext.jar.
freenetExtPath="$releaseDir/freenet-ext.jar"
# If "1" starts ssh agent before sending the update to the target host and stops it afterward.
useSshAgent="1"
# Hostname to send updates to.
targetHost="osprey.vm.bytemark.co.uk"
# FCP host hostname / IP.
fcpHost="127.0.0.1"
# FCP host port.
fcpPort="9481"
# User to switch to when signing the release.
signingUser="toad"
# User to run Wine under.
wineUser="freenet-buildwin"
# Takes a build number as an argument
# Saves a comparsion between the localization of that build and the previous
# as "$oldBuild-$newBuild.diff.txt" in the release directory.
function compareL10n {
pushd "$fredDir"
newBuild="$1"
oldBuild=$((newBuild - 1))
echo Comparing $newBuild to $oldBuild
for build in "$oldBuild" "$newBuld"
do
git checkout $(printf 'build%05d' "$build")
cp "src/freenet/l10n/freenet.l10n.en.properties" "$build"
done
diffName="$oldBuild-$newBuild.diff.txt"
diff -u0 "$oldBuild" "$newBuild" > "$diffName"
less "$diffName"
cp "$diffName" "$releaseDir"
popd
}
# Sets $gitVersion, $buildNumber, and $commitID.
# All of these are set for the highest build number.
# Assumes the working directory holds a Fred repository.
function getBuildInfo {
pushd "$fredDir" || exit
# Get highest build number, sorted numerically.
# Git tag includes only those tags starting with "build", and the awk
# substring excludes the first 5 characters, which are "build".
buildNumber=$(git tag -l 'build*' | awk '{print substr($0, 6)}' | sort --numeric-sort | tail -n1)
# Get tag with highest build number.
gitVersion=$(git tag -l 'build*' | grep "$buildNumber$")
# Strip possible leading zeros.
buildNumber=${buildNumber#0}
commitID=$(git log $gitVersion | head -n1 | cut -d " " -f 2)
popd
}
# Read configuration file if it exists.
function readConfig {
if [ -f "$configPath" ]; then
echo "Reading configuration at \"$configPath\"."
source "$configPath" || exit
elif [ ! "$configPath" = "$defaultConfigPath" ]; then
echo Custom config file does not exist: "$configPath"
exit
fi
}