]> git.proxmox.com Git - mirror_lxc.git/blobdiff - templates/lxc-oracle.in
Merge pull request #2055 from marcosps/cgfsng_debug
[mirror_lxc.git] / templates / lxc-oracle.in
index 00af55d9a5eaab1147ab04829384c6d4675dac2f..afb690210903537651eb5da2769fb25ecc0ce207 100644 (file)
@@ -145,29 +145,30 @@ EOF
 
     # OL7 has systemd, no rc.sysinit
     if [ $container_release_major = "7" ]; then
-        # from mhw in the fedora template: We do need to disable the
-        # "ConditionalPathExists=/dev/tty0" line or no gettys are started on
-        # the ttys in the container. Lets do it in an override copy of the
-        # service so it can still pass rpm verifies and not be automatically
-        # updated by a new systemd version.
-        sed -e 's/^ConditionPathExists=/#LXC ConditionPathExists=/' \
-            < $container_rootfs/usr/lib/systemd/system/getty\@.service \
-            > $container_rootfs/etc/systemd/system/getty\@.service
-        # Setup getty service on the 4 ttys we are going to allow in the
-        # default config.  Number should match lxc.tty
-        ( cd $container_rootfs/etc/systemd/system/getty.target.wants
-            for i in 1 2 3 4 ; do ln -sf ../getty\@.service getty@tty${i}.service; done )
-        # We only want to spawn a getty on /dev/console in lxc, libvirt-lxc
-        # symlinks /dev/console to /dev/tty1
-        sed -i '/Before=getty.target/a ConditionVirtualization=lxc' $container_rootfs/usr/lib/systemd/system/console-getty.service
+        # with newer systemd (OL7.2), getty service include container-getty.service
+        # let that be the one who manage the getty service instead
+        if [ ! -f $container_rootfs/usr/lib/systemd/system/container-getty@.service ]; then
+               # from mhw in the fedora template: We do need to disable the
+               # "ConditionalPathExists=/dev/tty0" line or no gettys are started on
+               # the ttys in the container. Lets do it in an override copy of the
+               # service so it can still pass rpm verifies and not be automatically
+               # updated by a new systemd version.
+               sed -e 's/^ConditionPathExists=/#LXC ConditionPathExists=/' \
+                       < $container_rootfs/usr/lib/systemd/system/getty\@.service \
+                       > $container_rootfs/etc/systemd/system/getty\@.service
+               # Setup getty service on the 4 ttys we are going to allow in the
+               # default config.  Number should match lxc.tty
+               ( cd $container_rootfs/etc/systemd/system/getty.target.wants
+                       for i in 1 2 3 4 ; do ln -sf ../getty\@.service getty@tty${i}.service; done )
+               # We only want to spawn a getty on /dev/console in lxc, libvirt-lxc
+               # symlinks /dev/console to /dev/tty1
+               sed -i '/Before=getty.target/a ConditionVirtualization=lxc' $container_rootfs/usr/lib/systemd/system/console-getty.service
+        fi
 
         # disable some systemd services, set default boot, sigpwr target
         rm -f $container_rootfs/usr/lib/systemd/system/sysinit.target.wants/kmod-static-nodes.service
         chroot $container_rootfs systemctl -q disable graphical.target
         chroot $container_rootfs systemctl -q enable multi-user.target
-        if [ ! -e $container_rootfs/etc/systemd/system/sigpwr.target ]; then
-            chroot $container_rootfs ln -s /usr/lib/systemd/system/halt.target /etc/systemd/system/sigpwr.target
-        fi
 
         # systemd in userns won't be able to set /proc/self/oom_score_adj which
         # prevents the dbus service from starting
@@ -358,7 +359,7 @@ EOF
     # /dev/tty[1-4] will be symlinks to the ptys /dev/lxc/console and
     # /dev/lxc/tty[1-4] so that package updates can overwrite the symlinks.
     # lxc will maintain these links and bind mount ptys over /dev/lxc/*
-    # since lxc.devttydir is specified in the config.
+    # since lxc.tty.dir is specified in the config.
 
     # allow root login on console, tty[1-4], and pts/0 for libvirt
     echo "# LXC (Linux Containers)" >>$container_rootfs/etc/securetty
@@ -461,12 +462,10 @@ EOF
         fi
     fi
 
-    # add oracle user, set root password
+    # add oracle user
     chroot $container_rootfs useradd -m -s /bin/bash oracle
