]> git.pld-linux.org Git - packages/lxc.git/blobdiff - lxc-pld.in.sh
typo fix
[packages/lxc.git] / lxc-pld.in.sh
index 30236c11bd79b5003104c0066b22f76c7d5a0a2c..ca4a6de013c19decfd423a2eec8290e5a18a23ec 100755 (executable)
@@ -61,7 +61,7 @@ configure_pld()
        echo 0 > $rootfs_path/selinux/enforce
 
        # configure the network using the dhcp
-       sed -i -e "/^HOSTNAME=.*/HOSTNAME=${utsname}/" ${rootfs_path}/etc/sysconfig/network
+       sed -i -e "s/^HOSTNAME=.*/HOSTNAME=${utsname}/" ${rootfs_path}/etc/sysconfig/network
 
        # set hostname on systemd
        if [ $release = "3.0" ]; then
@@ -103,9 +103,8 @@ EOF
 
 configure_pld_init()
 {
-       # Setup getty service on the 4 ttys we are going to allow in the
-       # default config. Number should match lxc.tty
-#      sed -i -e 's///' ${rootfs_path}/etc/inittab
+       # default powerfail action waits 2 minutes. for lxc we want it immediately
+       sed -i -e '/^pf::powerfail:/ s,/sbin/shutdown.*,/sbin/halt,' ${rootfs_path}/etc/inittab
 }
 
 configure_pld_systemd()
@@ -170,7 +169,7 @@ copy_pld()
 
        # make a local copy of the minipld
        echo -n "Copying rootfs to $rootfs_path ..."
-       cp -a $cache/rootfs/ $rootfs_path || return 1
+       cp -a $cache/rootfs/* $rootfs_path || return 1
        return 0
 }
 
@@ -184,7 +183,7 @@ install_pld()
 {
        mkdir -p @LOCALSTATEDIR@/lock/subsys/
        (
-               flock -x 200
+               flock -x 9
                if [ $? -ne 0 ]; then
                        echo "Cache repository is busy."
                        return 1
@@ -215,7 +214,7 @@ install_pld()
                fi
 
                return 0
-       ) 200>@LOCALSTATEDIR@/lock/subsys/lxc-pld
+       ) 9>@LOCALSTATEDIR@/lock/subsys/lxc-pld
 
        return $?
 }
@@ -226,9 +225,12 @@ copy_configuration()
        mkdir -p $config_path
        grep -q "^lxc.rootfs" $config_path/config 2>/dev/null || echo "lxc.rootfs = $rootfs_path" >> $config_path/config
        cat <<EOF >> $config_path/config
+# Most of below settings should be taken as defaults  from
+# lxc.include = /usr/share/lxc/config/common.conf
 lxc.utsname = $utsname
 lxc.tty = 4
 lxc.pts = 1024
+# Consider if below line is right for systemd container
 lxc.mount = $config_path/fstab
 lxc.cap.drop = sys_module mac_admin mac_override sys_time
 
@@ -284,7 +286,7 @@ clean()
 
        # lock, so we won't purge while someone is creating a repository
        (
-               flock -x 200
+               flock -x 9
                if [ $? != 0 ]; then
                        echo "Cache repository is busy."
                        exit 1
@@ -293,7 +295,7 @@ clean()
                echo -n "Purging the download cache for PLD Linux $release..."
                rm --preserve-root --one-file-system -rf $cache && echo "Done." || exit 1
                exit 0
-       ) 200>@LOCALSTATEDIR@/lock/subsys/lxc-pld
+       ) 9>@LOCALSTATEDIR@/lock/subsys/lxc-pld
 }
 
 usage()
@@ -408,12 +410,15 @@ if [ "$(id -u)" != "0" ]; then
        exit 1
 fi
 
-if [ -z "$rootfs_path" ]; then
-       rootfs_path=$path/rootfs
-       # check for 'lxc.rootfs' passed in through default config by lxc-create
-       if grep -q '^lxc.rootfs' $path/config 2>/dev/null ; then
-               rootfs_path=$(awk -F= '/^lxc.rootfs =/{ print $2 }' $path/config)
-       fi
+if [ -z "$rootfs" ]; then
+    rootfs_path=$path/rootfs
+    # check for 'lxc.rootfs' passed in through default config by lxc-create
+    # TODO: should be lxc.rootfs.mount used instead?
+    if grep -q '^lxc.rootfs' $path/config 2>/dev/null ; then
+            rootfs_path=$(awk -F= '/^lxc.rootfs =/{ print $2 }' $path/config)
+    fi
+else
+    rootfs_path=$rootfs
 fi
 config_path=$default_path/$name
 cache=$cache_base/$release
This page took 0.117626 seconds and 4 git commands to generate.