tokland / arch-bootstrap

Bootstrap a base Arch Linux system
312 stars 89 forks source link

Edit rather than overwrite /etc/shadow from filesystem pkg #22

Closed bpow closed 8 years ago

bpow commented 8 years ago

Edit, rather than overwrite the /etc/shadow unpacked from the filesystem package. Otherwise many several users expected in the installed system (e.g. dbus) will not be present in the installed system.

bpow commented 8 years ago

As currently written, arch-bootstrap overwrites the /etc/shadow from the filesystem pkg. This results in the absence of many user entries (including dbus-- I figured this out after running into the same problem described here ). This makes it so that when filesystem is force-reinstalled later on in the script, the /etc/shadow (and /etc/passwd that it tries to install instead go to .pacnew files.

tokland commented 8 years ago

Good idea. Maybe ^root:.*?

GrayHatter commented 8 years ago

I suggest ^root.+\n

bpow commented 8 years ago

Updated to use a more explicit regex for the search (^root:.*$). This makes a lot of sense, avoiding replacing lines for usernames like root66 (yeah, a weird username, but that's how some people get their kicks, I guess).

The '$' may be overkill, but shouldn't hurt things.

Using '+' would require sed -r for extended regex, and I don't know how portable that is to other sed versions.

The other alternative would have been to use gawk (already a script requirement). I don't feel strongly about how to accomplish this.

Hopefully people change the root password soon after installing, anyway...

GrayHatter commented 8 years ago

The '$' may be overkill, but shouldn't hurt things.

I originally used that to mean end of line, but reading the sed man page makes me think it could be end of file/stream. Either way I that wasn't my goal so I dropped the $.

Using '+' would require sed -r for extended regex, and I don't know how portable that is to other sed versions.

Oh, I didn't know that, that's good to know. Thanks!

My current vote is just to use @tokland's suggestion then.

tokland commented 8 years ago

Merged, thx!