diff --git a/bin/libcrypto.so.1.0.2.gz b/bin/libcrypto.so.1.0.2.gz new file mode 100755 index 0000000..677bbf0 Binary files /dev/null and b/bin/libcrypto.so.1.0.2.gz differ diff --git a/resources.qrc b/resources.qrc index c88190d..060f70a 100644 --- a/resources.qrc +++ b/resources.qrc @@ -6,5 +6,6 @@ assets/problem.svg bin/rM1-vnc-server-standalone bin/rM2-vnc-server-standalone + bin/libcrypto.so.1.0.2.gz \ No newline at end of file diff --git a/setup.py b/setup.py index 86c4587..6c4a25a 100644 --- a/setup.py +++ b/setup.py @@ -32,7 +32,7 @@ class genResourcesEggInfo(egg_info): setup( name='rmview', - version='2.1', + version='2.1.5', url='https://github.com/bordaigorl/rmview', description='rMview: a fast live viewer for reMarkable', author='bordaigorl', diff --git a/src/rmview/rmview.py b/src/rmview/rmview.py index 6713ea9..30e2b83 100644 --- a/src/rmview/rmview.py +++ b/src/rmview/rmview.py @@ -235,7 +235,39 @@ class rMViewApp(QApplication): version = int(version[1]) + sftp = None # check needed files are in place + _,out,_ = ssh.exec_command("[ -x /usr/lib/libcrypto.so.1.0.2 ]") + if out.channel.recv_exit_status() != 0: + answer = QMessageBox.question(self.viewer, + "Missing libcrypto 1.0.2", + "Your reMarkable is missing the right version of a library needed by rmView.\n"\ + "This is most probably a result of updating the tablet to version 2.6.\n\n"\ + "Would you like rmView to install the missing library?\n"\ + "To resolve the issue manually, press NO and consult the documentation.") + if answer == QMessageBox.Yes: + log.info("Installing libcrypto...") + try: + sftp = ssh.open_sftp() + from stat import S_IXUSR + fo = QFile(':bin/libcrypto.so.1.0.2.gz') + fo.open(QIODevice.ReadOnly) + sftp.putfo(fo, '/usr/lib/libcrypto.so.1.0.2.gz') + fo.close() + _,out,_ = ssh.exec_command("/bin/gunzip /usr/lib/libcrypto.so.1.0.2.gz") + out = out.channel.recv_exit_status() + if out != 0: + raise Exception("libcrypto could not be decompressed on the tablet [%d]" % out) + log.info("Installation successful!") + except Exception as e: + log.error('%s %s', type(e), e) + QMessageBox.critical(None, "Error", 'There has been an error while trying to install the required components on the tablet.\n%s.' % e) + self.quit() + return + else: + self.quit() + return + _,out,_ = ssh.exec_command("[ -x $HOME/rM-vnc-server-standalone ]") if out.channel.recv_exit_status() != 0: mbox = QMessageBox(QMessageBox.NoIcon, 'Missing components', 'Your reMarkable is missing some needed components.') @@ -253,11 +285,12 @@ class rMViewApp(QApplication): mbox.addButton("Auto Install", QMessageBox.AcceptRole) mbox.setDefaultButton(0) answer = mbox.exec() - log.info(answer) + log.debug(answer) if answer == 1: log.info("Installing...") try: - sftp = ssh.open_sftp() + if sftp is None: + sftp = ssh.open_sftp() from stat import S_IXUSR fo = QFile(':bin/rM%d-vnc-server-standalone' % version) fo.open(QIODevice.ReadOnly)