Made the scripts check all known linux applicaion starters instead of just one

This commit is contained in:
Nek-12 2020-07-16 20:36:47 +03:00
parent 6e1d9e9516
commit 829335a739
3 changed files with 25 additions and 35 deletions

3
.gitignore vendored
View File

@ -104,3 +104,6 @@ dist
# TernJS port file # TernJS port file
.tern-port .tern-port
#JetBrains .idea folder
.idea/

View File

@ -1,4 +1,3 @@
# notion-enhancer # notion-enhancer
# (c) 2020 dragonwocky <thedragonring.bod@gmail.com> # (c) 2020 dragonwocky <thedragonring.bod@gmail.com>
# (c) 2020 TarasokUA # (c) 2020 TarasokUA
@ -57,23 +56,15 @@ try:
f' * {os.path.join(filepath, "app.asar.bak")} was not found: step skipped.') f' * {os.path.join(filepath, "app.asar.bak")} was not found: step skipped.')
if sys.platform == 'linux' and 'microsoft' not in platform.uname()[3].lower(): if sys.platform == 'linux' and 'microsoft' not in platform.uname()[3].lower():
path = '' pathlist = ['/usr/bin/notion-app', '/usr/bin/notion', '/opt/notion-app/notion-app']
if os.path.exists('/opt/notion-app/notion-app'): # get all the possible paths where the launcher may be located
path = '/opt/notion-app/notion-app' for path in pathlist:
elif os.path.exists('/usr/bin/notion-app'): if os.path.exists(path):
path = '/usr/bin/notion-app'
elif os.path.exists('/usr/bin/notion'):
path = '/usr/bin/notion'
else:
raise ValueError("Couldn't find the app launcher")
with open(path, 'r', encoding='UTF-8') as launcher: with open(path, 'r', encoding='UTF-8') as launcher:
contents = launcher.read() contents = launcher.read()
if 'app.asar' not in contents: if 'app.asar' not in contents:
print( print(f' ...patching app launcher in {path}')
f' ...patching app launcher') subprocess.call(['sed', '-i', r's/electron6\ app/electron6\ app\.asar/', path])
subprocess.call(
['sed', '-i', r's/electron6\ app/electron6\ app\.asar/',
path])
print(f'\n{bold}>>> SUCCESSFULLY CLEANED <<<{normal}') print(f'\n{bold}>>> SUCCESSFULLY CLEANED <<<{normal}')

View File

@ -224,19 +224,15 @@ try:
f' * {os.path.join(filepath, "app", "main", "main.js")} was not found: step skipped.') f' * {os.path.join(filepath, "app", "main", "main.js")} was not found: step skipped.')
if sys.platform == 'linux' and 'microsoft' not in platform.uname()[3].lower(): if sys.platform == 'linux' and 'microsoft' not in platform.uname()[3].lower():
print( def patch(dest):
f' ...patching app launcher') print(f' ...patching app launcher in {path}')
s = '' subprocess.call(['sed', '-i', r's/electron6\ app\.asar/electron6\ app/', dest])
if os.path.exists('/opt/notion-app/notion-app'):
s = '/opt/notion-app/notion-app' pathlist = ['/usr/bin/notion-app', '/usr/bin/notion', '/opt/notion-app/notion-app']
elif os.path.exists('/usr/bin/notion-app'): # check all the paths where the launcher may be located
s = '/usr/bin/notion-app' for path in pathlist:
elif os.path.exists('/usr/bin/notion'): if os.path.exists(path):
s = '/usr/bin/notion' patch(path)
else:
raise ValueError("Couldn't find the app launcher")
subprocess.call(
['sed', '-i', r's/electron6\ app\.asar/electron6\ app/', s])
print('\n>>> SUCCESSFULLY CUSTOMISED <<<') print('\n>>> SUCCESSFULLY CUSTOMISED <<<')