#!/usr/bin/python3

"""
Check if any of the directories provided in the imports.mounts configuration
section are empty.

Returns 0 if all arguments are non-empty, 1 otherwise. It stops at the first
empty directory.
"""

import os
import configuration

cfg = configuration.read()

if cfg and "imports" in cfg and "mounts" in cfg["imports"]:

	mounts = cfg["imports"]["mounts"]
	for item in mounts:
		with os.scandir(item) as contents:
			if not any(contents):
				exit(1)

else:
	print("No mounts in configuration")

exit(0)
