Skip to content

Commit b543e46

Browse files
envsetup: new function COPY
1 parent 3f2105b commit b543e46

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ do_build "out/fs" "arm64"
8080
- - `do_tar_bzip()`: to compress in bzip format
8181
- - `do_tar_lz4()`: to compress in lzip/lz4 format
8282
- `arch_translate()`: takes care of translating arch to find qemu static builds
83+
- `COPY()`: to copy files to target filesystem
8384
- `die()`: to echo an error message & exit if `ENABLE_EXIT` is set to true
8485
- `warn()`: like `die()` without exit
8586
- `shout()`: for printing logs

plugins/envsetup

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,21 @@ run_shell_script() {
456456
echo "Done running script: $1"
457457
}
458458

459+
COPY() {
460+
local src=$1
461+
local dest=$2
462+
463+
if [ -d "$src" ]; then
464+
$SUDO cp -vr "$src" "$chroot_dir/$dest"
465+
else
466+
if [ -f "$src" ]; then
467+
$SUDO cp -v "$src" "$chroot_dir/$dest"
468+
else
469+
die "Couldn't find $src, no such file or directory"
470+
fi
471+
fi
472+
}
473+
459474
install_pkg()
460475
{
461476
pkg_name="$*"

0 commit comments

Comments
 (0)