diff options
Diffstat (limited to 'aux')
-rw-r--r-- | aux/fett/fett.svg | 1 | ||||
-rwxr-xr-x | aux/git-checkers/.filelistgen-nonsysv | 122 | ||||
-rw-r--r-- | aux/git-checkers/.readme.md-head | 22 | ||||
-rwxr-xr-x | aux/git-checkers/.readmegen-debian | 13 | ||||
-rwxr-xr-x | aux/git-checkers/.readmegen-suse | 14 | ||||
-rw-r--r-- | aux/git-checkers/Makefile.readme | 10 | ||||
-rw-r--r-- | aux/git-checkers/bashlist | 14 | ||||
-rw-r--r-- | aux/git-checkers/ecmalist | 0 | ||||
l--------- | aux/git-checkers/filelistgen | 1 | ||||
-rw-r--r-- | aux/git-checkers/kornlist | 0 | ||||
-rwxr-xr-x | aux/git-checkers/logrotchecker | 16 | ||||
-rw-r--r-- | aux/git-checkers/makelist | 3 | ||||
-rw-r--r-- | aux/git-checkers/poshlist | 7 | ||||
-rwxr-xr-x | aux/git-checkers/readmegen | 11 | ||||
-rwxr-xr-x | aux/git-checkers/sudoerschecker | 9 | ||||
-rwxr-xr-x | aux/git-checkers/systemdchecker | 17 | ||||
-rw-r--r-- | aux/git-checkers/tidylist | 3 |
17 files changed, 263 insertions, 0 deletions
diff --git a/aux/fett/fett.svg b/aux/fett/fett.svg new file mode 100644 index 0000000..4a0ae7c --- /dev/null +++ b/aux/fett/fett.svg @@ -0,0 +1 @@ +<?xml version="1.0" ?><svg height="175px" version="1.1" viewBox="0 0 157 175" width="157px" xmlns="http://www.w3.org/2000/svg" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns" xmlns:xlink="http://www.w3.org/1999/xlink"><title/><desc/><defs/><g fill="none" fill-rule="evenodd" id="Page-1" stroke="none" stroke-width="1"><g id="star-wars-copy" transform="translate(-1014.000000, -2040.000000)"><g id="jango-fett" transform="translate(1014.000000, 2040.000000)"><path d="M144.738,60.644 C144.738,60.644 141.294,6.974 78.12,6.644 C14.946,6.974 11.502,60.644 11.502,60.644 L0.12,150.644 L60.12,174.644 L78.12,174.644 L96.12,174.644 L156.12,150.644 L144.738,60.644 Z" fill="#8C8C8C" id="Fill-40"/><path d="M6.12,18.644 L6.12,62.306 C2.55,64.388 0.12,68.216 0.12,72.644 L0.12,90.644 C0.12,97.268 5.496,102.644 12.12,102.644 L18.12,102.644 L18.12,60.644 L12.12,60.644 L12.12,18.644 L6.12,18.644 Z" fill="#BEBEBE" id="Fill-41"/><path d="M30.12,6.644 C30.12,3.332 27.432,0.644 24.12,0.644 L12.12,0.644 C5.496,0.644 0.12,6.02 0.12,12.644 L6.12,18.644 L12.12,18.644 L30.12,6.644 Z" fill="#323232" id="Fill-42"/><path d="M148.5336,90.6542 L78.1176,91.1102 L7.7076,90.6542 L0.1176,150.6422 C7.4556,121.6442 19.7256,114.6422 30.1176,114.6422 C46.6896,114.6422 60.1176,139.2962 60.1176,174.6422 L78.1176,174.6422 L96.1176,174.6422 C96.1176,139.2962 109.5516,114.6422 126.1176,114.6422 C136.5156,114.6422 148.7856,121.6442 156.1176,150.6422 L148.5336,90.6542 Z" fill="#1D628F" id="Fill-43"/><path d="M144.738,60.644 L78.12,60.644 L11.502,60.644 L7.698,90.734 C31.644,91.664 60.12,113.972 60.12,174.644 L78.12,174.644 L96.12,174.644 C96.12,113.972 124.596,91.664 148.542,90.734 L144.738,60.644 Z" fill="#2980B9" id="Fill-44"/><path d="M147.0906,79.2494 L146.2566,72.6434 L78.1206,72.6434 L9.9846,72.6434 L9.1506,79.2494 L66.1206,90.6434 L66.1206,174.6434 L78.1206,174.6434 L90.1206,174.6434 L90.1206,90.6434 L147.0906,79.2494 Z" fill="#323232" id="Fill-45"/><path d="M96.12,24.644 C113.418,24.734 126.216,28.838 135.714,34.73 C127.128,20.96 110.46,6.812 78.12,6.644 C14.946,6.974 11.502,60.644 11.502,60.644 L34.368,60.644 C41.184,45.014 57.462,24.848 96.12,24.644" fill="#BEBEBE" id="Fill-46" opacity="0.25"/></g></g></g></svg>
\ No newline at end of file diff --git a/aux/git-checkers/.filelistgen-nonsysv b/aux/git-checkers/.filelistgen-nonsysv new file mode 100755 index 0000000..a400beb --- /dev/null +++ b/aux/git-checkers/.filelistgen-nonsysv @@ -0,0 +1,122 @@ +#!/bin/bash + +RETVAL=0 +declare -x NCURSINST SCDIR GROOTDIR BASHLIST KORNLIST ECMALIST TIDYLIST +command -v tput >/dev/null 2>&1&&NCURSINST=1||NCURSINST=0 +SCDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +# I AM G(IT)ROOT! +GROOTDIR="$(git rev-parse --show-toplevel)"||exit 1 +BASHLIST="$GROOTDIR/aux/git-checkers/bashlist" +KORNLIST="$GROOTDIR/aux/git-checkers/kornlist" +POSHLIST="$GROOTDIR/aux/git-checkers/poshlist" +ECMALIST="$GROOTDIR/aux/git-checkers/ecmalist" +TIDYLIST="$GROOTDIR/aux/git-checkers/tidylist" +MAKELIST="$GROOTDIR/aux/git-checkers/makelist" + +function initmimick { + [ -z "$1" ]&&echo "crit_fail in initmimick(): no parameter passed" >&2&&exit 1 + [ -z "$2" ]&&echo "crit_fail in initmimick(): no string passed" >&2&&exit 2 + case "$1" in + 0) + echo -en "\\033[999D";echo -en "\\033[K" + case "$NCURSINST" in + 1)echo -en "[ $(tput setaf 2)$(tput bold)OK$(tput sgr0) ] $2.";; + *)echo -en "[ OK ] $2.";; + esac + echo " $3" + ;; + *) + echo -en "\\033[999D";echo -en "\\033[K" + case "$NCURSINST" in + 1)echo -en "[ $(tput setaf 1)$(tput bold)FAIL$(tput sgr0) ] $2:";; + *)echo -en "[ FAIL ] $2:";; + esac + echo " $3" + ;; + esac +} +STAGECMD="Generating Bash code list" +echo -n "[....] $STAGECMD" +if [ "$(find "$GROOTDIR" -type f -exec file '{}' \;|grep Bourne-Again|grep -vE "tmp/|aux/github-markdown"|sed "s|:.*||g;s|$GROOTDIR/||g"|grep -vcP "$(tr '\n' '|' < "$GROOTDIR/.gitignore"|sed 's/|$//g')")" -gt 0 ];then + if [ -e "$GROOTDIR/.gitignore" ];then + find "$GROOTDIR" -type f -exec file '{}' \;|grep Bourne-Again|grep -vE "tmp/|aux/github-markdown"|sed "s|:.*||g;s|$GROOTDIR/||g"|grep -vP "$(tr '\n' '|' < "$GROOTDIR/.gitignore"|sed 's/|$//g')" > "$BASHLIST" + else + find "$GROOTDIR" -type f -exec file '{}' \;|grep Bourne-Again|grep -vE "tmp/|aux/github-markdown"|sed "s|:.*||g;s|$GROOTDIR/||g"> "$BASHLIST" + fi +else + true>"$BASHLIST" +fi +CRETVAL="$?" +case "$CRETVAL" in + 0) initmimick 0 "$STAGECMD" "...$(wc -l "$BASHLIST"|awk '{print $1}') found";; + *) initmimick 1 "$STAGECMD" "...$(wc -l "$BASHLIST"|awk '{print $1}') found";((++RETVAL));; +esac +STAGECMD="Generating KSH code list" +echo -n "[....] $STAGECMD" +if [ "$(find "$GROOTDIR" -type f -exec file '{}' \;|grep Korn\ shell|grep -vE "/tmp/|aux/github-markdown"|sed "s|:.*||g;s|$GROOTDIR/||g"|grep -vcP "$(tr '\n' '|' < "$GROOTDIR/.gitignore"|sed 's/|$//g')")" -gt 0 ];then + if [ -e "$GROOTDIR/.gitignore" ];then + find "$GROOTDIR" -type f -exec file '{}' \;|grep Korn\ shell|grep -vE "/tmp/|aux/github-markdown"|sed "s|:.*||g;s|$GROOTDIR/||g"|grep -vP "$(tr '\n' '|' < "$GROOTDIR/.gitignore"|sed 's/|$//g')" > "$KORNLIST" + else + find "$GROOTDIR" -type f -exec file '{}' \;|grep Korn\ shell|grep -vE "/tmp/|aux/github-markdown"|sed "s|:.*||g;s|$GROOTDIR/||g" > "$KORNLIST" + fi +else + true>"$KORNLIST" +fi +CRETVAL="$?" +case "$CRETVAL" in + 0) initmimick 0 "$STAGECMD" "...$(wc -l "$KORNLIST"|awk '{print $1}') found";; + *) initmimick 1 "$STAGECMD" "...$(wc -l "$KORNLIST"|awk '{print $1}') found";((++RETVAL));; +esac +STAGECMD="Generating POSIX shell code list" +echo -n "[....] $STAGECMD" +if [ "$(find "$GROOTDIR" -type f -exec file '{}' \;|grep POSIX\ shell|grep -vE "/tmp/|aux/github-markdown|\.git/"|sed "s|:.*||g;s|$GROOTDIR/||g"|grep -vcP "$(tr '\n' '|' < "$GROOTDIR/.gitignore"|sed 's/|$//g')")" -gt 0 ];then + if [ -e "$GROOTDIR/.gitignore" ];then + find "$GROOTDIR" -type f -exec file '{}' \;|grep POSIX\ shell|grep -vE "/tmp/|aux/github-markdown|\.git/"|sed "s|:.*||g;s|$GROOTDIR/||g"|grep -vP "$(tr '\n' '|' < "$GROOTDIR/.gitignore"|sed 's/|$//g')" > "$POSHLIST" + else + find "$GROOTDIR" -type f -exec file '{}' \;|grep POSIX\ shell|grep -vE "/tmp/|aux/github-markdown|\.git/"|sed "s|:.*||g;s|$GROOTDIR/||g" > "$POSHLIST" + fi +else + true>"$POSHLIST" +fi +CRETVAL="$?" +case "$CRETVAL" in + 0) initmimick 0 "$STAGECMD" "...$(wc -l "$POSHLIST"|awk '{print $1}') found";; + *) initmimick 1 "$STAGECMD" "...$(wc -l "$POSHLIST"|awk '{print $1}') found";((++RETVAL));; +esac +STAGECMD="Generating ECMA script list" +echo -n "[....] $STAGECMD" +if [ "$(find "$GROOTDIR" -type f -name "*.js"|sed "s|$GROOTDIR/||g"|grep -vcE "/tmp/")" -gt 0 ];then + find "$GROOTDIR" -type f -name "*.js"|sed "s|$GROOTDIR/||g"|grep -vE "/tmp/" > "$ECMALIST" 2>/dev/null +else + true>"$ECMALIST" +fi +CRETVAL="$?" +case "$CRETVAL" in + 0) initmimick 0 "$STAGECMD" "...$(wc -l "$ECMALIST"|awk '{print $1}') found";; + *) initmimick 1 "$STAGECMD" "...$(wc -l "$ECMALIST"|awk '{print $1}') found";((++RETVAL));; +esac +STAGECMD="Generating PHP and HTML code list" +echo -n "[....] $STAGECMD" +if [ "$(find "$GROOTDIR" -type f -exec file '{}' \;|grep -E 'PHP script|HTML document'|sed "s|:.*||g;s|$GROOTDIR/||g"|wc -l)" -gt 0 ];then + find "$GROOTDIR" -type f -exec file '{}' \;|grep -E 'PHP script|HTML document'|sed "s|:.*||g;s|$GROOTDIR/||g" > "$TIDYLIST" 2>/dev/null +else + true>"$TIDYLIST" +fi +CRETVAL="$?" +case "$CRETVAL" in + 0) initmimick 0 "$STAGECMD" "...$(wc -l "$TIDYLIST"|awk '{print $1}') found";; + *) initmimick 1 "$STAGECMD" "...$(wc -l "$TIDYLIST"|awk '{print $1}') found";((++RETVAL));; +esac +STAGECMD="Generating Makefile code list" +echo -n "[....] $STAGECMD" +if [ "$(find "$GROOTDIR" -type f -exec file '{}' \;|grep makefile\ script|sed "s|:.*||g;s|$GROOTDIR/||g"|wc -l)" -gt 0 ];then + find "$GROOTDIR" -type f -exec file '{}' \;|grep makefile\ script|sed "s|:.*||g;s|$GROOTDIR/||g" > "$MAKELIST" +else + true>"$MAKELIST" +fi +CRETVAL="$?" +case "$CRETVAL" in + 0) initmimick 0 "$STAGECMD" "...$(wc -l "$MAKELIST"|awk '{print $1}') found";; + *) initmimick 1 "$STAGECMD" "...$(wc -l "$MAKELIST"|awk '{print $1}') found";((++RETVAL));; +esac +exit $RETVAL diff --git a/aux/git-checkers/.readme.md-head b/aux/git-checkers/.readme.md-head new file mode 100644 index 0000000..6435b70 --- /dev/null +++ b/aux/git-checkers/.readme.md-head @@ -0,0 +1,22 @@ +META LAYER +========== + +Meta layer here means: this is a git folder about its git repository. Here I'll +explicitly push the code with which I administer my git folders. + +Τα [**μεταδεδομένα**] (https://el.wikipedia.org/wiki/%CE%9C%CE%B5%CF%84%CE%B1%CE%B4%CE%B5%CE%B4%CE%BF%CE%BC%CE%AD%CE%BD%CE%B1) (μετάφραση του όρου metadata, ο οποίος σχηματίζεται από την ελληνική λέξη μετά και τη λατινική λέξη data "δεδομένα") είναι δεδομένα τα οποία περιγράφουν άλλα δεδομένα. + +Content +------- + +* ***Makefile*** for the folder itself building up a readme, prose goes in +.readme-head and **README.md** will then be **generated with a file list with +http links**. +Currently only works with my aniline repository, abstraction will follow. +* ***filelistgen*** which generates "bashlist" and "kornlist", lists of shell scripts which will then be parsed through gitlab CI runner scripts to ensure validity (not in terms of commands but in case of abstract shell code) +* ***logrotchecker*** and ***sudoerschecker*** which will be used to parse logrotate and sudoers files in a gitlab CI runner to ensure their basical validity +* ***.gitlab-ci.yml*** - Gitlab YAML to trigger all CI runner checks, including all of the above plus a Makefile checker for the root directory's Makefile + +Files +----- + diff --git a/aux/git-checkers/.readmegen-debian b/aux/git-checkers/.readmegen-debian new file mode 100755 index 0000000..e44d915 --- /dev/null +++ b/aux/git-checkers/.readmegen-debian @@ -0,0 +1,13 @@ +#!/bin/bash + +. /lib/lsb/init-functions +log_begin_msg "Generating Readme.md" +cat .readme.md-head>README.md +[ "$?" -ne 0 ]&&log_end_msg 1&&exit 1 +# @echo '```'>>README.md +tree -f "$(pwd)" >> README.md +[ "$?" -ne 0 ]&&log_end_msg 1&&exit 1 +./urlinjector README.md +[ "$?" -ne 0 ]&&log_end_msg 1&&exit 1 +# @echo '```'>>README.md +log_end_msg 0&&exit 0 diff --git a/aux/git-checkers/.readmegen-suse b/aux/git-checkers/.readmegen-suse new file mode 100755 index 0000000..06af767 --- /dev/null +++ b/aux/git-checkers/.readmegen-suse @@ -0,0 +1,14 @@ +#!/bin/bash + +. /lib/lsb/init-functions +rc_reset +echo -n "Generating Readme.md" +cat .readme.md-head>README.md +[ "$?" -ne 0 ]&&(false;rc_status -v)&&exit 1 +# @echo '```'>>README.md +tree -f "$(pwd)" >> README.md +[ "$?" -ne 0 ]&&(false;rc_status -v)&&exit 1 +./urlinjector README.md +[ "$?" -ne 0 ]&&(false;rc_status -v)&&exit 1 +# @echo '```'>>README.md +rc_status -v&&exit 0 diff --git a/aux/git-checkers/Makefile.readme b/aux/git-checkers/Makefile.readme new file mode 100644 index 0000000..094b651 --- /dev/null +++ b/aux/git-checkers/Makefile.readme @@ -0,0 +1,10 @@ +VERSION = 3.81 + +all: tree + +tree: tree-exists + @./readmegen +readme: tree + +tree-exists: + @command -v tree >/dev/null 2>&1 diff --git a/aux/git-checkers/bashlist b/aux/git-checkers/bashlist new file mode 100644 index 0000000..4632cb1 --- /dev/null +++ b/aux/git-checkers/bashlist @@ -0,0 +1,14 @@ +aux/git-checkers/.readmegen-suse +aux/git-checkers/sudoerschecker +aux/git-checkers/.readmegen-debian +aux/git-checkers/logrotchecker +aux/git-checkers/.filelistgen-nonsysv +aux/git-checkers/readmegen +aux/git-checkers/systemdchecker +localfs/usr/local/bin/virtmc +documentation/aux/block-inventory +documentation/aux/kvm-inventory +documentation/aux/ctrl-c +documentation/aux/git-inventory +documentation/aux/dnf-history +documentation/.update diff --git a/aux/git-checkers/ecmalist b/aux/git-checkers/ecmalist new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/aux/git-checkers/ecmalist diff --git a/aux/git-checkers/filelistgen b/aux/git-checkers/filelistgen new file mode 120000 index 0000000..acd0c7a --- /dev/null +++ b/aux/git-checkers/filelistgen @@ -0,0 +1 @@ +.filelistgen-nonsysv
\ No newline at end of file diff --git a/aux/git-checkers/kornlist b/aux/git-checkers/kornlist new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/aux/git-checkers/kornlist diff --git a/aux/git-checkers/logrotchecker b/aux/git-checkers/logrotchecker new file mode 100755 index 0000000..4f16efe --- /dev/null +++ b/aux/git-checkers/logrotchecker @@ -0,0 +1,16 @@ +#!/bin/bash + +# No way to push this to gitlab's CI runner YAML for now, so here's the script: +RETVAL=0 + +LOGROTS="$(find . -name "logrotate*" -type d|wc -l)" +[ "$LOGROTS" -eq 0 ]&&echo "No directory with a name starting with logrotate found."&&exit 0 + +for i in $(find . -name "logrotate*" -type d)/*;do + ERRCNT="$(/usr/sbin/logrotate -ds /tmp/logrotcheck "$i" 2>&1|grep '^error:'|grep -vcE 'unknown group|found error')" + echo "$i: $ERRCNT errors" + [ "$ERRCNT" -ne 0 ]&&((++RETVAL)) + continue +done + +exit $RETVAL diff --git a/aux/git-checkers/makelist b/aux/git-checkers/makelist new file mode 100644 index 0000000..f5a5da7 --- /dev/null +++ b/aux/git-checkers/makelist @@ -0,0 +1,3 @@ +aux/git-checkers/Makefile.readme +Makefile +documentation/Makefile diff --git a/aux/git-checkers/poshlist b/aux/git-checkers/poshlist new file mode 100644 index 0000000..425ea9f --- /dev/null +++ b/aux/git-checkers/poshlist @@ -0,0 +1,7 @@ +fakeenv/usr/bin/guestmount +fakeenv/usr/bin/guestunmount +fakeenv/bin/virsh +localfs/usr/local/sbin/brightness-up +localfs/usr/local/sbin/brightness-down +localfs/usr/local/bin/batman +.environ-prep diff --git a/aux/git-checkers/readmegen b/aux/git-checkers/readmegen new file mode 100755 index 0000000..40c2dfa --- /dev/null +++ b/aux/git-checkers/readmegen @@ -0,0 +1,11 @@ +#!/bin/bash + +[ ! -r /etc/os-release ]&&echo "/etc/os-release not readable. Wrong OS or deprecated OS?"&&exit 1 +LOCOS=$(grep ^ID= /etc/os-release |awk -F= '{print $NF}'|tr '[:upper:]' '[:lower:]') + +case $LOCOS in + debian|ubuntu) ./.readmegen-debian;; + *suse|*sles*) ./.readmegen-suse;; + redhat|fedora) echo "Red Hat / Fedora not implemented yet!";exit 1;; + *) echo "Unknown OS!";exit 1;; +esac diff --git a/aux/git-checkers/sudoerschecker b/aux/git-checkers/sudoerschecker new file mode 100755 index 0000000..1d7e7ed --- /dev/null +++ b/aux/git-checkers/sudoerschecker @@ -0,0 +1,9 @@ +#!/bin/bash + +GITROOT="$(git rev-parse --show-toplevel)"||exit 1 +SUDOERSDINV=( $(find "$GITROOT" -name sudoers.d -type d) ) +SUDOERSD=1 +[ "${#SUDOERSDINV[@]}" -eq 0 ]&&echo "No directory called sudoers.d found."&&SUDOERSD=0 + +[ "$SUDOERSD" -eq 1 ]&&for i in "${SUDOERSDINV[@]}"/*;do /usr/sbin/visudo -cf "$i";done +find "$GITROOT" -name sudoers -type f -exec /usr/sbin/visudo -cf '{}' \; diff --git a/aux/git-checkers/systemdchecker b/aux/git-checkers/systemdchecker new file mode 100755 index 0000000..85cb24e --- /dev/null +++ b/aux/git-checkers/systemdchecker @@ -0,0 +1,17 @@ +#!/bin/bash + +GITROOT="$(git rev-parse --show-toplevel)"||exit 1 + +echo -n "Locating systemd units..." +SVCFILES=( $(find "$GITROOT" -name "*.service" -exec grep -l '\[Unit\]' '{}' \;) ) +TGTFILES=( $(find "$GITROOT" -name "*.target" -exec grep -l '\[Unit\]' '{}' \;) ) +TMRFILES=( $(find "$GITROOT" -name "*.timer" -exec grep -l '\[Unit\]' '{}' \;) ) +MNTFILES=( $(find "$GITROOT" -name "*.mount" -exec grep -l '\[Unit\]' '{}' \;) ) +SYSTEMDFILES=( ${SVCFILES[@]} ${TGTFILES[@]} ${TMRFILES[@]} ${MNTFILES[@]} ) +echo " found ${#SYSTEMDFILES[@]} unit$([ "${#SYSTEMDFILES[@]}" -gt 1 ]&&echo -n "s") to check." + +export LOOPRV=0 +for i in "${SYSTEMDFILES[@]}";do + systemd-analyze verify "$i"&&echo "$i: $(tput -Txterm smul)OK$(tput -Txterm rmul)"||((++LOOPRV)) +done +exit $LOOPRV diff --git a/aux/git-checkers/tidylist b/aux/git-checkers/tidylist new file mode 100644 index 0000000..05b9997 --- /dev/null +++ b/aux/git-checkers/tidylist @@ -0,0 +1,3 @@ +localfs/var/www/vhosts/jango104.domain.de/index.html +documentation/kvm-details/domain-arch.xml +documentation/kvm-details/domain-jango105.xml |