about summary refs log tree commit diff stats
path: root/chroot_file_list.sh
blob: 3a46a2be9330daba772ee69ec21b3f44e42a26fa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh
# You should probably have DSCIP_DISREGARD_COMMIT_CHECK set to true until you  #
# get all the correct files in the chroot jail.                                #

set -u

# Defaults should allow anything to build, but is a bit excessive. Change to   #
# needs.                                                                       #
export CHROOT_FILES="/lib
/lib64
/usr/include
/usr/lib64
/usr/lib
/usr/local/lib
/usr/bin
/bin
"

rm -rf "$WORKING_DIRECTORY"/jail
mkdir -p "$WORKING_DIRECTORY"/jail

printf "%s" "$CHROOT_FILES" |
		while IFS='' read -r directory
		do
				echo "Copying $directory into jail..."
				if [ ! -L "$directory" ]; then
					mkdir -p "$WORKING_DIRECTORY"/jail/"$directory"
				fi
				
				if [ -L "$directory" ]; then
					cp -r "$directory" "$WORKING_DIRECTORY"/jail/"$directory"
				elif [ -d "$directory" ]; then
					cp -r "$directory"/* "$WORKING_DIRECTORY"/jail/"$directory"
				fi
		done