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