diff --git a/profiles/templates/3.1/6_ac_install_pxe/sys-boot/syslinux/pxelinux.cfg/default.new.patch b/profiles/templates/3.1/6_ac_install_pxe/sys-boot/syslinux/pxelinux.cfg/default.new.patch
new file mode 100644
index 000000000..98d7d3b18
--- /dev/null
+++ b/profiles/templates/3.1/6_ac_install_pxe/sys-boot/syslinux/pxelinux.cfg/default.new.patch
@@ -0,0 +1,13 @@
+# Calculate format=patch name=default cl_ver>=3.1.9.4
+ root=/dev/ram0
+ real_root=/dev/nfs nfsroot=#-os_install_pxe_ip-#:#-os_install_pxe_path-#/calculate
+\n\nLABEL harddisk([^\n]*\n*)+SLX=0x80
+
+([ =])(/boot)
+\1/calculate\2
+KERNEL memtest
+KERNEL calculate/syslinux/memtest
+ (common.cfg|calcmenu.c32)
+ pxelinux.cfg/\1
+ scandelay=\d+
+
diff --git a/profiles/templates/3.1/6_ac_install_pxe/sys-boot/syslinux/pxelinux.cfg/default.patch b/profiles/templates/3.1/6_ac_install_pxe/sys-boot/syslinux/pxelinux.cfg/default.patch
index d4bcca8c5..f920cc607 100644
--- a/profiles/templates/3.1/6_ac_install_pxe/sys-boot/syslinux/pxelinux.cfg/default.patch
+++ b/profiles/templates/3.1/6_ac_install_pxe/sys-boot/syslinux/pxelinux.cfg/default.patch
@@ -1,4 +1,4 @@
-# Calculate format=patch name=default
+# Calculate format=patch name=default cl_ver<3.1.9.4
root=/dev/ram0
real_root=/dev/nfs nfsroot=#-list(os_install_net_ip,0)-#:#-os_install_pxe_path-#/calculate
\n\nLABEL harddisk([^\n]*\n*)+SLX=0x80
diff --git a/sys-apps/calculate-install/Manifest b/sys-apps/calculate-install/Manifest
index 4f31b2060..bf445079f 100644
--- a/sys-apps/calculate-install/Manifest
+++ b/sys-apps/calculate-install/Manifest
@@ -12,6 +12,7 @@ AUX calculate-install-3.1.8-r9.patch 29911 SHA256 f99b690458835d8561fcdc04c3ea84
AUX calculate-install-3.1.9-r1.patch 774 SHA256 3cf115d79f71f8505f80ca4390ae7e43e58c044d18490ae78bffee49217d8aaa SHA512 49a8b5dd8566a9115e148bdaa157916ac9f7e72e3c59dcc6610639372498146e76b9de8c671406266fbc556780eb518f481e5a508aa18d7d3c49607e7b738e90 WHIRLPOOL 292a426beab159289d04054f8ab5ae3cc14026492b8788418a02483ddad6cb040c13e449301abbea1055a542aa748a3d22dbfab22d53811d4d11cb73a61f05de
AUX calculate-install-3.1.9-r10.patch 10442 SHA256 b89d3d822b7319e5163fe2d1e88d15d7d973896f8c70d4fa797add8a25c2d268 SHA512 0431765e2e2d371cffab1369aa74909f77741aceb984a5c94f4d6996c5afbbbdb22eca86b1ec50bc9cf4950f026c1a7c6d6706de5e74e1d745584cf992ba6412 WHIRLPOOL 6fcb0cf8e397d7b6308e3caa5b6c876d2ea5808262d722e924bdadee8d7a898ce65e838a11b2cd5529d3421ba0be4c9644769764469a20bd50e2187cc2f136b9
AUX calculate-install-3.1.9-r11.patch 10794 SHA256 04331ce870cba46088ce36d518a9a7986c149dfd0770a81624f5d62445662a35 SHA512 33fdcc95143405017abf2fbd8a75bbc591efa3eacdcff32e627ab276115dd39e69c44bb54ede7f68ed027d7ead4ea3821b944ad10aa0c8e420d92edaf4b39d27 WHIRLPOOL bc2b98348334b5219151d21b4fe5e3f9f5fec9ac84f35124b83be8911e5c7632c4dfc537843a468a68f9a77c9f5d01788e6052e6677be26f79707f57b85e8fc4
+AUX calculate-install-3.1.9-r12.patch 12031 SHA256 f2e1c8924089396c1d442d59b82b14ebd00392d1344552e30c7176ae49d7300c SHA512 fb27ddfe79379847d622f99d8057686193d8b1be3f95d693d0d3a09bbe266e2a81f922f70e602f6e6b316aa7dee97d3c70cd376a5a8b6a86681d0461cb788f5a WHIRLPOOL 3bb01f9de52c098ef39f4657dd586703200193a33c2882aa6e55dd4def6e1c2d1da0ba8d4193b8376b7bd09695eaf16f9e4035cbe7ea17e31369e3fce391a2c8
AUX calculate-install-3.1.9-r2.patch 1830 SHA256 3c824988d608a0d390639d4244988733525c911edb2457e1815766f9619ba246 SHA512 f97fa46b21e945e0f58cda31a2c5de30e5951aa96bcd97bf176addfc9b347fa38890c43aafd2186b08a8f8ccd56437502b945c74da1b104d9fd3266f1d6f3cfa WHIRLPOOL 2b6bdae69c1e9dd05b22bd7c8eaf37f6917344c0a7cdcfd06d9519b56e43a6da640a9414582e05a4b9f797e41bbbd1abbf60102b803e4d5789ede46b3311a4ce
AUX calculate-install-3.1.9-r3.patch 5207 SHA256 8206f8c0450a5d8b70c2fea85e1321385dac7ddef08250897f91a73104c10395 SHA512 acc60616e0c32f0a30c95a3f251b9b526c5da23e9f039cf1a7c62a74406ce82aaaa779ffa1e79314a2b6348157097516835462d1c7b050bafd0b8a5b4d066761 WHIRLPOOL 2dfe264a75a8bd96226722f01b4cdc1f0cc1986f7c0f51b1a2ef64662a7a119467b82a841cb51c0168c87a3e42e53a69db4a3b9d45dd17ba2d2a2e4abbeed346
AUX calculate-install-3.1.9-r4.patch 6433 SHA256 bb447b6c506daa179ef4062e73ba1dd07694d9219de7783b384ae56838f82f3a SHA512 fbce8d9c89936f396150e7d898192158ac38c43df1af90144d9b588bb4c639fd3f8b0c5ba7a9211961420893276741d59cb037499de173dfb9ff5be1124f6ca2 WHIRLPOOL abd4651ad0769817529a51fc4848915ec7347f06c202334229f6d6dc0cabb53e986800ba190ad589eb29a0414170d09e7f9f785a0ac1876ff294dd2d22706aa0
@@ -37,6 +38,7 @@ EBUILD calculate-install-3.1.8-r9.ebuild 1043 SHA256 a7386df450112f9452b74adcb4e
EBUILD calculate-install-3.1.9-r1.ebuild 1043 SHA256 7717e300e60731aff78a352c6e0f062d9499fc2f4c5319fde12901b6eb99ccb4 SHA512 391583448b9d342b9b027f5dd508ceff14490060da870ab47d409481a2a30054802987a7daa6932fd436395a0435202208dded9e4b1a544557e6a662a730f4c5 WHIRLPOOL 33e7521b22e4cf02c601a6dd9cf0bf218edb48b13b2bf4b918c915cda4752804ab7a664b2e2555c965a43bd1ee1a89081d4251aa13c2e900b6428d13446db928
EBUILD calculate-install-3.1.9-r10.ebuild 1044 SHA256 35b0300d43abd6db0959a01b7b8e0b44e186fe6b8077776b5a79a4484d0c1652 SHA512 be28294764d8761b9173cc04191703b4180661f168eddf674bc8528337e85675aa25925baf77d7ee31043a4d11889d719ecc11ded774d17d95f46ad23ee031a0 WHIRLPOOL 29a56de74b2234a26ff1b33e8e967da2ee97c06a331ffefb94fce1cd3cdb2e4644b33bb1e132c4a9d38b863539d18e0f8621a7a2c573739f57de1269b5a16e0d
EBUILD calculate-install-3.1.9-r11.ebuild 1044 SHA256 1330b3ccdfb64f078f689fb36026c14f5ceac6ad0ce6521c8900979d16ec9142 SHA512 ad23052270e1b9bb068cdbbd38258a54195058d2a93d1de5c415256fa821c66ff1c97f84e1519b0e68e01be9ba619580256dfed5a4872d4f9a2a35b323101077 WHIRLPOOL 842c266e98ac73db85b20bc85d3194be15f0658e6f081a1949d4f650cb33f6d25a059dcf35477463c188bdd441597a25e6ec75c1f6fee883751fd3e365e95ff2
+EBUILD calculate-install-3.1.9-r12.ebuild 1044 SHA256 59550dc34c6fa367882e7e9364bd76857d2eb240a2623a21abfce27fbc16fa5c SHA512 778e3058ec4fd7cb011f9a9d85e82dec82bb31b64993973f2c63f7c4eb65547ff2b4d583329bc0d5e913191b785d1dfc99424e160eafe12fb174e876c60bf78f WHIRLPOOL 6f637b1dd4b3f734d0deec5d39f9ade9d6f2bee8b54f258d24a481b67c4bab85a9791de06563254312ab7595d9b43bbfe335df3c4e3cc78eacb5b4a2e5a77ced
EBUILD calculate-install-3.1.9-r2.ebuild 1043 SHA256 c58c63e912fe36ba7b508962021abd266c3419f433c4919187081a2d703b6a45 SHA512 020356b5997a5e98e7efa7bf55d4170d791d1e1bb39f01ed16158f0a4e4ab74cd9c76c3e616e6cd3880669908028a2939527d7a0cf25cb2af0c7c50ac91ec404 WHIRLPOOL 3c8342f245cb8af50223d921ed9adf45866d0efc1c9bede7a758bfb93796d0e99d8faba54e11af759ed60c13833243b13a27056506cc20339311ba60f3c18a27
EBUILD calculate-install-3.1.9-r3.ebuild 1043 SHA256 aac533eae9f9741530c4eaa6b0a329714148bbc49805040844c5573b2eb6215a SHA512 7d86242205439d7143aa1e7cd4e22188fb619b5ced707c2b37ed96b40c9f80de5e9d1ddb073d15438095100a0eddd4dd85b816e5e64f10bd78938788e6d95d6b WHIRLPOOL f04dd65059e4915d66dd9d7490d3249325c7735bdfcbb3b8614defb270a94b57850b7691871a47716f9ca6de62225a83e81965163722f11a9b63b182a7e1602d
EBUILD calculate-install-3.1.9-r4.ebuild 1043 SHA256 5bce6c93d6bcb0c710a0c0c973a4d765175027e6f1cd30846d4390c7252ca0d7 SHA512 c8d9756a07983742ab90065bce5d69e1fe7a76f5d22590da176ff78b7baa329c4cf9bf3a4150831d1cee45cb77b93a60fdb25cf746dcbd60c4614490775c2daf WHIRLPOOL f1ed224612cc85a4ea05434c91491dae1012127094919d3e075be85320ef293ad35faebf2cc6e8e31c8df15ccbbbf4cbe69b2a8333cf8988a78a82e414215b4c
diff --git a/sys-apps/calculate-install/calculate-install-3.1.9-r12.ebuild b/sys-apps/calculate-install/calculate-install-3.1.9-r12.ebuild
new file mode 100644
index 000000000..26fcb2c70
--- /dev/null
+++ b/sys-apps/calculate-install/calculate-install-3.1.9-r12.ebuild
@@ -0,0 +1,44 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="3"
+SUPPORT_PYTHON_ABIS="1"
+PYTHON_DEPEND="2:2.7"
+RESTRICT_PYTHON_ABIS="2.4 2.5 2.6 3.*"
+
+inherit distutils eutils
+
+SRC_URI="ftp://ftp.calculate.ru/pub/calculate/calculate3/${PN}/${P}.tar.bz2"
+
+DESCRIPTION="The program of installation Calculate Linux"
+HOMEPAGE="http://www.calculate-linux.org/main/en/calculate2"
+LICENSE="Apache-2.0"
+SLOT="3"
+KEYWORDS="amd64 x86"
+IUSE="pxe minimal"
+
+DEPEND="~sys-apps/calculate-core-3.1.9
+ !=virtual/udev-197
+ !app-misc/livecd-tools
+ sys-apps/iproute2[-minimal]
+ !minimal? ( sys-boot/grub
+ sys-apps/gptfdisk
+ >=sys-apps/util-linux-2.19.1
+ sys-fs/dosfstools
+ sys-fs/squashfs-tools
+ sys-block/parted )
+ pxe? ( sys-apps/calculate-server
+ net-ftp/tftp-hpa
+ net-misc/dhcp
+ net-fs/nfs-utils )"
+
+src_unpack() {
+ unpack "${A}"
+ cd "${S}"
+
+ # apply revision changes
+ epatch "${FILESDIR}/calculate-install-3.1.9-r12.patch"
+}
diff --git a/sys-apps/calculate-install/files/calculate-install-3.1.9-r12.patch b/sys-apps/calculate-install/files/calculate-install-3.1.9-r12.patch
new file mode 100644
index 000000000..666a975fd
--- /dev/null
+++ b/sys-apps/calculate-install/files/calculate-install-3.1.9-r12.patch
@@ -0,0 +1,269 @@
+diff --git data/calculate data/calculate
+index c7f60b9..60a24b0 100644
+--- data/calculate
++++ data/calculate
+@@ -134,10 +134,6 @@ start() {
+ touch /* /bin/* /sbin/*
+ udevadm trigger --action="add" --subsystem-match=net
+ fi
+- if [[ $roottype != "livecd" ]]
+- then
+- /usr/bin/eix-checkout &>/dev/null &
+- fi
+
+ /sbin/rc-update --update
+ return 0
+diff --git install/distr.py install/distr.py
+index 88de47f..e6202e8 100644
+--- install/distr.py
++++ install/distr.py
+@@ -31,7 +31,8 @@ from functools import partial
+ from calculate.lib.utils.files import (runOsCommand,isMount,removeDir,
+ processProgress,countFiles,STDOUT,
+ typeFile,pathJoin,process,getRunCommands,
+- readLinesFile,getProgPath,listDirectory,checkUtils)
++ readLinesFile,getProgPath,listDirectory,checkUtils,
++ MAGIC_COMPRESS,MAGIC_SYMLINK,MAGIC_CONTINUE)
+ from calculate.lib.utils.common import getTupleVersion,cmpVersion
+ from calculate.lib.utils.device import (detectDeviceForPartition,
+ getUdevDeviceInfo, countPartitions,
+@@ -114,7 +115,7 @@ class Distributive(object):
+ def fromFile(cls,filename):
+ """Get Distributive object by filename"""
+ # MAGIC_COMPRESS 0x000004 Check inside compressed files
+- tf = typeFile(magic=0x6)
++ tf = typeFile(magic=MAGIC_COMPRESS|MAGIC_SYMLINK|MAGIC_CONTINUE)
+ ftype = tf.getMType(filename)
+ if ftype:
+ if "block special" in ftype:
+@@ -753,7 +754,7 @@ class PartitionDistributive(Distributive):
+ mulipartDataNotBind = filter(lambda x: x[2]!="bind",
+ self.getMultipartData())
+ for dev, mountPoint, fileSystem, isFormat, partTable\
+- in mulipartDataNotBind:
++ in sorted(mulipartDataNotBind, key=lambda x:x[1]):
+ if fileSystem!="swap":
+ realMountPoint = pathJoin(mdirectory, mountPoint)
+ self._mountPartition(dev,realMountPoint,"-t %s"%fileSystem)
+@@ -1095,7 +1096,7 @@ class IsoDistributive(Distributive):
+ self.compress = compress
+
+ def getType(self):
+- tf = typeFile(magic=0x6)
++ tf = typeFile(magic=MAGIC_COMPRESS|MAGIC_SYMLINK|MAGIC_CONTINUE)
+ ftype = tf.getMType(self.file)
+ if "block special" in ftype:
+ return _("live image %s")%self.file
+@@ -1116,7 +1117,7 @@ class IsoDistributive(Distributive):
+ def _mountIso(self,file,directory):
+ if self.file != self.mdirectory:
+ self._makeDirectory(directory)
+- tf = typeFile(magic=0x6)
++ tf = typeFile(magic=MAGIC_COMPRESS|MAGIC_SYMLINK|MAGIC_CONTINUE)
+ ftype = tf.getMType(file)
+ if "block special" in ftype:
+ mopts = "-o ro"
+diff --git install/install.py install/install.py
+index fdd6b04..c3e0c7e 100644
+--- install/install.py
++++ install/install.py
+@@ -28,7 +28,8 @@ from shutil import copy2
+ from calculate.core.server.func import safetyWrapper
+ from calculate.lib.utils.files import (runOsCommand,pathJoin,
+ isMount,process,listDirectory,STDOUT,
+- checkUtils,readFile,find,copyWithPath)
++ checkUtils,readFile,find,copyWithPath,
++ readLinesFile)
+ from calculate.lib.utils.common import (appendProgramToEnvFile,
+ removeProgramToEnvFile, getTupleVersion,
+ cmpVersion,getUserPassword,
+@@ -350,7 +351,7 @@ class Install:
+ newModuleName = defaultGL
+ curModuleName = map(lambda x:x.strip().rpartition('=')[-1].strip('"\''),
+ filter(lambda x: x.startswith("OPENGL_PROFILE="),
+- readFile(openGLenv)))
++ readLinesFile(openGLenv)))
+ curModuleName = curModuleName[-1] if curModuleName else ""
+ if curModuleName == newModuleName:
+ return True
+diff --git install/variables/audio.py install/variables/audio.py
+index 0243ec3..5dc7a1c 100644
+--- install/variables/audio.py
++++ install/variables/audio.py
+@@ -33,13 +33,12 @@ class VariableOsAudioData(ReadonlyTableVariable):
+ 'os_audio_name']
+
+ def get(self,hr=False):
+- alsaInfo = getProgPath('/usr/bin/alsa-info')
+- if not alsaInfo:
++ data = readFile('/proc/asound/cards')
++ cards = re.findall('^\s*(\d+).*\n\s+(\S.*) at .*$',data,re.M)
++ if cards:
++ return map(list, cards)
++ else:
+ return [[]]
+- entry = re.compile('^Card hw:(\d+)\s*[^/]+/\'(.*?) at .*$')
+- return tuple(map(lambda x:x.groups(),
+- filter(None,map(entry.search,
+- process(alsaInfo,'--stdout',envdict=os.environ)))))
+
+ setValue = Variable.setValue
+
+diff --git install/variables/disk.py install/variables/disk.py
+index ef0f9e2..14462e7 100644
+--- install/variables/disk.py
++++ install/variables/disk.py
+@@ -31,7 +31,7 @@ from calculate.lib.utils.device import (getUdevDeviceInfo,getDeviceType,
+ getUUIDDict,getCommonDeviceName)
+ from calculate.install.variables.autopartition import Sizes
+ from calculate.lib.utils.files import (listDirectory,pathJoin,readFile,FStab,
+- isMount)
++ isMount,getProgPath)
+ from calculate.install.distr import PartitionDistributive
+ from calculate.install.fs_manager import FileSystemManager
+
+@@ -110,7 +110,8 @@ class VariableOsDeviceDev(ReadonlyVariable,DeviceHelper):
+ """Get device /dev name"""
+ if self.master is None:
+ self.master,slave = pty.openpty()
+- self.monitor = Popen(["/sbin/udevadm","monitor","--kernel",
++ udevAdm = getProgPath('/sbin/udevadm')
++ self.monitor = Popen([udevAdm,"monitor","--kernel",
+ "--subsystem-match=block"],stdout=slave,
+ close_fds=True)
+ os.close(slave)
+@@ -1834,7 +1835,7 @@ class VariableOsInstallFstabMountConf(ReadonlyVariable,DeviceHelper):
+ 'os_install_disk_mount',
+ 'os_install_disk_format',
+ 'os_install_disk_options',
+- 'os_disk_dev'],
++ 'os_install_disk_dev'],
+ where='os_install_disk_mount',
+ func=lambda x:x[0] != "" and x[0] != "swap"),
+ lambda x,y: cmp(self.separateDevice(x[1]),
+diff --git install/variables/kernel.py install/variables/kernel.py
+index 2e844ac..6fa1bd7 100644
+--- install/variables/kernel.py
++++ install/variables/kernel.py
+@@ -19,7 +19,8 @@ import sys
+ import re
+ from os import path
+ from calculate.lib.datavars import Variable,VariableError,ReadonlyVariable
+-from calculate.lib.utils.files import typeFile,process,listDirectory
++from calculate.lib.utils.files import (
++ typeFile,process,listDirectory,MAGIC_SYMLINK,MAGIC_COMPRESS)
+
+ from calculate.lib.cl_lang import setLocalTranslate
+ setLocalTranslate('cl_install3',sys.modules[__name__])
+@@ -137,8 +138,10 @@ class KernelHelper:
+ def getFilesByType(self,pathname,descr):
+ """Get files from "pathname" has "descr" in descriptions"""
+ filelist = map(lambda x:path.join(pathname,x),os.listdir(pathname))
+- ftype = typeFile(magic=0x4).getMType
+- filesWithType = map(lambda x:(x,ftype(x)), filelist)
++ ftype = typeFile(magic=MAGIC_COMPRESS|MAGIC_SYMLINK).getMType
++ filesWithType = map(lambda x:(x,ftype(x)),
++ filter(path.exists,
++ filelist))
+ return filter(lambda x:descr in x[1],filesWithType)
+
+ def getInitrd(self,arch,shortname,chroot,kernel,suffix="",notsuffix=""):
+@@ -150,7 +153,7 @@ class KernelHelper:
+ return resInitrdVer.groups()[1]
+ return ""
+
+- ftype = typeFile(magic=0x4).getMType
++ ftype = typeFile(magic=MAGIC_COMPRESS|MAGIC_SYMLINK).getMType
+ kernelfile = path.join(chroot,'boot',kernel)
+ typeKernelFile = ftype(kernelfile)
+ if typeKernelFile == None:
+diff --git install/variables/net.py install/variables/net.py
+index d8d22f6..01b0032 100644
+--- install/variables/net.py
++++ install/variables/net.py
+@@ -107,11 +107,18 @@ class VariableOsInstallNetInterfacesOrig(NetHelper,ReadonlyVariable):
+ return self.Get('os_install_net_interfaces')
+ def getOrig(x):
+ try:
+- nameParam = filter(lambda x:x.startswith("ID_NET_NAME_PATH="),
+- process("udevadm","test-builtin","net_id",
+- "/sys/class/net/%s"%x))
++ nameParam = \
++ map(lambda x:x.partition('=')[::2],
++ filter(lambda x:x.startswith("ID_NET_NAME_PATH=") or
++ x.startswith("ID_NET_NAME_ONBOARD="),
++ process("udevadm","test-builtin","net_id",
++ "/sys/class/net/%s"%x)))
+ if nameParam:
+- return nameParam[0].partition('=')[2].strip() or x
++ sortOrder = {'ID_NET_NAME_PATH':0,
++ 'ID_NET_NAME_ONBOARD':1}
++ nameParam = sorted(nameParam,
++ key=lambda x:sortOrder.get(x[0],-1))
++ return nameParam[-1][1].strip() or x
+ except Exception as e:
+ print str(e)
+ return x
+@@ -783,3 +790,24 @@ class VariableOsInstallNetSettings(NetHelper,Variable):
+
+ def choice(self):
+ return [("","")]+self.Get('os_install_net_conf_available')
++
++class VariableOsInstallPxeIp(Variable):
++ """
++ IP адрес PXE сервера
++ """
++ type = "choice"
++ opt = ["--ip"]
++ metavalue = "IP"
++
++ def init(self):
++ self.label = _("PXE server IP")
++ self.help = "set IP address for PXE server"
++
++ def get(self):
++ for ipaddr in ifilter(None, self.Get('os_install_net_ip')):
++ return ipaddr
++ else:
++ return ""
++
++ def choice(self):
++ return filter(None, self.Get('os_install_net_ip'))
+diff --git install/variables/system.py install/variables/system.py
+index a9193b6..69e800e 100644
+--- install/variables/system.py
++++ install/variables/system.py
+@@ -86,8 +86,6 @@ class VariableOsFormatUse(ReadonlyVariable):
+ 'value': "off"}
+
+ def checkFunc(self,fs):
+- if fs == "btrfs" and self.Get('os_root_type') == 'livecd':
+- return "no"
+ if "format" in FileSystemManager.supportFS[fs] and \
+ path.exists(FileSystemManager.supportFS[fs]["format"]):
+ return "yes"
+@@ -656,6 +654,10 @@ class VariableOsInstallGrubTerminal(Variable):
+ 'etc/default/grub')
+ if getValueFromConfig(grubDefault,'GRUB_TERMINAL') == 'console':
+ return 'console'
++ grubCfg = '/boot/grub/grub.cfg'
++ if re.search('^terminal_output\s*console',readFile(grubCfg),re.M):
++ return 'console'
++
+ return 'gfxterm'
+
+ def choice(self):
+diff --git install/wsdl_install.py install/wsdl_install.py
+index 511e16c..f47e342 100644
+--- install/wsdl_install.py
++++ install/wsdl_install.py
+@@ -150,7 +150,8 @@ class Wsdl(WsdlBase):
+ 'groups':[
+ lambda group:group(_("PXE install"),
+ normal=('cl_image_filename',),
+- expert=('os_install_pxe_path',),
++ expert=('os_install_pxe_path',
++ 'os_install_pxe_ip'),
+ next_label=_("Install"))]},
+ # настройка аудио
+ {
diff --git a/sys-apps/calculate-lib/Manifest b/sys-apps/calculate-lib/Manifest
index adbb48cb5..ef8acce4e 100644
--- a/sys-apps/calculate-lib/Manifest
+++ b/sys-apps/calculate-lib/Manifest
@@ -16,6 +16,7 @@ AUX calculate-lib-3.1.9-r1.patch 1039 SHA256 c5bd00abd4804b19da1f8e5100033c3557d
AUX calculate-lib-3.1.9-r10.patch 22013 SHA256 20bb1e8692da01f66443472e385a12ca38ed3aa6fad908057c4d0fed26f2dd9c SHA512 6a41ffa070f9c8c8b480aee85b71ee15913d07a700c9a9aad1f13dc74725dc41a7752d9fde6ba5c0c9c1368b3167f28723384af9479790b618fca79957b9aa0c WHIRLPOOL fb8d9f07ce46d8f796508eb56ce2a49014ac464c1accc4ef100b3bafa7ee6550980eb88a10116e98f083fb50b50367e323a75746fe59c9c638875fde3682b1f4
AUX calculate-lib-3.1.9-r11.patch 22015 SHA256 691db8e689e6321539df25f1bd8dee6db0d37057edb84fa98b59bc48e5e37c46 SHA512 a3584c6cda448f9455d83521e1d9b27aeafa0caa7a92f39406606c8c8ae0756656da6b6a81fe24082d86cca3e893841325b4dd280f407bee571a42760f071052 WHIRLPOOL bb25c68134a553b33aef2a7120c10719e3ab0e8d5683699733114ffa6d3fe7ef1aa137cfc379ee8a1f56090828f32a53729777613e5c87b872871d381e9dc98a
AUX calculate-lib-3.1.9-r12.patch 22468 SHA256 a2d33c715703061ba81c3e474a889cd1c87455e8a22f2a9cf5b977afd282cb65 SHA512 307f0759697daabbe30f7f4c91176c5b0d50cf443480688fe9d02eaf2ee7f7069fe9bd0e741da9a4de4448c912b8929255e785350bc9bc8d126d20e566e2ec79 WHIRLPOOL 7953191099a3a7b7f9bf91ebbc2929e1412782b008f1cb260e431ef18f59438b8f04c7cea717fa9b792bc864607d4547f9a28b9c514026a597133f61ea144fda
+AUX calculate-lib-3.1.9-r13.patch 22468 SHA256 207509aa254b79008eeae9bcbff95f47d01588348e234e5be3f7d1e22c3b842a SHA512 99caad599a2607ee0d35d5b8d3f9208d956134ffbb95fc5c2179b30d698b470fb54def47aa098bbef436cb29e6036e4ca13a283dca645afa0380b5f17d063d82 WHIRLPOOL f3871fb3dbcc18efe77f0b524d1366a908700cd267a7d451f2b5cfd8c51859907326e308611d6d23f72b8892ab593088e5498d28edf8f8a9bce1b3042c9d9ab6
AUX calculate-lib-3.1.9-r2.patch 2310 SHA256 fa08609228a82b42872606e58b5cbb0c12eee336ec1adf283f4ab484d41eed47 SHA512 b41f4e0a33c4199e50e8443f419271f945a6e25420f717c06e8f4ea2167d85b1c9843651c2f7801a65f546642c24731dcae3511c491b4aeb73eada4ee958a672 WHIRLPOOL ea5cc55d58e86eb25ad90432d555a0374b450264b6524ae28d7bf1e1a61626a30f98b4ecb7387d90cb52fa229cea91783c2a3c0b5008b0984d12e7d30d6cf648
AUX calculate-lib-3.1.9-r3.patch 5775 SHA256 972f7724c55273cd96f9f2adcd2594c9a2b2d62f35c2b26723e0b0aee6fb4c3f SHA512 97a4d78e6821a7016c7bc563af74ca87f06b172fa0499d42ce4af1caf8774234f68324aded2facaf51ea760e28099b8fe5f30467894238b008adfe890b2149d6 WHIRLPOOL 76e1adc9b4779038fe9d30afbd3b80ba21d9aeb103122a6fc64ed8048730e1ffc5f2f0ac7e1119cf654581aa1813c690b5310b61b6c107d2ef610da2f63e3d20
AUX calculate-lib-3.1.9-r4.patch 6380 SHA256 52b89cdd45270c7784d21c30a6466eb2096955bab98469b8cc67f6e84b7358fb SHA512 5b678292b332275013f8c845e54ea0ab33ec13bb70e27d60f06cb490fc896699c7fda2215c8edfef91b12d1597927a7d0fe9fc848e1d7807d706c2cbf5f14b08 WHIRLPOOL b9d85f021763bbf63f537ae5640c9fa316a97e1f5ef04794f8e09455712d3f0b4d44f10878474028b4d971272dc6b55ec2745d129e7bdf2aad75a38ae4315b0d
@@ -46,6 +47,7 @@ EBUILD calculate-lib-3.1.9-r1.ebuild 824 SHA256 d3b67409877b08aaf4e4135f7bced2dc
EBUILD calculate-lib-3.1.9-r10.ebuild 825 SHA256 d4083418ef433b2639b69fd1d18c392188aab4fb5d86cccd41cf74271e449df8 SHA512 b27e45293c65dbfb464450449a38f52e21c87c424cda72e73d3dedad0b8ca55eff28dd4e1c80d1dda820b69eaac171678182c1c6e35eb578e80edd9f7f54c8de WHIRLPOOL d19c06af5940577d238d172e224857ee0c84ae85cf16c085d45517a5616b5b8fbc818ee6964cd75ffde1e66214fbb1dbf181f17d42fbf344805b32106872e44e
EBUILD calculate-lib-3.1.9-r11.ebuild 825 SHA256 f66934d975161be69d645bf8a0a96e24b8baa1b4f8e8470c75dd769635346e0a SHA512 82dafbdcfe66a152b42e8bf89fbc4b427323f6cb9c4d7ebede9f07f0bd2e3cfb7192af8a467dc8ff3d356478f9c0b3c008e63f56f4917e6458288402fc32bb64 WHIRLPOOL 82cd049c17d2332286a200d55ad5b188d402057aa79bfeb3bdb23aad49c628198603ca72e892b3fbd0a3ff85dbbc0a4aad75415e9c014531d86a94c7b6262b99
EBUILD calculate-lib-3.1.9-r12.ebuild 825 SHA256 6eb85339b0fb4d675197d6646e2aa9519ed2edb3bfbcd656485a6a89af108084 SHA512 787845e84dcc6cab0f357a449766cbc03a869609d86ea532974fa7ed0360b468559a0da4bf06cb563f8b07a0bdf0461ce840245b66ce3b9abf13f6b036f9ff8b WHIRLPOOL 969483f49044245693f97b463073c8143821191c2051233515b460afda2b33102d638b44844768f29842ff4f61d28ef045540b5769df8ebe2648cdf3e280d501
+EBUILD calculate-lib-3.1.9-r13.ebuild 825 SHA256 0f40156758c17f4c170a871b0f470c0209c0916259b08c059f62c452ce2d1889 SHA512 70fe4ec6695918779d884c4f2b5312b12cfd59f8b25c16ba53c342df0b629799fc50b8f541e2abebf51f2308c12f95dc740c5037c11317adbc2ccadcd173bb1a WHIRLPOOL 9f0cfc5bbea546fecf885f3d76ae26c006c642b37dca84a9b28f652a99ee21cbfee855f1fff3861528beeb53fd00c4b05ac7ba9be60454a75ddeea47be0b2975
EBUILD calculate-lib-3.1.9-r2.ebuild 824 SHA256 ffa9e169fe308f8d7b7fc9158a56c99663c1cde9bc8b3ae24eac0a964bce27ca SHA512 d6f0e336b90476f8f7ad48897f9f054bc60c95da15fc50b0d05bf5f7deca950e249abdecbbb2dde3c11cb4533ba7a90da2da51fba2446bcd64f62cacb681dbc8 WHIRLPOOL 9a0ec32cf4b287416349ab61bae01587eca720873eef2d9ec7a7d07e21fa34fe7afb61faf84ed3f0c29c2e27b6326bef893c4859a0ef0360022a2d24da504817
EBUILD calculate-lib-3.1.9-r3.ebuild 824 SHA256 3199d484c3a5ecbaf4d254649cb4e7ee7ab072aa6fe51710cd82d7fdc78255c4 SHA512 567bcb0a0b016755dbfd69c71623854ffcb1761e4770b0ded01a7c27d3b46788ece0c21416106d24fabd7a365c0c0ae7127c2fa0bebbb6cbf060b49cba8dd0a9 WHIRLPOOL 4e733fd6f6501a5a6d1eced9c55b89a8088ff06e52576f307f853c282d437cbded80353d0b9ba122ba8efc9f614eb28fc7f5fad1714237119bab8bf75eefe35f
EBUILD calculate-lib-3.1.9-r4.ebuild 824 SHA256 b1b73001e179931b6444e61520b003c610af89b96b6f4c2aea696783d079852d SHA512 d0911eeda97a7f5a8faec7787b71db43472ea18f1a377e4956db1d9e3b67a684dd4200e56ad8569a52757a4d3ac2ad2725744f5115d680ccb6b304e3242fecb4 WHIRLPOOL 1ac814a74146528810b643edce703f2824b0cf2dda7871f66f1d5a9b3fa1674b86594bdc2b3d19ed39ad15cc895c42edf06952af38c184033fe4665780e7c0d4
diff --git a/sys-apps/calculate-lib/calculate-lib-3.1.9-r13.ebuild b/sys-apps/calculate-lib/calculate-lib-3.1.9-r13.ebuild
new file mode 100644
index 000000000..f72b4105e
--- /dev/null
+++ b/sys-apps/calculate-lib/calculate-lib-3.1.9-r13.ebuild
@@ -0,0 +1,36 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="3"
+SUPPORT_PYTHON_ABIS="1"
+PYTHON_DEPEND="2:2.7"
+RESTRICT_PYTHON_ABIS="2.4 2.5 2.6 3.*"
+
+inherit distutils eutils
+
+SRC_URI="ftp://ftp.calculate.ru/pub/calculate/calculate3/${PN}/${P}.tar.bz2"
+
+DESCRIPTION="The library for Calculate 3"
+HOMEPAGE="http://www.calculate-linux.org/main/en/calculate2"
+LICENSE="Apache-2.0"
+SLOT="3"
+KEYWORDS="amd64 x86"
+IUSE="minimal"
+DEPEND="!minimal? ( dev-python/py-smbpasswd )
+ >=dev-python/pyxml-0.8
+ sys-apps/iproute2
+ sys-apps/pciutils
+ sys-fs/lvm2
+ sys-fs/mdadm
+ dev-python/pyinotify
+ sys-apps/file[python]"
+RDEPEND="${DEPEND}"
+
+src_unpack() {
+ unpack "${A}"
+ cd "${S}"
+
+ # apply revision changes
+ epatch "${FILESDIR}/calculate-lib-3.1.9-r13.patch"
+}
diff --git a/sys-apps/calculate-lib/files/calculate-lib-3.1.9-r13.patch b/sys-apps/calculate-lib/files/calculate-lib-3.1.9-r13.patch
new file mode 100644
index 000000000..9fc6ee431
--- /dev/null
+++ b/sys-apps/calculate-lib/files/calculate-lib-3.1.9-r13.patch
@@ -0,0 +1,491 @@
+diff --git calculate/lib/cl_template.py calculate/lib/cl_template.py
+index 6c98b35..35100db 100644
+--- calculate/lib/cl_template.py
++++ calculate/lib/cl_template.py
+@@ -487,16 +487,16 @@ class _terms(_error, _shareTermsFunction):
+ if flagFoundQ:
+ listQPar = []
+ for par in listPar:
+- if par.endswith("'"):
+- listQPar.append(par.replace("'",""))
++ if par.endswith("'") and par.count("'")>1:
++ listQPar.append(par[:-1].replace("='","="))
+ else:
+ listQPar.append(par)
+ listPar = listQPar
+ if flagFoundQQ:
+ listQQPar = []
+ for par in listPar:
+- if par.endswith('"'):
+- listQQPar.append(par.replace('"',''))
++ if par.endswith('"') and par.count('"')>1:
++ listQQPar.append(par[:-1].replace('="','='))
+ else:
+ listQQPar.append(par)
+ listPar = listQQPar
+@@ -511,7 +511,7 @@ class fileHeader(_terms):
+ "comment", "append", "force",
+ "link", "mirror", "symbolic", "chmod", "chown", "name",
+ "path", "autoupdate","protected", "run","exec","merge",
+- "module","env"]
++ "module","env","postmerge"]
+
+ # Тип шаблона
+ fileType = ""
+@@ -705,7 +705,7 @@ class dirHeader(_terms):
+ """
+ # Допустимые параметры заголовка
+ allowParam = ["append", "chmod", "chown", "name", "path", "autoupdate",
+- "module","env","merge"]
++ "module","env","merge","postmerge"]
+
+ # Тип вставки шаблона
+ typeAppend = ""
+@@ -2492,7 +2492,7 @@ class _shareTemplate:
+ pwdObj = pwd.getpwnam(userName)
+ uid = pwdObj.pw_uid
+ gid = pwdObj.pw_gid
+- homeDir = pwdObj.pw_dir
++ homeDir = self.objVar.Get('ur_home_path')
+ except:
+ raise TemplatesError(_("User %s not found")%str(userName))
+ if groupsInfo:
+@@ -2795,9 +2795,7 @@ class templateFunction(_error, _warning, _shareTemplate, _shareTermsFunction):
+ fileName = pathJoin(self._baseDir,fileName)
+ replace = ""
+ if os.path.exists(fileName):
+- FD = open(fileName)
+- replace = FD.read().strip()
+- FD.close()
++ replace = readFile(fileName).strip()
+ if replace and lenTerms >= 2 and terms[0] == "empty":
+ replace ="\n".join(filter(lambda x: not self.reEmptyLoad.search(x),
+ replace.split("\n")))
+@@ -3753,7 +3751,12 @@ class templateFunction(_error, _warning, _shareTemplate, _shareTermsFunction):
+ uid, gid = getModeFile(self.fileConfigIni, "owner")
+ if not self.uid in (uid,PORTAGEUID) or \
+ not self.gid in (gid,PORTAGEGID):
+- os.chown(self.fileConfigIni, self.uid, self.gid)
++ try:
++ os.chown(self.fileConfigIni, self.uid, self.gid)
++ except OSError as e:
++ self.setError(_("error") + " " +\
++ "'chown %d:%d %s'"%(self.uid, self.gid,
++ self.fileConfigIni))
+ return textTemplateTmp
+
+ class ChangedFiles:
+@@ -3806,6 +3809,9 @@ class Template(_file,_terms,_warning,xmlShare,templateFormat,_shareTemplate):
+ os.environ["CONFIG_PROTECT"].split(" "))
+ protectPaths = map(lambda x: os.path.normpath(x), protectPaths)
+
++ def hasError(self):
++ return self.getError() or self.bHasError
++
+ def __init__(self, objVar, servDir=False, dirsFilter=[], filesFilter=[],
+ cltObj=True, cltFilter=True, printWarning=True,
+ printSUCCESS=lambda x:x,printWARNING=lambda x:x,
+@@ -3820,8 +3826,14 @@ class Template(_file,_terms,_warning,xmlShare,templateFormat,_shareTemplate):
+ self.changedFiles = ChangedFiles()
+ self.printSUCCESS = printSUCCESS
+ self.printERROR = printERROR
++ self.postmergePkgs = []
++ self.postmergeFile = "/var/lib/calculate/-postmerge"
++ self.bHasError = False
+ if printERROR:
+- self.setError = self.printERROR
++ def newSetError(s):
++ self.printERROR(s)
++ self.bHasError = True
++ self.setError = newSetError
+ self.printWARNING = printWARNING
+ self.askConfirm = askConfirm
+ self.stop = 0
+@@ -3898,7 +3910,8 @@ re.M|re.S)
+ self.dictProcessedTemplates = {}
+ if cltObj is True:
+ # Объект templateClt
+- self.cltObj = templateClt(self.objVar,printSUCCESS=self.printSUCCESS,
++ self.cltObj = templateClt(self.objVar,self.postmergePkgs,
++ printSUCCESS=self.printSUCCESS,
+ printERROR=self.printERROR,
+ printWARNING=self.printWARNING,
+ askConfirm=self.askConfirm)
+@@ -4253,9 +4266,10 @@ gettext -d cl_template "$*"
+ """Check template variable cl_name in first directories and files"""
+ skipDirs = []
+ skipTemplates = []
++ debug = self.objVar.Get('cl_env_debug_set') == "on"
+ for dirsTemplate in dirsTemplates:
+ filesAndDirs = map(lambda x: os.path.join(dirsTemplate,x),
+- os.listdir(dirsTemplate))
++ listDirectory(dirsTemplate))
+ for dirFile in filesAndDirs:
+ if os.path.isdir(dirFile):
+ flagDir = True
+@@ -4274,8 +4288,9 @@ gettext -d cl_template "$*"
+ if textTemplate:
+ headerLine = self.getHeaderText(textTemplate)
+ if headerLine:
+- if not "cl_name==" in headerLine and \
+- not "ac_" in headerLine:
++ if not debug and \
++ not "cl_name==" in headerLine and \
++ not "ac_" in headerLine:
+ if flagDir:
+ skipDirs.append(dirFile)
+ else:
+@@ -4567,7 +4582,10 @@ gettext -d cl_template "$*"
+ os.unlink(fn)
+ except Exception as e:
+ self.printWARNING(_("Failed to remove %s")%fn)
+- pkgContents.writeContents()
++ try:
++ pkgContents.writeContents()
++ except IOError as e:
++ self.printWARNING(_("Failed to modify %s contents")%pkg)
+ self.filesApply = map(lambda x:autoUpdateDict.get(x,x),self.filesApply)
+ if filter(lambda x:"._cfg" in x, self.filesApply):
+ self.printWARNING(_("Some config files need updating. "
+@@ -4600,7 +4618,11 @@ gettext -d cl_template "$*"
+ self.objVar.Get('cl_autoupdate_set') == 'on'):
+ optDir["autoupdate"] = True
+ if flagDir or stat.S_ISDIR(os.lstat(scanDir)[stat.ST_MODE]):
+- for fileOrDir in sorted(os.listdir(scanDir)):
++ if not os.access(scanDir,os.R_OK|os.X_OK):
++ self.printWARNING(_("Failed to read templates directory %s")%
++ scanDir)
++ return False
++ for fileOrDir in sorted(listDirectory(scanDir)):
+ absPath = os.path.join(scanDir,fileOrDir)
+ if skipTemplates and absPath in skipTemplates:
+ continue
+@@ -4688,6 +4710,9 @@ gettext -d cl_template "$*"
+ def processingDirectory(self, path, prefix, opt):
+ """Обработка в случае директории если возвращаем None то пропуск дир."""
+ # Файл шаблона директории
++ if not os.access(path,os.R_OK|os.X_OK):
++ self.printWARNING(_("Failed to read templates directory %s")%path)
++ return None
+ dirInfoFile = os.path.join(path, self.templDirNameFile)
+ newDir = pathJoin(self._baseDir, path.partition(prefix)[2])
+ newDir = "/".join(map(lambda x:x.split("?")[0], newDir.split("/")))
+@@ -4710,6 +4735,44 @@ gettext -d cl_template "$*"
+ if path in self.dictTemplates.keys():
+ self.numberProcessTempl += self.dictTemplates[path]
+ return None
++
++ def _processMergePostmerge(self,params, templateDirFile):
++ """Обработка параметров merge= , postmerge="""
++ if "merge" in params:
++ mergePkgs = params['merge'].split(',')
++ else:
++ mergePkgs = []
++ if "postmerge" in params:
++ postmergePkgs = params['postmerge'].split(',')
++ else:
++ postmergePkgs = []
++
++ if mergePkgs or postmergePkgs:
++ for wrongPkg in (x for x in mergePkgs + postmergePkgs \
++ if not self.functObj.checkCorrectPkgName(x)):
++ self.printWARNING(
++ _("Wrong package '%s' for 'merge' in the template")%
++ wrongPkg + ": " + templateDirFile)
++ if self.objVar.Get('cl_ebuild_phase') == 'postinst':
++ for pkg in postmergePkgs:
++ if not pkg in self.objVar.Get('cl_merge_pkg_pass'):
++ self.objVar.Get('cl_merge_pkg_pass').append(pkg)
++ if not pkg in self.postmergePkgs:
++ try:
++ with open(self.postmergeFile,"a") as f:
++ f.write("%s\n"%pkg)
++ self.postmergePkgs.append(pkg)
++ except:
++ self.printWARNING(
++ _("Failed to reconfigure %s package")%pkg)
++ else:
++ mergePkgs = mergePkgs + postmergePkgs
++
++ for pkg in mergePkgs:
++ if not pkg in self.objVar.Get('cl_merge_pkg_new') and \
++ not pkg in self.objVar.Get('cl_merge_pkg_pass') and \
++ not pkg in self.objVar.Get('cl_merge_pkg'):
++ self.objVar.Get('cl_merge_pkg_new').append(pkg)
+
+ def getApplyHeadDir(self, newDir, templateDirFile, optDir):
+ """Применяет шаблон к директории (права, владелец, и.т. д)"""
+@@ -4810,19 +4873,7 @@ gettext -d cl_template "$*"
+ return ("", False, [])
+
+ # add packeges for reconfigure
+- if "merge" in objHead.params:
+- mergePkgs = objHead.params['merge'].split(',')
+- for wrongPkg in (x for x in mergePkgs \
+- if not self.functObj.checkCorrectPkgName(x)):
+- self.printWARNING(
+- _("Wrong package '%s' for 'merge' in the template")%
+- wrongPkg + ": " + templateDirFile)
+- for pkg in mergePkgs:
+- if not pkg in self.objVar.Get('cl_merge_pkg_new') and \
+- not pkg in self.objVar.Get('cl_merge_pkg_pass') and \
+- not pkg in self.objVar.Get('cl_merge_pkg'):
+- self.objVar.Get('cl_merge_pkg_new').append(pkg)
+-
++ self._processMergePostmerge(objHead.params, templateDirFile)
+ # Пропускаем директорию
+ if objHead.typeAppend == "skip":
+ applyDir = path
+@@ -5076,7 +5127,7 @@ gettext -d cl_template "$*"
+ # Создание файла
+ FD = open(nameFileConfig, "w")
+ FD.close()
+- os.chown(nameFileConfig, uid, gid)
++ os.lchown(nameFileConfig, uid, gid)
+ except Exception as e:
+ if hasattr(e,'errno') and e.errno == 13 and \
+ "var/calculate/remote" in nameFileConfig:
+@@ -5145,18 +5196,7 @@ gettext -d cl_template "$*"
+ return ([], False)
+
+ # add packeges for reconfigure
+- if "merge" in objHeadNew.params:
+- mergePkgs = objHeadNew.params['merge'].split(',')
+- for wrongPkg in (x for x in mergePkgs \
+- if not self.functObj.checkCorrectPkgName(x)):
+- self.printWARNING(
+- _("Wrong package '%s' for 'merge' in the template")%
+- wrongPkg + ": " + nameFileTemplate)
+- for pkg in mergePkgs:
+- if not pkg in self.objVar.Get('cl_merge_pkg_new') and \
+- not pkg in self.objVar.Get('cl_merge_pkg_pass') and \
+- not pkg in self.objVar.Get('cl_merge_pkg'):
+- self.objVar.Get('cl_merge_pkg_new').append(pkg)
++ self._processMergePostmerge(objHeadNew.params, nameFileTemplate)
+
+ # Родительская директория
+ path = optFile["path"]
+@@ -5294,6 +5334,10 @@ gettext -d cl_template "$*"
+ if objHeadNew.params.has_key("mirror"):
+ if objHeadNew.params.has_key("link"):
+ templateFile = objHeadNew.params['link']
++ if templateFile and templateFile[0] == "~":
++ # Получаем директорию пользователя
++ templateFile = os.path.join(self.homeDir,
++ templateFile.partition("/")[2],"")[:-1]
+ templateFile = pathJoin(self._baseDir, templateFile)
+ if not os.path.exists(templateFile):
+ if os.path.exists(pathOldFile):
+@@ -5312,6 +5356,10 @@ gettext -d cl_template "$*"
+ if objHeadNew.params.has_key("link") and\
+ not objHeadNew.params.has_key("symbolic"):
+ templateFile = objHeadNew.params['link']
++ if templateFile and templateFile[0] == "~":
++ # Получаем директорию пользователя
++ templateFile = os.path.join(self.homeDir,
++ templateFile.partition("/")[2],"")[:-1]
+ templateFile = pathJoin(self._baseDir, templateFile)
+ foundTemplateFile = os.path.exists(templateFile)
+ if foundTemplateFile:
+@@ -5981,7 +6029,7 @@ class scanDirectoryClt:
+ if not prefix:
+ prefix = os.path.realpath(scanDir)
+ if flagDir or stat.S_ISDIR(os.lstat(scanDir)[stat.ST_MODE]):
+- for fileOrDir in sorted(os.listdir(scanDir)):
++ for fileOrDir in sorted(listDirectory(scanDir)):
+ try:
+ absPath = os.path.join(scanDir,fileOrDir)
+ stInfo = os.lstat(absPath)
+@@ -6012,9 +6060,10 @@ class scanDirectoryClt:
+ class templateClt(scanDirectoryClt, Template):
+ """Класс для обработки шаблонов c расширением .clt"""
+
+- def __init__(self, objVar,**kwargs):
++ def __init__(self, objVar, postmergePkgs, **kwargs):
+ self.checkNumberTemplate = True
+ Template.__init__(self, objVar, cltObj=False,**kwargs)
++ self.postmergePkgs = postmergePkgs
+ applyPackages = ["calculate-core"]
+ self.flagApplyTemplates = False
+ if self.objVar.Get("cl_name") in applyPackages:
+@@ -6035,6 +6084,7 @@ class templateClt(scanDirectoryClt, Template):
+ # Пропуск шаблонов директорийscanningTemplates
+ if self.templDirNameFile == os.path.split(path)[1]:
+ return True
++ self.functObj.currentBelong = ""
+ # Проверка на переменные в названии файла
+ if not self.getNeedTemplate(path):
+ if self.getError():
+diff --git calculate/lib/utils/files.py calculate/lib/utils/files.py
+index e9d19ad..fca4e6e 100644
+--- calculate/lib/utils/files.py
++++ calculate/lib/utils/files.py
+@@ -44,13 +44,23 @@ def timeout(seconds):
+ signal.signal(signal.SIGALRM, original_handler)
+
+ try:
+- from magic import open as type_file, MAGIC_NONE as MAGIC_NONE
+-except ImportError:
++ from magic import (open as type_file, MAGIC_NONE, MAGIC_CONTINUE,
++ MAGIC_MIME_TYPE, MAGIC_COMPRESS,
++ MAGIC_MIME_ENCODING, MAGIC_SYMLINK)
++except ImportError as e:
+ try:
+- from magic import open as type_file, NONE as MAGIC_NONE
++ from magic import (open as type_file, NONE as MAGIC_NONE,
++ CONTINUE as MAGIC_CONTNUE, MIME_TYPE as MAGIC_MIME_TYPE,
++ COMPRESS as MAGIC_COMPRESS,MIME_ENCODING as MIME_ENCODING,
++ SYMLINK as MAGIC_SYMLINK)
+ except:
+ type_file = None
+- MAGIC_NONE = None
++ MAGIC_NONE = 0
++ MAGIC_SYMLINK = 0x002
++ MAGIC_COMPRESS = 0x004
++ MAGIC_CONTINUE = 0x020
++ MAGIC_MIME_TYPE = 0x010
++ MAGIC_MIME_ENCODING = 0x400
+
+ from calculate.lib.cl_lang import setLocalTranslate
+ setLocalTranslate('cl_lib3',sys.modules[__name__])
+@@ -273,22 +283,33 @@ class proxy_type_file:
+ def close(self):
+ pass
+
++ def _get_cmd_by_flags(self,flags):
++ """
++ Получить команду для выполнения по флагам
++ """
++ paramdict = {MAGIC_CONTINUE:"-k",
++ MAGIC_SYMLINK:"-L",
++ MAGIC_MIME_TYPE:"--mime-type",
++ MAGIC_MIME_ENCODING:"--mime-encoding",
++ MAGIC_COMPRESS:"-z"}
++ appendParam = map(lambda x:paramdict[x],
++ filter(lambda x:flags & x,
++ sorted(paramdict.keys())))
++ fileCmd = getProgPath('/usr/bin/file')
++ return [fileCmd,'-b']+appendParam
++
+ def file(self,filename):
+ if path.exists(filename):
+- if self.flags == 0x410:
+- processFile = process("file","-bi",filename)
+- if processFile.success():
+- return processFile.read().rstrip()
+- else:
+- processFile = process("file","-bz",filename)
+- if processFile.success():
+- return processFile.read().rstrip()
++ processFile = \
++ process(*(self._get_cmd_by_flags(self.flags)+[filename]))
++ if processFile.success():
++ return processFile.read().rstrip()
+ return None
+
+ class typeFile:
+ """Получение типа файла"""
+
+- def __init__(self, magic=0x410):
++ def __init__(self, magic=MAGIC_MIME_ENCODING|MAGIC_MIME_TYPE):
+ if type_file is None:
+ self.magicObject = proxy_type_file(MAGIC_NONE)
+ else:
+@@ -318,12 +339,10 @@ class typeFile:
+ def isBinary(self, filename):
+ """является ли файл бинарным"""
+ mime = self.getMType(filename)
+- # В случае ошибки
+- if mime.count("`"):
+- return mime
+- elif mime.count("binary"):
++ if mime.startswith("text"):
++ return False
++ else:
+ return True
+- return False
+
+ class scanDirectory:
+ """Класс для cканирования директории"""
+diff --git calculate/lib/utils/ip.py calculate/lib/utils/ip.py
+index 5fd7c18..25d84b5 100644
+--- calculate/lib/utils/ip.py
++++ calculate/lib/utils/ip.py
+@@ -126,10 +126,17 @@ def intIpToStrIp(addr):
+ return "{0}.{1}.{2}.{3}".format(
+ addr>>24,(addr>>16)&0xff,(addr>>8)&0xff,addr&0xff)
+
++def numMaskToCidr(netmask):
++ """
++ Convert integer mask to cidr
++ """
++ neg_net = ctypes.c_uint32(~netmask).value
++ return 32 - int(math.log(neg_net,2))-1 if neg_net else 32
++
+ def maskToCidr(mask):
+ """Convert mask specified by str to net"""
+ mask = strIpToIntIp(mask)
+- return 32-int(math.log(((~mask) & 0xffffffff)+1,2))
++ return numMaskToCidr(mask)
+
+ def cidrToMask(cidr):
+ """Convert net to mask specified by str"""
+@@ -234,7 +241,7 @@ def getMask(iface):
+ finally:
+ sockfd.close()
+ netmask = socket.ntohl(struct.unpack('16sH2xI8x', res)[2])
+- return 32 - int(math.log(ctypes.c_uint32(~netmask).value + 1, 2))
++ return numMaskToCidr(netmask)
+
+ def getMac(iface):
+ """
+diff --git calculate/lib/variables/__init__.py calculate/lib/variables/__init__.py
+index 5bd1cf6..8792ca3 100644
+--- calculate/lib/variables/__init__.py
++++ calculate/lib/variables/__init__.py
+@@ -41,4 +41,4 @@ class VariableClVer(ReadonlyVariable):
+ """
+ Package version
+ """
+- value = "3.1.9"
++ value = "3.1.9.4"
+diff --git calculate/lib/variables/env.py calculate/lib/variables/env.py
+index 6d376e5..83ecdb4 100644
+--- calculate/lib/variables/env.py
++++ calculate/lib/variables/env.py
+@@ -402,3 +402,10 @@ class VariableClTemplateCltSet(ReadonlyVariable):
+ """
+ def get(self):
+ return "on" if "clt" in self.Get('cl_templates_locate') else "off"
++
++class VariableClEnvDebugSet(ReadonlyVariable):
++ """
++ Переменная для включения отладки
++ """
++ type = "bool"
++ value = "off"
+diff --git calculate/lib/variables/system.py calculate/lib/variables/system.py
+index 1e43f15..70749aa 100644
+--- calculate/lib/variables/system.py
++++ calculate/lib/variables/system.py
+@@ -75,6 +75,20 @@ class VariableOsRootDev(ReadonlyVariable):
+ return {'none':'/dev/ram0'}.get(root_dev,root_dev)
+ return ""
+
++class VariableOsMapperRootDev(ReadonlyVariable):
++ """
++ Название диска через devicemapper если возможно
++ """
++ def get(self):
++ rootdev = self.Get('os_root_dev')
++ devLinks = getUdevDeviceInfo(name=rootdev).get("DEVLINKS","")
++ if devLinks:
++ mapperName = filter(lambda x:"/dev/mapper" in x,
++ devLinks.split())
++ if mapperName:
++ return mapperName[0]
++ return rootdev
++
+ class VariableOsRootType(ReadonlyVariable):
+ """
+ Root type (ram, hdd, usb-hdd, livecd)
diff --git a/sys-apps/calculate-utilities/Manifest b/sys-apps/calculate-utilities/Manifest
index 0a1ee410a..8a7876552 100644
--- a/sys-apps/calculate-utilities/Manifest
+++ b/sys-apps/calculate-utilities/Manifest
@@ -45,6 +45,7 @@ EBUILD calculate-utilities-3.1.9-r25.ebuild 771 SHA256 b4d7992d3a501e41f904446ad
EBUILD calculate-utilities-3.1.9-r26.ebuild 771 SHA256 b384a483d7ea0350ce43e6fd37b49e7591de362535d19550d2bbafac22d0c507 SHA512 e07c50fd27e4d141037532348b3084432fff0e14277a61d18fb71c6d065a37aada1a2f620ee6c5ffdbe0e2360dad8ec22daf8ab242c6efaa5b7559cbb3cb7ee9 WHIRLPOOL 6b2766f28653a45920724045e0b51d819ca402715db56b6d5ada721b8e168c6f34d1450a225e709be7167c6dfc8ca7c91e9d8a6da11accb37f572e99a78c64bb
EBUILD calculate-utilities-3.1.9-r27.ebuild 772 SHA256 257ddc6c781d2389d8ea1b2931e55b4bbb3f7887a57b4df12f63f84829886b29 SHA512 b34ad9aa22d497c985a953a466293747bedd3d8bbabaabb0bc5a76be04d39159072599184e7eb3cc8e457124151af904c9260bc6cf052225e7d7f9c332b77aaa WHIRLPOOL 302860289371244ca0b8aca33552220a257b8f0344c655c121317174e5cf3f2f68774f2ba45f2790ddd73c0486b240600347c5ff54a630cb4b61558d7be4e14e
EBUILD calculate-utilities-3.1.9-r28.ebuild 772 SHA256 9f03600e56b217e8294de7a8f8787afc72cecde02161ddc2c723f3e3c820e3a7 SHA512 2a1bebfdd62c083d3b84307cdc90e950f9cedc06cea30ec22c30b90cece76caf4bfc170962055e1e0df35f8df54debd664fd7ba0b131842025fee169d67a3293 WHIRLPOOL 3a64ca2e74df6b9e03aa09f531a48a01a9d6aef706719cab33262fa45e505bb0725153e777c93f893407b88febf8db6d9c4c85e1877d56007e8f8ebe493e7687
+EBUILD calculate-utilities-3.1.9-r29.ebuild 772 SHA256 e2e20539a465cccc75f6be6f14ac8409b43319c87f8cd10121a29ac2ef3830ca SHA512 42bd49cde7235a1cda33f6b8d7f041a36a286cc9b3755f2106b15154ed1b481756c6d55941cd2d8176c66ebcabe9d22fcc856d78b03db965a619fb57b285d9ad WHIRLPOOL 99ec7c8c2f14be6e79dc459a35d79a6c4e14a84c7745e83c71017e94bd58c8f91d53abd5448354bdff7855b931fb1520e81a64757107dd5db276683fdc309005
EBUILD calculate-utilities-3.1.9-r3.ebuild 758 SHA256 7bdb0132b728c1a0b8ea57f0ea585afdc82f9d80aff5a13909bc152321a7ec28 SHA512 228155e8264c47456a5b375ef160e64557a87aa7e32adcb6136ef0df78f6a5b93c83d1293bf682bb00c7caa39821560ebf7c0c07200c5b65cf385b26e9607e64 WHIRLPOOL a2b35dd15636e6528f7828c9ebc1b1084c8cc3ba5384e68aea826f0c3b0220cd4376b35220eec77b40194c2ba62be1bc652407b45efab5ee999167d6c9cc90c7
EBUILD calculate-utilities-3.1.9-r4.ebuild 761 SHA256 14ec84c6cad91bc692b12b8ba2f3f78698f76a1570faf6cbf84f644aac6baecf SHA512 a51fa4a937eb13eb6ad7048f68e86903fcdbf37531668def216a3f745c253e353b5f893e91982bc16c874bfe82146dea2165c24ef26a9a28164923a772b72f40 WHIRLPOOL 4b185030c44756d36afda759a4d5f83156b42c7b9378f4045ba5cb9cbd3e9a1f1cb337184d642be9f844962fbfe4aa1d40086c07226b8688b7ea1e1078301845
EBUILD calculate-utilities-3.1.9-r5.ebuild 761 SHA256 a6ddc522be5784c19c22e360f17c5c1149f92c7c23eabe724a00d0b20be9424d SHA512 2b8d02937095edfb747926d11140a2cc44ee266668b9b830dba86efe149e03b4cc0eeea662e2c2c299f58039de70c8dec089422e9636470a6e7039f5dd7752ab WHIRLPOOL 391954432a980cbaddf39ba75a65483067941f62375e2d955820525c8f0513e3b8c766dd377b28f4cb3d52aaab4fbb447ee2093f6bd60b39cac27973887d6b3e
diff --git a/sys-apps/calculate-utilities/calculate-utilities-3.1.9-r29.ebuild b/sys-apps/calculate-utilities/calculate-utilities-3.1.9-r29.ebuild
new file mode 100644
index 000000000..c3aeaf9d4
--- /dev/null
+++ b/sys-apps/calculate-utilities/calculate-utilities-3.1.9-r29.ebuild
@@ -0,0 +1,26 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+DESCRIPTION="Calculate Utilities meta package"
+HOMEPAGE="http://www.calculate-linux.org/main/en/calculate2"
+SRC_URI=""
+
+LICENSE="Apache-2.0"
+SLOT="3"
+KEYWORDS="amd64 x86"
+IUSE="cl_consolegui cl_client cl_desktop cl_console"
+
+RDEPEND="${RDEPEND}
+ =sys-apps/calculate-install-3.1.9-r12
+ =sys-apps/calculate-i18n-3.1.9
+ =sys-apps/calculate-lib-3.1.9-r13
+ =sys-apps/calculate-core-3.1.9-r4
+ =sys-apps/calculate-update-3.1.9
+ cl_client? ( =sys-apps/calculate-client-3.1.9-r3 )
+ cl_desktop? ( =sys-apps/calculate-desktop-3.1.9-r4 )
+ cl_consolegui? ( =sys-apps/calculate-console-gui-3.1.9-r1 )
+ cl_console? ( =sys-apps/calculate-console-3.1.9-r1 )
+"