Was supposed to be a linux distribution, now just a collection of build scripts for packages on top of (ideally) any distribution.
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.

50 lines
1.1 KiB

#!/bin/sh
umask 022
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
rocket="$(realpath "$rocket")"
checkmount() {
local point="$(eval echo \${$#})"
if cut -d' ' -f2 /proc/mounts | grep "$point" > /dev/null; then
true
else
mount $@
fi
}
mkdir -p "$rocket/dev" "$rocket/proc" "$rocket/sys" "$rocket/run"
checkmount --bind /dev "$rocket/dev"
checkmount -t devpts devpts "$rocket/dev/pts"
checkmount -t proc proc "$rocket/proc"
checkmount -t tmpfs tmpfs "$rocket/run"
if [ -h "$rocket/dev/shm" ]; then
mkdir -p "$rocket/$(readlink "$rocket/dev/shm")"
fi
mkdir -p "$rocket/etc"
cp /etc/resolv.conf "$rocket/etc/resolv.conf"
chroot "$rocket" /tools/bin/env -i \
HOME=/root \
TERM="$TERM" \
PS1="(buildenv) \u:\w \$ " \
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/tools/bin \
MAKEFLAGS="$MAKEFLAGS" \
/tools/bin/ash -l
umount "$rocket/dev/pts"
umount "$rocket/dev"
umount "$rocket/proc"
umount "$rocket/run"