From bfa1c5faef8f0897ea4acfe08f0526d205f88323 Mon Sep 17 00:00:00 2001 From: neingeist Date: Sun, 17 Jul 2016 17:19:45 +0200 Subject: [PATCH 01/30] libvirt-check-trim.py: Add shebang --- libvirt-check-trim.py | 1 + 1 file changed, 1 insertion(+) diff --git a/libvirt-check-trim.py b/libvirt-check-trim.py index 0b0c73e..1f35948 100644 --- a/libvirt-check-trim.py +++ b/libvirt-check-trim.py @@ -1,3 +1,4 @@ +#!/usr/bin/python # Check if all libvirt domains are prepared for TRIM/fstrim from __future__ import division, print_function From 4a7233f7156e8b502f13f92814d2b318f519bebb Mon Sep 17 00:00:00 2001 From: neingeist Date: Sun, 17 Jul 2016 17:20:14 +0200 Subject: [PATCH 02/30] libvirt-check-trim.py: Check machine type & handle diskless VMs --- libvirt-check-trim.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libvirt-check-trim.py b/libvirt-check-trim.py index 1f35948..2c9e7f1 100644 --- a/libvirt-check-trim.py +++ b/libvirt-check-trim.py @@ -19,6 +19,16 @@ for domain in conn.listAllDomains(): xml = domain.XMLDesc() tree = objectify.fromstring(xml) + machine = tree.os.type.get('machine') + if machine < 'pc-i440fx-2.1': + print('machine should be at least pc-i440fx-2.1') + # Might want to check qemu-system-x86_64 -M help for supported + # machines. + + if not hasattr(tree.devices, 'disk'): + print('(has no disks)') + continue + # every disk should be scsi + discard=unmap for disk in tree.devices.disk: if disk.get('device') != 'disk': From c0aebcbe91bee27176dfd241e16af2173c6637d2 Mon Sep 17 00:00:00 2001 From: neingeist Date: Wed, 3 Aug 2016 17:48:50 +0200 Subject: [PATCH 03/30] libvirt-check-trim: fail more elegantly if listAllDomains() is not available --- libvirt-check-trim.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libvirt-check-trim.py b/libvirt-check-trim.py index 2c9e7f1..1c054e7 100644 --- a/libvirt-check-trim.py +++ b/libvirt-check-trim.py @@ -13,6 +13,10 @@ if not conn: print('Failed to open connection to the hypervisor!') sys.exit(1) +if not hasattr(conn, "listAllDomains"): + print('connection does not have listAllDomains(), is python-libvirt too old?') + sys.exit(1) + for domain in conn.listAllDomains(): print('== {}'.format(domain.name())) From 1849c6a6235c6b85cb1f0c84adf9391976cb694b Mon Sep 17 00:00:00 2001 From: neingeist Date: Sun, 21 Aug 2016 15:40:16 +0200 Subject: [PATCH 04/30] dbus-discover: Discover DBUS session bus --- dbus-discover | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 dbus-discover diff --git a/dbus-discover b/dbus-discover new file mode 100755 index 0000000..7e19bb2 --- /dev/null +++ b/dbus-discover @@ -0,0 +1,34 @@ +#!/bin/bash +# Discover DBUS session bus +# Source: can't remember where this from... + +# Remember to run this script using the command "source ./filename.sh" + +# Search these processes for the session variable +# (they are run as the current user and have the DBUS session variable set) +compatiblePrograms=( nautilus kdeinit kded4 pulseaudio trackerd ) + +# Attempt to get a program pid +for index in ${compatiblePrograms[@]}; do + PID=$(pidof -s ${index}) + if [[ "${PID}" != "" ]]; then + break + fi +done +if [[ "${PID}" == "" ]]; then + echo "Could not detect active login session" + return 1 +fi + +QUERY_ENVIRON="$(tr '\0' '\n' < /proc/${PID}/environ | grep "DBUS_SESSION_BUS_ADDRESS" | cut -d "=" -f 2-)" +if [[ "${QUERY_ENVIRON}" != "" ]]; then + export DBUS_SESSION_BUS_ADDRESS="${QUERY_ENVIRON}" + echo "Connected to session:" + echo "DBUS_SESSION_BUS_ADDRESS=${DBUS_SESSION_BUS_ADDRESS}" +else + echo "Could not find dbus session ID in user environment." + return 1 +fi + +return 0 + From b88ab56b952d8b83c46b7b43f93f9ff4fbe04feb Mon Sep 17 00:00:00 2001 From: neingeist Date: Sun, 11 Sep 2016 17:14:18 +0200 Subject: [PATCH 05/30] Add saubermann-rpm --- saubermann-rpm | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 saubermann-rpm diff --git a/saubermann-rpm b/saubermann-rpm new file mode 100755 index 0000000..570b16d --- /dev/null +++ b/saubermann-rpm @@ -0,0 +1,26 @@ +#!/bin/sh +# check for things not installed via RPM + +echo "== should be installed via RPM or pip install --user:" +for site_packages in /usr/lib/python2.7/site-packages/; do + rpm -qf $site_packages/*.egg-info 2>&1 | grep "not owned" +done + +echo "== /usr/local" +find /usr/local/ -type f \ + -and -not -name mimeinfo.cache \ + -and -not -name defaults.list \ + -print0 | xargs -0 rpm -qf 2>&1 | grep "not owned" + +echo "== /usr/bin etc." +find /usr/bin /usr/sbin /usr/lib -type f \ + \( \ + -path '/usr/lib/modules/*/modules.*' -prune \ + -or -path '*/__pycache__/*.py?' -prune \ + -or -print0 \ + \) | xargs -0 rpm -qf 2>&1 | grep "not owned" + +echo "== *.rpmnew etc." +find /etc/ /usr/ \ + -path '/usr/share/eclipse/dropins' -prune \ + -or -name "*.rpm*" -and -not -name "*.rpm" From 0b50a9477dc3ef4200fb664defc80e7379b629fb Mon Sep 17 00:00:00 2001 From: neingeist Date: Sun, 11 Sep 2016 18:25:09 +0200 Subject: [PATCH 06/30] saubermann-dpkg: check for things not installed via dpkg/apt --- saubermann-dpkg | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 saubermann-dpkg diff --git a/saubermann-dpkg b/saubermann-dpkg new file mode 100755 index 0000000..3aae185 --- /dev/null +++ b/saubermann-dpkg @@ -0,0 +1,14 @@ +#!/bin/sh +# check for things not installed via dpkg/apt + +echo "== Packages not in installed state" +dpkg -l | egrep -v "^(ii|Desired|\||\+)" + +echo "== Orphan packages" +deborphan | egrep -v 'libc6-i686|lib.*-ruby$|opensync|gstreamer0.10-plugins.*|libtime-modules-perl|vpim|gnome-session-fallback|.*-globalmenu|gcalctool|clive|unity-scope' + +echo "== *.dpkg in /etc" +find /etc -name "*.dpkg-*" -or -name "*.ucf-*" + +echo "== Orphan packages according to aptitude" +aptitude search "~o" From 3bf13f2251b1c4a1caf0d709c6a09bf3e4048cf8 Mon Sep 17 00:00:00 2001 From: neingeist Date: Sun, 11 Sep 2016 18:27:39 +0200 Subject: [PATCH 07/30] saubermann-common: check for common problems + junk --- saubermann-common | 8 ++++++++ saubermann-dpkg | 4 +++- saubermann-rpm | 4 +++- 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100755 saubermann-common diff --git a/saubermann-common b/saubermann-common new file mode 100755 index 0000000..304d90d --- /dev/null +++ b/saubermann-common @@ -0,0 +1,8 @@ +#!/bin/sh +# check for common problems + junk + +echo "== Dangling symlinks in /etc" +symlinks -r /etc | grep ^dangling | egrep -v 'blkid.tab|/var/log/dropbear' + +echo "== Trashes" +du -s /home/*/.local/share/Trash | awk '{ if ($1 > 100000) { print } }' diff --git a/saubermann-dpkg b/saubermann-dpkg index 3aae185..b82dab7 100755 --- a/saubermann-dpkg +++ b/saubermann-dpkg @@ -1,5 +1,7 @@ #!/bin/sh -# check for things not installed via dpkg/apt +# check for things not installed via dpkg/apt and other junk + +saubermann-common echo "== Packages not in installed state" dpkg -l | egrep -v "^(ii|Desired|\||\+)" diff --git a/saubermann-rpm b/saubermann-rpm index 570b16d..7357212 100755 --- a/saubermann-rpm +++ b/saubermann-rpm @@ -1,5 +1,7 @@ #!/bin/sh -# check for things not installed via RPM +# check for things not installed via RPM and other junk + +saubermann-common echo "== should be installed via RPM or pip install --user:" for site_packages in /usr/lib/python2.7/site-packages/; do From 7a4a975267205034d2164b5145e7bd61932be4af Mon Sep 17 00:00:00 2001 From: neingeist Date: Sun, 11 Sep 2016 18:28:48 +0200 Subject: [PATCH 08/30] saubermann-rpm: remove trailing space --- saubermann-rpm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/saubermann-rpm b/saubermann-rpm index 7357212..ce3c78c 100755 --- a/saubermann-rpm +++ b/saubermann-rpm @@ -4,7 +4,7 @@ saubermann-common echo "== should be installed via RPM or pip install --user:" -for site_packages in /usr/lib/python2.7/site-packages/; do +for site_packages in /usr/lib/python2.7/site-packages/; do rpm -qf $site_packages/*.egg-info 2>&1 | grep "not owned" done From a87cfc177933e2979ff07fa0b26f61934746757a Mon Sep 17 00:00:00 2001 From: neingeist Date: Fri, 14 Oct 2016 14:59:57 +0200 Subject: [PATCH 09/30] rename libvirt-check-trim + make it executable --- libvirt-check-trim.py => libvirt-check-trim | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename libvirt-check-trim.py => libvirt-check-trim (100%) mode change 100644 => 100755 diff --git a/libvirt-check-trim.py b/libvirt-check-trim old mode 100644 new mode 100755 similarity index 100% rename from libvirt-check-trim.py rename to libvirt-check-trim From c8be40968949fd002e3e0fcea2b5cc992719a239 Mon Sep 17 00:00:00 2001 From: neingeist Date: Fri, 14 Oct 2016 15:01:10 +0200 Subject: [PATCH 10/30] add XXX: List XXXs, FIXMEs and TODOs in files --- XXX | 3 +++ 1 file changed, 3 insertions(+) create mode 100755 XXX diff --git a/XXX b/XXX new file mode 100755 index 0000000..d629198 --- /dev/null +++ b/XXX @@ -0,0 +1,3 @@ +#!/bin/sh +# List XXXs, FIXMEs and TODOs in files +ag "XXX|FIXME|TODO" From 03a51c2e04e46e83bbdefcce37c023e523592f18 Mon Sep 17 00:00:00 2001 From: neingeist Date: Fri, 2 Dec 2016 16:40:41 +0100 Subject: [PATCH 11/30] b64-image: Convert an image to CSS/HTML base64 foo --- b64-image | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 b64-image diff --git a/b64-image b/b64-image new file mode 100755 index 0000000..4dd82e0 --- /dev/null +++ b/b64-image @@ -0,0 +1,22 @@ +#!/usr/bin/python3 +# Convert an image to CSS/HTML base64 foo + +from __future__ import division, print_function +import base64 +import magic +import sys + +if not hasattr(magic, "from_file"): + print("wrong magic module installed? try pip install python-magic") + sys.exit(1) + + +if len(sys.argv[1:]) == 0: + print("Usage: " + sys.argv[0] + " IMAGE.PNG ...") + sys.exit(1) + +for filename in sys.argv[1:]: + mimetype = magic.from_file(filename, mime=True) + with open(filename, "rb") as f: + encoded = base64.b64encode(f.read()) + print("url(data:{};base64,{})".format(mimetype, encoded)) From 8102df5f5227ab27062a504b2a433418d1ca68d2 Mon Sep 17 00:00:00 2001 From: neingeist Date: Mon, 5 Dec 2016 16:27:47 +0100 Subject: [PATCH 12/30] gen-yum: restorecon --- gen-yum | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gen-yum b/gen-yum index 3dd6134..fd5d4e3 100755 --- a/gen-yum +++ b/gen-yum @@ -31,3 +31,5 @@ for base_dir in $BASE_DIRS; do fi done done + +restorecon -Rv $BASE_DIRS From b72e439aa973c4bcc9570c860bfe4bcd2523d638 Mon Sep 17 00:00:00 2001 From: neingeist Date: Mon, 5 Dec 2016 16:35:31 +0100 Subject: [PATCH 13/30] gen-yum: fix permissions --- gen-yum | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gen-yum b/gen-yum index fd5d4e3..9c81474 100755 --- a/gen-yum +++ b/gen-yum @@ -28,8 +28,9 @@ for base_dir in $BASE_DIRS; do gpg -u $GPG_KEY --detach-sign --armor repodata/repomd.xml fi + # Fix permissions + chmod a+r *.rpm + restorecon -v *.rpm fi done done - -restorecon -Rv $BASE_DIRS From e18525babcc7a1a6235110c6da59c3db169314a2 Mon Sep 17 00:00:00 2001 From: neingeist Date: Thu, 29 Dec 2016 14:21:14 +0100 Subject: [PATCH 14/30] libvirt-check-trim: improve machine type checking --- libvirt-check-trim | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/libvirt-check-trim b/libvirt-check-trim index 1c054e7..f4cb231 100755 --- a/libvirt-check-trim +++ b/libvirt-check-trim @@ -3,8 +3,10 @@ from __future__ import division, print_function +from distutils.version import LooseVersion from lxml import objectify import libvirt +import re import sys @@ -24,9 +26,12 @@ for domain in conn.listAllDomains(): tree = objectify.fromstring(xml) machine = tree.os.type.get('machine') - if machine < 'pc-i440fx-2.1': - print('machine should be at least pc-i440fx-2.1') - # Might want to check qemu-system-x86_64 -M help for supported + matches = re.match('^pc-(?:i440fx-)?([0-9.]*)', machine) + if matches: + i440_version = matches.group(1) + if LooseVersion(i440_version) < LooseVersion('2.1'): + print('machine type (version) should be at least pc-i440fx-2.1') + # Might want to check "qemu-system-x86_64 -M help" for supported # machines. if not hasattr(tree.devices, 'disk'): From aae7d24732dd2bc8a1756c99bfe59173d2e7e9bb Mon Sep 17 00:00:00 2001 From: neingeist Date: Thu, 29 Dec 2016 14:21:38 +0100 Subject: [PATCH 15/30] libvirt-check-trim: mention qcow2/thinp in description --- libvirt-check-trim | 1 + 1 file changed, 1 insertion(+) diff --git a/libvirt-check-trim b/libvirt-check-trim index f4cb231..ff10883 100755 --- a/libvirt-check-trim +++ b/libvirt-check-trim @@ -1,5 +1,6 @@ #!/usr/bin/python # Check if all libvirt domains are prepared for TRIM/fstrim +# (for use on qcow2 images or thin provisioned volumes) from __future__ import division, print_function From d620a51082ca359835a034cb93ad9a7fd6c760b5 Mon Sep 17 00:00:00 2001 From: neingeist Date: Thu, 29 Dec 2016 14:27:35 +0100 Subject: [PATCH 16/30] libvirt-check-trim: commit two remaining code chunks --- libvirt-check-trim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libvirt-check-trim b/libvirt-check-trim index ff10883..9aeed52 100755 --- a/libvirt-check-trim +++ b/libvirt-check-trim @@ -26,6 +26,7 @@ for domain in conn.listAllDomains(): xml = domain.XMLDesc() tree = objectify.fromstring(xml) + # machine type version should be >= 2.1 if i440fx machine = tree.os.type.get('machine') matches = re.match('^pc-(?:i440fx-)?([0-9.]*)', machine) if matches: @@ -35,6 +36,7 @@ for domain in conn.listAllDomains(): # Might want to check "qemu-system-x86_64 -M help" for supported # machines. + # no disks, no need to check if not hasattr(tree.devices, 'disk'): print('(has no disks)') continue From aa2323fb6b1c75563b9a5b40d0786b0c67b3c47a Mon Sep 17 00:00:00 2001 From: neingeist Date: Sat, 31 Dec 2016 12:09:18 +0100 Subject: [PATCH 17/30] check-java-versions: Check Java versions against the newest one installed --- check-java-versions | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 check-java-versions diff --git a/check-java-versions b/check-java-versions new file mode 100755 index 0000000..4845bba --- /dev/null +++ b/check-java-versions @@ -0,0 +1,40 @@ +#!/usr/bin/python2 +# Check Java versions against the newest one installed +# +# This assumes that there's OpenJDK installed and kept up to date. + +from __future__ import division, print_function +from distutils.version import LooseVersion +from subprocess import check_output +import re + + +def is_java(package): + filelist = check_output(['rpm', '-ql', package]) + return re.search(r'bin/java$', filelist, re.MULTILINE) + + +def package_version(package): + version_query = ['rpm', '--queryformat', '%{VERSION}', '-q'] + version_query.append(package) + + version = check_output(version_query) + + version = re.sub('_', '.', version) + return version + + +def java_packages(): + all_packages = check_output(['rpm', '-qa']).split('\n') + packages = [package + for package in all_packages + if re.search(r'jdk|jre', package)] + return [package for package in packages if is_java(package)] + + +versions = [LooseVersion(package_version(package)) + for package in java_packages()] +wanted_version = max(versions) +old_versions = [version for version in versions if version < wanted_version] + +print('Too old:', old_versions) From 06dd0f6639f168c0992f97de71d1fbfcfd0edc82 Mon Sep 17 00:00:00 2001 From: neingeist Date: Thu, 12 Jan 2017 14:40:49 +0100 Subject: [PATCH 18/30] connections-without-ipv6-privacy: list all redhat/networkmanager connections without ipv6 privacy --- connections-without-ipv6-privacy | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100755 connections-without-ipv6-privacy diff --git a/connections-without-ipv6-privacy b/connections-without-ipv6-privacy new file mode 100755 index 0000000..eeff7dc --- /dev/null +++ b/connections-without-ipv6-privacy @@ -0,0 +1,9 @@ +#!/bin/bash +# list all redhat/networkmanager connections without ipv6 privacy +set -e +cd /etc/sysconfig/network-scripts +for c in ifcfg-*; do + if ! grep -q IPV6_PRIVACY=rfc3041 $c; then + echo $c + fi +done From 5bb8b6dd3850c18647fe3ad872176c66423e1305 Mon Sep 17 00:00:00 2001 From: neingeist Date: Thu, 12 Jan 2017 14:45:51 +0100 Subject: [PATCH 19/30] firefox-fix-outdated-flash-plugin: fix for new profile directory names --- firefox-fix-outdated-flash-plugin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firefox-fix-outdated-flash-plugin b/firefox-fix-outdated-flash-plugin index 8d1443a..e52238b 100755 --- a/firefox-fix-outdated-flash-plugin +++ b/firefox-fix-outdated-flash-plugin @@ -1,5 +1,5 @@ #!/bin/sh # Fix wrong "Flash outdated" error message by Firefox killall firefox -rm .mozilla/firefox/*.default/pluginreg.dat +rm .mozilla/firefox/*.default*/pluginreg.dat firefox From 4881aaea09749388a5f78bf2f8e45c29830865d7 Mon Sep 17 00:00:00 2001 From: neingeist Date: Thu, 19 Jan 2017 18:47:19 +0100 Subject: [PATCH 20/30] gen-yum: use gpg2 to make use of gpg-agent --- gen-yum | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gen-yum b/gen-yum index 9c81474..27845f1 100755 --- a/gen-yum +++ b/gen-yum @@ -25,7 +25,7 @@ for base_dir in $BASE_DIRS; do if [ ! -e repodata/repomd.xml.asc \ -o repodata/repomd.xml.asc -ot repodata/repomd.xml ]; then rm -f repodata/repomd.xml.asc - gpg -u $GPG_KEY --detach-sign --armor repodata/repomd.xml + gpg2 -u $GPG_KEY --detach-sign --armor repodata/repomd.xml fi # Fix permissions From ba99abe2751f8deb0e2f464f2959811b0eb7b65d Mon Sep 17 00:00:00 2001 From: neingeist Date: Thu, 19 Jan 2017 18:57:35 +0100 Subject: [PATCH 21/30] Add list-firefox-bookmarks --- list-firefox-bookmarks | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100755 list-firefox-bookmarks diff --git a/list-firefox-bookmarks b/list-firefox-bookmarks new file mode 100755 index 0000000..867c258 --- /dev/null +++ b/list-firefox-bookmarks @@ -0,0 +1,6 @@ +#!/bin/sh +# List Firefox bookmarks +places=~/.mozilla/firefox/*default*/places.sqlite + +# tags are parents with their parent = 4, so these have to be filtered +sqlite3 $places "select pl.url, b.title from moz_bookmarks as b join moz_bookmarks as pa on b.parent=pa.id join moz_places as pl on b.fk=pl.id where pa.parent != 4" From 2bcdd52dc44b371f9240a06cc63d6b7a414a82d6 Mon Sep 17 00:00:00 2001 From: neingeist Date: Thu, 2 Feb 2017 00:23:03 +0100 Subject: [PATCH 22/30] gen-yum: fix selinux file context --- gen-yum | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gen-yum b/gen-yum index 27845f1..67cdcd7 100755 --- a/gen-yum +++ b/gen-yum @@ -12,6 +12,10 @@ for base_dir in $BASE_DIRS; do echo "== $YUM" cd $YUM + # Fix permissions + chmod a+r *.rpm + chcon -t svirt_sandbox_file_t *.rpm + # Check for unsigned RPMs unsigned=`rpm --checksig *.rpm | egrep -v ': .*pgp'` || true if [ ${#unsigned} != 0 ]; then @@ -28,9 +32,6 @@ for base_dir in $BASE_DIRS; do gpg2 -u $GPG_KEY --detach-sign --armor repodata/repomd.xml fi - # Fix permissions - chmod a+r *.rpm - restorecon -v *.rpm fi done done From 9aab5d5147b3149ca07fb5ce1602434265be5f20 Mon Sep 17 00:00:00 2001 From: neingeist Date: Mon, 6 Feb 2017 13:28:10 +0100 Subject: [PATCH 23/30] connections-without-ipv6-privacy: skip lo --- connections-without-ipv6-privacy | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/connections-without-ipv6-privacy b/connections-without-ipv6-privacy index eeff7dc..f77393d 100755 --- a/connections-without-ipv6-privacy +++ b/connections-without-ipv6-privacy @@ -3,6 +3,10 @@ set -e cd /etc/sysconfig/network-scripts for c in ifcfg-*; do + if [ "$c" == "ifcfg-lo" ]; then + continue + fi + if ! grep -q IPV6_PRIVACY=rfc3041 $c; then echo $c fi From 875737b1088218b0d638f0a7577f4b6ee9b3ac0a Mon Sep 17 00:00:00 2001 From: neingeist Date: Fri, 4 Aug 2017 10:37:15 +0200 Subject: [PATCH 24/30] gen-yum: Sign unsigned RPMs --- gen-yum | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gen-yum b/gen-yum index 67cdcd7..0e59b6b 100755 --- a/gen-yum +++ b/gen-yum @@ -16,12 +16,12 @@ for base_dir in $BASE_DIRS; do chmod a+r *.rpm chcon -t svirt_sandbox_file_t *.rpm - # Check for unsigned RPMs - unsigned=`rpm --checksig *.rpm | egrep -v ': .*pgp'` || true + # Sign unsigned RPMs + unsigned=`rpm --checksig *.rpm | egrep -v ': .*pgp' | sed 's#:.*##'` || true if [ ${#unsigned} != 0 ]; then echo "Unsigned packages:" echo "$unsigned" - exit 1 + rpmsign --addsign $unsigned fi # Create and sign repodata From bb0962fad84c249e8a601b0e39aca8e9750dc6c1 Mon Sep 17 00:00:00 2001 From: neingeist Date: Fri, 4 Aug 2017 20:01:08 +0200 Subject: [PATCH 25/30] XXX: ignore mktemp --- XXX | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/XXX b/XXX index d629198..5c98fbb 100755 --- a/XXX +++ b/XXX @@ -1,3 +1,3 @@ #!/bin/sh # List XXXs, FIXMEs and TODOs in files -ag "XXX|FIXME|TODO" +ag '^(?!.*mktemp).*XXX|FIXME|TODO' From da58498b13d3492b1532ac56d81c4765251d104a Mon Sep 17 00:00:00 2001 From: neingeist Date: Wed, 30 Aug 2017 01:38:50 +0200 Subject: [PATCH 26/30] git-fsck-all: skip .sync directories --- git-fsck-all | 2 ++ 1 file changed, 2 insertions(+) diff --git a/git-fsck-all b/git-fsck-all index 69b5af9..2cef177 100755 --- a/git-fsck-all +++ b/git-fsck-all @@ -15,6 +15,8 @@ import subprocess def git_directories(startdir): for dirpath, dirnames, _ in os.walk(startdir): + if '.sync' in dirpath: + continue if set(['info', 'objects', 'refs']).issubset(set(dirnames)): yield dirpath From af692df85ea182d5a6efc70701e7b1c74652e26e Mon Sep 17 00:00:00 2001 From: neingeist Date: Fri, 8 Sep 2017 12:37:13 +0200 Subject: [PATCH 27/30] Deal with empty counts --- maildir-zero | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/maildir-zero b/maildir-zero index 37199dc..80498cf 100755 --- a/maildir-zero +++ b/maildir-zero @@ -67,8 +67,15 @@ else: key = lambda i: i[0] reverse = False -length_name = max(len(name) for name in counts.keys()) -length_count = max(len(str(count)) for count in counts.values()) +try: + length_name = max(len(name) for name in counts.keys()) +except: + length_name = len('Total') +try: + length_count = max(len(str(count)) for count in counts.values()) +except: + length_count = 3 + for name, count in sorted(counts.items(), key=key, reverse=reverse): print('{0:{1}}\t{2:{3}d}'.format(name, length_name, count, length_count)) From a31bdfffee6160c07c26c51da2abaceafd8bb1e5 Mon Sep 17 00:00:00 2001 From: neingeist Date: Tue, 26 Sep 2017 21:21:49 +0200 Subject: [PATCH 28/30] XXX: Allow user-supplied ag options --- XXX | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/XXX b/XXX index 5c98fbb..b5b11ac 100755 --- a/XXX +++ b/XXX @@ -1,3 +1,3 @@ #!/bin/sh # List XXXs, FIXMEs and TODOs in files -ag '^(?!.*mktemp).*XXX|FIXME|TODO' +ag '^(?!.*mktemp).*XXX|FIXME|TODO' "$@" From 3d373dfc7fefa2e902326aab811d8d5f99ecf4d5 Mon Sep 17 00:00:00 2001 From: neingeist Date: Mon, 2 Oct 2017 15:22:52 +0200 Subject: [PATCH 29/30] Add search-nulls --- search-nulls | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 search-nulls diff --git a/search-nulls b/search-nulls new file mode 100755 index 0000000..67e88d7 --- /dev/null +++ b/search-nulls @@ -0,0 +1,31 @@ +#!/usr/bin/env python +"""Find files starting with null bytes""" + +from __future__ import division, print_function +import argparse +import os + + +parser = argparse.ArgumentParser( + description='Find files starting with null bytes') +parser.add_argument( + 'directories', metavar='dir', default=['.'], nargs='*', + type=str, help='directory to be searched') +parser.add_argument( + '-n', dest='nullbytes', default=16, + type=int, help='number of null bytes') +args = parser.parse_args() + + +for directory in args.directories: + for dirpath, _, filenames in os.walk(directory): + for filename in filenames: + filename = os.path.join(dirpath, filename) + + if not os.path.isfile(filename): + continue + + with open(filename, 'rb') as f: + firstbytes = f.read(args.nullbytes) + if firstbytes == b'\0'*args.nullbytes: + print(filename) From e078fee5411828c76feafa4dd1271026a9f37909 Mon Sep 17 00:00:00 2001 From: neingeist Date: Fri, 13 Oct 2017 18:49:39 +0200 Subject: [PATCH 30/30] libvirt-restart-running: Restart all running --- libvirt-restart-running | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 libvirt-restart-running diff --git a/libvirt-restart-running b/libvirt-restart-running new file mode 100755 index 0000000..4690fb2 --- /dev/null +++ b/libvirt-restart-running @@ -0,0 +1,19 @@ +#!/usr/bin/python +# Restart all running libvirt domains + +from __future__ import division, print_function + +import libvirt +import sys + +conn = libvirt.open('qemu:///system') +if not conn: + print('Failed to open connection to the hypervisor!') + sys.exit(1) + +for domain in conn.listAllDomains(): + name = domain.name() + if domain.isActive(): + print('Restarting {}...'.format(name)) + domain.destroyFlags(flags=libvirt.VIR_DOMAIN_DESTROY_GRACEFUL) + domain.create()