From 23789675c819803fa966a9f39cb21e64a0785846 Mon Sep 17 00:00:00 2001 From: Philip Date: Thu, 28 Jul 2016 01:27:41 +0200 Subject: [PATCH] [machineid] cleanup first - to garantie a random new ID also dbus machine-id needs to be removed --- src/modules/machineid/main.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/modules/machineid/main.py b/src/modules/machineid/main.py index 36b4833fc..325bac0ad 100644 --- a/src/modules/machineid/main.py +++ b/src/modules/machineid/main.py @@ -4,6 +4,7 @@ # === This file is part of Calamares - === # # Copyright 2014, Kevin Kofler +# Copyright 2015, Philip Müller # # Calamares is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -34,18 +35,18 @@ def run(): enable_symlink = libcalamares.job.configuration["symlink"] target_systemd_machineid_file = "{}/etc/machine-id".format(root_mount_point) - if enable_systemd: - if os.path.exists(target_systemd_machineid_file): - os.remove(target_systemd_machineid_file) + if os.path.exists(target_systemd_machineid_file): + os.remove(target_systemd_machineid_file) + if os.path.exists(target_dbus_machineid_file): + os.remove(target_dbus_machineid_file) + + if enable_systemd: check_target_env_call("systemd-machine-id-setup") if enable_dbus: target_dbus_machineid_file = "{}/var/lib/dbus/machine-id".format(root_mount_point) - if os.path.exists(target_dbus_machineid_file): - os.remove(target_dbus_machineid_file) - if enable_symlink and os.path.exists(target_systemd_machineid_file): check_target_env_call(["ln", "-s", "/etc/machine-id", "/var/lib/dbus/machine-id"]) else: