some more groundwork

This commit is contained in:
brent s 2019-11-01 03:43:14 -04:00
parent ca1f12f5bd
commit d36368c4df
6 changed files with 22 additions and 18 deletions

View File

@ -810,7 +810,7 @@
</xs:element>
<!-- END SCRIPTS -->
</xs:all>
<xs:attribute name="version" type="aif:t_nonempty" use="required"/>
<xs:attribute name="version" type="aif:t_nonempty" use="optional" default="master"/>
</xs:complexType>
</xs:element>
</xs:schema>

2
aif/config/__init__.py Normal file
View File

@ -0,0 +1,2 @@
from . import parser
# from . import generator # pending API

View File

@ -1,3 +1,4 @@
arch_releng_key = '4AA4767BBC9C4B1D18AE28B77F2D434B9741E8AC'
version = '0.2.0'
external_deps = ['blkinfo',
'gpg',

View File

@ -3,9 +3,7 @@
# https://github.com/dcantrell/pyparted/blob/master/examples/query_device_capacity.py
# TODO: Remember to replicate genfstab behaviour.

import os
import re
import subprocess
try:
# https://stackoverflow.com/a/34812552/733214
# https://github.com/karelzak/util-linux/blob/master/libmount/python/test_mount_context.py#L6
@ -14,7 +12,6 @@ except ImportError:
# We should never get here. util-linux is part of core (base) in Arch and uses "libmount".
import pylibmount as mount
##
# import blkinfo
import parted # https://www.gnu.org/software/parted/api/index.html
import psutil
##

View File

@ -25,6 +25,7 @@ _mod_dir = os.path.join('/lib/modules',
os.uname().release,
'kernel/fs')
_strip_mod_suffix = re.compile(r'(?P<fsname>)\.ko(\.(x|g)?z)?$', re.IGNORECASE)
try:
for i in os.listdir(_mod_dir):
path = os.path.join(_mod_dir, i)
fs_name = None
@ -39,6 +40,9 @@ for i in os.listdir(_mod_dir):
if os.getuid() == 0:
subprocess.run(['modprobe', fs_name])
FS_FSTYPES.append(fs_name)
except FileNotFoundError:
# We're running on a kernel that doesn't have modules
pass


class FS(object):