FS#25788 - [filesystem mkinitcpio] move of USB modprobe rule

Attached to Project: Arch Linux
Opened by Matthias Dienstbier (fs4000) - Saturday, 27 August 2011, 11:36 GMT
Last edited by Dave Reisner (falconindy) - Sunday, 09 October 2011, 23:55 GMT
Task Type Bug Report
Category Arch Projects
Status Closed
Assigned To Thomas Bächler (brain0)
Dave Reisner (falconindy)
Tom Gundersen (tomegun)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

In filesystem the USB modprobe rule was moved to /lib:
http://projects.archlinux.org/svntogit/packages.git/commit/filesystem/trunk?id=2b345129f35af2974c8c92322628ce3f2869dd84

Don't forget to reflect this change in mkinitcpio and release both at the same time:
http://projects.archlinux.org/mkinitcpio.git/tree/install/base (line 14)
This task depends upon

Closed by  Dave Reisner (falconindy)
Sunday, 09 October 2011, 23:55 GMT
Reason for closing:  Fixed
Additional comments about closing:  mkinitcpio 0.7.4, filesystem 2011.10
Comment by Tom Gundersen (tomegun) - Sunday, 28 August 2011, 10:49 GMT
Thanks for the reminder. I have pushed a commit here: <https://github.com/teg/mkinitcpio/commit/d7714d5c2e608230c19d63875bbeb7022d9b7f69>.

One thing to check before committing: How does add_file deal with missing files? In the future the /etc/modprobe.d/<...> file may or may not exist. Will it just be silently ignored if I try to add a non-existent file? Should it be?
Comment by Dave Reisner (falconindy) - Sunday, 28 August 2011, 12:56 GMT
It complains about missing files:

https://github.com/falconindy/mkinitcpio/blob/master/functions#L233

If you add a file and it doesn't exist, you should be told as such.
Comment by Tom Gundersen (tomegun) - Monday, 29 August 2011, 00:41 GMT
I don't know what is best: adding just the /lib file will not cause any warnings, but is strictly speaking "wrong" as the user should be able to override it in /etc. That said, I cannot imagine why anyone would override this file...
Comment by Matthias Dienstbier (fs4000) - Tuesday, 30 August 2011, 21:02 GMT
What about that?
[ -f "/etc/modprobe.d/usb-load-ehci-first.conf" ] && add_file "/etc/modprobe.d/usb-load-ehci-first.conf" || add_file "/lib/modprobe.d/usb-load-ehci-first.conf"

or

if [ -f "/etc/modprobe.d/usb-load-ehci-first.conf" ]; then
__add_file "/etc/modprobe.d/usb-load-ehci-first.conf"
else
__add_file "/lib/modprobe.d/usb-load-ehci-first.conf"
fi
Comment by Dave Reisner (falconindy) - Tuesday, 30 August 2011, 21:29 GMT
Sure, a conditional is the way to solve this. I don't think that needs to be pointed out here. However, neither of your solutions are satisfactory. For your own edification:

- we use bash, not posix constructs in mkinitcpio
- there are undesirable side effects when using a compound command (especially in this case)
- we should be looking explicitly for the rule in /lib first, not /etc.
- __add_file requires 3 parameters or else it will fail. moreover, it should never be used by build-time hooks. add_file is much smarter.
Comment by Matthias Dienstbier (fs4000) - Wednesday, 31 August 2011, 10:02 GMT
I used the underscores only for indentation as spaces don't work, didn't realize this other function also exists.
Comment by Dave Reisner (falconindy) - Sunday, 09 October 2011, 23:54 GMT
Did this in one fell swoop. No kludges, just a hard dep on the new filesystem package.

Loading...