From 75540f024d5b7628aaf42d921cf93b1f4f4cafb9 Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Thu, 6 Oct 2022 13:52:17 +0500 Subject: [PATCH] bug fix: use different lscpd versions according to os detection --- install/install.py | 10 ++++++++-- plogical/upgrade.py | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/install/install.py b/install/install.py index bc8ce0635..9fde99c22 100755 --- a/install/install.py +++ b/install/install.py @@ -1457,13 +1457,19 @@ autocreate_system_folders = On lscpdPath = '/usr/local/lscp/bin/lscpd' - command = 'cp -f /usr/local/CyberCP/lscpd.0.4.0 /usr/local/lscp/bin/lscpd.0.4.0' + result = open('/etc/lsb-release', 'r').read() + lscpdSelection = 'lscpd-0.3.1' + if result.find('22.04') > -1: + lscpdSelection = 'lscpd.0.4.0' + + + command = f'cp -f /usr/local/CyberCP/{lscpdSelection} /usr/local/lscp/bin/{lscpdSelection}' preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) command = 'rm -f /usr/local/lscp/bin/lscpd' preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) - command = 'mv /usr/local/lscp/bin/lscpd.0.4.0 /usr/local/lscp/bin/lscpd' + command = f'mv /usr/local/lscp/bin/{lscpdSelection} /usr/local/lscp/bin/lscpd' preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) command = 'chmod 755 %s' % (lscpdPath) diff --git a/plogical/upgrade.py b/plogical/upgrade.py index 2f4e41d35..109c81ee9 100755 --- a/plogical/upgrade.py +++ b/plogical/upgrade.py @@ -1992,13 +1992,19 @@ autocreate_system_folders = On if os.path.exists(lscpdPath): os.remove(lscpdPath) - command = 'cp -f /usr/local/CyberCP/lscpd.0.4.0 /usr/local/lscp/bin/lscpd.0.4.0' + result = open(Upgrade.UbuntuPath, 'r').read() + + lscpdSelection = 'lscpd-0.3.1' + if result.find('22.04') > -1: + lscpdSelection = 'lscpd.0.4.0' + + command = f'cp -f /usr/local/CyberCP/{lscpdSelection} /usr/local/lscp/bin/{lscpdSelection}' Upgrade.executioner(command, command, 0) command = 'rm -f /usr/local/lscp/bin/lscpd' Upgrade.executioner(command, command, 0) - command = 'mv /usr/local/lscp/bin/lscpd.0.4.0 /usr/local/lscp/bin/lscpd' + command = f'mv /usr/local/lscp/bin/{lscpdSelection} /usr/local/lscp/bin/lscpd' Upgrade.executioner(command, command, 0) command = f'chmod 755 {lscpdPath}'