From 737cf3c79a03489a53b250cf53cf2a8f53f603a4 Mon Sep 17 00:00:00 2001 From: Harald Pfeiffer Date: Mon, 25 Nov 2019 10:04:43 +0100 Subject: +documentation scripts --- documentation/aux/block-inventory | 10 ++++++++++ documentation/aux/ctrl-c | 7 +++++++ documentation/aux/git-inventory | 13 +++++++++++++ documentation/aux/kvm-inventory | 18 ++++++++++++++++++ documentation/aux/yum-history | 21 +++++++++++++++++++++ 5 files changed, 69 insertions(+) create mode 100755 documentation/aux/block-inventory create mode 100755 documentation/aux/ctrl-c create mode 100755 documentation/aux/git-inventory create mode 100755 documentation/aux/kvm-inventory create mode 100755 documentation/aux/yum-history (limited to 'documentation/aux') diff --git a/documentation/aux/block-inventory b/documentation/aux/block-inventory new file mode 100755 index 0000000..c8dc3f3 --- /dev/null +++ b/documentation/aux/block-inventory @@ -0,0 +1,10 @@ +#!/bin/bash + +SCDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +source "$SCDIR/ctrl-c"||exit 1 +ODETFIL="$SCDIR/../blockdevices" + +echo -n "Fetching blocks..." +true>"$ODETFIL";[ "$?" -ne 0 ]&&echo "failed."&&exit 1||echo -n "." +echo -n ".";lsblk -im -o+FSTYPE,MIN-IO,MOUNTPOINT 2>/dev/null|sed 's/luks-[^\ ]\+/luks- /g' >"$ODETFIL" +[ "$?" -ne 0 ]&&echo ".failed."||echo ".done." diff --git a/documentation/aux/ctrl-c b/documentation/aux/ctrl-c new file mode 100755 index 0000000..b7530b2 --- /dev/null +++ b/documentation/aux/ctrl-c @@ -0,0 +1,7 @@ +#!/bin/bash + +function ctrl_c() { + echo " CUNT PUNT!" >&2 + exit 187 +} +trap ctrl_c INT diff --git a/documentation/aux/git-inventory b/documentation/aux/git-inventory new file mode 100755 index 0000000..182812a --- /dev/null +++ b/documentation/aux/git-inventory @@ -0,0 +1,13 @@ +#!/bin/bash + +SCDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +source "$SCDIR/ctrl-c"||exit 1 +GITSYSFILE="$SCDIR/../git-system-repos" + +echo -n "Fetching system git stuff" +( + true>"$GITSYSFILE";[ "$?" -ne 0 ]&&echo "...failed."&&exit 1||true + for i in $(find /usr/src -type d -name ".git"|sed 's|/[^/]\+$||g');do echo -n ".";echo "$i" >> "$GITSYSFILE";cd "$i";CDRETVAL=$?;git remote show origin 2>/dev/null|grep Fetch\ URL >> "$GITSYSFILE";[ "$CDRETVAL" -eq 0 ]&&cd - >/dev/null 2>&1;done +) + +[ "$?" -ne 0 ]&&echo "failed."||echo "done." diff --git a/documentation/aux/kvm-inventory b/documentation/aux/kvm-inventory new file mode 100755 index 0000000..c739514 --- /dev/null +++ b/documentation/aux/kvm-inventory @@ -0,0 +1,18 @@ +#!/bin/bash + +SCDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +source "$SCDIR/ctrl-c"||exit 1 +ODETFIL="$SCDIR/../kvm_overview" +ODETDIR="$SCDIR/../kvm-details" + +echo -n "Fetching KVM config" +( + echo -n ".";>"$ODETFIL";[ "$?" -ne 0 ]&&echo "failed."&&exit 1||true + echo -n ".";virsh list --all --title>>"$ODETFIL" 2>/dev/null;[ "$?" -ne 0 ]&&exit 1||true + echo -n ".";echo "" >> "$ODETFIL";virsh net-list --all>>"$ODETFIL" 2>/dev/null;[ "$?" -ne 0 ]&&exit 1||true + echo -n ".";echo "" >> "$ODETFIL";virsh pool-list --all --details>>"$ODETFIL" 2>/dev/null;[ "$?" -ne 0 ]&&exit 1||true + echo -n ".";for i in $(virsh list --all --name);do virsh dumpxml "$i">"$ODETDIR"/domain-"$i".xml||break;done;[ "$?" -ne 0 ]&&exit 1||true + echo -n ".";for i in $(virsh net-list --all --name);do virsh net-dumpxml "$i">"$ODETDIR"/net-"$i".xml||break;done;[ "$?" -ne 0 ]&&exit 1||true + echo -n ".";for i in $(virsh pool-list --all --name);do virsh pool-dumpxml "$i">"$ODETDIR"/pool-"$i".xml||break;done;[ "$?" -ne 0 ]&&exit 1||true +) +[ "$?" -ne 0 ]&&echo "failed."||echo "done." diff --git a/documentation/aux/yum-history b/documentation/aux/yum-history new file mode 100755 index 0000000..8a8a2a2 --- /dev/null +++ b/documentation/aux/yum-history @@ -0,0 +1,21 @@ +#!/bin/bash + +# we need to use sudo, better fetch the session now so it doesn't feck up our +# nice output later on, tee hee. +sudo echo -n "" +[ "$?" -ne 0 ]&&echo "Not allowed to proceed :("&&exit 1 +SCDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +#SCDIR="$HOME" +source "$SCDIR/ctrl-c"||exit 1 +ODETFIL="$SCDIR/../packages-raw" + +echo -n "Fetching yum history" +true>"$ODETFIL";[ "$?" -ne 0 ]&&echo "failed."&&exit 1||echo -n "." +LCNT=0 +for i in $(sudo yum history list all|grep -vP -- '^--|^ID|^Loaded|^history|leaves'|sed 's/^[\ \t]\+\([0-9]\+\).*/\1/g');do + ((++LCNT)) + [ "$(($LCNT % 3))" -eq 0 ]&&echo -n "."||true + sudo yum history info "$i" 2>>"$ODETFIL"|grep -i Command\ line>>"$ODETFIL" + #[ "$?" -ne 0 ]&&break +done;echo "done." +#[ "$?" -ne 0 ]&&echo "failed."||echo "done." -- cgit v1.2.3