Colin, I'll rather propose that (simplifying the code):
# Prevent from updating if parameters already present (persistent usb key)
if ! `grep -qs 'AutomaticLoginEnable' $GDMCustomFile` ; then
if ! `grep -qs '\[daemon\]' $GDMCustomFile` ; then
printf '[daemon]' >> $GDMCustomFile
fi
sed -i "s/\[daemon\]/\[daemon\]\n$AutologinParameters/" $GDMCustomFile
fi
With that, we handle every cases:
- no GDMCustomFile, create the autologin part with [daemon]
- GDMCustomFile already exists with [daemon] section but without the autologin
part (case of ubutu derivatives): add it
- GDMCustomFile exists without [daemon] section: add all the autologin stuff
and the section (don't know if that can happen with current GDM implementation,
but it'll surely later)
- GDMCustomFile exists with [daemon] section and autologin stuff in place
(case of persistent usb key): don't do anything
And we get our \n interpreted by sed :)
This new proposal is in my linked branch.
** Changed in: casper (Ubuntu)
Importance: Undecided => High
--
No more autologin in live CD
https://bugs.launchpad.net/bugs/505140
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs