main/postmarketos-initramfs: support custom IP addresses for USB net (MR 3349)
[ci:skip-build] already built successfully in CI
This commit is contained in:
parent
037d44ada1
commit
80fff9242a
7 changed files with 32 additions and 15 deletions
|
@ -1,7 +1,7 @@
|
||||||
# Maintainer: Clayton Craft <clayton@craftyguy.net>
|
# Maintainer: Clayton Craft <clayton@craftyguy.net>
|
||||||
pkgname=postmarketos-base-ui
|
pkgname=postmarketos-base-ui
|
||||||
pkgver=12
|
pkgver=13
|
||||||
pkgrel=1
|
pkgrel=0
|
||||||
pkgdesc="Meta package for minimal postmarketOS UI base"
|
pkgdesc="Meta package for minimal postmarketOS UI base"
|
||||||
url="https://postmarketos.org"
|
url="https://postmarketos.org"
|
||||||
arch="noarch"
|
arch="noarch"
|
||||||
|
@ -205,7 +205,7 @@ d4b4c4fed2dee7266f6a87ae266691377593014943e2953e4cd87a59f3110f25bfb5f3f866cc8435
|
||||||
d1ddd43489e6016e3ffd716027ed2bae4a2ab5f213118bdbcb96750e267ab7c0367cd0e0e386300aa5550352653144f5caeddd790621fe0879f83ca1995bb65c rootfs-etc-tinydm.d-env-wayland.d-50-firefox-wayland.sh
|
d1ddd43489e6016e3ffd716027ed2bae4a2ab5f213118bdbcb96750e267ab7c0367cd0e0e386300aa5550352653144f5caeddd790621fe0879f83ca1995bb65c rootfs-etc-tinydm.d-env-wayland.d-50-firefox-wayland.sh
|
||||||
ecaa57d033a119a53a6574c27636b7c89d659d75ea48a973a6a4ff6f90e5d07202529fd489bfc9dfc7430f5b60f40612f6d5c06f7fab47e681b0a3112a874058 rootfs-etc-tinydm.d-env-wayland.d-50-sdl-wayland.sh
|
ecaa57d033a119a53a6574c27636b7c89d659d75ea48a973a6a4ff6f90e5d07202529fd489bfc9dfc7430f5b60f40612f6d5c06f7fab47e681b0a3112a874058 rootfs-etc-tinydm.d-env-wayland.d-50-sdl-wayland.sh
|
||||||
52d58729cbf3cd0318de633e8a8da74c7af246025a8c5746d5e7c854bdabbf27fa07d8558ffec92a30491cdb687fe4414de5adcddd7da5be3510f918fba463a2 rootfs-usr-lib-NetworkManager-dispatcher.d-50-dns-filter.sh
|
52d58729cbf3cd0318de633e8a8da74c7af246025a8c5746d5e7c854bdabbf27fa07d8558ffec92a30491cdb687fe4414de5adcddd7da5be3510f918fba463a2 rootfs-usr-lib-NetworkManager-dispatcher.d-50-dns-filter.sh
|
||||||
b344a64619aac5295342c597087ecf0614d4dfa0f7afd51f71dd2e9abc473ab9d08b22b3c075729e2f5e69f4e0e601ed3a9b76886c805650e02d6cc4643a7280 rootfs-usr-lib-NetworkManager-dispatcher.d-50-tethering.sh
|
515ede48ce1245e72b501e17e59986d04a26aab9a42881b44974253c7dec1db08658625157d23adb6f8f62fd78c3f93b71fee1894ad0c80d61be3f5f32d5b990 rootfs-usr-lib-NetworkManager-dispatcher.d-50-tethering.sh
|
||||||
bf8db527c49fa724e640a90269ba2648a2555f5867b2adbfbd88d1f685261f757339757c09ee08f590c76de4bd3d0c73a47dea9bd340644dd4707e76152cefd1 rootfs-etc-profile.d-qt-mobile-controls.sh
|
bf8db527c49fa724e640a90269ba2648a2555f5867b2adbfbd88d1f685261f757339757c09ee08f590c76de4bd3d0c73a47dea9bd340644dd4707e76152cefd1 rootfs-etc-profile.d-qt-mobile-controls.sh
|
||||||
6e193eca3961a78d47b4656892eae34d019d9317a255a201f5ea61e3300caff04c526a27cd98d0edc072b36e3eaf3a1768f4cd27c5e2be8b19c167d535c820a6 rootfs-etc-profile.d-qt-wayland.sh
|
6e193eca3961a78d47b4656892eae34d019d9317a255a201f5ea61e3300caff04c526a27cd98d0edc072b36e3eaf3a1768f4cd27c5e2be8b19c167d535c820a6 rootfs-etc-profile.d-qt-wayland.sh
|
||||||
"
|
"
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
|
# shellcheck disable=SC1091
|
||||||
# Handle USB tethering with unudhcpd and NetworkManager while also
|
# Handle USB tethering with unudhcpd and NetworkManager while also
|
||||||
# keeping SSH login over USB working when tethering is disabled.
|
# keeping SSH login over USB working when tethering is disabled.
|
||||||
#
|
#
|
||||||
|
@ -9,8 +10,10 @@
|
||||||
# using UUID allows the user to change the connection name if they want to.
|
# using UUID allows the user to change the connection name if they want to.
|
||||||
con_uuid="83bd1823-feca-4c2b-9205-4b83dc792e1f"
|
con_uuid="83bd1823-feca-4c2b-9205-4b83dc792e1f"
|
||||||
interface="usb0"
|
interface="usb0"
|
||||||
host_ip="172.16.42.1"
|
|
||||||
client_ip="172.16.42.2"
|
[ -e /etc/unudhcpd.conf ] && . /etc/unudhcpd.conf
|
||||||
|
host_ip="${unudhcpd_host_ip:-172.16.42.1}"
|
||||||
|
client_ip="${unudhcpd_client_ip:-172.16.42.2}"
|
||||||
|
|
||||||
# Skip if iface does not match
|
# Skip if iface does not match
|
||||||
if [ "$DEVICE_IFACE" != "$interface" ]; then
|
if [ "$DEVICE_IFACE" != "$interface" ]; then
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
/bin/busybox-extras
|
/bin/busybox-extras
|
||||||
/bin/sh
|
/bin/sh
|
||||||
/etc/deviceinfo
|
/etc/deviceinfo
|
||||||
|
/etc/unudhcpd.conf
|
||||||
/usr/share/misc/source_deviceinfo
|
/usr/share/misc/source_deviceinfo
|
||||||
/usr/bin/unudhcpd
|
/usr/bin/unudhcpd
|
||||||
/usr/sbin/kpartx
|
/usr/sbin/kpartx
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Maintainer: Oliver Smith <ollieparanoid@postmarketos.org>
|
# Maintainer: Oliver Smith <ollieparanoid@postmarketos.org>
|
||||||
# Co-Maintainer: Clayton Craft <clayton@craftyguy.net>
|
# Co-Maintainer: Clayton Craft <clayton@craftyguy.net>
|
||||||
pkgname=postmarketos-initramfs
|
pkgname=postmarketos-initramfs
|
||||||
pkgver=1.3.1
|
pkgver=1.4.0
|
||||||
pkgrel=0
|
pkgrel=0
|
||||||
pkgdesc="Base files for the postmarketOS initramfs / initramfs-extra"
|
pkgdesc="Base files for the postmarketOS initramfs / initramfs-extra"
|
||||||
url="https://postmarketos.org"
|
url="https://postmarketos.org"
|
||||||
|
@ -30,11 +30,15 @@ source="
|
||||||
00-initramfs-extra-base.files
|
00-initramfs-extra-base.files
|
||||||
init.sh
|
init.sh
|
||||||
init_functions.sh
|
init_functions.sh
|
||||||
|
unudhcpd.conf
|
||||||
"
|
"
|
||||||
arch="noarch"
|
arch="noarch"
|
||||||
license="GPL-2.0-or-later"
|
license="GPL-2.0-or-later"
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
|
install -Dm644 "$srcdir/unudhcpd.conf" \
|
||||||
|
"$pkgdir/etc/unudhcpd.conf"
|
||||||
|
|
||||||
install -Dm644 "$srcdir/init_functions.sh" \
|
install -Dm644 "$srcdir/init_functions.sh" \
|
||||||
"$pkgdir/usr/share/mkinitfs/init_functions.sh"
|
"$pkgdir/usr/share/mkinitfs/init_functions.sh"
|
||||||
|
|
||||||
|
@ -66,8 +70,9 @@ package() {
|
||||||
sha512sums="
|
sha512sums="
|
||||||
bed319179bcd0b894d6267c7e73f2890db07bc07df71542936947dfb3bdb17fade8a7b4e7b577f278af4472464427bba07f75aff0a1e454a4167052c088f3b6a 00-default.modules
|
bed319179bcd0b894d6267c7e73f2890db07bc07df71542936947dfb3bdb17fade8a7b4e7b577f278af4472464427bba07f75aff0a1e454a4167052c088f3b6a 00-default.modules
|
||||||
399da6e61993f48c8a62c956bb15d294cac10bf003d84257efdf4a213ebc87bb51cdcd75c4675f51c3be832146b8f21a7c769bf3e94f574a5067f001662632a1 00-initramfs-base.dirs
|
399da6e61993f48c8a62c956bb15d294cac10bf003d84257efdf4a213ebc87bb51cdcd75c4675f51c3be832146b8f21a7c769bf3e94f574a5067f001662632a1 00-initramfs-base.dirs
|
||||||
3bc73f3a0d1de210444d9c45fab51fd4520e38b43ffbb76368f8ff854b990aa2f21c6356840c5a48eb9808e834eb885a6d581639a60707c26abf66fc20b70db9 00-initramfs-base.files
|
db8ba79257ed2666628825f9f28ab27c8d8b55f631b27f28d59fa322aaea6488355ad169c4ec3ad7d080c42af2b3ad00cf35cc6186791d15c301c74350f2bf21 00-initramfs-base.files
|
||||||
e984cd3033ce8752ebc71127828b964b46259a5263c2ebfab32c1394b674bcff464862ff00b8e920d3d31386c54ca0b94f84bc77580d275ecfeea33e76c07ef4 00-initramfs-extra-base.files
|
e984cd3033ce8752ebc71127828b964b46259a5263c2ebfab32c1394b674bcff464862ff00b8e920d3d31386c54ca0b94f84bc77580d275ecfeea33e76c07ef4 00-initramfs-extra-base.files
|
||||||
4e6f5b79b0bd6188bab9a96526f727780dda6be1c1e5fe04c3ce5a892bf0f92b7c7d0fc5809ac3eacc8121096a4815c6177a573f1b968752972f20460cc04ac6 init.sh
|
6605a4d92d36ce1fcb4d86536279d19eaa5308ed58067bf03427f2d82f772ca0c3df3bfbda9f4fff9cd91c1535f5802878a65eef3b9db16a43864e9ee4417675 init.sh
|
||||||
38416294fe58af8f687a85a3b20b285075cdb34da8aab6c96a778994ee3dd121d1bb29da71b8147b2a53f19b58eb3203f583ce261cbb05b4bd1987bc7c82b1d9 init_functions.sh
|
d77d880ff3558606131e99ee0dfc6a484853e13f0f355f2d38d9488fc6ed6e8bf7db1c177e23ac12d3b9fb4ed2de769da047f166f78d841d24b1119ac695342d init_functions.sh
|
||||||
|
ba3275a9af788c7c782322a22a0f144d5e50e3498ea6886486a29331f23ae89cd32d500a3635cfa7cab369afba92edc18aeca64ccbf0cd589061cce23d15b46c unudhcpd.conf
|
||||||
"
|
"
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
[ -e /hooks/10-verbose-initfs.sh ] && set -x
|
[ -e /hooks/10-verbose-initfs.sh ] && set -x
|
||||||
|
|
||||||
|
[ -e /etc/unudhcpd.conf ] && . /etc/unudhcpd.conf
|
||||||
. ./init_functions.sh
|
. ./init_functions.sh
|
||||||
. /usr/share/misc/source_deviceinfo
|
. /usr/share/misc/source_deviceinfo
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# This file will be in /init_functions.sh inside the initramfs.
|
# This file will be in /init_functions.sh inside the initramfs.
|
||||||
IP=172.16.42.1
|
|
||||||
ROOT_PARTITION_UNLOCKED=0
|
ROOT_PARTITION_UNLOCKED=0
|
||||||
ROOT_PARTITION_RESIZED=0
|
ROOT_PARTITION_RESIZED=0
|
||||||
|
|
||||||
|
@ -586,15 +585,17 @@ start_unudhcpd() {
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Starting unudhcpd"
|
local host_ip="${unudhcpd_host_ip:-172.16.42.1}"
|
||||||
|
local client_ip="${unudhcpd_client_ip:-172.16.42.2}"
|
||||||
|
echo "Starting unudhcpd with server ip $host_ip, client ip: $client_ip"
|
||||||
# Get usb interface
|
# Get usb interface
|
||||||
INTERFACE=""
|
INTERFACE=""
|
||||||
ifconfig rndis0 "$IP" 2>/dev/null && INTERFACE=rndis0
|
ifconfig rndis0 "$host_ip" 2>/dev/null && INTERFACE=rndis0
|
||||||
if [ -z $INTERFACE ]; then
|
if [ -z $INTERFACE ]; then
|
||||||
ifconfig usb0 "$IP" 2>/dev/null && INTERFACE=usb0
|
ifconfig usb0 "$host_ip" 2>/dev/null && INTERFACE=usb0
|
||||||
fi
|
fi
|
||||||
if [ -z $INTERFACE ]; then
|
if [ -z $INTERFACE ]; then
|
||||||
ifconfig eth0 "$IP" 2>/dev/null && INTERFACE=eth0
|
ifconfig eth0 "$host_ip" 2>/dev/null && INTERFACE=eth0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z $INTERFACE ]; then
|
if [ -z $INTERFACE ]; then
|
||||||
|
@ -607,7 +608,7 @@ start_unudhcpd() {
|
||||||
echo " Using interface $INTERFACE"
|
echo " Using interface $INTERFACE"
|
||||||
echo " Starting the DHCP daemon"
|
echo " Starting the DHCP daemon"
|
||||||
(
|
(
|
||||||
unudhcpd -i "$INTERFACE" -s 172.16.42.1 -c 172.16.42.2
|
unudhcpd -i "$INTERFACE" -s "$host_ip" -c "$client_ip"
|
||||||
) &
|
) &
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
6
main/postmarketos-initramfs/unudhcpd.conf
Normal file
6
main/postmarketos-initramfs/unudhcpd.conf
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
# This configuration file is used by the initramfs to run unudhcpd.
|
||||||
|
# It is *not* used directly by unudhcpd!
|
||||||
|
# Note: The initramfs must be recreated by running the 'mkinitfs' command
|
||||||
|
# for changes here to be applied/used during boot.
|
||||||
|
unudhcpd_host_ip=172.16.42.1
|
||||||
|
unudhcpd_client_ip=172.16.42.2
|
Loading…
Reference in a new issue