mirror of https://github.com/cutefishos/calamares
commit
6e98f63bf3
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
# Whether to create /etc/machine-id for systemd.
|
||||||
|
systemd: true
|
||||||
|
# Whether to create /var/lib/dbus/machine-id for D-Bus.
|
||||||
|
dbus: true
|
||||||
|
# Whether /var/lib/dbus/machine-id should be a symlink to /etc/machine-id
|
||||||
|
# (ignored if dbus is false, or if there is no /etc/machine-id to point to).
|
||||||
|
symlink: true
|
@ -0,0 +1,43 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# encoding: utf-8
|
||||||
|
# === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
|
#
|
||||||
|
# Copyright 2014, Kevin Kofler <kevin.kofler@chello.at>
|
||||||
|
#
|
||||||
|
# Calamares is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# Calamares is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import libcalamares
|
||||||
|
import os
|
||||||
|
from libcalamares.utils import check_chroot_call
|
||||||
|
|
||||||
|
|
||||||
|
def run():
|
||||||
|
root_mount_point = libcalamares.globalstorage.value("rootMountPoint")
|
||||||
|
enable_systemd = libcalamares.job.configuration["systemd"]
|
||||||
|
enable_dbus = libcalamares.job.configuration["dbus"]
|
||||||
|
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)
|
||||||
|
check_chroot_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_chroot_call(["ln", "-s", "/etc/machine-id", "/var/lib/dbus/machine-id"])
|
||||||
|
else:
|
||||||
|
check_chroot_call(["dbus-uuidgen", "--ensure"])
|
||||||
|
return None
|
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
type: "job"
|
||||||
|
name: "machineid"
|
||||||
|
interface: "python"
|
||||||
|
script: "main.py"
|
Loading…
Reference in New Issue