10 [ -d "$1" ] || mkdir
"$1" || die
"Unable to mkdir $1"
17 [ -n "$R" ] || die
"Usage: prepare-chroot.sh <root>"
18 [ -x git
] || die
"This script needs to be executed at git source code's top directory"
19 [ -x /bin
/busybox
] || die
"You need busybox"
21 xmkdir
"$R" "$R/bin" "$R/etc" "$R/lib" "$R/dev"
22 [ -c "$R/dev/null" ] || die
"/dev/null is missing. Do mknod $R/dev/null c 1 3 && chmod 666 $R/dev/null"
23 echo "root:x:0:0:root:/:/bin/sh" > "$R/etc/passwd"
24 echo "$(id -nu):x:$(id -u):$(id -g)::$(pwd)/t:/bin/sh" >> "$R/etc/passwd"
25 echo "root::0:root" > "$R/etc/group"
26 echo "$(id -ng)::$(id -g):$(id -nu)" >> "$R/etc/group"
28 [ -x "$R/bin/busybox" ] ||
cp /bin
/busybox
"$R/bin/busybox"
29 [ -x "$R/bin/sh" ] ||
ln -s /bin
/busybox
"$R/bin/sh"
30 [ -x "$R/bin/su" ] ||
ln -s /bin
/busybox
"$R/bin/su"
33 rsync
--exclude-from t
/t1509
/excludes
-Ha .
"$R$(pwd)"
34 ldd git |
grep '/' |
sed 's,.*\s\(/[^ ]*\).*,\1,' |
while read i
; do
35 mkdir
-p "$R$(dirname $i)"
38 echo "Execute this in root: 'chroot $R /bin/su - $(id -nu)'"