It takes some finagling to get this to work everywhere, but this seems to do the trick. Note that this means we need to set UBIQUITY_AUTOMATIC=1, which has some other side effects, but nothing too bad (mostly related to not being able to go backwards in the ubiquity installer).tags/nilmbuntu-5
@@ -10,11 +10,17 @@ set -x | |||||
# Set up live username and hostname | # Set up live username and hostname | ||||
cat >/etc/casper.conf <<"EOF" | cat >/etc/casper.conf <<"EOF" | ||||
export USERNAME="ubuntu" | |||||
export USERFULLNAME="Live session user" | |||||
export USERNAME="nilm" | |||||
export USERFULLNAME="NILM User" | |||||
export HOST="nilmbuntu" | export HOST="nilmbuntu" | ||||
export BUILD_SYSTEM="Ubuntu" | export BUILD_SYSTEM="Ubuntu" | ||||
export FLAVOUR="NILMbuntu" | export FLAVOUR="NILMbuntu" | ||||
# Do the inital user setup even though UID 1000 already exists. | |||||
# This also needs to be set in /etc/environment, for ubiquity, | |||||
# but we do that in preseed/early_command so that it only shows | |||||
# up in the LiveCD image. | |||||
export OVERRIDE_SYSTEM_USER=true | |||||
EOF | EOF | ||||
# Set up NILM-specific stuff to get added to /etc/hosts after installation | # Set up NILM-specific stuff to get added to /etc/hosts after installation | ||||
@@ -293,32 +299,13 @@ EOF | |||||
# sudo -i -u nilmdb git clone $GIT/$repo.git git/$repo | # sudo -i -u nilmdb git clone $GIT/$repo.git git/$repo | ||||
# done | # done | ||||
# # build as root, because we need to do that for the install | |||||
# for repo in $REPOS; do | |||||
# make -C /home/nilmdb/git/$repo install | |||||
# done | |||||
# Create NILM user. This should happen after anything that we put in | |||||
# /etc/skel, since files get copied from there. Note that this user | |||||
# is the same as what we have in the preseed file and casper.conf | |||||
adduser --gecos "NILM User" --disabled-password nilm | |||||
# # fix up all permissions in git dir, so nilmdb user can play with it later | # # fix up all permissions in git dir, so nilmdb user can play with it later | ||||
# chown -R nilmdb:nilmdb /home/nilmdb/git | # chown -R nilmdb:nilmdb /home/nilmdb/git | ||||
# # Create the initial database and streams by running the standalone | |||||
# # server as nilmdb, making the right nilmtool calls, and killing it. | |||||
# sudo -i -u nilmdb nilmdb-server -a 127.0.0.1 -p 18646 -d /home/nilmdb/db & | |||||
# SERVERPID=$! | |||||
# trap "kill -9 $SERVERPID" 0 | |||||
# for i in $(seq 1 120) ; do | |||||
# sleep 1 | |||||
# echo waiting for nilmdb to start $i | |||||
# if nilmtool -u http://127.0.0.1:18646/ info ; then | |||||
# break | |||||
# fi | |||||
# done | |||||
# nilmtool -u http://127.0.0.1:18646/ destroy -R "/data/*" || true | |||||
# nilmtool -u http://127.0.0.1:18646/ create /data/raw uint16_6 | |||||
# nilmtool -u http://127.0.0.1:18646/ create /data/sinefit float32_3 | |||||
# nilmtool -u http://127.0.0.1:18646/ create /data/prep-a float32_8 | |||||
# nilmtool -u http://127.0.0.1:18646/ create /data/prep-b float32_8 | |||||
# nilmtool -u http://127.0.0.1:18646/ create /data/prep-c float32_8 | |||||
# kill $SERVERPID | |||||
# wait | |||||
# trap "" 0 | |||||
# Make sure initramfs was regenerated with casper changes | |||||
update-initramfs |
@@ -1,11 +1,15 @@ | |||||
# Commands to run at casper boot: | # Commands to run at casper boot: | ||||
# - Regenerate SSH keys | # - Regenerate SSH keys | ||||
# - Append /etc/hosts.nilm to /etc/hosts | # - Append /etc/hosts.nilm to /etc/hosts | ||||
# - Append some stuff to /etc/enviroment that's needed for Ubiquity to | |||||
# create the initial user properly, when we've already created it. | |||||
d-i preseed/early_command string \ | d-i preseed/early_command string \ | ||||
echo "early_command running" ; \ | echo "early_command running" ; \ | ||||
chroot /root sh -c "rm -f /etc/ssh/ssh_host_*" ; \ | chroot /root sh -c "rm -f /etc/ssh/ssh_host_*" ; \ | ||||
chroot /root sh -c "dpkg-reconfigure openssh-server" ; \ | chroot /root sh -c "dpkg-reconfigure openssh-server" ; \ | ||||
chroot /root sh -c "cat /etc/hosts.nilm >> /etc/hosts" ; \ | 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" ; \ | |||||
echo "early_command done" | echo "early_command done" | ||||
# Commands to run on successful install: | # Commands to run on successful install: | ||||
@@ -22,11 +26,17 @@ ubiquity ubiquity/success_command string \ | |||||
umount /target/dev ; \ | umount /target/dev ; \ | ||||
echo "success_command done" >>/target/var/log/installer/postinst.log | 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. | # Default user. Ubiquity should let them change this. | ||||
# (To skip the dialog completely, maybe set a password?) | |||||
# (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/user-fullname string NILM User | ||||
d-i passwd/username string nilm | 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/allow-password-weak boolean true | ||||
d-i user-setup/force-encrypt-home boolean false | |||||
d-i user-setup/encrypt-home boolean false | |||||
d-i passwd/auto-login boolean true | d-i passwd/auto-login boolean true |