make sure scp does not get an additional parameter as last argument
[schsh.git] / makeschsh
index 0dbb0aab2edc77427cb3362512317ce954722287..dc31830eedf68f1de5d8277281e4f6435965c64b 100755 (executable)
--- a/makeschsh
+++ b/makeschsh
@@ -23,22 +23,23 @@ def setup(name):
        userpw = pwd.getpwnam(name)
        
        # schroot configuration
-       with open("/etc/schroot/chroot.d/user-"+name, "w") as f:
-               print >>f, """[user-{0}]
+       with open("/etc/schroot/chroot.d/schsh-"+name, "w") as f:
+               print >>f, """[schsh-{0}]
 type=directory
 directory={1}
 users={0}
-profile=user
-setup.fstab=user/user-{0}.fstab
+profile=schsh
+setup.fstab=schsh/{0}.fstab
 """.format(name, chroot)
-       with open("/etc/schroot/user/user-"+name+".fstab", "w") as f:
-               print >>f, """# <file system> <mount point>   <type>  <options>       <dump>  <pass>
-/bin          \t/bin          \tnone  \trw,bind       \t0     \t0
-/lib          \t/lib          \tnone  \trw,bind       \t0     \t0
-/usr/bin      \t/usr/bin      \tnone  \trw,bind       \t0     \t0
-/usr/lib      \t/usr/lib      \tnone  \trw,bind       \t0     \t0
-/home/{0}/data\t/data         \tnone  \trw,bind       \t0     \t0
-""".replace(' ', '').format(name) # need to remove spaces so schroot does not complain
+       with open("/etc/schroot/schsh/"+name+".fstab", "w") as f:
+               # no spaces, schroot does not like them
+               print >>f, "# <file system> <mount point>   <type>  <options>       <dump>  <pass>"
+               # system folders
+               for folder in ("/bin", "/lib", "/lib64", "/usr/bin", "/usr/lib", "/usr/lib64"):
+                       if os.path.exists(folder):
+                               print >>f, "{0}\t{0}\tnone\trw,bind\t0\t0".format(folder)
+               # user folder
+               print >>f, "/home/{0}/data\t/data\tnone\trw,bind\t0\t0".format(name)
        
        # setup the schroot directory
        os.mkdir(chroot)