WHOOHOO! it validates finally...

This commit is contained in:
brent s 2017-03-08 11:50:06 -05:00
parent 459c48104b
commit 7035dfc490
3 changed files with 194 additions and 68 deletions

11
TODO
View File

@ -8,6 +8,16 @@ bf566e594a2ad3e488fef7cfa6832d4ba857d8129b0c00fe3a096e9fbb85e92c268368a201f12f22
</disk> </disk>
... ...



it seems urllib in python3 doesn't support ftps, so you'll need to use ftplib if so.

server = ftplib.FTP_TLS(server, user, password)
server.login(user, password)
server.prot_p()
server.retrlines("RETR " + filepath)

should do it.

- use sgdisk? scripting (generated by python) for disk partitioning (part types listed at http://www.rodsbooks.com/gdisk/walkthrough.html ) - use sgdisk? scripting (generated by python) for disk partitioning (part types listed at http://www.rodsbooks.com/gdisk/walkthrough.html )
-- actually, might want to use parted --script instead? then we can do percentages. https://www.gnu.org/software/parted/manual/parted.html -- actually, might want to use parted --script instead? then we can do percentages. https://www.gnu.org/software/parted/manual/parted.html
https://unix.stackexchange.com/questions/200582/scripteable-gpt-partitions-using-parted https://unix.stackexchange.com/questions/200582/scripteable-gpt-partitions-using-parted
@ -23,7 +33,6 @@ parser: make sure to use https://mikeknoop.com/lxml-xxe-exploit/ fix


need to set proper location block for https://aif.square-r00t.net/aif.xsd need to set proper location block for https://aif.square-r00t.net/aif.xsd



xmllint --noout --schema aif.xsd aif.xml xmllint --noout --schema aif.xsd aif.xml


docs: docs:

84
aif.xml
View File

@ -13,70 +13,42 @@
<network hostname="aiftest.square-r00t.net"> <network hostname="aiftest.square-r00t.net">
<iface device="auto" address="auto" netproto="ipv4" /> <iface device="auto" address="auto" netproto="ipv4" />
</network> </network>
<system timezone="EST5EDT" locale="en_US.UTF-8" /> <system timezone="EST5EDT" locale="en_US.UTF-8">
<user>
<!-- note: all password hashes below are "test"; don't waste your time trying to crack. :) --> <!-- note: all password hashes below are "test"; don't waste your time trying to crack. :) -->
<root> <users rootpass="$6$3YPpiS.l3SQC6ELe$NQ4qMvcDpv5j1cCM6AGNc5Hyg.rsvtzCt2VWlSbuZXCGg2GB21CMUN8TMGS35tdUezZ/n9y3UFGlmLRVWXvZR.">
<password>$6$3YPpiS.l3SQC6ELe$NQ4qMvcDpv5j1cCM6AGNc5Hyg.rsvtzCt2VWlSbuZXCGg2GB21CMUN8TMGS35tdUezZ/n9y3UFGlmLRVWXvZR.</password> <user name="aifusr"
</root> sudo="true"
<regusr> password="$6$WtxZKOyaahvvWQRG$TUys60kQhF0ffBdnDSJVTA.PovwCOajjMz8HEHL2H0ZMi0bFpDTQvKA7BqzM3nA.ZMAUxNjpJP1dG/eA78Zgw0"
<username>aifusr</username> comment="A test user for AIF.">
<comment>A test user for AIF.</comment> <home path="/opt/aifusr" create="true" />
<sudo>true</sudo> <xgroup name="admins" create="true" />
<group>aifusr</group> <xgroup name="wheel" />
<password>$6$WtxZKOyaahvvWQRG$TUys60kQhF0ffBdnDSJVTA.PovwCOajjMz8HEHL2H0ZMi0bFpDTQvKA7BqzM3nA.ZMAUxNjpJP1dG/eA78Zgw0</password> <xgroup name="users" />
<homedir path="/home/aifusr" create="true" /> </user>
<xgroup name="admins" /> </users>
<xgroup name="wheel" /> </system>
<xgroup name="users" />
</regusr>
</user>
<pacman> <pacman>
<repos> <repos>
<core> <repo name="core" enabled="true" siglevel="default" mirror="file:///etc/pacman.d/mirrorlist" />
<status>enabled</status> <repo name="extra" enabled="true" siglevel="default" mirror="file:///etc/pacman.d/mirrorlist" />
<mirror>Include = /etc/pacman.d/mirrorlist</mirror> <repo name="community" enabled="true" siglevel="default" mirror="file:///etc/pacman.d/mirrorlist" />
</core> <repo name="multilib" enabled="true" siglevel="default" mirror="file:///etc/pacman.d/mirrorlist" />
<extra> <repo name="testing" enabled="false" siglevel="default" mirror="file:///etc/pacman.d/mirrorlist" />
<status>enabled</status> <repo name="multilib-testing" enabled="false" siglevel="default" mirror="file:///etc/pacman.d/mirrorlist" />
<mirror>Include = /etc/pacman.d/mirrorlist</mirror> <repo name="archlinuxfr" enabled="false" siglevel="Optional TrustedOnly" mirror="http://repo.archlinux.fr/$arch" />
</extra>
<community>
<status>enabled</status>
<mirror>Include = /etc/pacman.d/mirrorlist</mirror>
</community>
<multilib>
<status>disabled</status>
<mirror>Include = /etc/pacman.d/mirrorlist</mirror>
</multilib>
<testing>
<status>disabled</status>
<mirror>Include = /etc/pacman.d/mirrorlist</mirror>
</testing>
<multilib-testing>
<status>disabled</status>
<mirror>Include = /etc/pacman.d/mirrorlist</mirror>
</multilib-testing>
<custom name="archlinuxfr">
<status>disabled</status>
<mirror>http://repo.archlinux.fr/$arch</mirror>
<siglevel>Never</siglevel>
</custom>
</repos> </repos>
<mirrorlist> <mirrorlist>
<server>http://mirrors.advancedhosters.com/archlinux/$repo/os/$arch</server> <mirror>http://mirrors.advancedhosters.com/archlinux/$repo/os/$arch</mirror>
<server>http://mirror.us.leaseweb.net/archlinux/$repo/os/$arch</server> <mirror>http://mirrors.advancedhosters.com/archlinux/$repo/os/$arch</mirror>
<server>http://ftp.osuosl.org/pub/archlinux/$repo/os/$arch</server> <mirror>http://mirror.us.leaseweb.net/archlinux/$repo/os/$arch</mirror>
<server>http://arch.mirrors.ionfish.org/$repo/os/$arch</server> <mirror>http://ftp.osuosl.org/pub/archlinux/$repo/os/$arch</mirror>
<server>http://mirrors.gigenet.com/archlinux/$repo/os/$arch</server> <mirror>http://arch.mirrors.ionfish.org/$repo/os/$arch</mirror>
<server>http://mirror.jmu.edu/pub/archlinux/$repo/os/$arch</server> <mirror>http://mirrors.gigenet.com/archlinux/$repo/os/$arch</mirror>
<mirror>http://mirror.jmu.edu/pub/archlinux/$repo/os/$arch</mirror>
</mirrorlist> </mirrorlist>
<software> <software>
<package name="sed" repo="core" /> <package name="sed" repo="core" />
</software> </software>
</pacman> </pacman>
<bootloader efi="true"> <bootloader type="grub" target="/boot" efi="true" />
<type>GRUB</type>
<where>/boot</where>
</bootloader>
</aif> </aif>

167
aif.xsd
View File

@ -53,13 +53,49 @@
<xs:pattern value="(both|ipv4|ipv6)" /> <xs:pattern value="(both|ipv4|ipv6)" />
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="scripturi">
<xs:restriction base="xs:anyURI">
<xs:pattern value="(https?|ftps?|file)://" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="devlang">
<xs:restriction base="xs:token">
<xs:pattern value="/(usr/)?s?bin/[A-Za-z0-9][A-Za-z\.\-]?" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="nixgroup">
<xs:restriction base="xs:token">
<xs:pattern value="[_a-z][-0-9_a-z]*$?" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="nixpass">
<xs:restriction base="xs:token">
<xs:pattern value="$(6$[A-Za-z0-9\./\+=]{8,16}$[A-Za-z0-9\./\+=]{86}|1$[A-Za-z0-9\./\+=]{8,16}$[A-Za-z0-9\./\+=]{22}|5$[A-Za-z0-9\./\+=]{8,16}$[A-Za-z0-9\./\+=]{43})" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="pacuri">
<xs:restriction base="xs:anyURI">
<xs:pattern value="(file|https?)://.*" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="bootloaders">
<xs:restriction base="xs:token">
<xs:pattern value="(grub|lilo|syslinux)" />
</xs:restriction>
</xs:simpleType>
<!-- ROOT --> <!-- ROOT -->
<xs:element name="aif"> <xs:element name="aif">
<xs:complexType> <xs:complexType>
<xs:all> <xs:all>
<!-- BEGIN STORAGE --> <!-- BEGIN STORAGE -->
<xs:element name="storage" minOccurs="1"> <xs:element name="storage" minOccurs="1" maxOccurs="1">
<xs:complexType> <xs:complexType>
<xs:sequence> <xs:sequence>
<!-- BEGIN DISK --> <!-- BEGIN DISK -->
@ -126,9 +162,126 @@
<xs:selector xpath="iface" /> <xs:selector xpath="iface" />
<xs:field xpath="@address" /> <xs:field xpath="@address" />
<xs:field xpath="@netproto" /> <xs:field xpath="@netproto" />
</xs:unique> </xs:unique>
</xs:element> </xs:element>
<!-- END NETWORK --> <!-- END NETWORK -->
<!-- BEGIN SYSTEM -->
<xs:element name="system" maxOccurs="1" minOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="users" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="user" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="home" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="path" type="xs:token" />
<xs:attribute name="create" type="xs:boolean" />
</xs:complexType>
</xs:element>
<xs:element name="xgroup" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="name" type="nixgroup" use="required" />
<xs:attribute name="create" type="xs:boolean" />
<xs:attribute name="gid" type="xs:boolean" />
</xs:complexType>
<xs:unique name="unique-grp">
<xs:selector xpath="xgroup" />
<xs:field xpath="@name" />
</xs:unique>
</xs:element>
</xs:sequence>
<xs:attribute name="name" type="xs:token" use="required" />
<xs:attribute name="uid" type="xs:token" />
<xs:attribute name="group" type="nixgroup" />
<xs:attribute name="gid" type="xs:token" />
<xs:attribute name="password" type="nixpass" />
<xs:attribute name="comment" type="xs:token" />
<xs:attribute name="sudo" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="rootpass" type="nixpass" />
</xs:complexType>
<xs:unique name="unique-usr">
<xs:selector xpath="user" />
<xs:field xpath="@name" />
</xs:unique>
</xs:element>
<xs:element name="service" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="name" type="xs:token" use="required" />
<xs:attribute name="status" type="xs:boolean" use="required" />
</xs:complexType>
<xs:unique name="unique-svc">
<xs:selector xpath="service" />
<xs:field xpath="@name" />
<xs:field xpath="@status" />
</xs:unique>
</xs:element>
</xs:sequence>
<xs:attribute name="timezone" type="xs:string" use="required" />
<xs:attribute name="locale" type="xs:string" use="required" />
<xs:attribute name="kbd" type="xs:token" />
</xs:complexType>
</xs:element>
<!-- END SYSTEM -->
<!-- BEGIN PACMAN -->
<xs:element name="pacman" maxOccurs="1" minOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="repos" maxOccurs="1" minOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="repo" maxOccurs="unbounded" minOccurs="1">
<xs:complexType>
<xs:attribute name="name" type="xs:token" use="required" />
<xs:attribute name="enabled" type="xs:boolean" use="required" />
<xs:attribute name="siglevel" type="xs:token" use="required" />
<xs:attribute name="mirror" type="pacuri" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="mirrorlist" maxOccurs="1" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="mirror" type="pacuri" maxOccurs="unbounded" minOccurs="1" />
</xs:sequence>
</xs:complexType>
<xs:unique name="unique-mirrors">
<xs:selector xpath="mirror" />
<xs:field xpath="." />
</xs:unique>
</xs:element>
<xs:element name="software" maxOccurs="1" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="package" maxOccurs="unbounded" minOccurs="1">
<xs:complexType>
<xs:attribute name="name" type="xs:token" use="required" />
<xs:attribute name="repo" type="xs:token" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- END PACMAN -->
<!-- BEGIN BOOTLOADER -->
<xs:element name="bootloader" maxOccurs="1" minOccurs="1">
<xs:complexType>
<xs:attribute name="type" type="bootloaders" use="required" />
<xs:attribute name="target" type="xs:token" use="required" />
<xs:attribute name="efi" type="xs:boolean" />
</xs:complexType>
</xs:element>
<!-- END BOOTLOADER -->
<!--- BEGIN SCRIPTS --> <!--- BEGIN SCRIPTS -->
<xs:element name="scripts" maxOccurs="1" minOccurs="0"> <xs:element name="scripts" maxOccurs="1" minOccurs="0">
<xs:complexType> <xs:complexType>
@ -150,13 +303,5 @@
<!-- END SCRIPTS --> <!-- END SCRIPTS -->
</xs:all> </xs:all>
</xs:complexType> </xs:complexType>
<xs:complexType>
<xs:sequence>
<xs:element ref="system" maxOccurs="1" minOccurs="1" />
<xs:element ref="user" maxOccurs="1" minOccurs="1" />
<xs:element ref="pacman" maxOccurs="1" minOccurs="1" />
<xs:element ref="bootloader" maxOccurs="1" minOccurs="1" />
</xs:sequence>
</xs:complexType>
</xs:element> </xs:element>
</xs:schema> </xs:schema>