You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.2 KiB
43 lines
1.2 KiB
10 years ago
|
#!/bin/sh
|
||
|
umask 022
|
||
10 years ago
|
set -e
|
||
|
|
||
|
if [ "$(id -u)" != "0" ]; then
|
||
|
echo "Please run this script as root" 1>&2
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
if [ ! "$rocket" ]; then
|
||
|
echo 'Please set the $rocket variable' 1>&2
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
10 years ago
|
rocket="$(realpath "$rocket")"
|
||
|
|
||
10 years ago
|
mkdir -p "$rocket/dev" "$rocket/proc" "$rocket/sys" "$rocket/run"
|
||
9 years ago
|
mount --bind /dev "$rocket/dev" 2> /dev/null || true
|
||
|
mount --bind /dev/pts "$rocket/dev/pts" 2> /dev/null || true # Bind-mounting this because not doing so breaks some things.
|
||
|
mount -t proc proc "$rocket/proc" 2> /dev/null || true
|
||
|
mount -t tmpfs tmpfs "$rocket/run" 2> /dev/null || true
|
||
10 years ago
|
if [ -h "$rocket/dev/shm" ]; then
|
||
|
mkdir -p "$rocket/$(readlink "$rocket/dev/shm")"
|
||
|
fi
|
||
|
|
||
10 years ago
|
mkdir -p "$rocket/etc"
|
||
|
cp /etc/resolv.conf "$rocket/etc/resolv.conf"
|
||
|
|
||
9 years ago
|
# FORCE_UNSAFE_CONFIGURE is needed for building some packages as root
|
||
10 years ago
|
chroot "$rocket" /tools/bin/env -i \
|
||
|
HOME=/root \
|
||
|
TERM="$TERM" \
|
||
|
PS1="(buildenv) \u:\w \$ " \
|
||
9 years ago
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/tools/bin:/tools/sbin \
|
||
10 years ago
|
MAKEFLAGS="$MAKEFLAGS" \
|
||
9 years ago
|
FORCE_UNSAFE_CONFIGURE=1 \
|
||
10 years ago
|
/tools/bin/ash -l
|
||
10 years ago
|
|
||
9 years ago
|
umount "$rocket/dev/pts" || true
|
||
|
umount "$rocket/dev" || true
|
||
|
umount "$rocket/proc" || true
|
||
|
umount "$rocket/run" || true
|