spoc/usr/bin/spoc-hook

17 lines
440 B
Plaintext
Raw Normal View History

2020-02-06 19:00:41 +01:00
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
from spoc.container import Container
if __name__ == '__main__':
hook_type = os.environ['LXC_HOOK_TYPE']
container = Container(os.environ['LXC_NAME'], True)
if hook_type == 'pre-start':
container.clean_ephemeral_layer()
container.mount_rootfs()
elif hook_type == 'post-stop':
container.unmount_rootfs()
container.clean_ephemeral_layer()