fix: Switch to space-separated sources.conf format
- Change from colon to space separation to avoid URL parsing issues - Update sources.conf format: TYPE NAME URL VERSION BUILD_FUNCTION [EXTRA] - Implement awk-based parsing for reliable field extraction - Fix firmware package list (remove unavailable linux-firmware-marvell)
This commit is contained in:
113
initramfs/usr/share/dhcpcd/hooks/10-wpa_supplicant
Normal file
113
initramfs/usr/share/dhcpcd/hooks/10-wpa_supplicant
Normal file
@@ -0,0 +1,113 @@
|
||||
# Start, reconfigure and stop wpa_supplicant per wireless interface.
|
||||
#
|
||||
# This is only needed when using wpa_supplicant-2.5 or older, OR
|
||||
# when wpa_supplicant has not been built with CONFIG_MATCH_IFACE, OR
|
||||
# wpa_supplicant was launched without the -M flag to activate
|
||||
# interface matching.
|
||||
|
||||
if [ -z "$wpa_supplicant_conf" ]; then
|
||||
for x in \
|
||||
/etc/wpa_supplicant/wpa_supplicant-"$interface".conf \
|
||||
/etc/wpa_supplicant/wpa_supplicant.conf \
|
||||
/etc/wpa_supplicant-"$interface".conf \
|
||||
/etc/wpa_supplicant.conf \
|
||||
; do
|
||||
if [ -s "$x" ]; then
|
||||
wpa_supplicant_conf="$x"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
: ${wpa_supplicant_conf:=/etc/wpa_supplicant.conf}
|
||||
|
||||
wpa_supplicant_ctrldir()
|
||||
{
|
||||
dir=$(key_get_value "[[:space:]]*ctrl_interface=" \
|
||||
"$wpa_supplicant_conf")
|
||||
dir=$(trim "$dir")
|
||||
case "$dir" in
|
||||
DIR=*)
|
||||
dir=${dir##DIR=}
|
||||
dir=${dir%%[[:space:]]GROUP=*}
|
||||
dir=$(trim "$dir")
|
||||
;;
|
||||
esac
|
||||
printf %s "$dir"
|
||||
}
|
||||
|
||||
wpa_supplicant_start()
|
||||
{
|
||||
# If the carrier is up, don't bother checking anything
|
||||
[ "$ifcarrier" = "up" ] && return 0
|
||||
|
||||
# Pre flight checks
|
||||
if [ ! -s "$wpa_supplicant_conf" ]; then
|
||||
syslog warn \
|
||||
"$wpa_supplicant_conf does not exist"
|
||||
syslog warn "not interacting with wpa_supplicant(8)"
|
||||
return 1
|
||||
fi
|
||||
dir=$(wpa_supplicant_ctrldir)
|
||||
if [ -z "$dir" ]; then
|
||||
syslog warn \
|
||||
"ctrl_interface not defined in $wpa_supplicant_conf"
|
||||
syslog warn "not interacting with wpa_supplicant(8)"
|
||||
return 1
|
||||
fi
|
||||
|
||||
wpa_cli -p "$dir" -i "$interface" status >/dev/null 2>&1 && return 0
|
||||
syslog info "starting wpa_supplicant"
|
||||
driver=${wpa_supplicant_driver:+-D}$wpa_supplicant_driver
|
||||
err=$(wpa_supplicant -B -c"$wpa_supplicant_conf" -i"$interface" \
|
||||
"$driver" 2>&1)
|
||||
errn=$?
|
||||
if [ $errn != 0 ]; then
|
||||
syslog err "failed to start wpa_supplicant"
|
||||
syslog err "$err"
|
||||
fi
|
||||
return $errn
|
||||
}
|
||||
|
||||
wpa_supplicant_reconfigure()
|
||||
{
|
||||
dir=$(wpa_supplicant_ctrldir)
|
||||
[ -z "$dir" ] && return 1
|
||||
if ! wpa_cli -p "$dir" -i "$interface" status >/dev/null 2>&1; then
|
||||
wpa_supplicant_start
|
||||
return $?
|
||||
fi
|
||||
syslog info "reconfiguring wpa_supplicant"
|
||||
err=$(wpa_cli -p "$dir" -i "$interface" reconfigure 2>&1)
|
||||
errn=$?
|
||||
if [ $errn != 0 ]; then
|
||||
syslog err "failed to reconfigure wpa_supplicant"
|
||||
syslog err "$err"
|
||||
fi
|
||||
return $errn
|
||||
}
|
||||
|
||||
wpa_supplicant_stop()
|
||||
{
|
||||
dir=$(wpa_supplicant_ctrldir)
|
||||
[ -z "$dir" ] && return 1
|
||||
wpa_cli -p "$dir" -i "$interface" status >/dev/null 2>&1 || return 0
|
||||
syslog info "stopping wpa_supplicant"
|
||||
err=$(wpa_cli -i"$interface" terminate 2>&1)
|
||||
errn=$?
|
||||
if [ $errn != 0 ]; then
|
||||
syslog err "failed to stop wpa_supplicant"
|
||||
syslog err "$err"
|
||||
fi
|
||||
return $errn
|
||||
}
|
||||
|
||||
if [ "$ifwireless" = "1" ] && \
|
||||
command -v wpa_supplicant >/dev/null 2>&1 && \
|
||||
command -v wpa_cli >/dev/null 2>&1
|
||||
then
|
||||
case "$reason" in
|
||||
PREINIT) wpa_supplicant_start;;
|
||||
RECONFIGURE) wpa_supplicant_reconfigure;;
|
||||
DEPARTED|STOPPED) wpa_supplicant_stop;;
|
||||
esac
|
||||
fi
|
||||
47
initramfs/usr/share/dhcpcd/hooks/15-timezone
Normal file
47
initramfs/usr/share/dhcpcd/hooks/15-timezone
Normal file
@@ -0,0 +1,47 @@
|
||||
# Configure timezone
|
||||
|
||||
: ${localtime:=/etc/localtime}
|
||||
|
||||
set_zoneinfo()
|
||||
{
|
||||
[ -z "$new_tzdb_timezone" ] && return 0
|
||||
|
||||
zoneinfo_dir=
|
||||
for d in \
|
||||
/usr/share/zoneinfo \
|
||||
/usr/lib/zoneinfo \
|
||||
/var/share/zoneinfo \
|
||||
/var/zoneinfo \
|
||||
; do
|
||||
if [ -d "$d" ]; then
|
||||
zoneinfo_dir="$d"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "$zoneinfo_dir" ]; then
|
||||
syslog warning "timezone directory not found"
|
||||
return 1
|
||||
fi
|
||||
|
||||
zone_file="$zoneinfo_dir/$new_tzdb_timezone"
|
||||
if [ ! -e "$zone_file" ]; then
|
||||
syslog warning "no timezone definition for $new_tzdb_timezone"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if copy_file "$zone_file" "$localtime"; then
|
||||
syslog info "timezone changed to $new_tzdb_timezone"
|
||||
fi
|
||||
}
|
||||
|
||||
# For ease of use, map DHCP6 names onto our DHCP4 names
|
||||
case "$reason" in
|
||||
BOUND6|RENEW6|REBIND6|REBOOT6|INFORM6)
|
||||
new_tzdb_timezone="$new_dhcp6_tzdb_timezone"
|
||||
;;
|
||||
esac
|
||||
|
||||
if $if_configured && $if_up; then
|
||||
set_zoneinfo
|
||||
fi
|
||||
39
initramfs/usr/share/dhcpcd/hooks/29-lookup-hostname
Normal file
39
initramfs/usr/share/dhcpcd/hooks/29-lookup-hostname
Normal file
@@ -0,0 +1,39 @@
|
||||
# Lookup the hostname in DNS if not set
|
||||
|
||||
lookup_hostname()
|
||||
{
|
||||
[ -z "$new_ip_address" ] && return 1
|
||||
# Silly ISC programs love to send error text to stdout
|
||||
if command -v dig >/dev/null 2>&1; then
|
||||
h=$(dig +short -x $new_ip_address)
|
||||
if [ $? = 0 ]; then
|
||||
echo "$h" | sed 's/\.$//'
|
||||
return 0
|
||||
fi
|
||||
elif command -v host >/dev/null 2>&1; then
|
||||
h=$(host $new_ip_address)
|
||||
if [ $? = 0 ]; then
|
||||
echo "$h" \
|
||||
| sed 's/.* domain name pointer \(.*\)./\1/'
|
||||
return 0
|
||||
fi
|
||||
elif command -v getent >/dev/null 2>&1; then
|
||||
h=$(getent hosts $new_ip_address)
|
||||
if [ $? = 0 ]; then
|
||||
echo "$h" | sed 's/[^ ]* *\([^ ]*\).*/\1/'
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
set_hostname()
|
||||
{
|
||||
if [ -z "${new_host_name}${new_fqdn_name}" ]; then
|
||||
export new_host_name="$(lookup_hostname)"
|
||||
fi
|
||||
}
|
||||
|
||||
if $if_up; then
|
||||
set_hostname
|
||||
fi
|
||||
59
initramfs/usr/share/dhcpcd/hooks/50-yp.conf
Normal file
59
initramfs/usr/share/dhcpcd/hooks/50-yp.conf
Normal file
@@ -0,0 +1,59 @@
|
||||
# Sample dhcpcd hook for ypbind
|
||||
# This script is only suitable for the Linux version.
|
||||
|
||||
ypbind_pid()
|
||||
{
|
||||
[ -s /var/run/ypbind.pid ] && cat /var/run/ypbind.pid
|
||||
}
|
||||
|
||||
make_yp_conf()
|
||||
{
|
||||
[ -z "${new_nis_domain}${new_nis_servers}" ] && return 0
|
||||
cf=/etc/yp.conf."$ifname"
|
||||
rm -f "$cf"
|
||||
echo "$signature" > "$cf"
|
||||
prefix=
|
||||
if [ -n "$new_nis_domain" ]; then
|
||||
if ! valid_domainname "$new_nis_domain"; then
|
||||
syslog err "Invalid NIS domain name: $new_nis_domain"
|
||||
rm -f "$cf"
|
||||
return 1
|
||||
fi
|
||||
domainname "$new_nis_domain"
|
||||
if [ -n "$new_nis_servers" ]; then
|
||||
prefix="domain $new_nis_domain server "
|
||||
else
|
||||
echo "domain $new_nis_domain broadcast" >> "$cf"
|
||||
fi
|
||||
else
|
||||
prefix="ypserver "
|
||||
fi
|
||||
for x in $new_nis_servers; do
|
||||
echo "$prefix$x" >> "$cf"
|
||||
done
|
||||
save_conf /etc/yp.conf
|
||||
cat "$cf" > /etc/yp.conf
|
||||
rm -f "$cf"
|
||||
pid="$(ypbind_pid)"
|
||||
if [ -n "$pid" ]; then
|
||||
kill -HUP "$pid"
|
||||
fi
|
||||
}
|
||||
|
||||
restore_yp_conf()
|
||||
{
|
||||
[ -n "$old_nis_domain" ] && domainname ""
|
||||
restore_conf /etc/yp.conf || return 0
|
||||
pid="$(ypbind_pid)"
|
||||
if [ -n "$pid" ]; then
|
||||
kill -HUP "$pid"
|
||||
fi
|
||||
}
|
||||
|
||||
if $if_configured; then
|
||||
if $if_up; then
|
||||
make_yp_conf
|
||||
elif $if_down; then
|
||||
restore_yp_conf
|
||||
fi
|
||||
fi
|
||||
Reference in New Issue
Block a user