Browse Source

Fix UUID related issues with casper boot

tags/nilmbuntu-6
Jim Paris 3 years ago
parent
commit
bbb4a2201d
6 changed files with 32 additions and 29 deletions
  1. +2
    -7
      customize.sh
  2. +3
    -0
      enter.sh
  3. +18
    -0
      files/casper.conf
  4. +7
    -21
      files/customize-inner.sh
  5. +2
    -0
      files/hosts.nilm
  6. +0
    -1
      run.sh

+ 2
- 7
customize.sh View File

@@ -27,7 +27,7 @@ perl -n -i \
-e "s/ quiet splash//g;" \
-e "print;" \
${ISO}/isolinux/txt.cfg
perl -n -i -e "s/menu margin .*/menu margin 2/" ${ISO}/isolinux/menu.cfg
sed -i -s -e "s/^menu margin .*/menu margin 2/g;" ${ISO}/isolinux/menu.cfg
sed -i -s -e "s/^ui gfxboot/# ui gfxboot/g;" ${ISO}/isolinux/isolinux.cfg

# Set up grub similarly
@@ -41,14 +41,9 @@ perl -n -i \
-e "print;" \
${ISO}/boot/grub/{grub,loopback}.cfg

sudo cp files/nilmbuntu.png ${FS}/usr/share/xfce4/backdrops/nilmbuntu.png
sudo cp files/customize-inner.sh ${FS}/root/customize-inner.sh
sudo install -D -m 0644 files/fallback_dns.conf ${FS}/etc/systemd/resolved.conf.d/fallback_dns.conf
sudo chmod +x ${FS}/root/customize-inner.sh

if ! [ "$1" == "skip" ] ; then

# Run the customize-inner.sh script inside the chroot
./enter.sh "cd /root ; ./customize-inner.sh"
./enter.sh "cd /root ; files/customize-inner.sh"

fi

+ 3
- 0
enter.sh View File

@@ -99,6 +99,8 @@ run() {

set -e

rsync -avP --delete files/ ${FS}/root/files/

setup_networking
start_container

@@ -125,6 +127,7 @@ run "rm -f /var/lib/systemd/random-seed"
run "rm -f /var/lib/ubuntu-drivers-common/last_gfx_boot"
run "rm -f /var/lib/NetworkManager/*"
run "rm -f /root/.bash_history"
run "rm -rf /root/files"

kill_container



+ 18
- 0
files/casper.conf View File

@@ -0,0 +1,18 @@
export USERNAME="nilm"
export USERFULLNAME="NILM User"
export HOST="nilmbuntu"
export BUILD_SYSTEM="Ubuntu"
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

# The ISO has a UUID stored in /.disk/casper-uuid-generic, which
# won't match the new UUID that update-initramfs put in /conf/uuid.conf,
# so it won't find the live media at casper boot.
# Easiest way to avoid this is to set a blank UUID, so that the
# UUID checks are skipped.
export UUID=""

+ 7
- 21
files/customize-inner.sh View File

@@ -8,27 +8,13 @@ fi
set -e
set -x

# Set up live username and hostname
cat >/etc/casper.conf <<"EOF"
export USERNAME="nilm"
export USERFULLNAME="NILM User"
export HOST="nilmbuntu"
export BUILD_SYSTEM="Ubuntu"
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
# Move stuff to the right places
install -D -m 0644 files/nilmbuntu.png /usr/share/xfce4/backdrops/nilmbuntu.png
install -D -m 0644 files/fallback_dns.conf /etc/systemd/resolved.conf.d/fallback_dns.conf
install -D -m 0644 files/casper.conf /etc/casper.conf
install -D -m 0644 files/hosts.nilm /etc/hosts.nilm

# Set up NILM-specific stuff to get added to /etc/hosts after installation
cat >/etc/hosts.nilm <<"EOF"
127.0.2.1 nilm.primary
127.0.2.2 nilm.secondary
EOF
# And copy it for now (although it will get overwritten at boot)
# Copy hosts for now (although it will get overwritten at boot)
cat /etc/hosts.nilm >> /etc/hosts

# Upgrade packages
@@ -170,7 +156,7 @@ fi
# Manipulate some config files to avoid host stuff leaking through.
echo 'RESUME=none' > /etc/initramfs-tools/conf.d/resume
mv /etc/crypttab /etc/crypttab-old
update-initramfs -u
CASPER_GENERATE_UUID=1 update-initramfs -u
rm /etc/initramfs-tools/conf.d/resume
mv /etc/crypttab-old /etc/crypttab


+ 2
- 0
files/hosts.nilm View File

@@ -0,0 +1,2 @@
127.0.2.1 nilm.primary
127.0.2.2 nilm.secondary

+ 0
- 1
run.sh View File

@@ -47,7 +47,6 @@ set -x

cfg=""

cfg+=" -nodefaults"
cfg+=" -drive file=${DISK},media=disk,format=raw,if=virtio"
cfg+=" -enable-kvm"
cfg+=" -m 2048"


Loading…
Cancel
Save