mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-26 03:19:48 +00:00
Fix cpio generation
It needed to be relative path, and also fix use of bytes fed into cpio.
This commit is contained in:
parent
59e9ef2215
commit
906855ecf7
@ -86,23 +86,28 @@ def initialize(cmdset):
|
||||
for x in bytearray(os.urandom(22)):
|
||||
tmpname += fnamechars[x >> 2]
|
||||
topack = []
|
||||
for currd, _, files in os.walk('/var/lib/confluent/public/site/tls'):
|
||||
opath = os.getcwd()
|
||||
os.chdir('/var/lib/confluent/public/site')
|
||||
for currd, _, files in os.walk('tls'):
|
||||
for fname in files:
|
||||
topack.append(os.path.join(currd, fname))
|
||||
for currd, _, files in os.walk('/var/lib/confluent/public/site/ssh'):
|
||||
for currd, _, files in os.walk('ssh'):
|
||||
for fname in files:
|
||||
topack.append(os.path.join(currd, fname))
|
||||
with open(tmpname, 'wb') as initramfs:
|
||||
packit = subprocess.Popen(['cpio', '-H', 'newc', '-o'],
|
||||
stdout=initramfs, stdin=subprocess.PIPE)
|
||||
for packfile in topack:
|
||||
if not isinstance(packfile, bytes):
|
||||
packfile = packfile.encode('utf8')
|
||||
packit.stdin.write(packfile)
|
||||
packit.stdin.write('\n')
|
||||
packit.stdin.write(b'\n')
|
||||
packit.stdin.close()
|
||||
res = packit.wait()
|
||||
if res:
|
||||
sys.stderr.write('Error occurred while packing site initramfs')
|
||||
sys.exit(1)
|
||||
os.chdir(opath)
|
||||
os.rename(tmpname, '/var/lib/confluent/public/site/initramfs.cpio')
|
||||
|
||||
def osimport(imagefile):
|
||||
|
Loading…
Reference in New Issue
Block a user