Quoting Michael H. Warfield (m...@wittsend.com): > 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.
Will systemd care that the lxc-startup specified in ExecStart and ExecStop doesn't exist? > --- > lxc.spec.in | 8 ++++++++ > src/lxc/lxc-devsetup | 26 ++++++++++++++++++++++++++ > src/lxc/lxc.service | 18 ++++++++++++++++++ > 3 files changed, 52 insertions(+) > create mode 100755 src/lxc/lxc-devsetup > create mode 100644 src/lxc/lxc.service > > diff --git a/lxc.spec.in b/lxc.spec.in > index a6c96a2..3ef5881 100644 > --- a/lxc.spec.in > +++ b/lxc.spec.in > @@ -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 > diff --git a/src/lxc/lxc-devsetup b/src/lxc/lxc-devsetup > new file mode 100755 > index 0000000..583a001 > --- /dev/null > +++ b/src/lxc/lxc-devsetup > @@ -0,0 +1,26 @@ > +#!/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 > + > diff --git a/src/lxc/lxc.service b/src/lxc/lxc.service > new file mode 100644 > index 0000000..d3d3238 > --- /dev/null > +++ b/src/lxc/lxc.service > @@ -0,0 +1,18 @@ > +[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 > + > -- > 1.8.3.1 > > > -- > Michael H. Warfield (AI4NB) | (770) 978-7061 | m...@wittsend.com > /\/\|=mhw=|\/\/ | (678) 463-0932 | http://www.wittsend.com/mhw/ > NIC whois: MHW9 | An optimist believes we live in the best of all > PGP Key: 0x674627FF | possible worlds. A pessimist is sure of it! > > ------------------------------------------------------------------------------ > November Webinars for C, C++, Fortran Developers > Accelerate application performance with scalable programming models. Explore > techniques for threading, error checking, porting, and tuning. Get the most > from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk > _______________________________________________ > Lxc-devel mailing list > Lxc-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/lxc-devel ------------------------------------------------------------------------------ Shape the Mobile Experience: Free Subscription Software experts and developers: Be at the forefront of tech innovation. Intel(R) Software Adrenaline delivers strategic insight and game-changing conversations that shape the rapidly evolving mobile landscape. Sign up now. http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk _______________________________________________ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel