Skip to content

Commit

Permalink
truncate machine-id instead of removing
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Lange committed Sep 12, 2017
1 parent 837aff7 commit 740403a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion examples/simple/basefiles/mk-basefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,10 @@ EOM
cleanup-deb() {

chroot $xtmp apt-get clean
rm -f $xtmp/etc/hostname $xtmp/etc/resolv.conf $xtmp/etc/machine-id \
rm -f $xtmp/etc/hostname $xtmp/etc/resolv.conf \
$xtmp/var/lib/apt/lists/*_* $xtmp/usr/bin/qemu-*-static \
$xtmp/etc/udev/rules.d/70-persistent-net.rules
> $xtmp/etc/machine-id
}


Expand Down
3 changes: 1 addition & 2 deletions examples/simple/scripts/CLOUD/99-cleanup
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ rm -f $target/etc/resolv.conf \
$target/etc/udev/rules.d/70-persistent-net.rules \
$target/lib/udev/write_net_rules \
$target/etc/mailname \
$target/etc/machine-id \
$target/var/lib/dbus/machine-id

touch $target/etc/machine-id
> $target/etc/machine-id

shred --remove $target/etc/ssh/ssh_host_*

Expand Down
3 changes: 2 additions & 1 deletion examples/simple/scripts/DEBIAN/40-misc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ elif [ -f $target/lib/systemd/system/getty@.service ]; then
sed -i -e 's#sbin/agetty --noclear#sbin/agetty -f /etc/issue.linuxlogo --noclear#' $target/lib/systemd/system/getty@.service
fi

if [ ! -f $target/etc/machine-id -a -f $target/bin/systemd-machine-id-setup ]; then
# recreate machine-id if the file is empty
if [ X"$(stat -c '%s' $target/etc/machine-id 2>/dev/null)" = X0 -a -f /bin/systemd-machine-id-setup ]; then
$ROOTCMD systemd-machine-id-setup
fi

Expand Down

0 comments on commit 740403a

Please sign in to comment.