Nimbin[12]?Mirrors & Forks / jhalfs / extras/do_copy_files

jhalfs git · trunk

jhalfs LFS build automation (mirror)

lfs mirror bash · first commit 2005-09-11 · last commit 2024-02-13 (2 years ago) · synced 3 days ago · upstream: git.linuxfromscratch.org/jhalfs

Python 78.4% Shell 19.8% Makefile 1.8%
git clone https://git.christianimmanuel.de/mirrors-forks/jhalfs.gitwget https://git.christianimmanuel.de/mirrors-forks/jhalfs/archive/jhalfs.tar.gz
extras/do_copy_files 838 B · 36 lines raw
#!/bin/bash

set -e

: <<inline_doc
    desc:       Copy files from one dir to another dir using tar
    usage:      do_copy_files $PRUNEPATH $ROOT_DIR $DEST_DIR
    input vars: $1 list of dirs that must be skipped by tar
                $2 the root dir of the files that will be copied
                $3 the dir where the copied files will be placed
    externals:  --
    modifies:   --
    returns:    --
    on error:
    on success:
inline_doc

TMP_FILE=/tmp/prunelist

echo -en "\nCopying system files to $3 ..."

# Create a file that we can pass to tar as an "exclude list".
# There might be an easier way to achieve tar exclusions? Strip
# the leading /.
for F in $1 ; do
  echo .${F} >> $TMP_FILE
done

mkdir -p $3
cd $2
tar -X $TMP_FILE -cf - . | tar -C $3 -xf -

# Clear out the temporary file
rm -f ${TMP_FILE}

echo "done."