Skip to content

Commit

Permalink
fix fs parse with psutil
Browse files Browse the repository at this point in the history
  • Loading branch information
pennybelle committed Oct 4, 2024
1 parent 4d752ff commit 7e2eebf
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/pbfetch/parse/fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,15 @@ def parse_fs():
partitions = disk_partitions()
disks = {}
for disk in partitions:
disks[disk.device] = disk
# print(disks)
disks[disk.mountpoint] = disk.fstype

values = [item for item in disks.values()]
if len(values) == 1:
# print(values)
fs = values[0].fstype
fs = values[0]
return fs

elif "/" in disks.keys():
fs = disks["/"].fstype
fs = disks["/"]
return fs

except Exception:
Expand All @@ -38,3 +36,13 @@ def parse_fs():
except Exception as e:
print(f"Parse Filesystem Error: {e}")
return None


"""
{'/dev/mapper/root': sdiskpart(device='/dev/mapper/root', mountpoint='/', fstype='btrfs', opts='rw,relatime,compress=zstd:3,ssd,space_cache=v2,subvolid=256,subvol=/@')}
{'/dev/mapper/root': sdiskpart(device='/dev/mapper/root', mountpoint='/.snapshots', fstype='btrfs', opts='rw,relatime,compress=zstd:3,ssd,space_cache=v2,subvolid=260,subvol=/@.snapshots')}
{'/dev/mapper/root': sdiskpart(device='/dev/mapper/root', mountpoint='/var/log', fstype='btrfs', opts='rw,relatime,compress=zstd:3,ssd,space_cache=v2,subvolid=258,subvol=/@log')}
{'/dev/mapper/root': sdiskpart(device='/dev/mapper/root', mountpoint='/var/cache/pacman/pkg', fstype='btrfs', opts='rw,relatime,compress=zstd:3,ssd,space_cache=v2,subvolid=259,subvol=/@pkg')}
{'/dev/mapper/root': sdiskpart(device='/dev/mapper/root', mountpoint='/home', fstype='btrfs', opts='rw,relatime,compress=zstd:3,ssd,space_cache=v2,subvolid=257,subvol=/@home')}
{'/dev/mapper/root': sdiskpart(device='/dev/mapper/root', mountpoint='/home', fstype='btrfs', opts='rw,relatime,compress=zstd:3,ssd,space_cache=v2,subvolid=257,subvol=/@home'), '/dev/nvme0n1p1': sdiskpart(device='/dev/nvme0n1p1', mountpoint='/boot', fstype='vfat', opts='rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro')}
"""

0 comments on commit 7e2eebf

Please sign in to comment.