WizardKit/.bin/Scripts/safemode_enter.py
2Shirt 0902a7997f Moved SafeMode sections into functions/safemode.py
* Allows for better descriptions of the actions being taken
* Allowd for better error handling
* Fixes issue #34
2018-05-14 12:58:06 -06:00

38 lines
1.1 KiB
Python

# Wizard Kit: Enter SafeMode by editing the BCD
import os
import sys
# Init
os.chdir(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(os.getcwd())
from functions.safemode import *
init_global_vars()
os.system('title {}: SafeMode Tool'.format(KIT_NAME_FULL))
if __name__ == '__main__':
try:
clear_screen()
print_info('{}: SafeMode Tool\n'.format(KIT_NAME_FULL))
other_results = {
'Error': {'CalledProcessError': 'Unknown Error'},
'Warning': {}}
if not ask('Enable booting to SafeMode (with Networking)?'):
abort()
# Configure SafeMode
try_and_print(message='Set BCD option...',
function=enable_safemode, other_results=other_results)
try_and_print(message='Enable MSI in SafeMode...',
function=enable_safemode_msi, other_results=other_results)
# Done
print_standard('\nDone.')
pause('Press Enter to reboot...')
reboot()
exit_script()
except SystemExit:
pass
except:
major_exception()