Duplicate modules added to HOOKS in mkinitcpio.conf

After installation with architect on a system that uses LVM, I started to see these errors.

mkdir: can't create directory '/run/lvm': File exists

Failed to acquire lock on /run/lvmetad.pid. Already running?

The cause as described by gabe.rust in this forum post was multiple lvm2 entries being added to HOOKS= in /etc/mkinicpio.conf.

Example: HOOKS=(base udev autodetect modconf block lvm2 lvm2 filesystems keyboard)

The cause seems to be sed statements found here util-desktop.sh#L389-398 and here util-base.sh#L322-331. When the aforementioned code is run after util-desktop.sh#L435-437 and util-base.sh#L368-370, duplicate modules will be added.

!253 (merged) should resolve the duplicates by updating the sed statements to only insert if the module being added isn't already present in the line.

Edited by Zachary Smith