#!/bin/sh apt update && apt upgrade -y apt install bridge-utils dnsmasq hostapd ifupdown iptables libqmi-utils resolvconf samba udhcpc udiskie udisks2 -y apt purge dhcpcd modemmanager -y sed -i -e '/^\[HotPi SMB]$/,+3d' /etc/samba/smb.conf -e '/^usb_max_current_enable=1$/d' /boot/firmware/config.txt echo '#!/bin/sh qmicli -d /dev/cdc-wdm0 --wds-noop --client-cid=17 2> /dev/null qmicli -d /dev/cdc-wdm0 -E raw-ip qmicli -d /dev/cdc-wdm0 --wds-start-network=ip-type=4 --client-no-release-cid udhcpc -i wwan0' > /bin/hotpistart echo '#!/bin/sh ifconfig wwan0 down qmicli -d /dev/cdc-wdm0 --wds-noop --client-cid=17 2> /dev/null' > /bin/hotpistop echo '#!/bin/sh udisksctl mount -b /dev/sda1' > /bin/hotpimount echo '#!/bin/sh udisksctl unmount -b /dev/sda1' > /bin/hotpiunmount echo '#!/bin/sh chmod -R 755 /media/root' > /bin/hotpiread echo '#!/bin/sh chmod -R 777 /media/root' > /bin/hotpiwrite echo '#!/bin/sh apt update && apt upgrade -y' > /bin/hotpiupdate echo 'allow-hotplug br0 iface br0 inet static address 192.168.0.1 bridge_ports wlan0 eth0' > /etc/network/interfaces.d/hotpi.conf echo 'interface=br0 dhcp-range=192.168.0.2,192.168.0.254,24h' > /etc/dnsmasq.d/hotpi.conf echo 'net.ipv4.ip_forward=1' > /etc/sysctl.d/hotpi.conf echo 'bridge=br0 channel=1 country_code=US hw_mode=g ieee80211n=1 interface=wlan0 rsn_pairwise=CCMP ssid=raspberrypi wmm_enabled=1 wpa=2 wpa_key_mgmt=WPA-PSK wpa_passphrase=password' > /etc/hostapd/hostapd.conf echo '[HotPi SMB] path = /media/root public = yes writeable = yes' >> /etc/samba/smb.conf echo 'usb_max_current_enable=1' >> /boot/firmware/config.txt echo 'ATTR{idVendor}=="1e0e", ATTR{idProduct}=="9001", RUN="/bin/systemd-run hotpistart"' > /etc/udev/rules.d/hotpi.rules echo '[Service] ExecStart=sh -c "iptables -t nat -A POSTROUTING -o wwan0 -j MASQUERADE ; udiskie -N -F" [Install] WantedBy=multi-user.target' > /etc/systemd/system/hotpi.service mkdir -p /media/root chmod 755 /bin/hotpi* /media/root systemctl unmask hostapd systemctl enable hostapd hotpi resolvconf reboot