2017-12-23 19:22:28 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# shellcheck disable=SC1091
|
|
|
|
. ./init_functions.sh
|
2023-05-30 06:57:08 +00:00
|
|
|
. /usr/share/misc/source_deviceinfo
|
2017-12-23 19:22:28 +00:00
|
|
|
TELNET_PORT=23
|
|
|
|
|
|
|
|
setup_usb_network
|
2022-01-08 19:30:19 +00:00
|
|
|
start_unudhcpd
|
2017-12-23 19:22:28 +00:00
|
|
|
|
2022-01-24 00:34:07 +00:00
|
|
|
show_splash "WARNING: debug-shell is active\\nhttps://postmarketos.org/debug-shell"
|
2017-12-23 19:22:28 +00:00
|
|
|
|
|
|
|
echo "Create 'pmos_continue_boot' script"
|
|
|
|
{
|
|
|
|
echo "#!/bin/sh"
|
2023-10-18 17:00:08 +00:00
|
|
|
#Disable any active usb mass storage
|
|
|
|
echo "if [ -d /config/usb_gadget/g1/functions/mass_storage.0 ]; then setup_usb_storage; fi"
|
2023-08-21 16:39:02 +00:00
|
|
|
echo "pkill -9 -f pmos_shell"
|
2023-12-18 22:48:14 +00:00
|
|
|
echo "pkill -f pmos_fail_halt_boot"
|
2017-12-23 19:22:28 +00:00
|
|
|
echo "pkill -f telnetd.*:${TELNET_PORT}"
|
|
|
|
} >/usr/bin/pmos_continue_boot
|
|
|
|
chmod +x /usr/bin/pmos_continue_boot
|
|
|
|
|
|
|
|
echo "Create 'pmos_shell' script"
|
|
|
|
{
|
|
|
|
echo "#!/bin/sh"
|
|
|
|
echo "sh"
|
|
|
|
} >/usr/bin/pmos_shell
|
|
|
|
chmod +x /usr/bin/pmos_shell
|
|
|
|
|
2023-12-18 22:48:14 +00:00
|
|
|
echo "Create 'pmos_fail_halt_boot' script"
|
2017-12-23 19:22:28 +00:00
|
|
|
{
|
|
|
|
echo "#!/bin/sh"
|
|
|
|
echo '. /init_functions.sh'
|
2023-12-18 22:48:14 +00:00
|
|
|
echo "fail_halt_boot"
|
|
|
|
} >/usr/bin/pmos_fail_halt_boot
|
|
|
|
chmod +x /usr/bin/pmos_fail_halt_boot
|
2017-12-23 19:22:28 +00:00
|
|
|
|
|
|
|
echo "Start the telnet daemon"
|
|
|
|
{
|
|
|
|
echo "#!/bin/sh"
|
|
|
|
echo "echo \"Type 'pmos_continue_boot' to continue booting:\""
|
|
|
|
echo "sh"
|
|
|
|
} >/telnet_connect.sh
|
|
|
|
chmod +x /telnet_connect.sh
|
2023-08-26 15:12:57 +00:00
|
|
|
|
|
|
|
host_ip="${unudhcpd_host_ip:-172.16.42.1}"
|
|
|
|
telnetd -b "${host_ip}:${TELNET_PORT}" -l /telnet_connect.sh
|
2017-12-23 19:22:28 +00:00
|
|
|
|
2020-02-02 04:26:28 +00:00
|
|
|
# mount pstore, if possible
|
|
|
|
if [ -d /sys/fs/pstore ]; then
|
|
|
|
mount -t pstore pstore /sys/fs/pstore || true
|
|
|
|
fi
|
2021-10-31 20:21:10 +00:00
|
|
|
# mount debugfs - very helpful for debugging
|
|
|
|
mount -t debugfs none /sys/kernel/debug || true
|
|
|
|
# make a symlink like Android recoveries do
|
|
|
|
ln -s /sys/kernel/debug /d
|
2020-02-02 04:26:28 +00:00
|
|
|
|
2017-12-23 19:22:28 +00:00
|
|
|
echo "---"
|
2023-08-26 15:12:57 +00:00
|
|
|
echo "WARNING: debug-shell is active on ${host_ip}:${TELNET_PORT}."
|
2017-12-23 19:22:28 +00:00
|
|
|
echo "This is a security hole! Only use it for debugging, and"
|
|
|
|
echo "uninstall the debug-shell hook afterwards!"
|
2023-10-18 17:00:08 +00:00
|
|
|
echo "You can expose storage devices using 'setup_usb_storage /dev/DEVICE'"
|
2017-12-23 19:22:28 +00:00
|
|
|
echo "---"
|
|
|
|
|
2023-08-21 16:39:02 +00:00
|
|
|
pmos_shell
|
2023-06-30 17:07:27 +00:00
|
|
|
|
|
|
|
# Show "Loading" splash again when continuing
|
|
|
|
show_splash "Loading..."
|