Add nasty Ubiquity hacks to force username, set password

Username is fixed, but password can still be changed.
Also forces encryption off, since it won't work with an existing
/home dir.
This commit is contained in:
Jim Paris 2016-07-03 02:07:24 -04:00
parent 0c439a1643
commit 6d16d6dc0e

View File

@ -1,16 +1,30 @@
# Commands to run at casper boot:
# - Regenerate SSH keys
# - Append /etc/hosts.nilm to /etc/hosts
#
# And the following hacks, which could also run in customize-inner.sh,
# but doing them here ensures that they'll only be present during the
# LiveCD session
# - Append some stuff to /etc/enviroment that's needed for Ubiquity to
# create the initial user properly, when we've already created it.
# - Hack Ubiquity to prevent changing the username, and to set
# a default password
d-i preseed/early_command string \
echo "early_command running" ; \
chroot /root sh -c "rm -f /etc/ssh/ssh_host_*" ; \
chroot /root sh -c "dpkg-reconfigure openssh-server" ; \
chroot /root sh -c "cat /etc/hosts.nilm >> /etc/hosts" ; \
chroot /root sh -c "echo OVERRIDE_SYSTEM_USER=1 >> /etc/environment" ; \
chroot /root sh -c "echo UBIQUITY_AUTOMATIC=1 >> /etc/environment" ; \
cat /root/etc/hosts.nilm >> /root/etc/hosts ; \
echo OVERRIDE_SYSTEM_USER=1 >> /root/etc/environment ; \
sed -i \
-e 's@id="login_encrypt">@id="login_encrypt"><property name="sensitive">False</property>@g' \
-e 's@id="fullname">@id="fullname"><property name="sensitive">False</property>@g' \
-e 's@id="username">@id="username"><property name="sensitive">False</property>@g' \
-e 's@"visibility">False@"visibility">True@g' \
-e 's@id="password">@id="password"><property name="text">nilm</property>@g' \
-e 's@id="verified_password">@id="verified_password"><property name="text">nilm</property>@g' \
/root/usr/share/ubiquity/gtk/stepUserInfo.ui ; \
echo "early_command done"
# chroot /root sh -c "echo UBIQUITY_AUTOMATIC=1 >> /etc/environment"
# Commands to run on successful install:
# (Ubiquity doesn't actually use preseed/late_command, so we do it
@ -27,15 +41,14 @@ ubiquity ubiquity/success_command string \
echo "success_command done" >>/target/var/log/installer/postinst.log
ubiquity ubiquity/use_nonfree boolean true
ubiquity ubiquity/use_nonfree seen false
# Default user. Ubiquity should let them change this.
# (To skip the dialog completely, set the first 4, and put
# UBIQUITY_AUTOMATIC in /etc/environment in early_command above)
d-i passwd/user-fullname string NILM User
d-i passwd/username string nilm
d-i passwd/user-password password nilm
d-i passwd/user-password-again password nilm
#d-i passwd/user-password password nilm
#d-i passwd/user-password-again password nilm
d-i user-setup/allow-password-weak boolean true
d-i user-setup/force-encrypt-home boolean false
d-i user-setup/encrypt-home boolean false