]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
Fix message after {fedora|centos}container creation 773/head
authorNehal J Wani <nehaljw.kkd1@gmail.com>
Thu, 21 Jan 2016 21:06:33 +0000 (02:36 +0530)
committerNehal J Wani <nehaljw.kkd1@gmail.com>
Thu, 28 Jan 2016 20:01:30 +0000 (01:31 +0530)
If the backingstore is not 'dir', then lxc shouldn't ask the user
to change the password by performing a 'chroot'. Rather, the user
should start, attach, use the passwd command, and then stop the
container.

Fixes #731

Signed-off-by: Nehal J Wani <nehaljw.kkd1@gmail.com>
templates/lxc-centos.in
templates/lxc-fedora.in

index 99faf4b0e481509aace72fc9765d58f9704bce85..5bd2f712fdcd60315864b46a51e5022c7bf95506 100644 (file)
@@ -916,7 +916,16 @@ then
 else
     if [ ${root_expire_password} = "yes" ]
     then
-        echo "
+        if ( mountpoint -q -- "${rootfs_path}" )
+        then
+            echo "To reset the root password, you can do:
+
+        lxc-start -n ${name}
+        lxc-attach -n ${name} -- passwd
+        lxc-stop -n ${name}
+"
+        else
+           echo "
 The root password is set up as "expired" and will require it to be changed
 at first login, which you should do as soon as possible.  If you lose the
 root password or wish to change it without starting the container, you
@@ -925,5 +934,6 @@ also reset the expired flag):
 
         chroot ${rootfs_path} passwd
 "
+        fi
     fi
 fi
index 1354d21926bb8adca09aeedf8aff762c1f2cb75e..5a2ce719754cac9f3ca0ead3b6b4267b3fc59240 100644 (file)
@@ -1468,7 +1468,16 @@ then
 else
     if [ ${root_expire_password} = "yes" ]
     then
-        echo "
+        if ( mountpoint -q -- "${rootfs_path}" )
+        then
+            echo "To reset the root password, you can do:
+
+        lxc-start -n ${name}
+        lxc-attach -n ${name} -- passwd
+        lxc-stop -n ${name}
+"
+        else
+           echo "
 The root password is set up as "expired" and will require it to be changed
 at first login, which you should do as soon as possible.  If you lose the
 root password or wish to change it without starting the container, you
@@ -1477,5 +1486,6 @@ also reset the expired flag):
 
         chroot ${rootfs_path} passwd
 "
+        fi
     fi
 fi