Refactor and fix umounts
This commit is contained in:
parent
9475d8b9af
commit
7d14d488da
@ -16,15 +16,14 @@ class BuildScript(Script):
|
|||||||
umounts() {
|
umounts() {
|
||||||
for i in "${mounts[@]}"; do
|
for i in "${mounts[@]}"; do
|
||||||
umount $i
|
umount $i
|
||||||
echo $mounts
|
|
||||||
mounts=("${mounts[@]/$i}")
|
mounts=("${mounts[@]/$i}")
|
||||||
echo $mounts
|
|
||||||
done
|
done
|
||||||
|
buildah unmount $ctr
|
||||||
|
trap - 0
|
||||||
}
|
}
|
||||||
trap umounts 0
|
trap umounts 0
|
||||||
ctr=$(buildah from $base)
|
ctr=$(buildah from $base)
|
||||||
mnt=$(buildah mount $ctr)
|
mnt=$(buildah mount $ctr)
|
||||||
mounts=("$mnt" "${mounts[@]}")
|
|
||||||
''')
|
''')
|
||||||
|
|
||||||
def config(self, line):
|
def config(self, line):
|
||||||
@ -49,5 +48,3 @@ class BuildScript(Script):
|
|||||||
self.run('sudo mkdir -p ' + dst)
|
self.run('sudo mkdir -p ' + dst)
|
||||||
self.append('mkdir -p ' + src)
|
self.append('mkdir -p ' + src)
|
||||||
self.append(f'mount -o bind {src} $mnt{dst}')
|
self.append(f'mount -o bind {src} $mnt{dst}')
|
||||||
# for unmount trap
|
|
||||||
self.append('mounts=("$mnt%s" "${mounts[@]}")' % dst)
|
|
||||||
|
|||||||
@ -40,7 +40,6 @@ class Commit:
|
|||||||
|
|
||||||
script.append(f'''
|
script.append(f'''
|
||||||
umounts
|
umounts
|
||||||
trap - 0
|
|
||||||
buildah commit --format={self.format} $ctr {self.repo}
|
buildah commit --format={self.format} $ctr {self.repo}
|
||||||
''')
|
''')
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user