]> git.proxmox.com Git - mirror_lxc.git/commitdiff
minor cleanup in template and add systemd_configure function with openmandriva-relate...
authorAlexander Khryukin <alexander@mezon.ru>
Thu, 10 Oct 2013 14:31:10 +0000 (18:31 +0400)
committerStéphane Graber <stgraber@ubuntu.com>
Thu, 10 Oct 2013 17:33:46 +0000 (13:33 -0400)
Signed-off-by: Alexander Khryukin <alexander@mezon.ru>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
templates/lxc-openmandriva.in

index 325f6233b90b2e6573878e7e6a37d9fb2946e2f8..a0f0cadf014b3afeed8684e74917926a11332125 100755 (executable)
@@ -69,6 +69,7 @@ EOF
 
 populate_dev()
 {
+    echo -n "Create devices in /dev/"
     dev_path="${rootfs_path}/dev"
     rm -rf $dev_path
     mkdir -p $dev_path
@@ -89,8 +90,7 @@ populate_dev()
     mknod -m 600 ${dev_path}/initctl p
     mknod -m 666 ${dev_path}/ptmx c 5 2
     mkdir -m 755 ${dev_path}/net
-    mknod -m 666 ${dev_path}/net/tun   c 10 200
-    return 0
+    mknod -m 666 ${dev_path}/net/tun c 10 200
 
 }
 
@@ -99,7 +99,7 @@ set_guest_root_password()
     [[ -z "$root_password" ]] && return # pass is empty, abort
 
     echo -n " - setting guest root password.."
-    echo "root passwd is: $root_password"
+    echo -n "root passwd is: $root_password"
     echo "root:$root_password" | chroot "$rootfs_path" chpasswd
     echo "done."
 }
@@ -114,10 +114,9 @@ create_chroot_openmandriva()
         return 1
     fi
     # package list to install
-    PKG_LIST="basesystem-minimal locales locales-en initscripts urpmi cronie dhcp-client"
+    PKG_LIST="basesystem-minimal locales locales-en initscripts urpmi cronie dhcp-client kbd"
     # download a mini openmandriva into a cache
     echo "Downloading openmandriva minimal ..."
-    #URPMI="/usr/sbin/urpmi.addmedia --urpmi-root $INSTALL_ROOT main http://abf.rosalinux.ru/downloads/$distro/repository/$arch/main/release"
     URPMI="/usr/sbin/urpmi.addmedia --urpmi-root $INSTALL_ROOT main http://abf.rosalinux.ru/downloads/$release/repository/$arch/main/release"
     echo $URPMI
     URPMI_BASE="/usr/sbin/urpmi --no-suggests --no-verify-rpm --ignorearch --root $INSTALL_ROOT --urpmi-root $INSTALL_ROOT --auto $PKG_LIST"
@@ -150,9 +149,26 @@ copy_openmandriva()
 update_openmandriva()
 {
     echo "automated update in progress..."
-#    chroot $cache/rootfs urpmi --auto --auto-update
+    urpmi --root $cache/rootfs urpmi-root $cache/rootfs --auto --auto-update --ignorearch
 }
 
+configure_openmandriva_systemd()
+{
+    chroot ${rootfs_path} ln -s /dev/null /etc/systemd/system/proc-sys-fs-binfmt_misc.automount
+    chroot ${rootfs_path} ln -s /dev/null /etc/systemd/system/systemd-udevd.service
+    chroot ${rootfs_path} ln -s /dev/null /etc/systemd/system/systemd-udevd-control.socket
+    chroot ${rootfs_path} ln -s /dev/null /etc/systemd/system/systemd-udevd-kernel.socket
+    # remove numlock service
+    # KDGKBLED: Inappropriate ioctl for device
+    rm -f ${rootfs_path}/etc/systemd/system/getty@.service.d/enable-numlock.conf
+
+    unlink ${rootfs_path}/etc/systemd/system/default.target
+    chroot ${rootfs_path} ln -s /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
+    sed -i 's!ConditionPathExists=/dev/tty0!ConditionPathExists=|/dev/tty0\nConditionVirtualization=|lxc!' \
+           ${rootfs_path}/lib/systemd/system/getty\@.service
+}
+
+
 install_openmandriva()
 {
     mkdir -p @LOCALSTATEDIR@/lock/subsys/
@@ -200,6 +216,7 @@ copy_configuration()
     grep -q "^lxc.rootfs" $config_path/config 2>/dev/null || echo "lxc.rootfs = $rootfs_path" >> $config_path/config
     cat <<EOF >> $config_path/config
 lxc.utsname = $name
+lxc.autodev = 1
 lxc.tty = 4
 lxc.pts = 1024
 lxc.mount = $config_path/fstab
@@ -212,7 +229,7 @@ lxc.cap.drop = sys_module mac_admin mac_override sys_time
 lxc.network.type = $lxc_network_type
 lxc.network.flags = up
 lxc.network.link = $lxc_network_link
-lxc.network.name = veth0
+lxc.network.name = eth0
 lxc.network.mtu = 1500
 EOF
 if [ ! -z ${ipv4} ]; then
@@ -366,6 +383,10 @@ if [ ! -z "$clean" -a -z "$path" ]; then
     exit 0
 fi
 
+if [ -z "${utsname}" ]; then
+    utsname=${name}
+fi
+
 type urpmi >/dev/null 2>&1
 if [ $? -ne 0 ]; then
     echo "'urpmi' command is missing"
@@ -425,6 +446,12 @@ if [ $? -ne 0 ]; then
     exit 1
 fi
 
+# If the systemd configuration directory exists - set it up for what we need.
+if [ -d ${rootfs_path}/etc/systemd/system ]
+then
+    configure_openmandriva_systemd
+fi
+
 populate_dev
 if [ $? -ne 0 ]; then
     echo "failed to populated /dev/ devices"