Copy: support multiple srcs
This commit is contained in:
parent
8ee415e642
commit
3e76bdb96e
@ -1,7 +1,7 @@
|
|||||||
class Copy:
|
class Copy:
|
||||||
def __init__(self, src, dst):
|
def __init__(self, *args):
|
||||||
self.src = src
|
self.src = args[:-1]
|
||||||
self.dst = dst
|
self.dst = args[-1]
|
||||||
|
|
||||||
def init_build(self, script):
|
def init_build(self, script):
|
||||||
count = self.dst.count(':')
|
count = self.dst.count(':')
|
||||||
@ -14,10 +14,9 @@ class Copy:
|
|||||||
self.owner = script.variable('user')
|
self.owner = script.variable('user')
|
||||||
|
|
||||||
def build(self, script):
|
def build(self, script):
|
||||||
if isinstance(self.src, list):
|
script.run(f'sudo mkdir -p {self.dst}')
|
||||||
script.run(f'sudo mkdir -p {self.dst}')
|
for item in self.src:
|
||||||
for item in self.src:
|
script.append(f'cp -a {item} $mnt{self.dst}')
|
||||||
script.append(f'cp -a {item} $mnt{self.dst}')
|
|
||||||
|
|
||||||
if self.mode:
|
if self.mode:
|
||||||
script.run(f'sudo chmod {self.mode} $mnt{self.dst}')
|
script.run(f'sudo chmod {self.mode} $mnt{self.dst}')
|
||||||
|
|||||||
@ -15,3 +15,5 @@ ctr=$(buildah from $base)
|
|||||||
mnt=$(buildah mount $ctr)
|
mnt=$(buildah mount $ctr)
|
||||||
echo "Copy.init_build"
|
echo "Copy.init_build"
|
||||||
echo "Copy.build"
|
echo "Copy.build"
|
||||||
|
buildah run --user root $ctr -- mkdir -p /app
|
||||||
|
cp -a /home/jpic/src/podctl/tests $mnt/app
|
||||||
Loading…
x
Reference in New Issue
Block a user