-    echo "oracle:oracle" | chroot $container_rootfs chpasswd
-    echo "root:root" | chroot $container_rootfs chpasswd
-    printf "Added container user:\033[1moracle\033[0m password:\033[1moracle\033[0m\n"
-    printf "Added container user:\033[1mroot\033[0m password:\033[1mroot\033[0m\n"
+    printf "Added container user:\033[1moracle\033[0m\n"
+    printf "Added container user:\033[1mroot\033[0m\n"
 }
 
 # create the container's lxc config file
@@ -483,9 +482,9 @@ container_config_create()
     cat <<EOF >> $cfg_dir/config || die "unable to create $cfg_dir/config"
 # Container configuration for Oracle Linux $container_release_major.$container_release_minor
 lxc.arch = $arch
-lxc.utsname = $name
+lxc.uts.name = $name
 EOF
-    grep -q "^lxc.rootfs" $cfg_dir/config 2>/dev/null || echo "lxc.rootfs = $container_rootfs" >> $cfg_dir/config
+    grep -q "^lxc.rootfs.path" $cfg_dir/config 2>/dev/null || echo "lxc.rootfs.path = $container_rootfs" >> $cfg_dir/config
 
     if [ $container_release_major != "4" ]; then
         echo "lxc.cap.drop = sys_resource" >>$cfg_dir/config
@@ -498,36 +497,36 @@ EOF
 
     echo "# Networking" >>$cfg_dir/config
     # see if the default network settings were already specified
-    lxc_network_type=`grep '^lxc.network.type' $cfg_dir/config | awk -F'[= \t]+' '{ print $2 }'`
+    lxc_network_type=`grep '^lxc.net.0.type' $cfg_dir/config | awk -F'[= \t]+' '{ print $2 }'`
     if [ -z "$lxc_network_type" ]; then
-        echo "lxc.network.type = veth" >>$cfg_dir/config
+        echo "lxc.net.0.type = veth" >>$cfg_dir/config
         lxc_network_type=veth
     fi
 
-    lxc_network_link=`grep '^lxc.network.link' $cfg_dir/config | awk -F'[= \t]+' '{ print $2 }'`
+    lxc_network_link=`grep '^lxc.net.0.link' $cfg_dir/config | awk -F'[= \t]+' '{ print $2 }'`
     if [ -z "$lxc_network_link" ]; then
-        echo "lxc.network.link = lxcbr0" >>$cfg_dir/config
+        echo "lxc.net.0.link = lxcbr0" >>$cfg_dir/config
         lxc_network_link=lxcbr0
     fi
 
-    lxc_network_hwaddr=`grep '^lxc.network.hwaddr' $cfg_dir/config | awk -F'[= \t]+' '{ print $2 }'`
+    lxc_network_hwaddr=`grep '^lxc.net.0.hwaddr' $cfg_dir/config | awk -F'[= \t]+' '{ print $2 }'`
     if [ -z "$lxc_network_hwaddr" ]; then
        # generate a hwaddr for the container
         # see http://sourceforge.net/tracker/?func=detail&aid=3411497&group_id=163076&atid=826303
         local hwaddr="00:16:3e:`dd if=/dev/urandom bs=8 count=1 2>/dev/null |od -t x8 | \
                         head -n1 | awk '{print $2}' | cut -c1-6 | \
                         sed 's/\(..\)/\1:/g; s/.$//'`"
-        echo "lxc.network.hwaddr = $hwaddr" >>$cfg_dir/config
+        echo "lxc.net.0.hwaddr = $hwaddr" >>$cfg_dir/config
     fi
 
-    lxc_network_flags=`grep '^lxc.network.flags' $cfg_dir/config | awk -F'[= \t]+' '{ print $2 }'`
+    lxc_network_flags=`grep '^lxc.net.0.flags' $cfg_dir/config | awk -F'[= \t]+' '{ print $2 }'`
     if [ -z "$lxc_network_flags" ]; then
-        echo "lxc.network.flags = up" >>$cfg_dir/config
+        echo "lxc.net.0.flags = up" >>$cfg_dir/config
     fi
 
     cat <<EOF >> $cfg_dir/config || die "unable to create $cfg_dir/config"
-lxc.network.name = eth0
-lxc.network.mtu = 1500
+lxc.net.0.name = eth0
+lxc.net.0.mtu = 1500
 EOF
 }