core updated.

This commit is contained in:
Ertuğrul Erata
2015-05-17 16:28:10 +03:00
parent 14d58aa1d0
commit 8e13c775be
558 changed files with 543408 additions and 27657 deletions
+43
View File
@@ -0,0 +1,43 @@
fix issue #562
https://github.com/pisilinux/PisiLinux/issues/562
--- bin/mudur.py.orig 2015-05-11 20:46:23.509195049 +0200
+++ bin/mudur.py 2015-05-11 22:26:06.000000000 +0200
@@ -1406,7 +1406,7 @@
UI.info(_("Creating tmpfiles"))
if not os.path.isdir("/run/tmpfiles.d"): create_directory("/run/tmpfiles.d")
run("/usr/bin/kmod", "static-nodes", "--format=tmpfiles", "--output=/run/tmpfiles.d/kmod.conf")
- out = [line for line in capture("/sbin/mudur_tmpfiles.py")[0].split("\n") if line.strip()]
+ out = [line for line in capture("/sbin/mudur_tmpfiles.py", "--boot")[0].split("\n") if line.strip()]
if out: LOGGER.log("Errors during tmpfiles creation.\n\t%s" % "\n\t".join(out))
run("mount", "-t", "tmpfs", "tmpfs", "/dev/shm")
--- bin/mudur_tmpfiles.py.orig 2015-05-11 20:46:23.519200049 +0200
+++ bin/mudur_tmpfiles.py 2015-05-11 20:40:04.000000000 +0200
@@ -80,6 +80,7 @@
if __name__ == "__main__":
if ("-h" or "--help") in sys.argv: usage()
+ boot = True if "--boot" in sys.argv else False
config_files = {}
errors = []
@@ -90,7 +91,7 @@
except KeyError:
config_files[head] = [tail]
- if sys.argv[1:]:
+ if sys.argv[1:] and not boot:
for arg in sys.argv[1:]:
(head, tail) = os.path.split(arg)
if not tail.endswith(".conf"): errors.append("%s is not .conf file" % tail)
@@ -130,6 +131,9 @@
if i == "-": fields[n] = ""
if not fields[3]: fields[3] = "root"
if not fields[4]: fields[4] = "root"
+ if fields[0].endswith("!"):
+ if not boot: continue
+ else: fields[0] = fields[0].replace("!", "")
if not fields[0] in ["c", "d", "D", "f", "F", "L", "w"]: errors.append("%s - wrong type in file: %s" % (fields[0], os.path.join(d, f)))
elif fields[0] == "L":
if not fields[6]: errors.append("No arg for type 'L' specified in file: %s" % os.path.join(d, f))
@@ -0,0 +1,115 @@
diff -Nuar mudur-4.4.0.orig/bin/mudur_cgroupfs.py mudur-4.4.0/bin/mudur_cgroupfs.py
--- mudur-4.4.0.orig/bin/mudur_cgroupfs.py 1970-01-01 02:00:00.000000000 +0200
+++ mudur-4.4.0/bin/mudur_cgroupfs.py 2015-05-13 22:58:43.264005210 +0300
@@ -0,0 +1,81 @@
+# -*- coding : utf-8 -*-
+import os, sys
+
+def mountpoint(path):
+ status = os.system("mountpoint -q %s" % path)
+ if status == 0:
+ return True
+ else:
+ return False
+
+class Controller:
+ def __init__(self, subsysname, hierarchy, num_cgroups, enabled ):
+ self.subsysname = subsysname
+ self.hierarchy = hierarchy
+ self.num_cgroups = num_cgroups
+ self.enabled = enabled
+
+ def mount(self):
+ if self.enabled == 1:
+ os.chdir("/sys/fs/cgroup")
+ if mountpoint(self.subsysname) == False:
+ s = self.subsysname
+ status = os.system("mkdir -p %s; mount -n -t cgroup -o %s cgroup %s" % (s, s,s))
+ if status == 0:
+ return True
+ else:
+ return False
+
+
+class Cgroupfs:
+ def __init__(self):
+ self.controllers = {}
+ if self.check_fstab == True:
+ print("cgroupfs in fstab, exiting.")
+ sys.exit(-1)
+
+ if self.kernel_support() == False:
+ print("No kernel support for cgroupfs, exiting.")
+ sys.exit(-2)
+
+ if self.check_sysfs() == False:
+ print("/sys/fs/cgroups directory not found, exiting")
+ sys.exit(-3)
+
+ self.mount_cgroup()
+ self.find_controllers()
+ for cname, c in self.controllers.items():
+ c.mount()
+
+ def check_fstab(self):
+ found = False
+ for line in open("/etc/fstab").readlines():
+ if line[0] == "#":
+ continue
+ else:
+ if line.find("cgroup"):
+ found = True
+ return found
+
+ def kernel_support(self):
+ return os.path.isfile("/proc/cgroups")
+
+ def check_sysfs(self):
+ return os.path.isdir("/sys/fs/cgroup")
+
+ def mount_cgroup(self):
+ if mountpoint("/sys/fs/cgroup") == False:
+ cmd = " mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup"
+ return os.system(cmd)
+
+ def find_controllers(self):
+ for line in open("/proc/cgroups").readlines():
+ line = line.strip()
+ if line[0] == "#":
+ continue
+ else:
+ subsysname, hierarchy, num_cgroups, enabled = line.split()
+ enb = int(enabled)
+ hie = int(hierarchy)
+ numc= int(num_cgroups)
+ self.controllers[subsysname] = Controller(subsysname, hie, numc, enb)
diff -Nuar mudur-4.4.0.orig/bin/mudur.py mudur-4.4.0/bin/mudur.py
--- mudur-4.4.0.orig/bin/mudur.py 2015-05-13 22:57:33.660007190 +0300
+++ mudur-4.4.0/bin/mudur.py 2015-05-13 22:59:17.161004246 +0300
@@ -22,6 +22,7 @@
import signal
import gettext
import subprocess
+from mudur_cgroupfs import Cgroupfs
########
# i18n #
@@ -1025,6 +1026,7 @@
break
df.close()
run_full("/bin/mount", "-t", "tmpfs", "-o", "nodev,nosuid,size=10%,mode=755", "tmpfs", "/run")
+ c = Cgroupfs()
def mount_remote_filesystems():
"""Mounts remote filesystems."""
diff -Nuar mudur-4.4.0.orig/setup.py mudur-4.4.0/setup.py
--- mudur-4.4.0.orig/setup.py 2014-03-07 23:15:31.000000000 +0200
+++ mudur-4.4.0/setup.py 2015-05-13 23:05:23.092993840 +0300
@@ -77,6 +77,7 @@
install_file("bin/mudur.py", prefix, "sbin/mudur.py")
install_file("bin/mudur_tmpfiles.py", prefix, "sbin/mudur_tmpfiles.py")
+ install_file("bin/mudur_cgroupfs.py", prefix, "sbin/mudur_cgroupfs.py")
install_file("bin/update-environment.py", prefix, "sbin/update-environment")
install_file("bin/update-fstab.py", prefix, "sbin/update-fstab")
install_file("bin/compat.py", prefix, "etc/init.d/compat.py")
@@ -0,0 +1,11 @@
--- bin/mudur.py~ 2014-06-14 14:28:45.136961885 +0200
+++ bin/mudur.py 2014-06-14 14:29:12.000000000 +0200
@@ -1406,7 +1406,7 @@
UI.info(_("Creating tmpfiles"))
if not os.path.isdir("/run/tmpfiles.d"): create_directory("/run/tmpfiles.d")
run("/usr/bin/kmod", "static-nodes", "--format=tmpfiles", "--output=/run/tmpfiles.d/kmod.conf")
- out = capture("/sbin/mudur_tmpfiles.py")[0].strip().split("\n")
+ out = [line for line in capture("/sbin/mudur_tmpfiles.py")[0].split("\n") if line.strip()]
if out: LOGGER.log("Errors during tmpfiles creation.\n\t%s" % "\n\t".join(out))
run("mount", "-t", "tmpfs", "tmpfs", "/dev/shm")
@@ -0,0 +1,13 @@
--- bin/mudur_tmpfiles.py~ 2014-05-16 03:56:41.000000000 +0200
+++ bin/mudur_tmpfiles.py 2014-06-11 21:54:58.333421994 +0200
@@ -37,6 +37,10 @@
open(path, mode).write(content)
def create(type, path, mode, uid, gid, age, arg):
+ if type == "d" and \
+ os.path.isdir(path) and \
+ (not uid == os.stat(path).st_uid or not gid == os.stat(path).st_gid):
+ type = "D"
if type == "L":
if not os.path.islink(path): os.symlink(arg, path)
return
@@ -0,0 +1,10 @@
--- bin/mudur_tmpfiles.py~ 2014-08-03 17:48:07.461463934 +0200
+++ bin/mudur_tmpfiles.py 2014-08-03 17:49:06.951461761 +0200
@@ -63,6 +63,7 @@
os.makedirs(os.path.dirname(path))
os.chown(os.path.dirname(path), uid, gid)
write_file(path, arg, mode = "a" if type == "f" else "w")
+ os.chmod(path, mode)
os.chown(path, uid, gid)
USAGE = """\