summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/antimatter-digest28
-rw-r--r--bin/antimatter/antimatter.html.footer2
-rw-r--r--bin/antimatter/antimatter.html.header27
-rwxr-xr-xbin/armv7a-emerge28
-rwxr-xr-xbin/atoms_to_keylost17
-rw-r--r--bin/buildrc73
-rwxr-xr-xbin/bump_ati_drivers22
-rw-r--r--bin/bump_crossdev20
-rwxr-xr-xbin/bump_injected_ati_drivers19
-rwxr-xr-xbin/bump_injected_kernel_mods41
-rwxr-xr-xbin/bump_injected_nvidia_drivers20
-rwxr-xr-xbin/bump_kernel_package27
-rwxr-xr-xbin/bump_kernel_package_inject17
-rwxr-xr-xbin/bump_kernel_packages246
-rwxr-xr-xbin/bump_kernel_video_drivers33
-rwxr-xr-xbin/bump_misc60
-rwxr-xr-xbin/bump_notice_weekly_repo2
-rwxr-xr-xbin/bump_nvidia_drivers23
-rwxr-xr-xbin/bump_vbox27
-rwxr-xr-xbin/bump_weekly_repo2
-rwxr-xr-xbin/check_la66
-rwxr-xr-xbin/clean_old_injected_packages91
-rwxr-xr-xbin/get_package_changes54
-rwxr-xr-xbin/get_package_changes_client55
-rwxr-xr-xbin/get_preserved_libs126
-rwxr-xr-xbin/glsa-digest5
-rwxr-xr-xbin/kernel-autobump150
-rwxr-xr-xbin/kernel-autobump-tracker12
-rw-r--r--bin/kernels.inc3
-rwxr-xr-xbin/matter-scheduler-chroot33
-rwxr-xr-xbin/rebuild_e1718
-rwxr-xr-xbin/sshd_wrapper3
-rwxr-xr-xbin/test_dep_rewrite41
33 files changed, 1391 insertions, 0 deletions
diff --git a/bin/antimatter-digest b/bin/antimatter-digest
new file mode 100755
index 0000000..d62a1f8
--- /dev/null
+++ b/bin/antimatter-digest
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+. /etc/profile
+
+set -e
+
+TMPL_PATH="$(dirname "${0}")/antimatter"
+HEADER_PATH="${TMPL_PATH}/antimatter.html.header"
+FOOTER_PATH="${TMPL_PATH}/antimatter.html.footer"
+ANTIMATTER="${ANTIMATTER:-antimatter}"
+
+(
+ cat "${HEADER_PATH}"
+
+ # Upgradable packages
+ "${ANTIMATTER}" -u --quiet --extended --html
+
+ # Dead packages (dropped by upstream)
+ "${ANTIMATTER}" -e --quiet --extended --html
+
+ # New packages - temp disabled
+ # "${ANTIMATTER}" -n --quiet --extended --html
+ # cat "${FOOTER_PATH}"
+
+) | sed \
+ -e "s|class='rt'|style='color: green;'|g" \
+ -e "s|class='frompkg'|style='color: brown;'|g" \
+ -e "s|class='topkg'|style='font-weight: bold; color: red;'|g"
diff --git a/bin/antimatter/antimatter.html.footer b/bin/antimatter/antimatter.html.footer
new file mode 100644
index 0000000..308b1d0
--- /dev/null
+++ b/bin/antimatter/antimatter.html.footer
@@ -0,0 +1,2 @@
+</body>
+</html>
diff --git a/bin/antimatter/antimatter.html.header b/bin/antimatter/antimatter.html.header
new file mode 100644
index 0000000..53dd3c4
--- /dev/null
+++ b/bin/antimatter/antimatter.html.header
@@ -0,0 +1,27 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<body>
+
+<style>
+.rt {
+ color: green;
+ font-family: arial, sans-serif;
+ font-size: 0.85em;
+}
+
+.rd {
+ font-size: 0.7em;
+ margin-bottom: 0.3em;
+}
+
+.frompkg {
+ color: brown;
+ font-family: arial, sans-serif;
+}
+
+.topkg {
+ color: red;
+ font-weight: bold;
+ font-family: arial, sans-serif;
+}
+</style>
diff --git a/bin/armv7a-emerge b/bin/armv7a-emerge
new file mode 100755
index 0000000..742b925
--- /dev/null
+++ b/bin/armv7a-emerge
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+. /etc/make.conf
+
+# just make sure
+FEATURES="${FEATURES} distcc distcc-pump"
+
+DISTCC_PATH="/usr/lib/distcc/bin"
+CUR_CHOST="$(basename /usr/lib/gcc/armv*)"
+DISTCC_WRAPPER="${CUR_CHOST}-wrapper"
+
+pushd "${DISTCC_PATH}" > /dev/null || exit 1
+cur_link=$(readlink cc)
+if [ "${cur_link}" = "/usr/bin/distcc" ] || [ ! -f "${DISTCC_WRAPPER}" ]; then
+ echo "Fixing links in ${DISTCC_PATH}"
+ rm -f c++ g++ gcc cc || exit 1
+ echo "#!/bin/bash" > "${DISTCC_WRAPPER}"
+ echo "exec /usr/lib/distcc/bin/${CUR_CHOST}-g\${0:\$[-2]} \"\$@\"" >> "${DISTCC_WRAPPER}"
+ chmod a+x "${DISTCC_WRAPPER}" || exit 1
+ ln -s "${DISTCC_WRAPPER}" cc || exit 1
+ ln -s "${DISTCC_WRAPPER}" gcc || exit 1
+ ln -s "${DISTCC_WRAPPER}" g++ || exit 1
+ ln -s "${DISTCC_WRAPPER}" c++ || exit 1
+fi
+popd > /dev/null
+
+export FEATURES PATH
+exec emerge "$@"
diff --git a/bin/atoms_to_keylost b/bin/atoms_to_keylost
new file mode 100755
index 0000000..60e8404
--- /dev/null
+++ b/bin/atoms_to_keylost
@@ -0,0 +1,17 @@
+#!/usr/bin/python
+import sys
+import entropy.dep
+
+atoms = sys.argv[1:]
+
+keyslot_cache = set()
+for atom in atoms:
+ key = entropy.dep.dep_getkey(atom)
+ with open("/var/db/pkg/%s/SLOT" % (atom,)) as slot_f:
+ slot = slot_f.readline().strip()
+ keyslot = "%s:%s" % (key, slot)
+ if keyslot in keyslot_cache:
+ continue
+ print(keyslot)
+ keyslot_cache.add(keyslot)
+
diff --git a/bin/buildrc b/bin/buildrc
new file mode 100644
index 0000000..237f0b2
--- /dev/null
+++ b/bin/buildrc
@@ -0,0 +1,73 @@
+#!/bin/bash
+
+_exec_locked() {
+ local tmp_dir="/var/tmp"
+ local lvm_snapshot_lock_file="/.entropy_locks/vg_chroots-lv_chroots-snapshot.lock"
+ local snapshot_lock_file="${tmp_dir}/.emerge.snapshot.lock"
+ local matter_lock_file="${tmp_dir}/.matter_resource.lock"
+
+ if [ ! -d "${tmp_dir}" ]; then
+ echo "${tmp_dir} is missing, creating it..." >&2
+ mkdir -p "${tmp_dir}"
+ fi
+
+ flock -x -n "${matter_lock_file}" true
+ rc=${?}
+ if [ "${rc}" != "0" ]; then
+ echo >&2
+ echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" >&2
+ echo "Matter or the Backup Script is running on this chroot" >&2
+ echo "Please be patient, it will eventually terminate..." >&2
+ echo "Snapshot lock file = ${snapshot_lock_file}" >&2
+ echo "Matter lock file = ${matter_lock_file}" >&2
+ echo >&2
+ echo "This ${1} instance will terminate NOW" >&2
+ echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" >&2
+ echo >&2
+ return 1
+ else
+ # acquire snapshot read lock in non-blocking, shared mode
+ (
+ flock -s -n 9 || {
+ echo "Hello there," >&2;
+ echo "a chroot snapshot is in progress..." >&2;
+ echo "Try again later." >&2;
+ exit 1;
+ }
+
+ flock -s --timeout=120 10
+ if [ "${?}" != "0" ]; then
+ echo >&2
+ echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" >&2
+ echo "The LVM lock of the Backup Script is being held for 2 minutes" >&2
+ echo "This should not happen. Please contact stefan.cristian@rogentos.ro and" >&2
+ echo "stop any activity NOW. However, if you're in an emergency" >&2
+ echo "Just rm ${lvm_snapshot_lock_file} and continue." >&2
+ echo "Please note that this will cause inconsistent backups." >&2
+ echo >&2
+ echo "This instance will terminate NOW" >&2
+ echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" >&2
+ echo >&2
+ exit 1
+ fi
+
+ "${@}"
+ exit ${?}
+
+ ) 9> "${snapshot_lock_file}" 10>"${lvm_snapshot_lock_file}"
+ return ${?}
+ fi
+}
+
+emerge() {
+ _exec_locked "/usr/bin/emerge" --quiet-build=y --oneshot "${@}"
+ return ${?}
+}
+
+eit() {
+ _exec_locked "/usr/bin/eit" "${@}"
+ return ${?}
+}
+
+# Alias configuration
+alias cosmos=/particles/cosmos/cosmos
diff --git a/bin/bump_ati_drivers b/bin/bump_ati_drivers
new file mode 100755
index 0000000..e0e5040
--- /dev/null
+++ b/bin/bump_ati_drivers
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+. /kogaion/bin/kernels.inc
+packages="x11-drivers/ati-drivers::kogaion-desktop"
+
+# build for latest kernel
+KERNEL_DIR="/usr/src/linux-${running_kernel}" emerge $packages media-video/amdcccle::kogaion-desktop
+echo -5 | etc-update
+eit commit
+
+for kernel in $kernels; do
+ if [ "${kernel}" = "${running_kernel}" ]; then
+ continue
+ fi
+ rm -rf /usr/portage/packages/*
+ KERNEL_DIR="/usr/src/linux-${kernel}" emerge -B ${packages} || { echo "ouch unable to build" && exit 1; }
+ built_pkgs=$(find /usr/portage/packages -name "*.tbz2" | xargs echo)
+ [[ -z "${built_pkgs}" ]] && echo "ouch no kernel pkgs" && exit 2
+ eit inject ${built_pkgs} || { echo "ouch unable to inject" && exit 3; }
+done
+
+echo "Now you should remove old packages..."
diff --git a/bin/bump_crossdev b/bin/bump_crossdev
new file mode 100644
index 0000000..668b817
--- /dev/null
+++ b/bin/bump_crossdev
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+ARCHES=(
+ armv7a-hardfloat-linux-gnueabi
+ armv7a-unknown-linux-gnueabi
+ armv6j-hardfloat-linux-gnueabi
+)
+
+GCC_VER="--g ~4.7.3"
+LIBC_VER="--l ~2.17"
+K_VER="--k ~3.7"
+BINUTILS_VER="--b =2.23*"
+
+for a in "${ARCHES[@]}"; do
+ # USE="-fortran" or glibc will fail to compile
+ USE="-fortran -gtk" crossdev -t "${a}" \
+ -oS "/usr/local/portage" \
+ -oO "/usr/local/portage" \
+ ${GCC_VER} ${LIBC_VER} ${K_VER} ${BINUTILS_VER} || exit 1
+done
diff --git a/bin/bump_injected_ati_drivers b/bin/bump_injected_ati_drivers
new file mode 100755
index 0000000..5ee9e62
--- /dev/null
+++ b/bin/bump_injected_ati_drivers
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+kernels="2.6.36-kogaion 2.6.37-kogaion 2.6.38-kogaion"
+packages="=x11-drivers/ati-drivers-11.2-r1"
+non_injected_packages="~x11-drivers/ati-userspace-11.2"
+ETP_REPO="${ETP_REPO:-kogaion-testing}"
+
+rm -rf /usr/portage/packages/x11-drivers/*
+emerge -B ${non_injected_packages} || exit 1
+eit inject --to ${ETP_REPO} /usr/portage/packages/x11-drivers/* || exit 1
+
+for kernel in $kernels; do
+ mypackages="${packages}"
+ # build for latest kernel
+ rm -rf /usr/portage/packages/x11-drivers/*
+ KERNEL_DIR="/usr/src/linux-${kernel}" emerge -B ${mypackages} || exit 1
+ eit inject --to ${ETP_REPO} /usr/portage/packages/x11-drivers/*
+ echo
+done
diff --git a/bin/bump_injected_kernel_mods b/bin/bump_injected_kernel_mods
new file mode 100755
index 0000000..240706b
--- /dev/null
+++ b/bin/bump_injected_kernel_mods
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+kernel="${1}"
+if [ -z "${kernel}" ]; then
+ echo "$0 <kernel>"
+ echo "example: $0 2.6.35-kogaion"
+ exit 1
+fi
+
+packages="app-emulation/open-vm-tools-kmod
+app-emulation/virtualbox-guest-additions
+app-emulation/virtualbox-modules
+app-emulation/vmware-modules
+app-laptop/omnibook
+app-laptop/tp_smapi
+media-video/em8300-modules
+net-wireless/acx
+net-wireless/broadcom-sta
+net-wireless/madwifi-ng
+=net-wireless/ndiswrapper-1.55-r1
+sys-block/iscsitarget
+sys-fs/vhba
+~x11-drivers/ati-drivers-10.8
+net-wireless/rtl8192se
+~x11-drivers/nvidia-drivers-173.14.27
+~x11-drivers/nvidia-drivers-195.36.31
+~x11-drivers/nvidia-drivers-96.43.18
+~x11-drivers/nvidia-drivers-256.53
+x11-drivers/xf86-video-virtualbox"
+
+ETP_REPO="${ETP_REPO:-kogaionlinux.ro}"
+
+# build for latest kernel
+rm -rf /usr/portage/packages/*
+KERNEL_DIR="/usr/src/linux-${kernel}" emerge -Bav ${packages}
+if [ "${?}" != "0" ]; then
+ exit 1
+fi
+eit inject --to ${ETP_REPO} $(find /usr/portage/packages -name "*.tbz2" | xargs echo)
+
+echo "Now you should remove old packages, if you want of course"
diff --git a/bin/bump_injected_nvidia_drivers b/bin/bump_injected_nvidia_drivers
new file mode 100755
index 0000000..9a394e5
--- /dev/null
+++ b/bin/bump_injected_nvidia_drivers
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+. /kogaion/bin/kernels.inc
+
+packages="=x11-drivers/nvidia-drivers-173* =x11-drivers/nvidia-drivers-304*"
+non_kernel_packages="=x11-drivers/nvidia-userspace-173* =x11-drivers/nvidia-userspace-304*"
+ETP_REPO="${ETP_REPO:-kogaion-testing}"
+
+rm -rf /usr/portage/packages/x11-drivers/*
+emerge -B ${non_kernel_packages} || exit 1
+eit inject --to ${ETP_REPO} /usr/portage/packages/x11-drivers/* || exit 1
+
+for kernel in $kernels; do
+ mypackages="${packages}"
+ # build for latest kernel
+ rm -rf /usr/portage/packages/x11-drivers/*
+ KERNEL_DIR="/usr/src/linux-${kernel}" emerge -B ${mypackages} || exit 1
+ eit inject --to ${ETP_REPO} /usr/portage/packages/x11-drivers/*
+ echo
+done
diff --git a/bin/bump_kernel_package b/bin/bump_kernel_package
new file mode 100755
index 0000000..1a184a0
--- /dev/null
+++ b/bin/bump_kernel_package
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+. /kogaion/bin/kernels.inc
+
+if [ "${#}" -lt 1 ]; then
+ echo "${0} <package> <package> ..." >&2 /dev/null
+ echo "example: ${0} net-wireless/broadcom-sta" >&2 /dev/null
+ exit 1
+fi
+
+# build for latest kernel
+KERNEL_DIR="/usr/src/linux-${running_kernel}" emerge "${@}" || exit 1
+echo -5 | etc-update
+eit add "${@}" || exit 1
+
+for kernel in $kernels; do
+ if [ "${kernel}" = "${running_kernel}" ]; then
+ continue
+ fi
+ rm -rf /usr/portage/packages/*
+ KERNEL_DIR="/usr/src/linux-${kernel}" emerge -B "${@}" || { echo "ouch unable to build" && exit 1; }
+ built_pkgs=$(find /usr/portage/packages -name "*.tbz2" | xargs echo)
+ [[ -z "${built_pkgs}" ]] && echo "ouch no kernel pkgs" && exit 2
+ eit inject ${built_pkgs} || { echo "ouch unable to inject" && exit 3; }
+done
+
+echo "Now you should remove old packages..."
diff --git a/bin/bump_kernel_package_inject b/bin/bump_kernel_package_inject
new file mode 100755
index 0000000..8948cf2
--- /dev/null
+++ b/bin/bump_kernel_package_inject
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+. /kogaion/bin/kernels.inc
+
+if [ "${#}" -lt 1 ]; then
+ echo "${0} <package> <package> ..." >&2 /dev/null
+ echo "example: ${0} net-wireless/broadcom-sta" >&2 /dev/null
+ exit 1
+fi
+
+for kernel in ${kernels}; do
+ rm -rf /usr/portage/packages/*
+ KERNEL_DIR="/usr/src/linux-${kernel}" emerge -B "${@}" || { echo "ouch unable to build" && exit 1; }
+ built_pkgs=$(find /usr/portage/packages -name "*.tbz2" | xargs)
+ [[ -z "${built_pkgs}" ]] && echo "ouch no kernel pkgs" && exit 2
+ eit inject ${built_pkgs} || { echo "ouch unable to inject" && exit 3; }
+done
diff --git a/bin/bump_kernel_packages b/bin/bump_kernel_packages
new file mode 100755
index 0000000..30d8fc4
--- /dev/null
+++ b/bin/bump_kernel_packages
@@ -0,0 +1,246 @@
+#!/usr/bin/python2
+
+import argparse
+import atexit
+import os
+import pwd
+import subprocess
+import shutil
+import sys
+import tempfile
+
+from entropy.server.interfaces import Server
+
+import entropy.dep
+
+
+if __name__ == "__main__":
+
+ srv = Server()
+
+ def ValidString(arg):
+ if not arg:
+ raise ValueError("invalid string")
+ return arg
+
+ def ValidRepository(arg):
+ if arg not in srv.repositories():
+ raise ValueError("invalid repository %s" % (arg,))
+ return arg
+
+ parser = argparse.ArgumentParser(
+ description="Bump Kernel Packages for Entropy Server")
+
+ parser.add_argument(
+ "query_version", metavar="<query version>",
+ help="the uname version to query",
+ type=ValidString)
+ parser.add_argument(
+ "build_version", metavar="<build version>",
+ help="the uname version to build packages for",
+ type=ValidString)
+
+ parser.add_argument(
+ "build_repo", metavar="<build repo>",
+ help="the repository to place packages into",
+ type=ValidRepository)
+
+ parser.add_argument(
+ "--only-injected", action="store_true", default=False,
+ help="only consider injected packages")
+ parser.add_argument(
+ "--no-spm-repo", action="store_true", default=False,
+ help=("do not include the SPM repository suffix "
+ "in dependency atoms"))
+ parser.add_argument(
+ "--keyslot", action="store_true", default=False,
+ help=("do not use the exact package version but "
+ "rather key:slot"))
+ parser.add_argument(
+ "--canfail", action="store_true", default=False,
+ help="if emerge can fail and you want to ignore it")
+
+ parser.add_argument(
+ "--non-interactive", action="store_true", default=False,
+ help="if set, the script will run in non-interactive mode")
+
+ parser.add_argument(
+ "--disable-shell-wrap", action="store_true", default=False,
+ help="if set, the script will not source .bashrc")
+
+ nsargs = parser.parse_args(sys.argv[1:])
+
+ known_multiple_injected_versions = set([
+ "x11-drivers/nvidia-drivers:0",
+ "x11-drivers/ati-drivers:0",
+ ])
+
+ pkgs_map = {}
+ try:
+
+ pkg_matches = {}
+ repository_ids = srv.repositories()
+ for repository_id in repository_ids:
+ repo = srv.open_repository(repository_id)
+ pkg_ids = repo.searchTaggedPackages(nsargs.query_version)
+
+ for pkg_id in pkg_ids:
+ key_slot = repo.retrieveKeySlotAggregated(pkg_id)
+ obj = pkg_matches.setdefault(key_slot, set())
+ obj.add((pkg_id, repository_id))
+
+ injected_pkgs = []
+ normal_pkgs = []
+ for key_slot, candidates in pkg_matches.items():
+ candidate = srv.atom_match(key_slot + "#" + nsargs.query_version)
+ if candidate not in candidates:
+ print("%s (%s) not in candidates %s, skipping" % (
+ candidate, key_slot, candidates))
+ continue
+ pkg_id, repository_id = candidate
+ repo = srv.open_repository(repository_id)
+ if repo.isInjected(pkg_id):
+ injected_pkgs.append(candidate)
+ else:
+ normal_pkgs.append(candidate)
+
+ # address other injected pkgs, like older nvidia drivers
+ for other_candidate in candidates:
+ if other_candidate != candidate:
+ pkg_id, repository_id = other_candidate
+ repo = srv.open_repository(repository_id)
+ if repo.isInjected(pkg_id):
+ clean_key_slot = entropy.dep.remove_tag_from_slot(
+ key_slot)
+ # filter out packages that we know we don't handle multiple
+ # versions of them.
+ if clean_key_slot in known_multiple_injected_versions:
+ injected_pkgs.append(other_candidate)
+
+ normal_atoms = []
+ injected_atoms = []
+ data = (
+ (normal_pkgs, normal_atoms),
+ (injected_pkgs, injected_atoms)
+ )
+
+ spm = srv.Spm()
+
+ for lst, dst in data:
+ for pkg_id, repository_id in lst:
+ repo = srv.open_repository(repository_id)
+ if nsargs.keyslot:
+ atom_str = entropy.dep.remove_tag_from_slot(
+ repo.retrieveKeySlotAggregated(pkg_id))
+ else:
+ atom_str = "~" + entropy.dep.remove_tag(
+ repo.retrieveAtom(pkg_id))
+ if not nsargs.no_spm_repo:
+ spm_repo = repo.retrieveSpmRepository(pkg_id)
+ if spm_repo is not None:
+ atom_str += "::" + spm_repo
+
+ if not spm.match_package(atom_str):
+ print("%s not found in Portage, skipping" % (atom_str,))
+ continue
+
+ dst.append(atom_str)
+ finally:
+ srv.shutdown()
+
+ if not nsargs.only_injected:
+ if normal_atoms:
+ print("normal packages: %s" % (
+ " ".join(normal_atoms),))
+ if injected_atoms:
+ print("injected packages: %s" % (
+ " ".join(injected_atoms),))
+
+ if not (normal_atoms or injected_atoms):
+ print("nothing to do !!")
+ raise SystemExit(0)
+
+ def clean_dirs(xdirs):
+ for directory in xdirs:
+ try:
+ shutil.rmtree(directory, True)
+ except shutil.Error:
+ pass
+
+ dirs = []
+ atexit.register(clean_dirs, dirs)
+
+ os.environ['KERNEL_DIR'] = "/usr/src/linux-%s" % (
+ nsargs.build_version,)
+
+ portage_tmpdir = tempfile.mkdtemp(
+ dir="/var/tmp", prefix="bump_kernel_packages.portage_tmpdir")
+ os.chmod(portage_tmpdir, 0o775)
+
+ try:
+ pass_s = pwd.getpwnam("portage")
+ os.chown(portage_tmpdir, pass_s.pw_uid, pass_s.pw_gid)
+ except KeyError:
+ pass
+
+ dirs.append(portage_tmpdir)
+ os.environ["PORTAGE_TMPDIR"] = portage_tmpdir
+ cmd_prefix = ""
+ if not nsargs.disable_shell_wrap:
+ cmd_prefix = "test -e ~/.bashrc && source ~/.bashrc;"
+
+ if normal_atoms and not nsargs.only_injected:
+ args = ["emerge", "-v", "--keep-going"]
+ if not nsargs.non_interactive:
+ args.append("-a")
+ args += [x for x in normal_atoms]
+ # emerge is a shell function in bashrc
+ rc = subprocess.call(cmd_prefix + " ".join(args), shell=True)
+ if rc != 0 and not nsargs.canfail:
+ raise SystemExit(rc)
+ subprocess.call(["/usr/sbin/etc-update"])
+
+ args = ["eit", "add", "--to", nsargs.build_repo]
+ if nsargs.non_interactive:
+ args.append("--quick")
+
+ args += normal_atoms
+ # eit is a shell function in bashrc
+ rc = subprocess.call(cmd_prefix + " ".join(args), shell=True)
+ if rc != 0:
+ raise SystemExit(rc)
+
+ if injected_atoms:
+ tmp_dir = tempfile.mkdtemp(
+ dir="/var/tmp", prefix="bump_kernel_packages")
+ dirs.append(tmp_dir)
+ os.environ['PKGDIR'] = tmp_dir
+
+ args = ["emerge", "-Bv", "--nodeps", "--keep-going"]
+ if not nsargs.non_interactive:
+ args.append("-a")
+ args += [x for x in injected_atoms]
+ # emerge is a shell function in .bashrc
+ rc = subprocess.call(cmd_prefix + " ".join(args), shell=True)
+ if rc != 0 and not nsargs.canfail:
+ raise SystemExit(rc)
+
+ tbz2s = []
+ for category in os.listdir(tmp_dir):
+ path = os.path.join(tmp_dir, category)
+ if not os.path.isdir(path):
+ continue
+ for sub_file in os.listdir(path):
+ if not sub_file.endswith(".tbz2"):
+ continue
+ tbz2s.append(os.path.join(path, sub_file))
+
+ if tbz2s:
+ args = ["eit", "inject", "--to", nsargs.build_repo]
+ args += tbz2s
+ # eit is a shell function in bashrc
+ rc = subprocess.call(cmd_prefix + " ".join(args), shell=True)
+ if rc != 0:
+ raise SystemExit(rc)
+
+ raise SystemExit(0)
diff --git a/bin/bump_kernel_video_drivers b/bin/bump_kernel_video_drivers
new file mode 100755
index 0000000..4fc6d97
--- /dev/null
+++ b/bin/bump_kernel_video_drivers
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+# PLEASE READ:
+# This script recompiles all the kernel-dependent video drivers for
+# every currently supported kernel. You can use this script when
+# you bump kernels or xorg-server.
+
+. /kogaion/bin/kernels.inc
+
+packages="=x11-drivers/nvidia-drivers-173* =x11-drivers/nvidia-drivers-304* =x11-drivers/nvidia-drivers-313*"
+non_injected_packages="x11-drivers/nvidia-drivers x11-drivers/ati-drivers x11-drivers/xf86-video-virtualbox"
+general_purpose_packages="media-video/amdcccle"
+ETP_REPO="${ETP_REPO:-kogaion-testing}"
+
+for kernel in $kernels; do
+ mypackages="${packages}"
+ if [ "${kernel}" != "${running_kernel}" ]; then
+ mypackages="${mypackages} ${non_injected_packages}"
+ fi
+ # build for latest kernel
+ rm -rf /usr/portage/packages/x11-drivers/*
+ KERNEL_DIR="/usr/src/linux-${kernel}" emerge -B ${mypackages} || exit 1
+ eit inject --to ${ETP_REPO} /usr/portage/packages/x11-drivers/*
+ echo
+done
+
+# Workout drivers for the running kernel, those non injected
+eselect kernel set "linux-${running_kernel}" || exit 1
+emerge ${non_injected_packages} ${general_purpose_packages} || exit 1
+echo -5 | etc-update
+eit add ${non_injected_packages} ${general_purpose_packages} || exit 1
+
+echo "Now you should remove old packages, if you want of course"
diff --git a/bin/bump_misc b/bin/bump_misc
new file mode 100755
index 0000000..837cdb7
--- /dev/null
+++ b/bin/bump_misc
@@ -0,0 +1,60 @@
+#!/bin/sh
+
+# script that makes it easier to bump split packages
+# (and perhaps other fun stuff)
+
+. /kogaion/bin/buildrc || exit 2
+
+list="git [sub]version [tra]nsmission"
+cmd="emerge -av"
+default_overlay="kogaion-desktop"
+overlay=
+
+if [ "$1" = "--repo" ]; then
+ overlay=$2
+ if [ -z "$overlay" ]; then
+ echo "--repo requires an argument" >&2
+ exit 1
+ fi
+ shift; shift
+fi
+
+overlay=${overlay:-$default_overlay}
+
+what=$1
+
+if [ -z "$what" ]; then
+ echo "What to compile? [ $list ]"
+ read what
+fi
+
+case $what in
+git)
+ $cmd \
+ dev-vcs/git::"$overlay" \
+ dev-vcs/git-cvs \
+ dev-vcs/git-gui-tools \
+ dev-vcs/git-subversion \
+ www-apps/gitweb
+ ;;
+subversion|sub)
+ $cmd \
+ dev-vcs/subversion::"$overlay" \
+ dev-vcs/subversion-java \
+ www-apache/mod_dav_svn
+ ;;
+transmission|tra)
+ $cmd \
+ net-p2p/transmission-base \
+ net-p2p/transmission-cli \
+ net-p2p/transmission-daemon \
+ net-p2p/transmission-gtk \
+ net-p2p/transmission-qt4 \
+ net-p2p/transmission::"$overlay"
+ ;;
+*)
+ echo "Excuse me, but I non capisco." >&2
+ echo "Use --repo <repository> to use different overlay (default: $default_overlay)." >&2
+ [ -n "$1" ] && echo "Run without any parameter for interactive use." >&2
+ exit 1
+esac
diff --git a/bin/bump_notice_weekly_repo b/bin/bump_notice_weekly_repo
new file mode 100755
index 0000000..f91c2cd
--- /dev/null
+++ b/bin/bump_notice_weekly_repo
@@ -0,0 +1,2 @@
+#!/bin/sh
+ssh entropy@pkg.kogaion.org /kogaion/bin/update-kogaion-weekly-notice
diff --git a/bin/bump_nvidia_drivers b/bin/bump_nvidia_drivers
new file mode 100755
index 0000000..4598056
--- /dev/null
+++ b/bin/bump_nvidia_drivers
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+. /kogaion/bin/kernels.inc
+packages="x11-drivers/nvidia-drivers::kogaion-desktop"
+
+# build for latest kernel
+KERNEL_DIR="/usr/src/linux-${running_kernel}" emerge $packages media-video/nvidia-settings::kogaion-desktop
+echo -5 | etc-update
+eit commit
+
+for kernel in $kernels; do
+ if [ "${kernel}" = "${running_kernel}" ]; then
+ continue
+ fi
+ rm -rf /usr/portage/packages/*
+ KERNEL_DIR="/usr/src/linux-${kernel}" emerge -B ${packages} || { echo "ouch unable to build" && exit 1; }
+ built_pkgs=$(find /usr/portage/packages -name "*.tbz2" | xargs echo)
+ [[ -z "${built_pkgs}" ]] && echo "ouch no kernel pkgs" && exit 2
+ eit inject ${built_pkgs} || { echo "ouch unable to inject" && exit 3; }
+ echo
+done
+
+echo "Now you should remove old packages..."
diff --git a/bin/bump_vbox b/bin/bump_vbox
new file mode 100755
index 0000000..55eb76c
--- /dev/null
+++ b/bin/bump_vbox
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+. /kogaion/bin/kernels.inc
+packages="app-emulation/virtualbox-guest-additions app-emulation/virtualbox-modules x11-drivers/xf86-video-virtualbox"
+non_tagged_packages="virtualbox-bin"
+
+# build for latest kernel
+KERNEL_DIR="/usr/src/linux-${running_kernel}" emerge $packages ${non_tagged_packages} || exit 1
+echo -5 | etc-update
+eit add ${packages} ${non_tagged_packages} || exit 1
+
+for kernel in $kernels; do
+ if [ "${kernel}" = "${running_kernel}" ]; then
+ continue
+ fi
+ rm -rf /usr/portage/packages/*
+ KERNEL_DIR="/usr/src/linux-${kernel}" emerge -B ${packages} || { echo "ouch unable to build" && exit 1; }
+ built_pkgs=$(find /usr/portage/packages -name "*.tbz2" | xargs echo)
+ [[ -z "${built_pkgs}" ]] && echo "ouch no kernel pkgs" && exit 2
+ eit inject ${built_pkgs} || { echo "ouch unable to inject" && exit 3; }
+ echo
+ eit search "#${kernel}" -q | sort | uniq
+ echo
+done
+
+echo "Now you should remove old packages"
+echo "PLEASE also see /etc/entropy/packages/packages.server.dep_rewrite"
diff --git a/bin/bump_weekly_repo b/bin/bump_weekly_repo
new file mode 100755
index 0000000..8521fa8
--- /dev/null
+++ b/bin/bump_weekly_repo
@@ -0,0 +1,2 @@
+#!/bin/sh
+ssh entropy@pkg.kogaion.org /kogaion/bin/update-kogaion-weekly-repository
diff --git a/bin/check_la b/bin/check_la
new file mode 100755
index 0000000..0ab6db7
--- /dev/null
+++ b/bin/check_la
@@ -0,0 +1,66 @@
+#!/usr/bin/python2
+import sys
+
+la_patterns = sys.argv[1:]
+if not la_patterns:
+ print sys.argv[0], "<.la files patterns>"
+ raise SystemExit(1)
+
+import os
+import re
+import tempfile
+import shutil
+from entropy.server.interfaces import Server
+import entropy.tools
+
+la_compiled_patterns = dict((x, re.compile(x)) for x in la_patterns)
+print la_compiled_patterns
+
+repo_id = os.getenv("ETP_REPO", "kogaionlinux.ro")
+srv = Server()
+dbconn = srv.open_repository(repo_id)
+pkg_ids = dbconn.listAllIdpackages(order_by="atom")
+for pkg_id in pkg_ids:
+ # get pkg path
+ pkg_path = srv._get_package_path(repo_id, dbconn, pkg_id)
+ if not os.path.isfile(pkg_path):
+ print "WTF, not a package file =>", pkg_path
+ continue
+ # now extract
+ tmp_dir = tempfile.mkdtemp()
+ rc = entropy.tools.uncompress_tarball(pkg_path, extract_path = tmp_dir,
+ catch_empty = True)
+ if rc != 0:
+ print "WTF, cannot extract file", pkg_path, "at dir", tmp_dir
+ continue
+
+
+ la_paths = []
+ for cur_dir, subdirs, files in os.walk(tmp_dir):
+ for file in files:
+ path = os.path.join(cur_dir, file)
+ if path.endswith(".la") and os.path.isfile(path) and os.access(path, os.R_OK):
+ la_paths.append(path)
+
+ if not la_paths:
+ continue
+
+ # print "pkg:", dbconn.retrieveAtom(pkg_id), "la:", la_paths
+ found = False
+ for la_path in la_paths:
+ # apply regexps
+ la_f = open(la_path, "r")
+ la_content = la_f.read()
+ la_f.close()
+ for la_pattern, cm_pattern in la_compiled_patterns.items():
+ if cm_pattern.search(la_content):
+ found = True
+ break
+ if found:
+ print dbconn.retrieveKeySlotAggregated(pkg_id)
+ break
+
+ shutil.rmtree(tmp_dir, True)
+
+srv.shutdown()
+raise SystemExit(0)
diff --git a/bin/clean_old_injected_packages b/bin/clean_old_injected_packages
new file mode 100755
index 0000000..03d4a94
--- /dev/null
+++ b/bin/clean_old_injected_packages
@@ -0,0 +1,91 @@
+#!/usr/bin/python
+
+import sys
+sys.path.insert(0, "/usr/lib/matter")
+sys.path.insert(0, "/usr/lib/entropy/lib")
+
+import os
+
+from entropy.server.interfaces import Server
+from entropy.i18n import _
+
+from matter.spec import SpecParser
+import matter.binpms.entropysrv # plugin registration
+
+
+PARTICLES_DIR = "/particles"
+
+
+if __name__ == "__main__":
+
+ # collect particles
+ particles = []
+ for root, dirs, files in os.walk(PARTICLES_DIR):
+ for name in files:
+ if name.endswith(".particle"):
+ particles.append(os.path.join(root, name))
+
+ packages = set()
+ for particle in particles:
+ with open(particle, "r") as f:
+ spec = SpecParser(f)
+ data = spec.parse()
+ if not data:
+ continue
+
+ if data.get("build-only", "no") != "yes":
+ continue
+
+ drop_injected = data.get("drop-old-injected", "no") == "yes"
+ if not drop_injected:
+ continue
+ for p_packages in data.get("packages", []):
+ packages.update(p_packages)
+
+ packages = sorted(packages)
+
+ srv = Server()
+ for repository in srv.repositories():
+
+ repo = srv.open_repository(repository)
+ for package in packages:
+
+ latest_package_id, _mrc = repo.atomMatch(package)
+ if latest_package_id == -1:
+ continue
+
+ package_ids, _mrc = repo.atomMatch(package, multiMatch=True)
+ if not package_ids:
+ continue
+
+ key_slots = set()
+ for package_id in package_ids:
+ key, slot = repo.retrieveKeySlot(package_id)
+ key_slots.add((key, slot))
+
+ key_slot_package_ids = set()
+ for key, slot in key_slots:
+ ks_package_ids = [x for x in repo.searchKeySlot(key, slot) \
+ if repo.isInjected(x)]
+ key_slot_package_ids.update(ks_package_ids)
+
+ key_slot_package_ids.discard(latest_package_id)
+ if key_slot_package_ids:
+ key_slot_package_ids = sorted(key_slot_package_ids)
+ atoms = [repo.retrieveAtom(x) for x in key_slot_package_ids]
+ atoms.sort()
+
+ latest_atom = repo.retrieveAtom(latest_package_id)
+ srv.output("%s is the latest package" % (latest_atom))
+ srv.output("removing old packages:")
+ for atom in atoms:
+ srv.output(" %s" % (atom,))
+ resp = srv.ask_question("Really remove?")
+ if resp != _("Yes"):
+ continue
+
+ srv.remove_packages(
+ repository, key_slot_package_ids)
+ srv.commit_repositories()
+
+ srv.destroy()
diff --git a/bin/get_package_changes b/bin/get_package_changes
new file mode 100755
index 0000000..0d54747
--- /dev/null
+++ b/bin/get_package_changes
@@ -0,0 +1,54 @@
+#!/usr/bin/python2
+import sys
+
+from entropy.server.interfaces import Server
+from entropy.const import etpUi
+etpUi['quiet'] = True
+import entropy.dep
+import portage
+
+def print_help():
+ sys.stderr.write("get_package_changes <added|removed>\n")
+
+if __name__ == "__main__":
+
+ args = sys.argv[1:]
+ if not args:
+ print_help()
+ raise SystemExit(1)
+
+ cmd = args.pop(0)
+ if cmd not in ("added", "removed"):
+ print_help()
+ raise SystemExit(1)
+
+ srv = Server()
+ repositories = srv.repositories()
+ pkg_keys = set()
+
+ for repository_id in repositories:
+ repo = srv.open_repository(repository_id)
+ for atom, package_id, branch in repo.listAllPackages():
+ pkg_keys.add(entropy.dep.dep_getkey(atom))
+
+ portdb = portage.db["/"]['porttree']
+ def _match_filter(atom):
+ best_visible = portdb.dbapi.xmatch("bestmatch-visible", atom)
+ if best_visible:
+ return True
+ return False
+
+ portage_pkg_keys = set(portdb.getallnodes())
+
+ if cmd == "added":
+ added = sorted(filter(_match_filter, portage_pkg_keys - pkg_keys))
+ for pkg_key in added:
+ sys.stdout.write(pkg_key + "\n")
+ sys.stdout.flush()
+ elif cmd == "removed":
+ removed = sorted(pkg_keys - portage_pkg_keys)
+ for pkg_key in removed:
+ sys.stdout.write(pkg_key + "\n")
+ sys.stdout.flush()
+ srv.shutdown()
+ raise SystemExit(0)
diff --git a/bin/get_package_changes_client b/bin/get_package_changes_client
new file mode 100755
index 0000000..b773389
--- /dev/null
+++ b/bin/get_package_changes_client
@@ -0,0 +1,55 @@
+#!/usr/bin/python2
+import sys
+
+from entropy.client.interfaces import Client
+from entropy.const import etpUi
+etpUi['quiet'] = True
+import entropy.dep
+import portage
+
+def print_help():
+ sys.stderr.write("get_package_changes <added|removed>\n")
+
+if __name__ == "__main__":
+
+ args = sys.argv[1:]
+ if not args:
+ print_help()
+ raise SystemExit(1)
+
+ cmd = args.pop(0)
+ if cmd not in ("added", "removed"):
+ print_help()
+ raise SystemExit(1)
+
+ client = Client()
+ repositories = client.repositories()
+ pkg_keys = set()
+
+ for repository_id in repositories:
+ repo = client.open_repository(repository_id)
+ for atom, package_id, branch in repo.listAllPackages():
+ pkg_keys.add(entropy.dep.dep_getkey(atom))
+
+ portdb = portage.db["/"]['porttree']
+ def _match_filter(atom):
+ best_visible = portdb.dbapi.xmatch("bestmatch-visible", atom)
+ if best_visible:
+ return True
+ return False
+
+ portage_pkg_keys = set(portdb.getallnodes())
+
+ if cmd == "added":
+ added = sorted(filter(_match_filter, portage_pkg_keys - pkg_keys))
+ for pkg_key in added:
+ sys.stdout.write(pkg_key + "\n")
+ sys.stdout.flush()
+ elif cmd == "removed":
+ removed = sorted(pkg_keys - portage_pkg_keys)
+ for pkg_key in removed:
+ sys.stdout.write(pkg_key + "\n")
+ sys.stdout.flush()
+ client.shutdown()
+ raise SystemExit(0)
+
diff --git a/bin/get_preserved_libs b/bin/get_preserved_libs
new file mode 100755
index 0000000..6f66cb9
--- /dev/null
+++ b/bin/get_preserved_libs
@@ -0,0 +1,126 @@
+#!/usr/bin/python
+
+import sys
+
+from _emerge.actions import load_emerge_config
+import portage.dep
+
+settings, trees, mtimedb = load_emerge_config()
+vardb = trees[settings["ROOT"]]["vartree"].dbapi
+
+linkmap = vardb._linkmap
+reg = vardb._plib_registry
+
+reg.lock()
+try:
+ plibdata = reg.getPreservedLibs()
+
+ if plibdata:
+ sys.stdout.write("# list of bumped libraries:\n")
+
+ for cpv, paths in plibdata.items():
+ sys.stdout.write("%s\n" % (cpv,))
+ for path in sorted(paths):
+ sys.stderr.write(" %s\n" % (path,))
+
+ if plibdata:
+ sys.stdout.write("# list of inverse deps:\n")
+
+ # taken from display_preserved_libs.py, Portage
+ linkmap.rebuild() # can raise CommandNotFound
+ consumer_map = {}
+ search_for_owners = set()
+ for cpv in plibdata:
+ internal_plib_keys = set(linkmap._obj_key(f) for f in plibdata[cpv])
+ for f in plibdata[cpv]:
+ if f in consumer_map:
+ continue
+
+ consumers = []
+ for c in linkmap.findConsumers(f):
+ # Filter out any consumers that are also preserved libs
+ # belonging to the same package as the provider.
+ if linkmap._obj_key(c) not in internal_plib_keys:
+ consumers.append(c)
+ consumers.sort()
+ consumer_map[f] = consumers
+ search_for_owners.update(consumers)
+
+ owners = {}
+ for f in search_for_owners:
+ owner_set = set()
+ for owner in linkmap.getOwners(f):
+ owner_dblink = vardb._dblink(owner)
+ if owner_dblink.exists():
+ owner_set.add(owner_dblink)
+ if owner_set:
+ owners[f] = owner_set
+
+ all_preserved = set()
+ all_preserved.update(*plibdata.values())
+ owners_map = {}
+
+ for cpv in plibdata:
+ sys.stdout.write("%s\n" % (cpv,))
+ samefile_map = {}
+ for f in plibdata[cpv]:
+ obj_key = linkmap._obj_key(f)
+ alt_paths = samefile_map.get(obj_key)
+ if alt_paths is None:
+ alt_paths = set()
+ samefile_map[obj_key] = alt_paths
+ alt_paths.add(f)
+
+ for alt_paths in samefile_map.values():
+ alt_paths = sorted(alt_paths)
+ for p in alt_paths:
+ sys.stderr.write(" - %s" % (p,))
+ f = alt_paths[0]
+ consumers = consumer_map.get(f, [])
+
+ consumers_non_preserved = [c for c in consumers
+ if c not in all_preserved]
+ if consumers_non_preserved:
+ # Filter the consumers that are preserved libraries, since
+ # they don't need to be rebuilt (see bug #461908).
+ consumers = consumers_non_preserved
+
+ for c in consumers:
+ owner_pkgs = []
+ if c in all_preserved:
+ # The owner is displayed elsewhere due to having
+ # its libs preserved, so distinguish this special
+ # case (see bug #461908).
+ owners_desc = "preserved"
+ else:
+ owner_cpvs = [x.mycpv for x in owners.get(c, [])]
+ owner_pkgs.extend(owner_cpvs)
+ owners_desc = ", ".join(owner_cpvs)
+
+ sys.stderr.write(" used by %s (%s)\n" % (c, owners_desc))
+
+ for owner_pkg in owner_pkgs:
+ cp_slot = "%s:%s" % (
+ portage.dep.dep_getkey("=" + owner_pkg),
+ vardb.aux_get(owner_pkg, ["SLOT"])[0]
+ )
+ obj = owners_map.setdefault(cp_slot, set())
+ obj.add(c)
+
+ sys.stdout.flush()
+ sys.stderr.flush()
+
+ if owners_map:
+ sys.stdout.write("# grouped list of rebuilds:\n")
+
+ for owner_pkg in sorted(owners_map.keys()):
+ owner_files = sorted(owners_map[owner_pkg])
+ sys.stdout.write("%s\n" % (owner_pkg,))
+ for owner_file in owner_files:
+ sys.stderr.write(" %s\n" % (owner_file,))
+
+ sys.stdout.flush()
+ sys.stderr.flush()
+
+finally:
+ reg.unlock()
diff --git a/bin/glsa-digest b/bin/glsa-digest
new file mode 100755
index 0000000..d340b76
--- /dev/null
+++ b/bin/glsa-digest
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+. /etc/profile
+
+exec /usr/bin/glsa-check --verbose --nocolor -t all
diff --git a/bin/kernel-autobump b/bin/kernel-autobump
new file mode 100755
index 0000000..94b6faa
--- /dev/null
+++ b/bin/kernel-autobump
@@ -0,0 +1,150 @@
+#!/bin/bash
+
+# Variables
+REPO_PATH=${1}
+PULL_REMOTE=${2}
+PUSH_REMOTE=${3}
+BRANCH=${4}
+PREFIX=${5}
+REGEX=${6}
+
+show_help() {
+ echo "${0} <repo path> <pull remote> <push remote> <branch> <push tag prefix> v<track regex>" >&2
+ echo "Example: ${0} ~/repos/kernel stable origin 3.12 kogaion- 3\.12\.[0-9999]" >&2
+}
+
+if [ ! -d "${REPO_PATH}" ]; then
+ show_help
+ exit 1
+fi
+
+if [ -z "${PULL_REMOTE}" ]; then
+ show_help
+ exit 1
+fi
+
+if [ -z "${PUSH_REMOTE}" ]; then
+ show_help
+ exit 1
+fi
+
+if [ -z "${BRANCH}" ]; then
+ show_help
+ exit 1
+fi
+
+if [ -z "${PREFIX}" ]; then
+ show_help
+ exit 1
+fi
+
+if [ -z "${REGEX}" ]; then
+ show_help
+ exit 1
+fi
+
+rollback() {
+ cd "${REPO_PATH}" || return 1
+ git rebase --abort || true
+ git reset --hard "${PUSH_REMOTE}/${BRANCH}" || return 1
+}
+
+start() {
+ cd "${REPO_PATH}" || return 1
+
+ echo "Fetching ${PULL_REMOTE}"
+ git fetch --quiet "${PULL_REMOTE}" || {
+ rollback
+ return 1;
+ }
+
+ echo "Fetching ${PUSH_REMOTE}"
+ git fetch --quiet "${PUSH_REMOTE}" || {
+ rollback
+ return 1;
+ }
+
+ local tags=$(git tag | grep -e "v${REGEX}")
+ echo "Tracking tags:"
+ echo -e "${tags}"
+ if [ -z "${tags}" ]; then
+ echo "No tags to track for: ${REGEX} in ${REPO_PATH}"
+ return 0
+ fi
+
+ local bumps=()
+ local tag= tracked_tag=
+ for tag in ${tags}; do
+ tracked_tag="${PREFIX}${tag/v}"
+ echo "Checking tag: ${tag}, ${tracked_tag}"
+ if ! git tag | grep -q -e "^${tracked_tag}$"; then
+ echo "Not tracked: ${tag}, ${tracked_tag}"
+ bumps+=( "${tag}" )
+ fi
+ done
+
+ if [ -z "${bumps[*]}" ]; then
+ echo "Nothing to do."
+ return 0
+ fi
+
+ if ! git show-branch "${BRANCH}" > /dev/null; then
+ echo "Creating branch: ${BRANCH}"
+ git checkout -q "${PUSH_REMOTE}/${BRANCH}" -b "${BRANCH}" || {
+ rollback
+ return 1;
+ }
+ else
+ echo "Checking out branch: ${BRANCH}"
+ git checkout -q "${BRANCH}" || {
+ rollback
+ return 1;
+ }
+ fi
+
+ echo "Updating branch"
+ git rebase --quiet "${PUSH_REMOTE}/${BRANCH}" || {
+ rollback
+ return 1;
+ }
+
+ for tag in "${bumps[@]}"; do
+ echo "Working on tag: ${tag}"
+ git merge --quiet "${tag}" -m "Automatic merge of tag ${PULL_REMOTE}/${tag}" || {
+ rollback
+ return 1;
+ }
+ bash kogaion/bump-configs.sh || {
+ rollback
+ return 1;
+ }
+
+ local changed=$(git ls-files -m -d -o --exclude-standard kogaion/config)
+ if [ -n "${changed}" ]; then
+ git commit --quiet kogaion/config -m "kogaion: bump configs" || {
+ rollback
+ return 1;
+ }
+ fi
+
+ git push --quiet || {
+ rollback
+ return 1;
+ }
+ git push --quiet --tags || {
+ rollback
+ return 1;
+ }
+
+ tracked_tag="${PREFIX}${tag/v}"
+ bash kogaion/tag-version.sh "${tracked_tag}" || {
+ rollback
+ return 1;
+ }
+
+ echo "Released ${tracked_tag}"
+ done
+}
+
+
+start
diff --git a/bin/kernel-autobump-tracker b/bin/kernel-autobump-tracker
new file mode 100755
index 0000000..14aef3f
--- /dev/null
+++ b/bin/kernel-autobump-tracker
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+. /etc/profile
+
+cd $(dirname "${0}") || exit 1
+
+# Tracked kernels
+./kernel-autobump /home/kogaionlenux/repos/kernel stable origin 3.10 kogaion- "3\.10\.[0-9999]"
+./kernel-autobump /home/kogaionlenux/repos/kernel stable origin 3.12 kogaion- "3\.12\.[0-9999]"
+./kernel-autobump /home/kogaionlenux/repos/kernel stable origin 3.14 kogaion- "3\.14\.[0-9999]"
+./kernel-autobump /home/kogaionlenux/repos/kernel stable origin 3.15 kogaion- "3\.15\.[0-9999]"
+./kernel-autobump /home/kogaionlenux/repos/kernel stable origin 3.16 kogaion- "3\.16\.[0-9999]"
diff --git a/bin/kernels.inc b/bin/kernels.inc
new file mode 100644
index 0000000..b884364
--- /dev/null
+++ b/bin/kernels.inc
@@ -0,0 +1,3 @@
+kernels="$(for d in $(find /usr/src -maxdepth 1 -name "linux-*-kogaion" -type d -print); do d=$(basename $d); echo ${d/linux-}; done | sort)"
+
+running_kernel="$(d=$(basename $(readlink /usr/src/linux)); echo ${d/linux-})"
diff --git a/bin/matter-scheduler-chroot b/bin/matter-scheduler-chroot
new file mode 100755
index 0000000..356bbb8
--- /dev/null
+++ b/bin/matter-scheduler-chroot
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+safe_exec() {
+ echo "safe_exec: ${*}"
+ local tries=5
+
+ for ((i=0; i < ${tries}; i++)); do
+ "${@}" && return 0
+
+ if [ "${i}" = "0" ]; then
+ sleep 10
+ continue
+ else
+ sleep 60
+ continue
+ fi
+ done
+ return 1
+}
+
+cd "${PARTICLES_DIR}" || exit 1
+safe_exec git pull || exit 1
+cd "${BUILD_GIT_DIR}" || exit 1
+safe_exec git pull || exit 1
+
+particles=$(find "${PARTICLES_DIR}" -name "*.particle" | sort)
+if [ -n "${particles}" ]; then
+ /usr/sbin/env-update
+ . /etc/profile
+ matter ${MATTER_ARGS} ${particles}
+ exit ${?}
+fi
+exit 1
diff --git a/bin/rebuild_e17 b/bin/rebuild_e17
new file mode 100755
index 0000000..1605ca4
--- /dev/null
+++ b/bin/rebuild_e17
@@ -0,0 +1,18 @@
+#!/bin/bash
+# Yeah, E17 is crap, real pure crap
+
+# STRICT ORDER!
+# http://www.enlightenment.org/p.php?p=download&l=en
+PACKAGES="
+ dev-libs/eina
+ dev-libs/eet
+ media-libs/evas
+ dev-libs/ecore
+ dev-libs/embryo
+ media-libs/edje
+ dev-libs/efreet
+ dev-libs/e_dbus
+ dev-libs/eeze
+ x11-wm/enlightenment"
+
+emerge ${PACKAGES} --nodeps
diff --git a/bin/sshd_wrapper b/bin/sshd_wrapper
new file mode 100755
index 0000000..7ea8331
--- /dev/null
+++ b/bin/sshd_wrapper
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+exec /usr/sbin/sshd -e "${@}" 2> /.sshd.log
diff --git a/bin/test_dep_rewrite b/bin/test_dep_rewrite
new file mode 100755
index 0000000..b8efb72
--- /dev/null
+++ b/bin/test_dep_rewrite
@@ -0,0 +1,41 @@
+#!/usr/bin/python
+import sys
+import re
+
+
+if __name__ == "__main__":
+ args = sys.argv[1:]
+ if not args or len(args) < 3:
+ sys.stderr.write(
+ "%s <target dependency> <rewrite rule> "
+ "<replace 1> [<replace 2> ...\n" % (sys.argv[0],))
+ raise SystemExit(1)
+
+ target, pattern, replaces = args[0], args[1], args[2:]
+ sys.stdout.write("Target: %s\n" % (target,))
+ sys.stdout.write("Pattern: %s\n" % (pattern,))
+ sys.stdout.write("Rewrites: %s\n" % (", ".join(replaces),))
+
+ if pattern.startswith("++"):
+ sys.stderr.write("You are just asking to add dep, meh!\n")
+ raise SystemExit(1)
+
+ sys.stdout.write("\n")
+
+ compiled_pattern = re.compile(pattern)
+ if not compiled_pattern.match(target):
+ sys.stderr.write("Error: Pattern does not match target dep\n")
+ raise SystemExit(1)
+
+ exit_st = 0
+ for replace in replaces:
+ new_target, number_of_subs = compiled_pattern.subn(
+ replace, target)
+ if number_of_subs:
+ sys.stdout.write("%s -> %s\n" % (target, new_target))
+ else:
+ sys.stderr.write("Error, not replaced: %s -> %s\n" % (
+ target, replace,))
+ exit_st = 1
+
+ raise SystemExit(exit_st)