- Updated Uninstaller to silence some output

This commit is contained in:
Ben Reaves
2020-06-19 11:04:31 -05:00
parent efc772d687
commit 9a1e66620b

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import json, time, os, sys, subprocess, shlex import json, time, os, sys, subprocess, shlex, platform
from shutil import copyfile from shutil import copyfile
from subprocess import PIPE, Popen from subprocess import PIPE, Popen
from prekinto import * from prekinto import *
@@ -16,8 +16,9 @@ def windows_setup():
print("") print("")
# Short DOS path notation # Short DOS path notation
path= cmdline('echo %cd%')[:-1] path= cmdline('echo %cd%')[:-1]
print("Copying autohotkey combinations for Terminals & Editors...") if default > 0 and default < 3:
os.system("copy /Y " + path + "\\windows\\kinto.ahk " + path + "\\windows\\kinto-new.ahk") print("Copying autohotkey combinations for Terminals & Editors...")
os.system("copy /Y " + path + "\\windows\\kinto.ahk " + path + "\\windows\\kinto-new.ahk")
if default == 1: if default == 1:
os.system('perl -pi -e "s/(; )(.*)(; MacModifiers)/$2$3/g" ./windows/kinto-new.ahk') os.system('perl -pi -e "s/(; )(.*)(; MacModifiers)/$2$3/g" ./windows/kinto-new.ahk')
# os.system("regedit " + path + "\\windows\\macbook_winctrl_swap.reg") # os.system("regedit " + path + "\\windows\\macbook_winctrl_swap.reg")
@@ -25,12 +26,17 @@ def windows_setup():
os.system('perl -pi -e "s/(; )(.*)(; WinModifiers)/$2$3/g" ./windows/kinto-new.ahk') os.system('perl -pi -e "s/(; )(.*)(; WinModifiers)/$2$3/g" ./windows/kinto-new.ahk')
# os.system("regedit " + path + "\\windows\\standard_ctrlalt_swap.reg") # os.system("regedit " + path + "\\windows\\standard_ctrlalt_swap.reg")
elif default == 3: elif default == 3:
os.system("regedit " + path + "\\windows\\remove_keyswap.reg") print("Removing any old registry keys from prior versions...")
os.system("del /f .\\windows\\kinto-new.ahk") p = subprocess.Popen(['powershell.exe', "Remove-ItemProperty -Path HKLM:'SYSTEM\CurrentControlSet\Control\Keyboard Layout' -Name 'Scancode Map' -ErrorAction SilentlyContinue"], stdout=sys.stdout)
os.system("del \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\kinto.ahk\"") print("Removing Kinto from Startup folder...")
os.system("taskkill /IM autohotkey.exe") os.system("(del \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\kinto.ahk\") 2>$null")
os.system('rd /s /q %userprofile%\\.kinto') os.system('(del "%userprofile%\\AppData\\Roaming\\Microsoft\\Windows\\STARTM~1\\Programs\\Startup\\kinto-start.vbs") 2>$null')
os.system('del "%userprofile%\\AppData\\Roaming\\Microsoft\\Windows\\STARTM~1\\Programs\\Startup\\kinto-start.vbs"') print("Ending any running Kinto tasks...")
os.system("(taskkill /IM autohotkey.exe) 2>$null")
print("Removing Kinto from users profile directory...")
os.system('(rd /s /q %userprofile%\\.kinto) 2>$null')
print("")
print("Uninstall of Kinto is Complete.")
if default > 0 and default < 3: if default > 0 and default < 3:
stvscode = yn_choice(bcolors.CYELLOW2 + "Would you like to use Sublime Text 3 keymaps in VS Code?\n" + bcolors.ENDC) stvscode = yn_choice(bcolors.CYELLOW2 + "Would you like to use Sublime Text 3 keymaps in VS Code?\n" + bcolors.ENDC)
print("Will now install chocolatey and autohotkey with elevated privileges...") print("Will now install chocolatey and autohotkey with elevated privileges...")
@@ -56,7 +62,7 @@ def windows_setup():
# # print("\nPlease log off and back on for changes to take full effect.") # # print("\nPlease log off and back on for changes to take full effect.")
print("If using WSL then please remember to right click on title bar -> Properties -> Edit Options -> Use Ctrl+Shift+C/V as Copy/Paste and enable it.") print("If using WSL then please remember to right click on title bar -> Properties -> Edit Options -> Use Ctrl+Shift+C/V as Copy/Paste and enable it.")
else: else:
os.system("del \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\kinto.ahk\"") os.system("(del \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\kinto.ahk\") 2>$null")
def cmdline(command): def cmdline(command):
process = Popen( process = Popen(
@@ -67,7 +73,11 @@ def cmdline(command):
) )
return process.communicate()[0] return process.communicate()[0]
# check_x11 = cmdline("env | grep -i x11").strip() if platform.system() == 'Windows':
print("\nYou are detected as running Windows.")
windows_setup()
sys.exit()
check_x11 = cmdline("(env | grep -i x11 || loginctl show-session \"$XDG_SESSION_ID\" -p Type) | awk -F= '{print $2}'").strip() check_x11 = cmdline("(env | grep -i x11 || loginctl show-session \"$XDG_SESSION_ID\" -p Type) | awk -F= '{print $2}'").strip()
if len(check_x11) == 0: if len(check_x11) == 0: