IIUC,one of the goal mentioned by cyphermox here seems to avoid the grep
cmd to catch ubuntu pattern where hostname has ubuntu in it.

Example:
sometextbeforeubuntusometextafter
ubuntusometextafter
sometextbeforeubuntu

and only catch it when it is 'ubuntu' nothing else.

I think "-w" should suffice to keep the if statement remove in Joshua'
proposal.

# man grep
-w, --word-regexp
              Select  only  those  lines  containing  matches  that  form whole 
words.

if ! echo "$RET" | grep -qw 'ubuntu'; then
or
if ! echo "$RET" | grep -q '\<ubuntu\>'; then


Some quick tests I quickly ran on my laptop :
# echo "beforeubuntuafter" | grep -w "ubuntu"
# echo "beforeubuntuafter" | grep -w "ubuntu"
# echo "ubuntuafter" | grep -w "ubuntu"
# echo "ubuntu" | grep -w "ubuntu"
ubuntu

That should cover at least that one item.

Thoughts ?

- Eric

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1452202

Title:
  ubuntu preseed install fails to set a hostname

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/debian-installer/+bug/1452202/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to