18 lines
522 B
Python
18 lines
522 B
Python
|
from . import btrfs, mounts
|
||
|
from .. import utils
|
||
|
|
||
|
|
||
|
async def create_snapshot(name:str, user:str):
|
||
|
# Find home path and mount
|
||
|
user_path = await utils.get_user_home(user)
|
||
|
candidates = []
|
||
|
for i in await mounts.list_mounts():
|
||
|
if user_path.startswith(i.target):
|
||
|
candidates.append(i)
|
||
|
candidates = sorted(candidates, key=lambda x: len(x.target))
|
||
|
mount = candidates[-1]
|
||
|
|
||
|
# List subvolumes
|
||
|
subvols = btrfs.list_path_subvolumes(mount, user_path)
|
||
|
print(repr(subvols))
|
||
|
raise
|