|
@@ -17,7 +17,8 @@ from .mount import getmntinfo |
|
|
import shlex
|
|
|
import shlex
|
|
|
import stat
|
|
|
import stat
|
|
|
from .misc import focker_lock, \
|
|
|
from .misc import focker_lock, \
|
|
|
focker_unlock
|
|
|
|
|
|
|
|
|
focker_unlock, \
|
|
|
|
|
|
random_sha256_hexdigest
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def backup_file(fname, nbackups=10, chmod=0o600):
|
|
|
def backup_file(fname, nbackups=10, chmod=0o600):
|
|
@@ -44,7 +45,7 @@ def jail_conf_write(conf): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def jail_fs_create(image=None):
|
|
|
def jail_fs_create(image=None):
|
|
|
sha256 = bytes([ random.randint(0, 255) for _ in range(32) ]).hex()
|
|
|
|
|
|
|
|
|
sha256 = random_sha256_hexdigest()
|
|
|
lst = zfs_list(fields=['focker:sha256'], focker_type='image')
|
|
|
lst = zfs_list(fields=['focker:sha256'], focker_type='image')
|
|
|
lst = list(filter(lambda a: a[0] == sha256, lst))
|
|
|
lst = list(filter(lambda a: a[0] == sha256, lst))
|
|
|
if lst:
|
|
|
if lst:
|
|
@@ -273,7 +274,7 @@ def command_jail_oneshot_old(): |
|
|
base, _ = zfs_snapshot_by_tag_or_sha256(args.image)
|
|
|
base, _ = zfs_snapshot_by_tag_or_sha256(args.image)
|
|
|
# root = '/'.join(base.split('/')[:-1])
|
|
|
# root = '/'.join(base.split('/')[:-1])
|
|
|
for _ in range(10**6):
|
|
|
for _ in range(10**6):
|
|
|
sha256 = bytes([ random.randint(0, 255) for _ in range(32) ]).hex()
|
|
|
|
|
|
|
|
|
sha256 = random_sha256_hexdigest()
|
|
|
name = sha256[:7]
|
|
|
name = sha256[:7]
|
|
|
name = base.split('/')[0] + '/focker/jails/' + name
|
|
|
name = base.split('/')[0] + '/focker/jails/' + name
|
|
|
if not zfs_exists(name):
|
|
|
if not zfs_exists(name):
|
|
|