0105a1d8ef
Refactor the install code to be generic, so we only need to add the new path in one place when adding a new file. Put the full path into the filename to make this possible. I've tried to mimic the final directory structure in the aport first (e.g. $pkgdir/sbin/swapfile -> main/postmarketos-base/sbin/swapfile), but that leads to conflicts as abuild only takes the filename for checksums (conflict with etc/conf.d/swapfile): https://gitlab.alpinelinux.org/alpine/abuild/-/issues/10013 We don't really need checksum verification for the files shipped in the same directory (not downloaded), but nevertheless this is a bug. It leads to confusing behavior and might be fixed by letting abuild demand that there is only one source file with the same name, as I suggested in the issue linked above. So let's avoid this altogether with the flat file name.
24 lines
572 B
Bash
24 lines
572 B
Bash
#!/bin/sh
|
|
|
|
FIRMWARE_DIRS="/lib/firmware /lib/firmware/postmarketos"
|
|
|
|
exec >>/var/log/firmwareload.log 2>&1
|
|
|
|
if [ ! -e "/sys/$DEVPATH/loading" ]; then
|
|
echo "firmware loader misses sysfs directory"
|
|
exit 1
|
|
fi
|
|
|
|
for DIR in $FIRMWARE_DIRS; do
|
|
[ -e "$DIR/$FIRMWARE" ] || continue
|
|
echo "loading $DIR/$FIRMWARE"
|
|
echo 1 > "/sys/$DEVPATH/loading"
|
|
cat "$DIR/$FIRMWARE" > "/sys/$DEVPATH/data"
|
|
echo 0 > "/sys/$DEVPATH/loading"
|
|
exit 0
|
|
done
|
|
|
|
# shellcheck disable=SC2039
|
|
echo -1 > "/sys/$DEVPATH/loading"
|
|
echo "cannot find firmware file '$FIRMWARE'"
|
|
exit 1
|