Add --with-dracut
This installs a Dracut module which parses the ostree= kernel command line argument, and if given, sets up the OS/ at /sysroot, which systemd's switch-root then moves into. This only works if dracut is configured to use systemd itself.
This commit is contained in:
parent
35df7a7eb4
commit
6496abacbd
|
|
@ -0,0 +1,30 @@
|
||||||
|
# Makefile for dracut module
|
||||||
|
#
|
||||||
|
# Copyright (C) 2013 Colin Walters <walters@verbum.org>
|
||||||
|
#
|
||||||
|
# This library is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU Lesser General Public
|
||||||
|
# License as published by the Free Software Foundation; either
|
||||||
|
# version 2 of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This library 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
|
||||||
|
# Lesser General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Lesser General Public
|
||||||
|
# License along with this library; if not, write to the
|
||||||
|
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
# Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
if BUILDOPT_DRACUT
|
||||||
|
# Not using $(libdir) here is intentional, dracut modules go in prefix/lib
|
||||||
|
dracutmoddir = $(prefix)/lib/dracut/modules.d/98ostree
|
||||||
|
dracutmod_SCRIPTS = src/dracut/module-setup.sh
|
||||||
|
dracutmod_DATA = src/dracut/ostree-prepare-root.service
|
||||||
|
|
||||||
|
dracutconfdir = $(sysconfdir)/dracut.conf.d
|
||||||
|
dracutconf_DATA = src/dracut/ostree.conf
|
||||||
|
endif
|
||||||
|
|
||||||
|
EXTRA_DIST += $(dracutmod_DATA) $(dracutmod_SCRIPTS)
|
||||||
|
|
@ -86,6 +86,7 @@ include Makefile-ostree.am
|
||||||
include Makefile-switchroot.am
|
include Makefile-switchroot.am
|
||||||
include Makefile-triggers.am
|
include Makefile-triggers.am
|
||||||
include Makefile-tests.am
|
include Makefile-tests.am
|
||||||
|
include Makefile-dracut.am
|
||||||
|
|
||||||
|
|
||||||
# Docbook generation copied from systemd/Makefile.am
|
# Docbook generation copied from systemd/Makefile.am
|
||||||
|
|
|
||||||
|
|
@ -146,6 +146,12 @@ AC_ARG_ENABLE(grub2-hook,
|
||||||
enable_grub2_hook=${grub2_hook_default})
|
enable_grub2_hook=${grub2_hook_default})
|
||||||
AM_CONDITIONAL(ENABLE_GRUB2_HOOK, test $enable_grub2_hook != no)
|
AM_CONDITIONAL(ENABLE_GRUB2_HOOK, test $enable_grub2_hook != no)
|
||||||
|
|
||||||
|
AC_ARG_WITH(dracut,
|
||||||
|
AS_HELP_STRING([--with-dracut],
|
||||||
|
[Install dracut module (default: no)]),,
|
||||||
|
[with_dracut=no])
|
||||||
|
AM_CONDITIONAL(BUILDOPT_DRACUT, test x$with_dracut = xyes)
|
||||||
|
|
||||||
AC_CONFIG_FILES([
|
AC_CONFIG_FILES([
|
||||||
Makefile
|
Makefile
|
||||||
embedded-dependencies/Makefile
|
embedded-dependencies/Makefile
|
||||||
|
|
@ -164,4 +170,5 @@ echo "
|
||||||
documentation: $enable_documentation
|
documentation: $enable_documentation
|
||||||
kernel updates integration: $enable_kernel_updates
|
kernel updates integration: $enable_kernel_updates
|
||||||
GRUB2 hook: $enable_grub2_hook
|
GRUB2 hook: $enable_grub2_hook
|
||||||
|
dracut: $with_dracut
|
||||||
"
|
"
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||||
|
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||||
|
#
|
||||||
|
# Copyright (C) 2013 Colin Walters <walters@verbum.org>
|
||||||
|
#
|
||||||
|
# This library is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU Lesser General Public
|
||||||
|
# License as published by the Free Software Foundation; either
|
||||||
|
# version 2 of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This library 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
|
||||||
|
# Lesser General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Lesser General Public
|
||||||
|
# License along with this library; if not, write to the
|
||||||
|
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
# Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
check() {
|
||||||
|
if [[ -x $systemdutildir/systemd ]] && [[ -x /usr/sbin/ostree-prepare-root ]]; then
|
||||||
|
return 255
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
depends() {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
install() {
|
||||||
|
dracut_install ostree-prepare-root
|
||||||
|
inst_simple "$moddir/ostree-prepare-root.service" "${systemdsystemunitdir}/ostree-prepare-root.service"
|
||||||
|
mkdir -p "${initdir}${systemdsystemconfdir}/initrd-switch-root.target.wants"
|
||||||
|
ln_r "${systemdsystemunitdir}/ostree-prepare-root.service" \
|
||||||
|
"${systemdsystemconfdir}/initrd-switch-root.target.wants/ostree-prepare-root.service"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
# Copyright (C) 2013 Colin Walters <walters@verbum.org>
|
||||||
|
#
|
||||||
|
# This library is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU Lesser General Public
|
||||||
|
# License as published by the Free Software Foundation; either
|
||||||
|
# version 2 of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This library 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
|
||||||
|
# Lesser General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Lesser General Public
|
||||||
|
# License along with this library; if not, write to the
|
||||||
|
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
# Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
[Unit]
|
||||||
|
Description=OSTree Prepare OS/
|
||||||
|
DefaultDependencies=no
|
||||||
|
ConditionKernelCommandLine=ostree
|
||||||
|
ConditionPathExists=/etc/initrd-release
|
||||||
|
OnFailure=emergency.service
|
||||||
|
After=initrd-switch-root.target
|
||||||
|
Before=initrd-switch-root.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=/usr/sbin/ostree-prepare-root /sysroot
|
||||||
|
StandardInput=null
|
||||||
|
StandardOutput=syslog
|
||||||
|
StandardError=syslog+console
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Copyright (C) 2013 Colin Walters <walters@verbum.org>
|
||||||
|
#
|
||||||
|
# This library is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU Lesser General Public
|
||||||
|
# License as published by the Free Software Foundation; either
|
||||||
|
# version 2 of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This library 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
|
||||||
|
# Lesser General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Lesser General Public
|
||||||
|
# License along with this library; if not, write to the
|
||||||
|
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
# Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
add_dracutmodules+="ostree"
|
||||||
Loading…
Reference in New Issue