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.
39 lines
1022 B
39 lines
1022 B
#!/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" "$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"
|
|
echo '# This is a config for use with busybox
|
|
cmd_download="wget -O {dst} {src}"' > "$rocket/etc/astronaut.conf"
|
|
|