Beispiel #1
0
def install_defaults(temp_folder, configuration):
    prnt.prnt('-n', 'Intalling the files from ' + temp_folder + 'file.')

    if (fileu.locate_folder(temp_folder)):
        prnt.prnt('-n', 'Located the folder.')

        # Install default i3 file
        if 'i3-config' in configuration:
            if (install_file(configuration, 'i3-config',
                             temp_folder + 'i3.template')):
                prnt.prnt('-s', 'Success!')
            else:
                prnt.prnt('-f', 'Failed!')

        # Install default polybar file
        if 'polybar-config' in configuration:
            if (install_file(configuration, 'polybar-config',
                             temp_folder + 'polybar.template')):
                prnt.prnt('-s', 'Success!')
            else:
                prnt.prnt('-f', 'Failed!')

        # Install default Xresources file
        if 'xresources' in configuration:
            if (install_file(configuration, 'xresources',
                             temp_folder + 'xresources.template')):
                prnt.prnt('-s', 'Success!')
            else:
                prnt.prnt('-f', 'Failed!')
    else:
        prnt.prnt('-f', 'Failed to locate the folder.')
        exit(9)
Beispiel #2
0
def backup_config(backup_folder, configuration):
    prnt.prnt('-n', 'Backing up your files.')

    if (fileu.locate_folder(backup_folder)):
        prnt.prnt('-s', 'Located the backup folder.')

        # Backup i3 file
        if 'i3-config' in configuration:
            if (backup_file(configuration, 'i3-config',
                            backup_folder + '/i3.config')):
                prnt.prnt('-s', 'Success!')
            else:
                prnt.prnt('-f', 'Failed!')

        # Backup Polybr config
        if 'polybar-config' in configuration:
            if (backup_file(configuration, 'polybar-config',
                            backup_folder + '/polybar.config')):
                prnt.prnt('-s', 'Success!')
            else:
                prnt.prnt('-f', 'Failed!')

        # Backup xresources
        if 'xresources' in configuration:
            if (backup_file(configuration, 'xresources',
                            backup_folder + '/xresources')):
                prnt.prnt('-s', 'Success!')
            else:
                prnt.prnt('-f', 'Failed!')

    else:
        prnt.prnt('-f', 'Failed to locate the backup folder.')
        exit(9)