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> </xs:element>
<!-- END SCRIPTS --> <!-- END SCRIPTS -->
</xs:all> </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:complexType>
</xs:element> </xs:element>
</xs:schema> </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' version = '0.2.0'
external_deps = ['blkinfo', external_deps = ['blkinfo',
'gpg', 'gpg',

View File

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


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

View File

@ -25,20 +25,24 @@ _mod_dir = os.path.join('/lib/modules',
os.uname().release, os.uname().release,
'kernel/fs') 'kernel/fs')
_strip_mod_suffix = re.compile(r'(?P<fsname>)\.ko(\.(x|g)?z)?$', re.IGNORECASE) _strip_mod_suffix = re.compile(r'(?P<fsname>)\.ko(\.(x|g)?z)?$', re.IGNORECASE)
for i in os.listdir(_mod_dir): try:
path = os.path.join(_mod_dir, i) for i in os.listdir(_mod_dir):
fs_name = None path = os.path.join(_mod_dir, i)
if os.path.isdir(path): fs_name = None
fs_name = i if os.path.isdir(path):
elif os.path.isfile(path): fs_name = i
mod_name = _strip_mod_suffix.search(i) elif os.path.isfile(path):
fs_name = mod_name.group('fsname') mod_name = _strip_mod_suffix.search(i)
if fs_name: fs_name = mod_name.group('fsname')
# The kernel *probably* has autoloading enabled, but in case it doesn't... if fs_name:
# TODO: logging! # The kernel *probably* has autoloading enabled, but in case it doesn't...
if os.getuid() == 0: # TODO: logging!
subprocess.run(['modprobe', fs_name]) if os.getuid() == 0:
FS_FSTYPES.append(fs_name) 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): class FS(object):