#!/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 echo "Changing ownership of $rocket to root" chown -R 0.0 "$rocket" echo "Creating device nodes" 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/ssl" "$rocket/bin" "$rocket/usr/pkg" "$rocket/usr/sat" echo "Moving temporary things into place" ln -sf /tools/bin/sh "$rocket/bin/sh" ln -sf /tools/bin/bash "$rocket/bin/bash" ln -sf /tools/lib/ssl/certs "$rocket/etc/ssl/certs" echo "Creating users and groups" echo 'root:x:0:0:root:/root:/bin/sh' > "$rocket/etc/passwd" echo 'root:x:0:' > "$rocket/etc/group"