Linux Container Development
 help / color / mirror / Atom feed
From: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: Daniel Lezcano <daniel.lezcano-GANU6spQydw@public.gmane.org>
Cc: Containers
	<containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>
Subject: [PATCH] liblxc: lxc-debian expects missing directories
Date: Thu, 05 Feb 2009 01:05:17 -0800	[thread overview]
Message-ID: <1233824717.28338.8.camel@localhost> (raw)

lxc-debian fails unless the directories a given rootfs needs already
exist. To fix this without relying on any particular function call order
we can do: mkdir -p `dirname PATH/TO/FILE`
before actually making the file.

Signed-off-by: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
---
 scripts/lxc-debian.in |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Index: lxc/scripts/lxc-debian.in
===================================================================
--- lxc.orig/scripts/lxc-debian.in
+++ lxc/scripts/lxc-debian.in
@@ -24,13 +24,14 @@ SSHD_CONFIG="/etc/ssh/sshd_config"
 # custom selinux
 
 write_debian_selinux() {
-    mkdir $ROOTFS/selinux
+    mkdir -p $ROOTFS/selinux
     echo 0 > $ROOTFS/selinux/enforce
 }
 
 # custom fstab
 
 write_debian_fstab() {
+mkdir -p `dirname $ROOTFS/$FSTAB`
 cat <<EOF > $ROOTFS/$FSTAB
 tmpfs  /dev/shm   tmpfs  defaults  0 0
 EOF
@@ -39,6 +40,7 @@ EOF
 # custom inittab
 
 write_debian_inittab() {
+mkdir -p `dirname $ROOTFS/$INITTAB`
 cat <<EOF > $ROOTFS/$INITTAB
 id:3:initdefault:
 si::sysinit:/etc/init.d/rcS
@@ -62,6 +64,7 @@ EOF
 # custom network configuration
 
 write_debian_network() {
+mkdir -p `dirname $ROOTFS/$INTERFACES`
 cat <<EOF > $ROOTFS/$INTERFACES
 auto eth0 lo
 iface eth0 inet static
@@ -76,6 +79,7 @@ EOF
 # custom hostname
 
 write_debian_hostname() {
+mkdir -p `dirname $ROOTFS/$HOSTNAME`
 cat <<EOF > $ROOTFS/$HOSTNAME
 $UTSNAME
 EOF
@@ -84,6 +88,7 @@ EOF
 # custom sshd configuration file
 
 write_debian_sshd_config() {
+mkdir -p `dirname $ROOTFS/$SSHD_CONFIG`
 cat <<EOF > $ROOTFS/$SSHD_CONFIG
 Port 22
 Protocol 2

             reply	other threads:[~2009-02-05  9:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-05  9:05 Matt Helsley [this message]
2009-02-05  9:20 ` [PATCH] liblxc: lxc-debian expects missing directories Daniel Lezcano
     [not found]   ` <498AAF77.20906-GANU6spQydw@public.gmane.org>
2009-02-05  9:29     ` Matt Helsley
2009-02-05  9:59       ` Matt Helsley
2009-02-05 10:21         ` Daniel Lezcano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1233824717.28338.8.camel@localhost \
    --to=matthltc-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=daniel.lezcano-GANU6spQydw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox