whew. this should work.

https://docstore.mik.ua/orelly/xml/schema/ch10_10.htm
This commit is contained in:
brent s. 2019-12-10 07:00:13 -05:00
parent e9405db556
commit 2295c0a078
9 changed files with 269 additions and 264 deletions

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="unqualified">

<xs:include schemaLocation="../types/linux.xsd"/>

<xs:complexType name="t_linux_disk">
<xs:sequence>
<xs:element name="part" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="1">
<xs:element name="partitionFlag" minOccurs="1" maxOccurs="unbounded" type="t_linux_part_flags"/>
</xs:sequence>
<xs:attribute name="id" type="xs:ID" use="required"/>
<xs:attribute name="name" type="t_std_nonempty" use="optional"/>
<xs:attribute name="label" type="t_std_nonempty" use="optional"/>
<xs:attribute name="start" type="t_linux_disksize" use="required"/>
<xs:attribute name="stop" type="t_linux_disksize" use="required"/>
<xs:attribute name="fsType" type="t_linux_fstype" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:ID" use="required"/>
<xs:attribute name="device" type="t_linux_diskdev" use="required"/>
<xs:attribute name="diskFormat" type="t_sys_diskfmt" use="required"/>
</xs:complexType>

</xs:schema>

View File

@ -1,16 +1,16 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:t_aif="https://schema.xml.r00t2.io/lib/types/aif.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="unqualified"
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="unqualified">

<xs:include schemaLocation="./linux.xsd"/>
<xs:include schemaLocation="./net.xsd"/>
<xs:include schemaLocation="./std.xsd"/>
<xs:include schemaLocation="./unix.xsd"/>
<xs:include schemaLocation="../elements/linux.xsd"/>

<xs:simpleType name="t_auto_ip6">
<xs:union memberTypes="t_auto_ip6">
<xs:simpleType name="t_aif_auto_ip6">
<xs:union memberTypes="t_net_auto_ip6">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="false"/>
@ -22,7 +22,7 @@
</xs:union>
</xs:simpleType>

<xs:simpleType name="t_bootloaders">
<xs:simpleType name="t_aif_bootloaders">
<!-- TODO: expand?
https://wiki.archlinux.org/index.php/Category:Boot_loaders
https://wiki.archlinux.org/index.php/Arch_boot_process#Boot_loader -->
@ -35,7 +35,7 @@
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="t_dhcp_clients">
<xs:simpleType name="t_aif_dhcp_clients">
<!-- Only valid for netctl. AIF-NG uses the internal daemons for systemd-networkd and NM. -->
<xs:restriction base="xs:string">
<xs:enumeration value="dhcpcd"/>
@ -43,7 +43,7 @@
</xs:restriction>
</xs:simpleType>

<xs:complexType name="t_iface">
<xs:complexType name="t_aif_iface">
<xs:sequence>
<xs:choice maxOccurs="unbounded">
<xs:element name="addresses" minOccurs="0" maxOccurs="1">
@ -56,8 +56,8 @@
<xs:element name="address" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="t_qualified_addr_ip4">
<xs:attribute name="gateway" type="t_addr_ip4"
<xs:extension base="t_net_qualified_addr_ip4">
<xs:attribute name="gateway" type="t_net_addr_ip4"
use="optional"/>
</xs:extension>
</xs:simpleContent>
@ -67,7 +67,7 @@
<xs:attribute name="auto" type="xs:boolean" use="optional" default="true"/>
</xs:complexType>
<xs:unique name="uniq_ipv4_addr">
<xs:selector xpath="t_aif:address"/>
<xs:selector xpath="address"/>
<xs:field xpath="."/>
</xs:unique>
</xs:element>
@ -77,15 +77,15 @@
<xs:element name="address" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="t_qualified_addr_ip6">
<xs:attribute name="gateway" type="t_addr_ip6"
<xs:extension base="t_net_qualified_addr_ip6">
<xs:attribute name="gateway" type="t_net_addr_ip6"
use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="auto" type="t_auto_ip6" use="optional" default="slaac"/>
<xs:attribute name="auto" type="t_aif_auto_ip6" use="optional" default="slaac"/>
</xs:complexType>
<xs:unique name="uniq_ipv6_addr">
<xs:selector xpath="address"/>
@ -100,7 +100,7 @@
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="unbounded">
<xs:choice minOccurs="1" maxOccurs="unbounded">
<xs:element name="resolver" minOccurs="1" maxOccurs="unbounded" type="t_both_addr"/>
<xs:element name="resolver" minOccurs="1" maxOccurs="unbounded" type="t_net_both_addr"/>
<xs:element name="ipv4" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="auto" type="xs:boolean"
@ -127,9 +127,9 @@
<xs:element name="route" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="t_qualified_addr_ip4">
<xs:extension base="t_net_qualified_addr_ip4">
<xs:attribute name="gateway"
type="t_addr_ip4"
type="t_net_addr_ip4"
use="required"/>
</xs:extension>
</xs:simpleContent>
@ -149,9 +149,9 @@
<xs:element name="address" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="t_qualified_addr_ip6">
<xs:extension base="t_net_qualified_addr_ip6">
<xs:attribute name="gateway"
type="t_addr_ip6"
type="t_net_addr_ip6"
use="required"/>
</xs:extension>
</xs:simpleContent>
@ -178,13 +178,13 @@
</xs:choice>
</xs:sequence>
<xs:attribute name="id" type="xs:ID" use="required"/>
<xs:attribute name="device" type="t_iface_name" use="required"/>
<xs:attribute name="device" type="t_aif_iface_name" use="required"/>
<xs:attribute name="defroute" type="xs:boolean" use="optional" default="false"/>
<xs:attribute name="searchDomain" type="t_nonempty" use="optional"/>
<xs:attribute name="searchDomain" type="t_std_nonempty" use="optional"/>
</xs:complexType>

<xs:simpleType name="t_iface_name">
<xs:union memberTypes="t_iface_name">
<xs:simpleType name="t_aif_iface_name">
<xs:union memberTypes="t_linux_iface_name">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="auto"/>
@ -193,22 +193,22 @@
</xs:union>
</xs:simpleType>

<xs:complexType name="t_iface_wifi">
<xs:complexType name="t_aif_iface_wifi">
<xs:complexContent>
<xs:extension base="t_iface">
<xs:extension base="t_aif_iface">
<xs:sequence>
<xs:element name="encryption" type="t_wifi_crypto" minOccurs="0" maxOccurs="1"/>
<xs:element name="encryption" type="t_net_wifi_crypto" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
<!-- TODO: SSID needs to support unicode chars in both XML(/XSD type=?) and program -->
<xs:attribute name="essid" type="xs:string" use="required"/>
<xs:attribute name="bssid" type="t_mac_addr" use="optional"/>
<xs:attribute name="bssid" type="t_net_mac_addr" use="optional"/>
<xs:attribute name="hidden" type="xs:boolean" use="optional" default="false"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>

<xs:simpleType name="t_netproto">
<xs:union memberTypes="t_netproto">
<xs:simpleType name="t_aif_netproto">
<xs:union memberTypes="t_net_netproto">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="both"/>
@ -217,7 +217,7 @@
</xs:union>
</xs:simpleType>

<xs:simpleType name="t_netprov">
<xs:simpleType name="t_aif_netprov">
<xs:restriction base="xs:token">
<xs:enumeration value="netctl"/>
<xs:enumeration value="nm"/>
@ -226,11 +226,11 @@
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="t_pacuri">
<xs:simpleType name="t_aif_pacuri">
<!-- xs:anyURI is too permissive. -->
<!-- <xs:restriction base="xs:anyURI"> -->
<xs:restriction base="xs:token">
<xs:pattern value="(file|https?)://.+"/>
<xs:pattern value="\s*(file|https?)://.+\s*"/>
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>

View File

@ -1,15 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:bsd="https://schema.xml.r00t2.io/lib/types/bsd.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="unqualified"
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="unqualified">

<xs:include schemaLocation="./linux.xsd"/>
<xs:include schemaLocation="./std.xsd"/>
<xs:include schemaLocation="./unix.xsd"/>

<xs:simpleType name="t_passwd_hashtypes">
<xs:union memberTypes="t_passwd_hashtypes">
<xs:simpleType name="t_bsd_passwd_hashtypes">
<xs:union memberTypes="t_linux_passwd_hashtypes">
<xs:simpleType>
<xs:restriction>
<!-- <xs:enumeration value="des"/> -->
@ -21,12 +20,12 @@
</xs:union>
</xs:simpleType>

<xs:simpleType name="t_shadowhash">
<xs:union memberTypes="t_shadowhash">
<xs:simpleType name="t_bsd_shadowhash">
<xs:union memberTypes="t_linux_shadowhash">
<xs:simpleType>
<xs:restriction>
<!-- Blowfish/bcrypt -->
<xs:pattern value="($2[abxy]?)?($[0-9]+)$[a-zA-Z0-9./]{53}"/>
<xs:pattern value="\s*($2[abxy]?)?($[0-9]+)$[a-zA-Z0-9./]{53}\s*"/>
</xs:restriction>
</xs:simpleType>
</xs:union>

View File

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="unqualified"
elementFormDefault="qualified"
attributeFormDefault="unqualified">

<xs:include schemaLocation="./std.xsd"/>
<xs:include schemaLocation="./sys.xsd"/>
<xs:include schemaLocation="./unix.xsd"/>

<xs:simpleType name="t_console_pageformats">
<xs:simpleType name="t_linux_console_pageformats">
<xs:restriction base="xs:positiveInteger">
<xs:enumeration value="8"/>
<xs:enumeration value="14"/>
@ -15,32 +15,23 @@
</xs:restriction>
</xs:simpleType>

<xs:complexType name="t_disk">
<xs:sequence>
<xs:element name="part" minOccurs="1" maxOccurs="unbounded" type="t_partition"/>
</xs:sequence>
<xs:attribute name="id" type="xs:ID" use="required"/>
<xs:attribute name="device" type="t_diskdev" use="required"/>
<xs:attribute name="diskFormat" type="t_diskfmt" use="required"/>
</xs:complexType>

<xs:simpleType name="t_diskdev">
<xs:simpleType name="t_linux_diskdev">
<xs:restriction base="xs:string">
<!-- TODO: is "auto" okay here? -->
<xs:pattern value="(/dev/([A-Za-z0-9_]+/)?[A-Za-z0-9_]+[0-9]?|auto)"/>
<xs:pattern value="\s*(/dev/([A-Za-z0-9_]+/)?[A-Za-z0-9_]+[0-9]?|auto)\s*"/>
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="t_disksize">
<xs:simpleType name="t_linux_disksize">
<xs:restriction base="xs:string">
<xs:pattern value="[-|+]?\s*([0-9]+)\s*(%|((k|Ki)|[MGTPEZY]i?)?B?|)\s*"/>
<xs:pattern value="\s*[-|+]?\s*([0-9]+)\s*(%|((k|Ki)|[MGTPEZY]i?)?B?|)\s*"/>
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="t_fstype">
<xs:union memberTypes="t_UUID4">
<xs:simpleType name="t_linux_fstype">
<xs:union memberTypes="t_std_UUID4">
<xs:simpleType>
<!-- parted names -->
<!-- https://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_type_GUIDs -->
@ -90,7 +81,7 @@
</xs:union>
</xs:simpleType>

<xs:simpleType name="t_iface_name">
<xs:simpleType name="t_linux_iface_name">
<xs:restriction base="xs:token">
<!-- https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-net_id.c.
I have no idea if this will work. TODO: simplify, validate in-code. -->
@ -100,30 +91,30 @@
</xs:restriction>
</xs:simpleType>

<xs:complexType name="t_luks">
<xs:complexType name="t_linux_luks">
<xs:sequence>
<!-- TODO: add support for custom flags/opts? -->
<xs:element name="luksDev" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="secrets" minOccurs="1" maxOccurs="10" type="t_luks_secrets"/>
<xs:element name="secrets" minOccurs="1" maxOccurs="10" type="t_linux_luks_secrets"/>
</xs:sequence>
<xs:attribute name="id" type="xs:ID" use="required"/>
<xs:attribute name="name" type="t_nonempty" use="required"/>
<xs:attribute name="name" type="t_std_nonempty" use="required"/>
<xs:attribute name="source" type="xs:IDREF" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>

<xs:complexType name="t_luks_secrets">
<xs:complexType name="t_linux_luks_secrets">
<xs:sequence minOccurs="1" maxOccurs="unbounded">
<xs:element name="passphrase" minOccurs="0" maxOccurs="unbounded" type="t_nonempty"/>
<xs:element name="passphrase" minOccurs="0" maxOccurs="unbounded" type="t_std_nonempty"/>
<!-- TODO: support URI to *read* bytes from? -->
<xs:element name="keyFile" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="t_filepath">
<xs:extension base="t_unix_filepath">
<xs:attribute name="size" type="xs:positiveInteger" use="optional"/>
</xs:extension>
</xs:simpleContent>
@ -132,7 +123,7 @@
</xs:sequence>
</xs:complexType>

<xs:complexType name="t_lvm">
<xs:complexType name="t_linux_lvm">
<xs:sequence>
<xs:element name="volumeGroup" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
@ -140,21 +131,21 @@
<xs:element name="physicalVolumes" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="pv" minOccurs="1" maxOccurs="unbounded" type="t_lvm_pv"/>
<xs:element name="pv" minOccurs="1" maxOccurs="unbounded" type="t_linux_lvm_pv"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="logicalVolumes" minOccurs="1" maxOccurs="1" type="t_lvm_lv"/>
<xs:element name="logicalVolumes" minOccurs="1" maxOccurs="1" type="t_linux_lvm_lv"/>
</xs:all>
<xs:attribute name="id" type="xs:ID" use="required"/>
<xs:attribute name="name" type="t_nonempty" use="required"/>
<xs:attribute name="extentSize" type="t_pesize" use="optional" default="0"/>
<xs:attribute name="name" type="t_std_nonempty" use="required"/>
<xs:attribute name="extentSize" type="t_linux_pesize" use="optional" default="0"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>

<xs:complexType name="t_lvm_lv">
<xs:complexType name="t_linux_lvm_lv">
<xs:sequence>
<xs:element name="lv" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
@ -166,19 +157,19 @@
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:ID" use="required"/>
<xs:attribute name="name" type="t_nonempty" use="required"/>
<xs:attribute name="size" type="t_lvsize" use="required"/>
<xs:attribute name="name" type="t_std_nonempty" use="required"/>
<xs:attribute name="size" type="t_linux_lvsize" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>

<xs:complexType name="t_lvm_pv">
<xs:complexType name="t_linux_lvm_pv">
<xs:attribute name="id" type="xs:ID" use="required"/>
<xs:attribute name="source" type="xs:IDREF" use="required"/>
</xs:complexType>

<xs:simpleType name="t_lvsize">
<xs:simpleType name="t_linux_lvsize">
<!-- If no suffix is provided, program should assume the size is in *extents*. -->
<xs:restriction base="xs:string">
<xs:pattern value="\s*([0-9]+)\s*(%|((k|Ki)|[MGTPEZY]i?)?B?|)\s*"/>
@ -186,7 +177,7 @@
</xs:restriction>
</xs:simpleType>

<xs:complexType name="t_mdadm">
<xs:complexType name="t_linux_mdadm">
<xs:sequence minOccurs="1" maxOccurs="unbounded">
<xs:element name="array" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
@ -198,21 +189,21 @@
</xs:element>
</xs:sequence>
<xs:attribute name="id" use="required" type="xs:ID"/>
<xs:attribute name="name" use="required" type="t_nonempty"/>
<xs:attribute name="meta" use="optional" default="1.2" type="t_raid_meta"/>
<xs:attribute name="level" use="required" type="t_raid_levels"/>
<xs:attribute name="name" use="required" type="t_std_nonempty"/>
<xs:attribute name="meta" use="optional" default="1.2" type="t_linux_raid_meta"/>
<xs:attribute name="level" use="required" type="t_linux_raid_levels"/>
<!-- KB *only*. -->
<!-- Can be pretty important!
https://www.zdnet.com/article/chunks-the-hidden-key-to-raid-performance/ -->
<xs:attribute name="chunkSize" use="optional" type="xs:positiveInteger" default="512"/>
<xs:attribute name="layout" use="optional" type="t_raid_layout" default="none"/>
<xs:attribute name="layout" use="optional" type="t_linux_raid_layout" default="none"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>

<xs:simpleType name="t_mountpath">
<xs:union memberTypes="t_filepath">
<xs:simpleType name="t_linux_mountpath">
<xs:union memberTypes="t_unix_filepath">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="swap"/>
@ -221,27 +212,28 @@
</xs:union>
</xs:simpleType>

<xs:complexType name="t_mounts">
<xs:complexType name="t_linux_mounts">
<xs:sequence minOccurs="1" maxOccurs="unbounded">
<xs:element name="mount" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="opt" minOccurs="1" maxOccurs="unbounded" type="t_cmdopts"/>
<xs:element name="opt" minOccurs="1" maxOccurs="unbounded" type="t_std_cmdopts"/>
</xs:sequence>
<xs:attribute name="source" type="xs:IDREF" use="required"/>
<xs:attribute name="target" type="t_mountpath" use="required"/>
<xs:attribute name="target" type="t_linux_mountpath" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>

<xs:complexType name="t_nixpass">
<xs:complexType name="t_linux_nixpass">
<xs:choice minOccurs="1" maxOccurs="1">
<xs:element name="passwordPlain">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="hashType" use="optional" default="sha512" type="t_passwd_hashtypes"/>
<xs:attribute name="hashType" use="optional" default="sha512"
type="t_linux_passwd_hashtypes"/>
<xs:attribute name="rounds" use="optional" default="5000" type="xs:positiveInteger"/>
</xs:extension>
</xs:simpleContent>
@ -250,9 +242,9 @@
<xs:element name="passwordHash">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="t_shadowhash">
<xs:extension base="t_linux_shadowhash">
<xs:attribute name="hashType" use="optional" default="(detect)"
type="t_passwd_hashtypes_detect"/>
type="t_linux_passwd_hashtypes_detect"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
@ -261,15 +253,15 @@
<xs:attribute name="locked" use="optional" default="false" type="xs:boolean"/>
</xs:complexType>

<xs:complexType name="t_package">
<xs:complexType name="t_linux_package">
<xs:simpleContent>
<xs:extension base="t_nonempty">
<xs:attribute name="repo" type="t_nonempty" use="optional"/>
<xs:extension base="t_std_nonempty">
<xs:attribute name="repo" type="t_std_nonempty" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>

<xs:simpleType name="t_part_flags">
<xs:simpleType name="t_linux_part_flags">
<xs:union>
<xs:simpleType>
<!-- parted.partition.partitionFlag -->
@ -322,20 +314,8 @@
</xs:union>
</xs:simpleType>

<xs:complexType name="t_partition">
<xs:sequence minOccurs="0" maxOccurs="1">
<xs:element name="partitionFlag" minOccurs="1" maxOccurs="unbounded" type="t_part_flags"/>
</xs:sequence>
<xs:attribute name="id" type="xs:ID" use="required"/>
<xs:attribute name="name" type="t_nonempty" use="optional"/>
<xs:attribute name="label" type="t_nonempty" use="optional"/>
<xs:attribute name="start" type="t_disksize" use="required"/>
<xs:attribute name="stop" type="t_disksize" use="required"/>
<xs:attribute name="fsType" type="t_fstype" use="required"/>
</xs:complexType>

<xs:simpleType name="t_passwd_hashtypes">
<xs:union memberTypes="t_passwd_hashtypes">
<xs:simpleType name="t_linux_passwd_hashtypes">
<xs:union memberTypes="t_unix_passwd_hashtypes">
<xs:simpleType>
<xs:restriction base="xs:string">
<!-- Unsupported in glibc. libxcrypt (https://github.com/besser82/libxcrypt/) has additional support. -->
@ -350,8 +330,8 @@
</xs:union>
</xs:simpleType>

<xs:simpleType name="t_passwd_hashtypes_detect">
<xs:union memberTypes="t_passwd_hashtypes">
<xs:simpleType name="t_linux_passwd_hashtypes_detect">
<xs:union memberTypes="t_unix_passwd_hashtypes">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="(detect)"/>
@ -360,7 +340,7 @@
</xs:union>
</xs:simpleType>

<xs:simpleType name="t_pesize">
<xs:simpleType name="t_linux_pesize">
<!-- This is *basically* t_lvsize except we don't allow percentages. -->
<!-- If no suffix is provided, we assume the size is in sectors
UNLESS it's "0", which means use the default (which I *think* is dynamically generated). -->
@ -370,7 +350,7 @@
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="t_raid_layout">
<xs:simpleType name="t_linux_raid_layout">
<!-- mdadm(8), "layout=" option -->
<!-- We don't need to cook in the "faulty" levels. -->
<xs:restriction base="xs:token">
@ -380,7 +360,7 @@
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="t_raid_levels">
<xs:simpleType name="t_linux_raid_levels">
<xs:restriction base="xs:integer">
<xs:enumeration value="0"/>
<xs:enumeration value="1"/>
@ -391,7 +371,7 @@
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="t_raid_meta">
<xs:simpleType name="t_linux_raid_meta">
<!-- Program should warn about 1.x used for non-aware bootloaders.
0.90 should be used in that case. -->
<xs:restriction base="xs:token">
@ -408,50 +388,49 @@
</xs:restriction>
</xs:simpleType>

<xs:complexType name="t_service">
<xs:complexType name="t_linux_service">
<xs:simpleContent>
<xs:extension base="t_nonempty">
<xs:extension base="t_std_nonempty">
<xs:attribute name="status" type="xs:boolean" use="optional" default="true"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>

<xs:simpleType name="t_shadowhash">
<xs:union memberTypes="t_shadowhash">
<xs:simpleType name="t_linux_shadowhash">
<xs:union memberTypes="t_unix_shadowhash">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="($5)?($[a-zA-Z0-9./]{1,16})$[a-zA-Z0-9./]{43}"/><!-- sha256 -->
<xs:pattern value="($6)?($[a-zA-Z0-9./]{1,16})$[a-zA-Z0-9./]{86}"/><!-- sha512 -->
<xs:pattern value="\s*($5)?($[a-zA-Z0-9./]{1,16})$[a-zA-Z0-9./]{43}\s*"/><!-- sha256 -->
<xs:pattern value="\s*($6)?($[a-zA-Z0-9./]{1,16})$[a-zA-Z0-9./]{86}\s*"/><!-- sha512 -->
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>

<xs:complexType name="t_user">
<xs:complexType name="t_linux_user">
<xs:sequence>
<xs:element name="password" minOccurs="0" maxOccurs="1"
type="t_nixpass"/>
<xs:element name="password" minOccurs="0" maxOccurs="1" type="t_linux_nixpass"/>
<xs:element name="xGroup" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="name" type="t_posixUserGroup" use="required"/>
<xs:attribute name="name" type="t_unix_posixUserGroup" use="required"/>
<xs:attribute name="create" type="xs:boolean" use="optional" default="false"/>
<xs:attribute name="gid" type="xs:positiveInteger" use="optional"/>
</xs:complexType>
<xs:unique name="uniq_grp">
<xs:unique name="uniq_linux_grp">
<xs:selector xpath="."/>
<xs:field xpath="@name"/>
</xs:unique>
</xs:element>
</xs:sequence>
<xs:attribute name="name" type="t_posixUserGroup" use="required"/>
<xs:attribute name="home" type="t_filepath" use="optional"/>
<xs:attribute name="name" type="t_unix_posixUserGroup" use="required"/>
<xs:attribute name="home" type="t_unix_filepath" use="optional"/>
<xs:attribute name="uid" type="xs:positiveInteger" use="optional"/>
<xs:attribute name="group" type="t_posixUserGroup" use="optional"/>
<xs:attribute name="group" type="t_unix_posixUserGroup" use="optional"/>
<xs:attribute name="gid" type="xs:positiveInteger" use="optional"/>
<xs:attribute name="comment" type="t_nonempty" use="optional"/>
<xs:attribute name="comment" type="t_std_nonempty" use="optional"/>
<xs:attribute name="sudo" type="xs:boolean" use="optional" default="false"/>
<xs:attribute name="sudoPassword" type="xs:boolean" use="optional" default="true"/>
<xs:attribute name="shell" type="t_filepath" use="optional" default="/bin/bash"/>
<xs:attribute name="shell" type="t_unix_filepath" use="optional" default="/bin/bash"/>
<!-- TODO: change the positiveIntegers to xs:duration? or union? -->
<!-- Might be pointless since the smallest increment is 1 day in
shadow(5). -->
@ -459,7 +438,7 @@
<xs:attribute name="maxAge" type="xs:positiveInteger" use="optional"/>
<xs:attribute name="warnDays" type="xs:positiveInteger" use="optional"/>
<xs:attribute name="inactiveDays" type="xs:positiveInteger" use="optional"/>
<xs:attribute name="expireDate" type="t_epoch_or_iso" use="optional"/>
<xs:attribute name="expireDate" type="t_std_epoch_or_iso" use="optional"/>
</xs:complexType>

</xs:schema>

View File

@ -1,30 +1,29 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:net="https://schema.xml.r00t2.io/lib/types/net.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="unqualified"
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="unqualified">

<xs:include schemaLocation="./std.xsd"/>

<xs:simpleType name="t_addr_ip4">
<xs:simpleType name="t_net_addr_ip4">
<xs:restriction base="xs:string">
<!-- This is a REALLY LAZY regex. Matching IPv4 in regex is ugly as heck, so we do that in-code.
This is just a gatekeeper. -->
<xs:pattern value="[0-9.]{7,15}"/>
<xs:pattern value="\s*[0-9.]{7,15}\s*"/>
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="t_addr_ip6">
<xs:simpleType name="t_net_addr_ip6">
<xs:restriction base="xs:string">
<!-- This is a REALLY LAZY regex. Matching IPv6 in regex is ugly as heck, so we do that in-code.
This is just a gatekeeper. -->
<xs:pattern value="[A-Za-z0-9:]+"/>
<xs:pattern value="\s*[A-Za-z0-9:]+\s*"/>
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="t_authselect">
<xs:simpleType name="t_net_authselect">
<xs:restriction base="xs:token">
<xs:enumeration value="basic"/>
<xs:enumeration value="digest"/>
@ -33,44 +32,45 @@
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="t_auto_ip6">
<xs:simpleType name="t_net_auto_ip6">
<xs:restriction base="xs:string">
<xs:enumeration value="slaac"/>
<xs:enumeration value="dhcp6"/>
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="t_both_addr">
<xs:union memberTypes="t_addr_ip4 t_addr_ip6"/>
<xs:simpleType name="t_net_both_addr">
<xs:union memberTypes="t_net_addr_ip4 t_net_addr_ip6"/>
</xs:simpleType>

<xs:simpleType name="t_both_qualified_addr">
<xs:union memberTypes="t_qualified_addr_ip4 t_qualified_addr_ip6"/>
<xs:simpleType name="t_net_both_qualified_addr">
<xs:union memberTypes="t_net_qualified_addr_ip4 t_net_qualified_addr_ip6"/>
</xs:simpleType>

<xs:complexType name="t_http_resource">
<xs:complexType name="t_net_http_resource">
<xs:simpleContent>
<xs:extension base="t_uri">
<xs:attribute name="user" type="t_nonempty" use="optional"/>
<xs:attribute name="password" type="t_nonempty" use="optional"/>
<xs:attribute name="realm" type="t_nonempty" use="optional"/>
<xs:attribute name="authtype" type="t_authselect" use="optional" default="none"/>
<xs:extension base="t_std_uri">
<xs:attribute name="user" type="t_std_nonempty" use="optional"/>
<xs:attribute name="password" type="t_std_nonempty" use="optional"/>
<xs:attribute name="realm" type="t_std_nonempty" use="optional"/>
<xs:attribute name="authtype" type="t_net_authselect" use="optional" default="none"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>

<xs:simpleType name="t_mac_addr">
<xs:simpleType name="t_net_mac_addr">
<xs:restriction base="xs:token">
<!-- EUI48[RFC7043§3] (previously MAC48[RFC7042§2.1]) -->
<xs:pattern value="([A-Fa-f0-9]{2}[:-]?){5}[A-Fa-f0-9]{2}"/>
<xs:pattern value="\s*([A-Fa-f0-9]{2}[:-]?){5}[A-Fa-f0-9]{2}\s*"/>
<!-- EUI64[RFC7043§4, RFC4291§2.5.1] -->
<xs:pattern value="([A-Fa-f0-9]{2}[:-]?){3}[Ff]{3}[FfEe][:-]?([A-Fa-f0-9]{2}[:-]?){2}[A-Fa-f0-9]{2}"/>
<xs:pattern value="([A-Fa-f0-9]{2}[:-]?){3}[A-Fa-f0-9]{4}[:-]?([A-Fa-f0-9]{2}[:-]?){2}[A-Fa-f0-9]{2}"/>
<xs:pattern value="\s*([A-Fa-f0-9]{2}[:-]?){3}[Ff]{3}[FfEe][:-]?([A-Fa-f0-9]{2}[:-]?){2}[A-Fa-f0-9]{2}\s*"/>
<xs:pattern
value="\s*([A-Fa-f0-9]{2}[:-]?){3}[A-Fa-f0-9]{4}[:-]?([A-Fa-f0-9]{2}[:-]?){2}[A-Fa-f0-9]{2}\s*"/>
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="t_netproto">
<xs:simpleType name="t_net_netproto">
<xs:restriction base="xs:token">
<xs:enumeration value="ipv4"/>
<xs:enumeration value="ipv6"/>
@ -78,7 +78,7 @@
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="t_proto">
<xs:simpleType name="t_net_proto">
<!-- TODO: expand? Remove gre? -->
<xs:restriction base="xs:string">
<xs:enumeration value="tcp"/>
@ -88,20 +88,20 @@
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="t_qualified_addr_ip4">
<xs:simpleType name="t_net_qualified_addr_ip4">
<!-- This is a REALLY LAZY regex. Matching IPv4 in regex is ugly as heck, so we do that in-code.
This is just a gatekeeper. -->
<xs:restriction base="xs:string">
<xs:pattern value="[0-9.]{7,15}/[0-9]{1,2}"/>
<xs:pattern value="\s*[0-9.]{7,15}/[0-9]{1,2}\s*"/>
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="t_qualified_addr_ip6">
<xs:simpleType name="t_net_qualified_addr_ip6">
<!-- This is a REALLY LAZY regex. Matching IPv6 in regex is ugly as heck, so we do that in-code.
This is just a gatekeeper. -->
<xs:restriction base="xs:string">
<xs:pattern value="[A-Za-z0-9:]+/[0-9]{1,3}"/>
<xs:pattern value="\s*[A-Za-z0-9:]+/[0-9]{1,3}\s*"/>
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>
@ -111,7 +111,7 @@
EAP,
eduroam (https://github.com/rst0git/netctl-eduroam-config/blob/master/eduroam), etc. -->
<!-- wep64, wep128, wpa-psk:tkip, wpa-psk:aes, wpa2-psk:tkip, wpa2-psk:aes, wpa2-psk:tkip/aes -->
<xs:complexType name="t_wifi_crypto">
<xs:complexType name="t_net_wifi_crypto">
<xs:all>
<xs:element name="type" minOccurs="1" maxOccurs="1" default="wpa2">
<xs:simpleType>

View File

@ -1,33 +1,32 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:std="https://schema.xml.r00t2.io/lib/types/std.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="unqualified"
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="unqualified">

<xs:simpleType name="t_UUID4">
<xs:simpleType name="t_std_UUID4">
<xs:restriction base="xs:token">
<xs:pattern value="[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}"/>
<xs:pattern value="\s*[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}\s*"/>
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>

<xs:complexType name="t_cksum">
<xs:complexType name="t_std_cksum">
<xs:simpleContent>
<xs:extension base="t_cksum_hashtypes">
<xs:attribute name="hashType" use="required" type="t_cksum_hashtypes"/>
<xs:extension base="t_std_nonempty">
<xs:attribute name="hashType" use="required" type="t_std_cksum_hashtypes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>

<xs:complexType name="t_cksum_file">
<xs:complexType name="t_std_cksum_file">
<xs:simpleContent>
<xs:extension base="t_uri">
<xs:attribute name="hashType" use="required" type="t_cksum_hashtypes"/>
<xs:extension base="t_std_uri">
<xs:attribute name="hashType" use="required" type="t_std_cksum_hashtypes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>

<xs:simpleType name="t_cksum_hashtypes">
<xs:simpleType name="t_std_cksum_hashtypes">
<xs:restriction base="xs:string">
<xs:enumeration value="adler32"/>
<xs:enumeration value="crc32"/>
@ -49,7 +48,7 @@
</xs:restriction>
</xs:simpleType>

<xs:complexType name="t_cmdopts">
<xs:complexType name="t_std_cmdopts">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="name" use="required" type="xs:token"/>
@ -57,77 +56,77 @@
</xs:simpleContent>
</xs:complexType>

<xs:simpleType name="t_epoch_or_iso">
<xs:simpleType name="t_std_epoch_or_iso">
<!-- positiveInteger is used for UNIX Epoch. -->
<xs:union memberTypes="xs:dateTime xs:positiveInteger"/>
</xs:simpleType>

<xs:complexType name="t_gpg_keys">
<xs:complexType name="t_std_gpg_keys">
<xs:sequence minOccurs="1" maxOccurs="unbounded">
<xs:element name="keyID" minOccurs="1" maxOccurs="unbounded" type="t_gpg_key_id"/>
<xs:element name="keyID" minOccurs="1" maxOccurs="unbounded" type="t_std_gpg_key_id"/>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="t_gpg_key_id">
<xs:simpleType name="t_std_gpg_key_id">
<xs:restriction base="xs:string">
<xs:pattern value="(auto|default)"/><!-- Program should accept any key IDs it finds (INSECURE) -->
<xs:pattern value="(0x)?[0-9A-Fa-f]{40}"/><!-- Full key ID -->
<xs:pattern value="(0x)?[0-9A-Fa-f]{16}"/><!-- Shorthand key ID -->
<xs:pattern value="(0x)?[0-9A-Fa-f]{8}"/><!-- Legacy shorter shorthand -->
<xs:pattern value="([0-9A-Fa-f ]{4}){5} ?([0-9A-Fa-f ]{4}){4}[0-9A-Fa-f]{4}"/><!-- Fingerprint -->
<xs:pattern value="\s*(0x)?[0-9A-Fa-f]{40}\s*"/><!-- Full key ID -->
<xs:pattern value="\s*(0x)?[0-9A-Fa-f]{16}\s*"/><!-- Shorthand key ID -->
<xs:pattern value="\s*(0x)?[0-9A-Fa-f]{8}\s*"/><!-- Legacy shorter shorthand -->
<xs:pattern value="\s*([0-9A-Fa-f ]{4}){5} ?([0-9A-Fa-f ]{4}){4}[0-9A-Fa-f]{4}\s*"/><!-- Fingerprint -->
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="t_gpg_sig">
<xs:simpleType name="t_std_gpg_sig">
<xs:restriction base="xs:string">
<xs:whiteSpace value="preserve"/>
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="t_nonempty">
<xs:simpleType name="t_std_nonempty">
<xs:restriction base="xs:token">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="t_uri">
<xs:simpleType name="t_std_uri">
<xs:restriction base="xs:anyURI">
<xs:pattern value="(https?|ftps?|file)://.+"/>
<xs:pattern value="\s*(https?|ftps?|file)://.+\s*"/>
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>

<xs:complexType name="t_verifyfile">
<xs:all minOccurs="1">
<xs:element name="gpg" minOccurs="0" maxOccurs="1" type="t_verify_gpg">
<xs:complexType name="t_std_verifyfile">
<xs:choice minOccurs="1" maxOccurs="2">
<xs:element name="gpg" minOccurs="0" maxOccurs="1" type="t_std_verify_gpg">
<xs:unique name="uniq_gpg_sig">
<xs:selector xpath="std:signature"/>
<xs:selector xpath="signature"/>
<xs:field xpath="."/>
</xs:unique>
<xs:unique name="uniq_gpg_sigfile">
<xs:selector xpath="std:signatureFile"/>
<xs:selector xpath="signatureFile"/>
<xs:field xpath="."/>
</xs:unique>
</xs:element>
<xs:element name="hash" minOccurs="0" maxOccurs="1" type="t_verify_cksum"/>
</xs:all>
<xs:element name="hash" minOccurs="0" maxOccurs="1" type="t_std_verify_cksum"/>
</xs:choice>
</xs:complexType>

<xs:complexType name="t_verify_cksum">
<xs:complexType name="t_std_verify_cksum">
<xs:sequence>
<xs:element name="checksum" minOccurs="0" maxOccurs="unbounded" type="t_cksum"/>
<xs:element name="checksumFile" minOccurs="0" maxOccurs="unbounded" type="t_cksum_file"/>
<xs:element name="checksum" minOccurs="0" maxOccurs="unbounded" type="t_std_cksum"/>
<xs:element name="checksumFile" minOccurs="0" maxOccurs="unbounded" type="t_std_cksum_file"/>
</xs:sequence>
</xs:complexType>

<xs:complexType name="t_verify_gpg">
<xs:complexType name="t_std_verify_gpg">
<xs:choice minOccurs="1" maxOccurs="1">
<xs:element name="signature" minOccurs="0" maxOccurs="unbounded" type="t_gpg_sig"/>
<xs:element name="signatureFile" minOccurs="0" maxOccurs="unbounded" type="t_uri"/>
<xs:element name="gpgKeyIDs" minOccurs="1" maxOccurs="1" type="t_gpg_keys">
<xs:element name="signature" minOccurs="0" maxOccurs="unbounded" type="t_std_gpg_sig"/>
<xs:element name="signatureFile" minOccurs="0" maxOccurs="unbounded" type="t_std_uri"/>
<xs:element name="gpgKeyIDs" minOccurs="1" maxOccurs="1" type="t_std_gpg_keys">
<xs:unique name="uniq_key_id">
<xs:selector xpath="std:keyID"/>
<xs:selector xpath="keyID"/>
<xs:field xpath="."/>
</xs:unique>
</xs:element>

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="unqualified"
elementFormDefault="qualified"
attributeFormDefault="unqualified">

<xs:simpleType name="t_diskfmt">
<xs:simpleType name="t_sys_diskfmt">
<xs:restriction base="xs:token">
<xs:enumeration value="gpt"/>
<xs:enumeration value="bios"/>

View File

@ -1,24 +1,24 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:unix="https://schema.xml.r00t2.io/lib/types/unix.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="unqualified"
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="unqualified">

<xs:include schemaLocation="./std.xsd"/>

<xs:simpleType name="t_filepath">
<xs:simpleType name="t_unix_filepath">
<xs:restriction base="xs:string">
<xs:pattern value="(/[^/]+)+/?"/>
<xs:pattern value="\s*(/[^/]+)+/?\s*"/>
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>

<xs:complexType name="t_nixpass">
<xs:complexType name="t_unix_nixpass">
<xs:choice minOccurs="1" maxOccurs="1">
<xs:element name="passwordPlain">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="hashType" use="optional" default="md5" type="t_passwd_hashtypes"/>
<xs:attribute name="hashType" use="optional" default="md5" type="t_unix_passwd_hashtypes"/>
<xs:attribute name="rounds" use="optional" default="5000" type="xs:positiveInteger"/>
</xs:extension>
</xs:simpleContent>
@ -27,8 +27,8 @@
<xs:element name="passwordHash">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="t_shadowhash">
<xs:attribute name="hashType" use="optional" default="md5" type="t_passwd_hashtypes"/>
<xs:extension base="t_unix_shadowhash">
<xs:attribute name="hashType" use="optional" default="md5" type="t_unix_passwd_hashtypes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
@ -37,54 +37,54 @@
<xs:attribute name="locked" use="optional" default="false" type="xs:boolean"/>
</xs:complexType>

<xs:simpleType name="t_passwd_hashtypes">
<xs:simpleType name="t_unix_passwd_hashtypes">
<xs:restriction base="xs:string">
<xs:enumeration value="md5"/>
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="t_posixUserGroup">
<xs:simpleType name="t_unix_posixUserGroup">
<!-- https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_437
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_282
https://unix.stackexchange.com/a/435120/284004 -->
<xs:restriction base="xs:token">
<xs:pattern value="[a-z_]([a-z0-9_-]{0,31}|[a-z0-9_-]{0,30}$)"/>
<xs:pattern value="\s*[a-z_]([a-z0-9_-]{0,31}|[a-z0-9_-]{0,30}$)\s*"/>
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="t_shadowhash">
<xs:simpleType name="t_unix_shadowhash">
<!-- http://man7.org/linux/man-pages/man3/crypt.3.html#NOTES -->
<xs:restriction base="xs:token">
<xs:pattern value="($1)?($[a-zA-Z0-9./]{1,16})$[a-zA-Z0-9./]{22}"/><!-- md5 -->
<xs:pattern value="\s*($1)?($[a-zA-Z0-9./]{1,16})$[a-zA-Z0-9./]{22}\s*"/><!-- md5 -->
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>

<xs:complexType name="t_user">
<xs:complexType name="t_unix_user">
<xs:sequence>
<xs:element name="password" minOccurs="0" maxOccurs="1" type="t_nixpass"/>
<xs:element name="password" minOccurs="0" maxOccurs="1" type="t_unix_nixpass"/>
<xs:element name="xGroup" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="name" type="t_posixUserGroup" use="required"/>
<xs:attribute name="name" type="t_unix_posixUserGroup" use="required"/>
<xs:attribute name="create" type="xs:boolean" use="optional" default="false"/>
<xs:attribute name="gid" type="xs:positiveInteger" use="optional"/>
</xs:complexType>
<xs:unique name="uniq_grp">
<xs:selector xpath="unix:xGroup"/>
<xs:unique name="uniq_unix_grp">
<xs:selector xpath="xGroup"/>
<xs:field xpath="@name"/>
</xs:unique>
</xs:element>
</xs:sequence>
<xs:attribute name="name" type="t_posixUserGroup" use="required"/>
<xs:attribute name="home" type="t_filepath" use="optional"/>
<xs:attribute name="name" type="t_unix_posixUserGroup" use="required"/>
<xs:attribute name="home" type="t_unix_filepath" use="optional"/>
<xs:attribute name="uid" type="xs:positiveInteger" use="optional"/>
<xs:attribute name="group" type="t_posixUserGroup" use="optional"/>
<xs:attribute name="group" type="t_unix_posixUserGroup" use="optional"/>
<xs:attribute name="gid" type="xs:positiveInteger" use="optional"/>
<xs:attribute name="comment" type="t_nonempty" use="optional"/>
<xs:attribute name="comment" type="t_std_nonempty" use="optional"/>
<xs:attribute name="sudo" type="xs:boolean" use="optional" default="false"/>
<xs:attribute name="sudoPassword" type="xs:boolean" use="optional" default="true"/>
<xs:attribute name="shell" type="t_filepath" use="optional" default="/bin/bash"/>
<xs:attribute name="shell" type="t_unix_filepath" use="optional" default="/bin/bash"/>
<!-- TODO: change the positiveIntegers to xs:duration? or union? -->
<!-- Might be pointless since the smallest increment is 1 day in
shadow(5). -->
@ -92,7 +92,7 @@
<xs:attribute name="maxAge" type="xs:positiveInteger" use="optional"/>
<xs:attribute name="warnDays" type="xs:positiveInteger" use="optional"/>
<xs:attribute name="inactiveDays" type="xs:positiveInteger" use="optional"/>
<xs:attribute name="expireDate" type="t_epoch_or_iso" use="optional"/>
<xs:attribute name="expireDate" type="t_std_epoch_or_iso" use="optional"/>
</xs:complexType>

</xs:schema>

View File

@ -2,12 +2,11 @@
<xs:schema targetNamespace="https://aif-ng.io/"
xmlns="https://aif-ng.io/"
xmlns:aif="https://aif-ng.io/"
xmlns:t_aif="https://schema.xml.r00t2.io/lib/types/aif.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="unqualified">

<xs:import namespace="https://schema.xml.r00t2.io/lib/types/aif.xsd" schemaLocation="../lib/types/aif.xsd"/>
<xs:include schemaLocation="../lib/types/aif.xsd"/>

<!-- ROOT -->
<xs:element name="aif">
@ -17,8 +16,8 @@
<xs:element name="bootstrap" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:all>
<xs:element name="tarball" minOccurs="1" maxOccurs="1" type="t_aif:t_uri"/>
<xs:element name="verify" minOccurs="0" maxOccurs="1" type="t_aif:t_verifyfile"/>
<xs:element name="tarball" minOccurs="1" maxOccurs="1" type="t_std_uri"/>
<xs:element name="verify" minOccurs="0" maxOccurs="1" type="t_std_verifyfile"/>
</xs:all>
</xs:complexType>
</xs:element>
@ -31,7 +30,7 @@
<xs:element name="blockDevices" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="unbounded">
<xs:element name="disk" minOccurs="1" maxOccurs="unbounded" type="t_aif:t_disk">
<xs:element name="disk" minOccurs="1" maxOccurs="unbounded" type="t_linux_disk">
<xs:unique name="uniq_diskdev">
<xs:selector xpath="aif:disk"/>
<xs:field xpath="@device"/>
@ -49,13 +48,13 @@
<xs:complexType>
<xs:sequence>
<xs:element name="opt" minOccurs="0" maxOccurs="unbounded"
type="t_aif:t_cmdopts"/>
type="t_std_cmdopts"/>
</xs:sequence>
<xs:attribute name="id" type="xs:ID" use="required"/>
<xs:attribute name="source" type="xs:IDREF" use="required"/>
<!-- We validate this in-code because there's way too many and
it's way too variable per-host. -->
<xs:attribute name="type" type="t_aif:t_nonempty" use="required"/>
<xs:attribute name="type" type="t_std_nonempty" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
@ -63,7 +62,7 @@
</xs:element>
<!-- END FILESYSTEMS -->
<!-- BEGIN LUKS -->
<xs:element name="luks" minOccurs="0" maxOccurs="1" type="t_aif:t_luks">
<xs:element name="luks" minOccurs="0" maxOccurs="1" type="t_linux_luks">
<xs:unique name="uniq_luks_name">
<xs:selector xpath="aif:luksDev"/>
<xs:field xpath="@name"/>
@ -71,7 +70,7 @@
</xs:element>
<!-- END LUKS -->
<!-- BEGIN LVM -->
<xs:element name="lvm" minOccurs="0" maxOccurs="1" type="t_aif:t_lvm">
<xs:element name="lvm" minOccurs="0" maxOccurs="1" type="t_linux_lvm">
<xs:unique name="uniq_vg_names">
<xs:selector xpath="aif:volumeGroup"/>
<xs:field xpath="@name"/>
@ -87,7 +86,7 @@
</xs:element>
<!-- END LVM -->
<!-- BEGIN MDADM -->
<xs:element name="mdadm" minOccurs="0" maxOccurs="1" type="t_aif:t_mdadm">
<xs:element name="mdadm" minOccurs="0" maxOccurs="1" type="t_linux_mdadm">
<xs:unique name="uniq_array_name">
<xs:selector xpath="aif:array"/>
<xs:field xpath="@name"/>
@ -95,7 +94,7 @@
</xs:element>
<!-- END MDADM -->
<!-- BEGIN MOUNTPOINTS -->
<xs:element name="mountPoints" minOccurs="1" maxOccurs="1" type="t_aif:t_mounts">
<xs:element name="mountPoints" minOccurs="1" maxOccurs="1" type="t_linux_mounts">
<xs:unique name="uniq_mnts_src">
<xs:selector xpath="aif:mount"/>
<xs:field xpath="@source"/>
@ -114,13 +113,13 @@
<xs:element name="network" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:choice minOccurs="1" maxOccurs="unbounded">
<xs:element name="ethernet" type="t_aif:t_iface" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="wireless" type="t_aif:t_iface_wifi" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="ethernet" type="t_aif_iface" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="wireless" type="t_aif_iface_wifi" minOccurs="0" maxOccurs="unbounded"/>
</xs:choice>
<!-- It's nearly impossible to validate FQDNs/hostnames in XSD, so we do it in-code. -->
<xs:attribute name="hostname" type="t_aif:t_nonempty" use="required"/>
<xs:attribute name="provider" type="t_aif:t_netprov" use="optional" default="networkd"/>
<xs:attribute name="dhcpClient" type="t_aif:t_dhcp_clients" use="optional" default="dhcpcd"/>
<xs:attribute name="hostname" type="t_std_nonempty" use="required"/>
<xs:attribute name="provider" type="t_aif_netprov" use="optional" default="networkd"/>
<xs:attribute name="dhcpClient" type="t_aif_dhcp_clients" use="optional" default="dhcpcd"/>
</xs:complexType>
<xs:unique name="uniq_iface_eth">
<xs:selector xpath="aif:ethernet|aif:wireless"/>
@ -132,7 +131,7 @@
<xs:element name="system" maxOccurs="1" minOccurs="1">
<xs:complexType>
<xs:all>
<xs:element name="rootPassword" minOccurs="0" maxOccurs="1" type="t_aif:t_nixpass"/>
<xs:element name="rootPassword" minOccurs="0" maxOccurs="1" type="t_linux_nixpass"/>
<xs:element name="locales" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="unbounded">
@ -140,7 +139,7 @@
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:token">
<xs:attribute name="name" type="t_aif:t_nonempty" use="required"/>
<xs:attribute name="name" type="t_std_nonempty" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
@ -158,9 +157,9 @@
<xs:complexType>
<xs:choice>
<xs:element name="map" minOccurs="0" maxOccurs="1"
type="t_aif:t_nonempty" default="us"/>
type="t_std_nonempty" default="us"/>
<xs:element name="toggle" minOccurs="0" maxOccurs="1"
type="t_aif:t_nonempty"/>
type="t_std_nonempty"/>
</xs:choice>
</xs:complexType>
</xs:element>
@ -168,11 +167,11 @@
<xs:complexType>
<xs:choice minOccurs="1" maxOccurs="3">
<xs:element name="font" minOccurs="0" maxOccurs="1"
type="t_aif:t_nonempty"/>
type="t_std_nonempty"/>
<xs:element name="map" minOccurs="0" maxOccurs="1"
type="t_aif:t_nonempty"/>
type="t_std_nonempty"/>
<xs:element name="unicodeMap" minOccurs="0" maxOccurs="1"
type="t_aif:t_nonempty"/>
type="t_std_nonempty"/>
</xs:choice>
</xs:complexType>
</xs:element>
@ -183,7 +182,7 @@
<xs:complexType>
<xs:sequence>
<xs:element name="user" minOccurs="1" maxOccurs="unbounded"
type="t_aif:t_user"/>
type="t_linux_user"/>
</xs:sequence>
</xs:complexType>
<xs:unique name="uniq_usr">
@ -195,7 +194,7 @@
<xs:complexType>
<xs:sequence>
<xs:element name="service" minOccurs="1" maxOccurs="unbounded"
type="t_aif:t_service"/>
type="t_linux_service"/>
</xs:sequence>
</xs:complexType>
<xs:unique name="uniq_svc">
@ -205,7 +204,7 @@
</xs:unique>
</xs:element>
</xs:all>
<xs:attribute name="timezone" type="t_aif:t_nonempty" use="optional" default="UTC"/>
<xs:attribute name="timezone" type="t_std_nonempty" use="optional" default="UTC"/>
</xs:complexType>
</xs:element>
<!-- END SYSTEM -->
@ -218,10 +217,10 @@
<xs:sequence>
<xs:element name="repo" maxOccurs="unbounded" minOccurs="1">
<xs:complexType>
<xs:attribute name="name" type="t_aif:t_nonempty" use="required"/>
<xs:attribute name="name" type="t_std_nonempty" use="required"/>
<xs:attribute name="enabled" type="xs:boolean" use="required"/>
<xs:attribute name="sigLevel" type="t_aif:t_nonempty" use="required"/>
<xs:attribute name="mirror" type="t_aif:t_pacuri" use="required"/>
<xs:attribute name="sigLevel" type="t_std_nonempty" use="required"/>
<xs:attribute name="mirror" type="t_aif_pacuri" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
@ -234,7 +233,7 @@
<xs:element name="mirrorList" maxOccurs="1" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="mirror" type="t_aif:t_pacuri" maxOccurs="unbounded"
<xs:element name="mirror" type="t_aif_pacuri" maxOccurs="unbounded"
minOccurs="1"/>
</xs:sequence>
</xs:complexType>
@ -243,7 +242,7 @@
<xs:complexType>
<xs:sequence>
<xs:element name="package" maxOccurs="unbounded" minOccurs="1"
type="t_aif:t_package"/>
type="t_linux_package"/>
</xs:sequence>
</xs:complexType>
<xs:unique name="uniq_mirror">
@ -256,15 +255,15 @@
</xs:unique>
</xs:element>
</xs:sequence>
<xs:attribute name="command" type="t_aif:t_nonempty" use="optional" default="pacman -S"/>
<xs:attribute name="command" type="t_std_nonempty" use="optional" default="pacman -S"/>
</xs:complexType>
</xs:element>
<!-- END PACMAN -->
<!-- BEGIN BOOTLOADER -->
<xs:element name="bootloader" maxOccurs="1" minOccurs="1">
<xs:complexType>
<xs:attribute name="type" type="aif:t_bootloaders" use="required"/>
<xs:attribute name="target" type="t_aif:t_nonempty" use="required"/>
<xs:attribute name="type" type="t_aif_bootloaders" use="required"/>
<xs:attribute name="target" type="t_std_nonempty" use="required"/>
<xs:attribute name="efi" type="xs:boolean" use="optional" default="1"/>
</xs:complexType>
</xs:element>
@ -277,7 +276,7 @@
<xs:complexType>
<xs:sequence>
<xs:element name="script" minOccurs="1" maxOccurs="unbounded"
type="t_aif:t_http_resource"/>
type="t_net_http_resource"/>
</xs:sequence>
</xs:complexType>
</xs:element>
@ -285,7 +284,7 @@
<xs:complexType>
<xs:sequence>
<xs:element name="script" minOccurs="1" maxOccurs="unbounded"
type="t_aif:t_http_resource"/>
type="t_net_http_resource"/>
</xs:sequence>
</xs:complexType>
</xs:element>
@ -293,7 +292,7 @@
<xs:complexType>
<xs:sequence>
<xs:element name="script" minOccurs="1" maxOccurs="unbounded"
type="t_aif:t_http_resource"/>
type="t_net_http_resource"/>
</xs:sequence>
</xs:complexType>
</xs:element>
@ -302,7 +301,7 @@
</xs:element>
<!-- END SCRIPTS -->
</xs:all>
<xs:attribute name="chrootPath" type="t_aif:t_filepath" use="required"/>
<xs:attribute name="chrootPath" type="t_unix_filepath" use="required"/>
<xs:attribute name="reboot" type="xs:boolean" use="optional" default="false"/>
</xs:complexType>
</xs:element>