Skip to content

Commit

Permalink
Merge pull request #476 from wavesplatform/node-110-keep-home-directo…
Browse files Browse the repository at this point in the history
…ry-contents

Remove data files only when upgrading from 0.6.x
  • Loading branch information
alexeykiselev authored Aug 29, 2017
2 parents e04fbde + f3bf3dc commit ba7ef10
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 32 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ enablePlugins(sbtdocker.DockerPlugin, JavaServerAppPackaging, JDebPackaging, Sys

name := "waves"
organization := "com.wavesplatform"
version := "0.7.5"
version := "0.7.7-SNAPSHOT"
scalaVersion in ThisBuild := "2.12.3"
crossPaths := false
publishArtifact in (Compile, packageDoc) := false
Expand Down
1 change: 0 additions & 1 deletion src/package/debian/postrm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ if [ "$1" = purge ]; then
rm -rf /var/lib/${{app_name}}/snapshots
rm -rf /var/lib/${{app_name}}/data
rm -rf /etc/${{app_name}}/application.ini
rm -rf /etc/${{app_name}}.conf
rm -rf /var/log/${{app_name}}

if is_upstart; then
Expand Down
52 changes: 24 additions & 28 deletions src/package/debian/preinst
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,31 @@ ${{header}}
${{loader-functions}}

if [ "$1" = upgrade ]; then
# change home directory and remove legacy data files
previous_home=$(getent passwd ${{app_name}} | cut -d: -f6)
if [ "$previous_home" = /home/${{app_name}} ]; then
usermod --home /var/lib/${{app_name}} ${{app_name}}
fi
rm -f /home/${{app_name}}/waves/data/blockchain.dat
rm -f /home/${{app_name}}/waves/data/peers.dat

# delete legacy configuration files
for file_to_remove in application.conf application-dev.conf logback-to-file.xml logback.xml reference.conf logback-overrides.xml
do
rm -f /usr/share/${{app_name}}/conf/$file_to_remove
done

rm -fr /usr/share/${{app_name}}/conf/target
rm -f /etc/init/${{app_name}}.conf

chmod -s -x /usr/share/${{app_name}}/conf/* || true

mkdir -p /var/lib/${{app_name}}
# move wallet file to a new default location
if [ -f /home/${{app_name}}/waves/wallet/wallet.s.dat ]; then
echo Moving wallet file to a new default location ...
mkdir -p /var/lib/${{app_name}}/wallet/
mv /home/${{app_name}}/waves/wallet/wallet.s.dat /var/lib/${{app_name}}/wallet/wallet.dat
fi

case "$2" in
0.6*)
# change home directory and remove legacy data files
rm -f /home/${{app_name}}/waves/data/blockchain.dat
rm -f /home/${{app_name}}/waves/data/peers.dat

# delete legacy configuration files
for file_to_remove in application.conf application-dev.conf logback-to-file.xml logback.xml reference.conf logback-overrides.xml
do
rm -f /usr/share/${{app_name}}/conf/$file_to_remove
done

rm -fr /usr/share/${{app_name}}/conf/target

chmod -s -x /usr/share/${{app_name}}/conf/* || true

# move wallet file to a new default location
if [ -f /home/${{app_name}}/waves/wallet/wallet.s.dat ]; then
echo Moving wallet file to a new default location ...
mkdir -p /var/lib/${{app_name}}/wallet/
mv /home/${{app_name}}/waves/wallet/wallet.s.dat /var/lib/${{app_name}}/wallet/wallet.dat
fi

if [ -f /etc/${{app_name}}.conf ]; then
echo Moving node configuration file from /etc/${{app_name}}.conf to /etc/${{app_name}}/waves.conf ...
mv /etc/${{app_name}}.conf /etc/${{app_name}}/waves.conf || true
Expand All @@ -46,14 +42,14 @@ if [ "$1" = upgrade ]; then
mv /home/${{app_name}}/waves/journal /var/lib/${{app_name}}/journal || true
mv /home/${{app_name}}/waves/snapshots /var/lib/${{app_name}}/snapshots || true
fi
;;
*)

if [ -f /etc/${{app_name}}.json ]; then
echo Moving legacy configuration file to a new location ...
cp /etc/${{app_name}}.json /etc/${{app_name}}/waves.json
chmod -x /etc/${{app_name}}/waves.json
fi

;;
*)
rm -f /etc/${{app_name}}.json
rm -f /usr/share/${{app_name}}/settings.json
;;
Expand Down
3 changes: 1 addition & 2 deletions waves-mainnet.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ waves {
port = 6868

# Node name to send during handshake. Comment this string out to set random node name.
#node-name = "My MAINNET node"
# node-name = "My MAINNET node"

# String with IP address and port to send as external address during handshake. Could be set automatically if uPnP is enabled.
# declared-address = "1.2.3.4:6868"

}

# Wallet settings
Expand Down

0 comments on commit ba7ef10

Please sign in to comment.