Skip to content

Commit d1d2efb

Browse files
committed
work on geoshape-upgrade command.
1 parent c9e0f7a commit d1d2efb

2 files changed

Lines changed: 72 additions & 3 deletions

File tree

scripts/geoshape-install.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,6 @@ then
7878
echo "${RELEASE_TAGS[@]}"
7979
# sort the list of branches that had '.' in them such that index 0 is the largest one
8080
RELEASE_TAGS_SORTED=($(printf '%s\n' "${RELEASE_TAGS[@]}"|sort -r))
81-
echo 'sorted release branches: '
82-
echo "${RELEASE_TAGS_SORTED[@]}"
8381
GEOSHAPE_VERSION=${RELEASE_TAGS_SORTED[0]}
8482
echo '----[ discovered latest release version: '${GEOSHAPE_VERSION}
8583
fi
@@ -128,4 +126,4 @@ fi
128126
chmod 755 *.sh
129127

130128
# to install latest rogue run this .sh file. if you remove the /var/lib/geoserver_data folder, it will download it again. To keep your data, just leave the folder as is and the script will not pull down the basic data folder
131-
./geoshape-upgrade.sh
129+
./geoshape-upgrade.sh ${GEOSHAPE_VERSION} silent

solo/geoshape-upgrade.sh

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,82 @@
22
# exit if anything returns failure
33
set -e
44

5+
if [ "$1" = "silent" ];
6+
then
7+
GEOSHAPE_SILENT=true
8+
GEOSHAPE_VERSION="$2"
9+
elif [ "$2" = "silent" ];
10+
then
11+
GEOSHAPE_SILENT=true
12+
GEOSHAPE_VERSION="$1"
13+
else
14+
GEOSHAPE_VERSION="$1"
15+
fi
16+
17+
if [ "$GEOSHAPE_SILENT" != true ]; then
18+
echo "====[ WARNING:
19+
You are attempting to upgrade the installation of geoshape. Before proceeding, you should backup
20+
this machine. If it is a virtual machine, you should create a snapshot so that you can undo the changes
21+
if there are any incompatibilities. In some cases, the database may no longer operate as expented resulting
22+
in potential loss of data. Note that only some upgrades can complete successfully! Before continuing
23+
you should review changes introduced between the geoshape version you are currently on and the version
24+
you are attempting to upgrade to. There could be many backwards incompatible changes introduced at
25+
any of the geoshape dependencies. In some cases, a clean installation of geoshape might be necessary
26+
to get the latest functionality successfully. For example, the geoserver_data directory required by
27+
the latest version of geoshape, may contain some configuration or scripts that doesn't make it
28+
possible to simply keep your current /var/lib/geoserver_data directory. Similar issues could arise for
29+
many other dependencies of geoshape. This script is only intended for advanced users! The safest way
30+
the to upgrade geoshape is to create a new instance and migrate your data."
31+
32+
while true; do
33+
read -p "=> Are you sure you want to continue? " yn
34+
case $yn in
35+
[Yy]* ) break;;
36+
[Nn]* ) echo " geoshape upgrade exited. ";exit;;
37+
* ) echo " Please answer yes or no.";;
38+
esac
39+
done
40+
fi
41+
542
# store current directory
643
pushd .
744

845
cd /opt/rogue-chef-repo
946

47+
# get latest tags/branchs
48+
git fetch
49+
50+
if [ -z "$GEOSHAPE_VERSION" ];
51+
then
52+
# discover the latest release tag
53+
RELEASE_TAGS=(`git tag`)
54+
echo 'release tags: '
55+
echo "${RELEASE_TAGS[@]}"
56+
# sort the list of branches that had '.' in them such that index 0 is the largest one
57+
RELEASE_TAGS_SORTED=($(printf '%s\n' "${RELEASE_TAGS[@]}"|sort -r))
58+
UPGRADE_TO_GEOSHAPE_VERSION=${RELEASE_TAGS_SORTED[0]}
59+
fi
60+
61+
if [ -z "$GEOSHAPE_VERSION" ];
62+
then
63+
echo 'Note: geoshape version was not specified, did you intend to upgrade to release: '${UPGRADE_TO_GEOSHAPE_VERSION}
64+
while true; do
65+
read -p "=> Are you sure you want to continue? " yn
66+
case $yn in
67+
[Yy]* ) break;;
68+
[Nn]* ) echo " geoshape upgrade exited. ";exit;;
69+
* ) echo " Please answer yes or no.";;
70+
esac
71+
done
72+
fi
73+
74+
GEOSHAPE_VERSION=$UPGRADE_TO_GEOSHAPE_VERSION
75+
76+
# checkout the requests 'version' (tag, branch, commit)
77+
git checkout ${GEOSHAPE_VERSION}
78+
79+
# if on a branch, do a pull to get latest on local branch. When a branch is used, user essentially wants the latets
80+
# 'snapshot' from the specified branch (version)
1081
CURRENT_BRANCH=`git branch | sed -n '/\* /s///p'`
1182
if ["$CURRENT_BRANCH" != "(no branch)"]
1283
then

0 commit comments

Comments
 (0)