1c0ff6aa23
Later, the aports folder will probably get split up in its own repository. But right now this is simply convenient.
51 lines
1 KiB
Bash
51 lines
1 KiB
Bash
#!/bin/sh
|
|
IP=192.168.2.15
|
|
TELNET_PORT=23
|
|
|
|
usb_setup_android() {
|
|
SYS=/sys/class/android_usb/android0
|
|
[ -e "$SYS" ] || return
|
|
printf "%s" "0" > "$SYS/enable"
|
|
printf "%s" "18D1" > "$SYS/idVendor"
|
|
printf "%s" "D001" > "$SYS/idProduct"
|
|
printf "%s" "rndis" > "$SYS/functions"
|
|
printf "%s" "1" > "$SYS/enable"
|
|
}
|
|
|
|
dhcpcd_start()
|
|
{
|
|
# get usb interface
|
|
INTERFACE=""
|
|
ifconfig rndis0 "$IP" && INTERFACE=rndis0
|
|
if [ -z $INTERFACE ]; then
|
|
ifconfig usb0 "$IP" && INTERFACE=usb0
|
|
fi
|
|
|
|
# create /etc/udhcpd.conf
|
|
{
|
|
echo "start 192.168.2.20"
|
|
echo "end 192.168.2.90"
|
|
echo "lease_file /var/udhcpd.leases"
|
|
echo "interface $INTERFACE"
|
|
echo "option subnet 255.255.255.0"
|
|
} > /etc/udhcpd.conf
|
|
udhcpd
|
|
}
|
|
|
|
telnetd_start()
|
|
{
|
|
mkdir -p /dev/pts
|
|
mount -t devpts devpts /dev/pts
|
|
{
|
|
echo '#!/bin/sh'
|
|
echo '. /init_functions.sh'
|
|
echo 'unlock_root_partition'
|
|
echo 'killall cryptsetup telnetd'
|
|
} > /telnet_connect.sh
|
|
chmod +x /telnet_connect.sh
|
|
telnetd -b "${IP}:${TELNET_PORT}" -l /telnet_connect.sh
|
|
}
|
|
|
|
usb_setup_android
|
|
dhcpcd_start
|
|
telnetd_start
|