git.lirion.de

Of git, get, and gud

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md3
-rw-r--r--issues/arch.issue2
-rwxr-xr-xissues/display76
-rw-r--r--issues/issue.blank.1 (renamed from issues/issue.blank)0
-rw-r--r--issues/issue.blank.24
-rw-r--r--issues/suse.issue20
6 files changed, 88 insertions, 17 deletions
diff --git a/README.md b/README.md
index c048c33..d22f645 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,8 @@ And you can still continue to cheat yourself by putting whatever text inside. Le
Or try something meaningful instead.
-## issue.blank
+## issue.blank.*
Contains no logo, but some strings I use e.g. for VMs to have individual base information at a glance.
More dedicated systems like hypervisors bear less information in the issue.
+issue.blank.2 is the more recent one.
diff --git a/issues/arch.issue b/issues/arch.issue
index f099f9d..e6af458 100644
--- a/issues/arch.issue
+++ b/issues/arch.issue
@@ -1,4 +1,4 @@
-\e[036m .
+\e[38;2;23;147;209m .
c;
:oo,
;lool'
diff --git a/issues/display b/issues/display
index 0a19d43..70f9dca 100755
--- a/issues/display
+++ b/issues/display
@@ -1,24 +1,70 @@
#!/usr/bin/env bash
+
+MYTDIR="$(mktemp -d --tmpdir osissue.XXXXXX)" || exit 1
+MYPWD="$(cd "$(dirname "$0")" && pwd)" || exit 2
+function ctrl_c {
+ if [ ! -z "$MYTDIR" ]; then
+ rm -rf "$MYTDIR"
+ fi
+ exit 130
+}
if [ -n "$1" ];then
FARR="$1"
if [ ! -e "$FARR" ];then FARR="$FARR.issue";fi
else
IFS=$'\n'
- FARR=( $(ls *.issue) )
+ FARR=( $(ls *.issue) "issue.blank.1" "issue.blank.2" )
unset IFS
fi
-for i in "${FARR[@]}";do
- IFS=$'\n'
- FLARR=( $(cat "$i") )
- unset IFS
- if [ -z "$COLUMNS" ];then
- COLUMNS="$(tput cols)"
- [ -z "$COLUMNS"] && COLUMNS=20
+if [ -r "/etc/os-release" ]; then
+ source "/etc/os-release"
+fi
+if [ -n "$VARIABLE" ]; then
+ OSSTR_S="$VARIABLE"
+elif [ -n "$PRETTY_NAME" ]; then
+ OSSTR_S="$PRETTY_NAME"
+else
+ OSSTR_S="$(uname -o)"
+fi
+OSSTR_M="$(uname -m)"
+OSSTR_R="$(uname -r)"
+OSSTR_N="$(uname -n)"
+OSSTR_L="$(tty | sed 's#^/dev/##')"
+# see man:agetty(8), ... kinda: we don't have e.g. 4{IFACENAME} anywhere, so we only do the
+# argumentless variants
+OSSTR_4="$(ip -4 -o address show nomaster primary scope global up | head -n 1 | awk '{print $4}' | awk -F/ '{print $1}')"
+if [ -z "$OSSTR_4" ]; then
+ OSSTR_4="$(getent ahostsv4 "$(hostname -s)" | head -n1 | awk '{print $1}')"
+ if [ -z "$OSSTR_4" ]; then OSSTR_4="127.0.0.1"; fi
+fi
+OSSTR_6="$(ip -6 -o address show nomaster primary scope global up | head -n 1 | awk '{print $4}' | awk -F/ '{print $1}')"
+if [ -z "$OSSTR_6" ]; then
+ OSSTR_6="$(getent ahostsv6 "$(hostname -s)" | head -n1 | awk '{print $1}')"
+ if [ -z "$OSSTR_6" ]; then
+ # this could now be a number of reasons, we act as if IPv6 had been deactivated
+ OSSTR_6="::ffff:127.0.1.1"
fi
- printf "\\033[;1m"
- for ((j=0;j<$COLUMNS;++j)); do printf -- "-"; done
- printf "\\n %b\\n" "$i"
- for ((j=0;j<$COLUMNS;++j)); do printf -- "-"; done
- printf "\\033[0m\\n"
- printf "%b\\n" "${FLARR[@]}"
-done
+fi
+(
+ cd "$MYPWD" || exit 10
+ for issuefile in "${FARR[@]}";do
+ cp -p "$issuefile" "${MYTDIR}/" || break
+ sed -i "s#\\\\S#$OSSTR_S#;s#\\\\m#$OSSTR_M#;s#\\\\l#$OSSTR_L#" "${MYTDIR}/${issuefile}" &&\
+ sed -i "s#\\\\4#$OSSTR_4#;s#\\\\6#$OSSTR_6#" "${MYTDIR}/${issuefile}" &&\
+ sed -i "s#\\\\r#$OSSTR_R#;s#\\\\n#$OSSTR_N#" "${MYTDIR}/${issuefile}" || break
+ IFS=$'\n'
+ FLARR=( $(cat "${MYTDIR}/${issuefile}") )
+ unset IFS
+ if [ -z "$COLUMNS" ];then
+ COLUMNS="$(tput cols)"
+ [ -z "$COLUMNS" ] && COLUMNS=20
+ fi
+ printf "\\033[;1m"
+ for ((j=0;j<$COLUMNS;++j)); do printf -- "-"; done
+ printf "\\n %b\\n" "$issuefile"
+ for ((j=0;j<$COLUMNS;++j)); do printf -- "-"; done
+ printf "\\033[0m\\n"
+ printf "%b\\n" "${FLARR[@]}"
+ done
+)
+rm -rf "$MYTDIR"
diff --git a/issues/issue.blank b/issues/issue.blank.1
index 0699aef..0699aef 100644
--- a/issues/issue.blank
+++ b/issues/issue.blank.1
diff --git a/issues/issue.blank.2 b/issues/issue.blank.2
new file mode 100644
index 0000000..18894a9
--- /dev/null
+++ b/issues/issue.blank.2
@@ -0,0 +1,4 @@
+<SPACE_FOR_LOGO>
+
+\S \r (\l)
+\4 || \6
diff --git a/issues/suse.issue b/issues/suse.issue
new file mode 100644
index 0000000..2d00c37
--- /dev/null
+++ b/issues/suse.issue
@@ -0,0 +1,20 @@
+\e[92m ,;:clllooollc:;,' 'l:'
+ ',:clooooooooooooooooooolc:;, ,oool:;'
+ ';cooooooooooooooooooooooooooooooolc;',ooooooooc;,
+ ':loooooooooooooooooooooooooooooooooooooooooooool;:::;;
+ ,coooooooooooooooooooooooooooooooooooooooooooooool coolc'l
+ 'coooooooolllooooooooooooooooooooooooooooooooooooooc loo,' l:
+ ;oooool;, ';cooooooooooooooooooooooooooooooollol;;;;;col
+,ooool, ''' ;looooooooooooooooooooooooooool;;;::ccccc:
+coool 'clolllol:' ;oooooooooooooooooooooooooooooolccc::;'
+looo: oo: ;oo: 'looooooooooooooooooool,,;;;:::;,,
+:oool lo: :oo, looool''''''',;loooo,
+'oooo: ;: :oo; loooo, ;oool;'
+ 'loool, ':ooo' ;::::::, ':::::;'
+ ;looool::::cloooo;
+ ,:loooooooolc;
+ ';:ccc:,\e[0m
+
+Welcome to \S - Kernel \r (\l).
+
+\4 \6