Skip to content

Commit

Permalink
Merge pull request #343 from cheqd/DEV-1523
Browse files Browse the repository at this point in the history
fix: Small fixes for installer after testing
  • Loading branch information
Toktar authored Jul 6, 2022
2 parents 28217e2 + 98958a2 commit 1a23cd9
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions installer/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@
###############################################################
### Systemd Config ###
###############################################################
STANDALONE_SERVICE_FILE = "https://raw.githubusercontent.com/cheqd/cheqd-node/de487a0cfc095d92bd579b142c7708f64b6f1536/build-tools/node-standalone.service"
COSMOVISOR_SERVICE_FILE = "https://raw.githubusercontent.com/cheqd/cheqd-node/de487a0cfc095d92bd579b142c7708f64b6f1536/build-tools/node-cosmovisor.service"
LOGROTATE_TEMPLATE = "https://raw.githubusercontent.com/cheqd/cheqd-node/de487a0cfc095d92bd579b142c7708f64b6f1536/build-tools/logrotate.conf"
RSYSLOG_TEMPLATE = "https://raw.githubusercontent.com/cheqd/cheqd-node/de487a0cfc095d92bd579b142c7708f64b6f1536/build-tools/rsyslog.conf"
STANDALONE_SERVICE_FILE = "https://raw.githubusercontent.com/cheqd/cheqd-node/main/build-tools/node-standalone.service"
COSMOVISOR_SERVICE_FILE = "https://raw.githubusercontent.com/cheqd/cheqd-node/main/build-tools/node-cosmovisor.service"
LOGROTATE_TEMPLATE = "https://raw.githubusercontent.com/cheqd/cheqd-node/main/build-tools/logrotate.conf"
RSYSLOG_TEMPLATE = "https://raw.githubusercontent.com/cheqd/cheqd-node/main/build-tools/rsyslog.conf"
DEFAULT_STANDALONE_SERVICE_NAME = 'cheqd-noded'
DEFAULT_COSMOVISOR_SERVICE_NAME = 'cheqd-cosmovisor'
DEFAULT_STANDALONE_SERVICE_FILE_PATH = f"/lib/systemd/system/{DEFAULT_STANDALONE_SERVICE_NAME}.service"
Expand Down Expand Up @@ -247,8 +247,7 @@ def get_binary(self):
if fname.find(".tar.gz") != -1:
self.exec(f"tar -xzf {fname}")
self.remove_safe(fname)
else:
self.exec(f"mv {fname} {DEFAULT_BINARY_NAME}")
self.exec(f"chmod +x {DEFAULT_BINARY_NAME}")
except:
failure_exit("Failed to download binary")

Expand Down Expand Up @@ -489,6 +488,15 @@ def setup_cosmovisor(self):
self.log(f"Creating symlink to {self.cosmovisor_cheqd_bin_path}")
os.symlink(self.cosmovisor_cheqd_bin_path,
os.path.join(DEFAULT_INSTALL_PATH, DEFAULT_BINARY_NAME))

if self.interviewer.is_upgrade and \
os.path.exists(os.path.join(self.cheqd_data_dir, "upgrade-info.json")):

self.log(f"Copying upgrade-info.json file to cosmovisor/current/")
shutil.copy(os.path.join(self.cheqd_data_dir, "upgrade-info.json"),
os.path.join(self.cosmovisor_root_dir, "current"))
self.log(f"Changing owner to {DEFAULT_CHEQD_USER} user")
self.exec(f"chown -R {DEFAULT_CHEQD_USER}:{DEFAULT_CHEQD_USER} {self.cosmovisor_root_dir}")

self.log(f"Changing directory ownership for Cosmovisor to {DEFAULT_CHEQD_USER} user")
self.exec(f"chown -R {DEFAULT_CHEQD_USER}:{DEFAULT_CHEQD_USER} {self.cosmovisor_root_dir}")
Expand Down Expand Up @@ -803,8 +811,8 @@ def ask_for_version(self):
all_releases.insert(0, default)
for i, release in enumerate(all_releases[0: LAST_N_RELEASES]):
print(f"{i + 1}) {release.version}")
release_num = self.ask("Choose list option number above to select version of cheqd-node to install",
default=1)
release_num = int(self.ask("Choose list option number above to select version of cheqd-node to install",
default=1))
if release_num >= 1 and release_num <= len(all_releases):
self.release = all_releases[release_num - 1]
else:
Expand Down

0 comments on commit 1a23cd9

Please sign in to comment.