sample script shufflin'

This commit is contained in:
brent s 2017-05-04 03:25:20 -04:00
parent 9af137c660
commit b76ec6ccca
6 changed files with 15 additions and 1 deletions

View File

@ -53,5 +53,8 @@
</software>
</pacman>
<bootloader type="grub" target="/boot" efi="true" />
<script uri="https://aif.square-r00t.net/sample-scripts/pre.sh" order="1" bootstrap="1" />
<script uri="https://aif.square-r00t.net/sample-scripts/post/first.sh" order="1" bootstrap="0" />
<script uri="https://aif.square-r00t.net/sample-scripts/pre/second.pl" order="2" bootstrap="1" />
<script uri="https://aif.square-r00t.net/sample-scripts/pre/first.sh" order="1" bootstrap="1" />
<script uri="https://aif.square-r00t.net/sample-scripts/post/second.py" order="2" bootstrap="0" />
</aif>

View File

@ -339,6 +339,7 @@ class aif(object):
aifdict['scripts']['post'] = []
tempscriptdict = {'pre': {}, 'post': {}}
for x in xmlobj.find('scripts'):
print(x.attrib['uri'])
if all(keyname in list(x.attrib.keys()) for keyname in ('user', 'password')):
auth = {}
auth['user'] = x.attrib['user']
@ -350,6 +351,7 @@ class aif(object):
scriptcontents = self.webFetch(x.attrib['uri'], auth).decode('utf-8')
else:
scriptcontents = self.webFetch(x.attrib['uri']).decode('utf-8')
print(scriptcontents)
if x.attrib['bootstrap'].lower() in ('true', '1'):
tempscriptdict['pre'][x.attrib['order']] = scriptcontents
else:

View File

@ -0,0 +1,3 @@
#!/usr/bin/env python

print('And this is the second post script.\n')

View File

@ -0,0 +1,6 @@
#!/usr/bin/env perl

use strict;
use warnings;

print "And this is the second pre (bootstrap) script.\n";