Commit 87ff951e by Michael H. Warfield Committed by Serge Hallyn

Support files for systemd on Fedora.

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: 's avatarMichael H. Warfield <mhw@WittsEnd.com> Signed-off-by: 's avatarSerge Hallyn <serge.hallyn@ubuntu.com>
parent 24ef39f4
......@@ -102,6 +102,11 @@ rm -rf %{buildroot}
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}
......@@ -131,6 +136,8 @@ rm -rf %{buildroot}
%{_datadir}/lxc/*
%config(noreplace) %{_sysconfdir}/lxc/*
/lib/systemd/system/*
%files libs
%defattr(-,root,root)
%{_libdir}/*.so.*
......@@ -140,6 +147,7 @@ rm -rf %{buildroot}
%endif
%{_localstatedir}/*
%attr(4555,root,root) %{_libexecdir}/%{name}/lxc-init
%attr(555,root,root) %{_libexecdir}/%{name}/lxc-devsetup
%if %{with_lua}
%files lua
......
#!/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
[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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment