]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
Additional checks in ALTLinux template
authorDenis Pynkin <denis_pynkin@epam.com>
Tue, 19 Aug 2014 15:31:03 +0000 (18:31 +0300)
committerStéphane Graber <stgraber@ubuntu.com>
Sat, 20 Sep 2014 01:10:57 +0000 (21:10 -0400)
Added check of services in container before start or stop.
Added check of syslog config existence prior changing.

Signed-off-by: Denis Pynkin <dans@altlinux.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
templates/lxc-altlinux.in

index 8694eb6f34fcacfdc1606fcd8bf4d1a0687ed76b..b9166aeef45d25ea318352aeb83bb4fa5d6e4654 100644 (file)
@@ -108,16 +108,22 @@ EOF
     echo "pts/0" >> ${rootfs_path}/etc/securetty
     echo "console" >> ${rootfs_path}/etc/securetty
 
-    chroot ${rootfs_path} chkconfig network on
-    chroot ${rootfs_path} chkconfig syslogd on
-    chroot ${rootfs_path} chkconfig random on
-    chroot ${rootfs_path} chkconfig rawdevices off
-    chroot ${rootfs_path} chkconfig fbsetfont off
-#    chroot ${rootfs_path} chkconfig keytable off
+    # Enable services
+    for service in network syslogd random
+    do
+       chroot ${rootfs_path} chkconfig $service --list &>/dev/null && chroot ${rootfs_path} chkconfig $service on || true
+    done
+    # Disable services
+    for service in rawdevices fbsetfont
+    do
+       chroot ${rootfs_path} chkconfig $service --list &>/dev/null && chroot ${rootfs_path} chkconfig $service off || true
+    done
 
     subst 's/^\([3-9]\+:[0-9]\+:respawn:\/sbin\/mingetty.*\)/#\1/' ${rootfs_path}/etc/inittab
     echo "c1:2345:respawn:/sbin/mingetty --noclear console" >>  ${rootfs_path}/etc/inittab
-    subst 's,\/dev\/tty12,/var/log/syslog/console,' ${rootfs_path}/etc/syslog.conf
+
+    [ -f "${rootfs_path}/etc/syslog.conf" ] && \
+        subst 's,\/dev\/tty12,/var/log/syslog/console,' ${rootfs_path}/etc/syslog.conf
 
 #   touch file for fastboot
     touch ${rootfs_path}/fastboot