Beispiel #1
0
def write_path(r):
    """
    Writes a script to update the PATH variable into the sync registry
    The PATH update mirrors the current RobSettings

    SeeAlso:
        utool.util_win32.add_to_win32_PATH
    """
    import utool
    write_dir = join(r.d.HOME, 'Sync/win7/registry')
    path_fpath = normpath(join(write_dir, 'UPDATE_PATH.reg'))
    key = '[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment]'
    rtype = 'REG_EXPAND_SZ'
    pathsep = os.path.pathsep
    # Read current PATH values
    win_pathlist = list(os.environ['PATH'].split(os.path.pathsep))
    rob_pathlist = list(map(normpath, r.path_vars_list))
    new_path_list = utool.unique_ordered(win_pathlist + rob_pathlist)
    #new_path_list = unique_ordered(win_pathlist, rob_pathlist)
    print('\n'.join(new_path_list))
    pathtxt = pathsep.join(new_path_list)
    varval_list = [('Path', pathtxt)]
    write_regfile(path_fpath, key, varval_list, rtype)

    rob_helpers.view_directory(write_dir)
Beispiel #2
0
def write_path(r):
    """
    Writes a script to update the PATH variable into the sync registry
    The PATH update mirrors the current RobSettings

    SeeAlso:
        utool.util_win32.add_to_win32_PATH
    """
    import utool
    write_dir = join(r.d.HOME, 'Sync/win7/registry')
    path_fpath = normpath(join(write_dir, 'UPDATE_PATH.reg'))
    key = '[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment]'
    rtype = 'REG_EXPAND_SZ'
    pathsep = os.path.pathsep
    # Read current PATH values
    win_pathlist = list(os.environ['PATH'].split(os.path.pathsep))
    rob_pathlist = list(map(normpath, r.path_vars_list))
    new_path_list = utool.unique_ordered(win_pathlist + rob_pathlist)
    #new_path_list = unique_ordered(win_pathlist, rob_pathlist)
    print('\n'.join(new_path_list))
    pathtxt = pathsep.join(new_path_list)
    varval_list = [('Path', pathtxt)]
    write_regfile(path_fpath, key, varval_list, rtype)

    rob_helpers.view_directory(write_dir)
Beispiel #3
0
def write_env(r):
    rtype = 'REG_SZ'
    rtype = 'REG_EXPAND_SZ'
    write_dir = join(r.d.HOME, 'Sync/win7/registry')
    envtxt_fpath = normpath(join(write_dir, 'UPDATE_ENVARS.reg'))
    key = '[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment]'
    write_regfile(envtxt_fpath, key, r.env_vars_list, rtype)
    rob_helpers.view_directory(write_dir)
Beispiel #4
0
def write_env(r):
    rtype = 'REG_SZ'
    rtype = 'REG_EXPAND_SZ'
    write_dir = join(r.d.HOME, 'Sync/win7/registry')
    envtxt_fpath = normpath(join(write_dir, 'UPDATE_ENVARS.reg'))
    key = '[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment]'
    write_regfile(envtxt_fpath, key, r.env_vars_list, rtype)
    rob_helpers.view_directory(write_dir)
Beispiel #5
0
def reg_disable_automatic_reboot_122614(r):
    """
    rob reg_disable_automatic_reboot_122614

    writes a registry file that can be executed to produce desired changes

    References:
        http://www.makeuseof.com/tag/disable-forced-restarts-windows-update/
    """
    write_dir = join(r.d.HOME, 'Sync/win7/registry')
    envtxt_fpath = normpath(join(write_dir, 'disable_autoreboot.reg'))
    key = r'[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU]'
    varval_list = [('NoAutoRebootWithLoggedOnUsers', '1')]
    rtype = 'REG_DWORD'
    write_regfile(envtxt_fpath, key, varval_list, rtype)
    rob_helpers.view_directory(write_dir)
Beispiel #6
0
def reg_disable_automatic_reboot_122614(r):
    """
    rob reg_disable_automatic_reboot_122614

    writes a registry file that can be executed to produce desired changes

    References:
        http://www.makeuseof.com/tag/disable-forced-restarts-windows-update/
    """
    write_dir = join(r.d.HOME, 'Sync/win7/registry')
    envtxt_fpath = normpath(join(write_dir, 'disable_autoreboot.reg'))
    key = r'[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU]'
    varval_list = [('NoAutoRebootWithLoggedOnUsers', '1')]
    rtype = 'REG_DWORD'
    write_regfile(envtxt_fpath, key, varval_list, rtype)
    rob_helpers.view_directory(write_dir)