Skip to content

Commit d125acf

Browse files
committed
version issue
1 parent d653388 commit d125acf

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

extras/aqua.sh

+20-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# curl --silent "https://api.github.com/repos/sfeakes/AqualinkD/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")'
88
#
99
# list latest dev version
10-
# curl --silent "https://raw.githubusercontent.com/sfeakes/AqualinkD/master/version.h" | grep AQUALINKD_VERSION | cut -d '"' -f 2 | tr '\n'
10+
# curl --silent "https://raw.githubusercontent.com/sfeakes/AqualinkD/master/version.h" | grep AQUALINKD_VERSION | cut -d '"' -f 2
1111
#
1212

1313

@@ -30,6 +30,7 @@ function print_usage {
3030
echoerr "$0 force_latest <- Force latest option (don't run any version checks)"
3131
echoerr "$0 install <- Install to local filesystem, (config files will no be overwritten)"
3232
echoerr "$0 clean <- Remove everything, including configuration files"
33+
echoerr "$0 <option> downloadonly <- Download using one of above options, but don't unstall"
3334
echoerr ""
3435
}
3536

@@ -65,6 +66,10 @@ function git_release_version {
6566
echo `curl --silent "https://api.github.com/repos/sfeakes/AqualinkD/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")'`
6667
}
6768

69+
function get_development_version {
70+
echo `curl --silent "https://raw.githubusercontent.com/sfeakes/AqualinkD/master/version.h" | grep AQUALINKD_VERSION | cut -d '"' -f 2`
71+
}
72+
6873
function remove {
6974
#cd ~
7075

@@ -84,6 +89,7 @@ function isvalid_gitinstall {
8489
}
8590

8691
function development_version_download {
92+
echo "Upgrading $NAME from $(local_version) to $(get_development_version)"
8793
if isvalid_gitinstall; then
8894
update
8995
else
@@ -148,15 +154,19 @@ function release_version_download {
148154
# Use this tar instead, it's correct dir structure
149155
curl --silent -L "https://github.com/sfeakes/AqualinkD/archive/$git_version.tar.gz" | tar xz -C "$BASE"
150156

151-
ver=$(echo $git_version | sed 's/^.//' )
157+
ver=$(echo $git_version | sed 's/^[^0-9]*//' )
152158

153159
if [ -d "$AQUA" ]; then
154-
if [ -L "$AQUA" ]; then
155-
unlink "$AQUA"
156-
else
160+
if [ -d "$AQUA-$version" ]; then
157161
mv "$AQUA" "$AQUA-$RANDOM"
162+
else
163+
mv "$AQUA" "$AQUA-$version"
158164
fi
159165
fi
166+
if [ -L "$AQUA" ]; then
167+
unlink "$AQUA"
168+
fi
169+
160170
ln -s "$BASE/AqualinkD-$ver" "$AQUA"
161171
else
162172
echo "Local $NAME version $version is latest, not downloading"
@@ -201,7 +211,11 @@ else
201211
exit;
202212
fi
203213

204-
install
214+
if [ "$2" == "downloadonly" ]; then
215+
echo "No install, download only"
216+
else
217+
install
218+
fi
205219

206220
echo "Installed "`cat $AQUA/version.h | cut -d '"' -f 2 | tr '\n' ' '`
207221

0 commit comments

Comments
 (0)