Added a file "lxc.service" for a systemd service file.
Added a file "lxc-devsetup" to setup /dev/ on startup to support autodev
in containers.
Service file references lxc-devsetup as an ExecStartPre command. The
lxc-devsetup script is not dependent on systemd or Fedora and can
be used at bootup on any system.
Modified lxc.spec.in to install the two new files on Fedora. The systemd
specific code in the lxc.spec file may need some review and conditionalize
for systemd on non-systemd rpm-based systems.
Signed-off-by: Michael H. Warfield <mhw@WittsEnd.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
make install DESTDIR=%{buildroot}
find %{buildroot} -type f -name '*.la' -exec rm -f {} ';'
+# Install some of our systemd stuff...
+install -d -m 755 %{buildroot}/lib/systemd/system
+install -c -m 644 src/lxc/lxc.service %{buildroot}/lib/systemd/system
+install -c -m 755 src/lxc/lxc-devsetup %{buildroot}/%{_libexecdir}/%{name}
+
%clean
rm -rf %{buildroot}
%{_datadir}/lxc/*
%config(noreplace) %{_sysconfdir}/lxc/*
+/lib/systemd/system/*
+
%files libs
%defattr(-,root,root)
%{_libdir}/*.so.*
%endif
%{_localstatedir}/*
%attr(4555,root,root) %{_libexecdir}/%{name}/lxc-init
+%attr(555,root,root) %{_libexecdir}/%{name}/lxc-devsetup
%if %{with_lua}
%files lua
--- /dev/null
+#!/bin/sh -
+
+# lxc.devsetup - Setup host /dev for container /dev subdirectories.
+
+if [[ ! -d /dev/.lxc ]]
+then
+ echo "Creating /dev/.lxc"
+ mkdir /dev/.lxc
+ chmod 755 /dev/.lxc
+fi
+
+if grep -q "/dev devtmpfs " /proc/self/mounts
+then
+ echo "/dev is devtmpfs"
+else
+ echo "/dev is not devtmpfs - mounting tmpfs on .lxc"
+ mount -t tmpfs tmpfs /dev/.lxc
+fi
+
+if [[ ! -d /dev/.lxc/user ]]
+then
+ echo "Creating /dev/.lxc/user"
+ mkdir /dev/.lxc/user
+ chmod 1777 /dev/.lxc/user
+fi
--- /dev/null
+[Unit]
+Description=LXC Container Initialization and Autoboot Code
+After=syslog.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStartPre=/usr/libexec/lxc/lxc-devsetup
+ExecStart=/usr/libexec/lxc/lxc-startup start
+ExecStop=/usr/libexec/lxc/lxc-startup stop
+# Environment=BOOTUP=serial
+# Environment=CONSOLETYPE=serial
+StandardOutput=syslog
+StandardError=syslog
+
+[Install]
+WantedBy=multi-user.target