diff --git a/tools/chroot b/tools/chroot index a917bbc..680b78b 100755 --- a/tools/chroot +++ b/tools/chroot @@ -12,15 +12,29 @@ if [ ! "$rocket" ]; then 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" -mount --bind /dev "$rocket/dev" -mount -t devpts devpts "$rocket/dev/pts" -mount -t proc proc "$rocket/proc" -mount -t tmpfs tmpfs "$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" \ @@ -28,3 +42,8 @@ chroot "$rocket" /tools/bin/env -i \ 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" diff --git a/tools/mktools b/tools/mktools index 7d648c8..ae428f6 100755 --- a/tools/mktools +++ b/tools/mktools @@ -44,6 +44,8 @@ astrobuild() { # List of packages to build mkdir -p "$rocket/tools" + +# Toolchain astrobuild "binutils-1" astrobuild "gcc-1" astrobuild "linux-api" @@ -51,6 +53,10 @@ astrobuild "glibc" astrobuild "libstdc" astrobuild "binutils-2" astrobuild "gcc-2" -astrobuild "make" + +# Utilities astrobuild "busybox" +astrobuild "make" +astrobuild "perl" +astrobuild "stow" astrobuild "astronaut" diff --git a/tools/prepchroot b/tools/prepchroot index 10a015c..2655a3d 100755 --- a/tools/prepchroot +++ b/tools/prepchroot @@ -16,10 +16,24 @@ echo "Changing ownership of $rocket to root" chown -R 0.0 "$rocket" echo "Creating device nodes" -mknod -m 600 "$rocket/dev/console" c 5 1 -mknod -m 666 "$rocket/dev/null" c 1 3 +mkdir -p "$rocket/dev" +if cut -d' ' -f2 /proc/mounts | grep "$rocket/dev" > /dev/null; then + umount -R "$rocket/dev" +fi +mknod -m 600 "$rocket/dev/console" c 5 1 2> /dev/null || true +mknod -m 666 "$rocket/dev/null" c 1 3 2> /dev/null || true + +echo "Creating directories" +install -dm755 "$rocket/root" +mkdir -p "$rocket/etc" "$rocket/bin" "$rocket/usr/pkg" + +echo "Moving temporary things into place" +ln -sf /tools/bin/sh "$rocket/bin/sh" + +echo "Creating users and groups" +echo 'root:x:0:0:root:/root:/bin/sh' > "$rocket/etc/passwd" +echo 'root:x:0:' > "$rocket/etc/group" echo "Configuring astronaut" -mkdir -p "$rocket/etc" echo '# This is a config for use with busybox cmd_download="wget -O {dst} {src}"' > "$rocket/etc/astronaut.conf" diff --git a/tools/satellites/astronaut.sat b/tools/satellites/astronaut.sat index ac0a993..659bd99 100644 --- a/tools/satellites/astronaut.sat +++ b/tools/satellites/astronaut.sat @@ -1,3 +1,4 @@ # This is a hacky satellite. Please refrain of making more like this if possible. msg "Installing astronaut" + install -Dm755 "$(command -v "$0")" "$dir_install/tools/bin/astronaut" diff --git a/tools/satellites/busybox.config b/tools/satellites/busybox.config index 516fe9b..6950e8d 100644 --- a/tools/satellites/busybox.config +++ b/tools/satellites/busybox.config @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit # Busybox version: 1.22.1 -# Fri Nov 14 21:14:39 2014 +# Tue Nov 18 22:48:33 2014 # CONFIG_HAVE_DOT_CONFIG=y @@ -854,11 +854,11 @@ CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=0 CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="" # CONFIG_UDPSVD is not set # CONFIG_VCONFIG is not set -# CONFIG_WGET is not set -# CONFIG_FEATURE_WGET_STATUSBAR is not set -# CONFIG_FEATURE_WGET_AUTHENTICATION is not set +CONFIG_WGET=y +CONFIG_FEATURE_WGET_STATUSBAR=y +CONFIG_FEATURE_WGET_AUTHENTICATION=y # CONFIG_FEATURE_WGET_LONG_OPTIONS is not set -# CONFIG_FEATURE_WGET_TIMEOUT is not set +CONFIG_FEATURE_WGET_TIMEOUT=y # CONFIG_ZCIP is not set # diff --git a/tools/satellites/perl.sat b/tools/satellites/perl.sat new file mode 100644 index 0000000..c125da2 --- /dev/null +++ b/tools/satellites/perl.sat @@ -0,0 +1,14 @@ +name=perl +version=5.20.1 + +dlextract "http://www.cpan.org/src/5.0/$name-$version.tar.gz" \ + "7a195abb7d6769f751e90c7d30dcf2e0" + +cd "$name-$version" + +sh Configure -des -Dprefix=/tools -Dlibs=-lm +make + +cp perl cpan/podlators/pod2man "$dir_install/tools/bin" +mkdir -p "$dir_install/tools/lib/perl5" +cp -r lib "$dir_install/tools/lib/perl5/$version" diff --git a/tools/satellites/stow.sat b/tools/satellites/stow.sat new file mode 100644 index 0000000..2e1a64d --- /dev/null +++ b/tools/satellites/stow.sat @@ -0,0 +1,10 @@ +name=stow +version=2.2.0 + +dlextract "http://ftp.gnu.org/gnu/$name/$name-$version.tar.bz2" \ + "5bb56592eff9aaf9dfb6c975b3004240" + +cd "$name-$version" + +./configure --prefix=/tools +make DESTDIR="$dir_install" install-exec-am install-pmDATA install-dist_pmstowDATA