Jumpdrive/initramfs/init

64 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
## SPDX-License-Identifier: GPL-2.0-only
## Init script for JumpDrive
## Copyright (C) 2020 - postmarketOS
## Copyright (C) 2020 - Danctl12 <danct12@disroot.org>
echo "Welcome to JumpDrive"
. /info.sh
echo "Running on $PLATFORM"
. /init_functions.sh
# Environment variables that we want:
IP=172.16.42.1
# Create all the symlinks to /bin/busybox
mkdir -p /usr/bin
mkdir -p /sbin
mkdir -p /usr/sbin
echo "Installing Busybox..." && /bin/busybox --install -s
# Mount things needed by this script
mkdir /proc
mkdir /sys
mkdir /etc
mount -t proc proc /proc
mount -t sysfs sysfs /sys
mkdir /config
mount -t configfs -o nodev,noexec,nosuid configfs /config
# /dev/pts (needed for telnet)
mkdir -p /dev/pts
mount -t devpts devpts /dev/pts
# LED indicator for MMC r/w access
if [ -n "$LED" ]; then
echo $TRIGGER > /sys/class/leds/$LED/trigger
fi
if [ -n "$SLEEP" ]; then
echo "Waiting for hardware to initialize..."
sleep $SLEEP
fi
# Create device nodes
echo "Creating device nodes..."
mknod /dev/null c 1 3
mknod /dev/tty c 5 0
mdev -s
# Finishing rescue setup
start_serial_getty
setup_usb_configfs
start_udhcpd
setup_telnetd
gzip -c -d splash.ppm.gz > /splash.ppm
fbsplash -s /splash.ppm
loop_forever