# These folders are excluded by default. exclude_folders = ["/run/*", "/lost+found/*", "/dev/*", "/proc/*", "/sys/*", "/boot/grub/*", "/media/*", "/tmp/*", "/mnt/*", ".gvfs", "$BRFOLDER"] # if the user wants to exclude his home folder, add it to the exclude list if not include_home: exclude_folders.append("/home/*") tar_default_args = ["cvpf", "--sparse"] tar_patched_args = ["--acls", "--selinux", "--xattrs"] tar_exclude_args = ["--exclude=" + folder for folder in exclude_folders] # Construct tar's argument list tar_args = tar_default_args + tar_exclude_args if use_patched_tar: tar_args += tar_patched_args print(tar_args)