It might look nicer with spaces. Also deleted some unnecessary test files.

This commit is contained in:
Bandie 2019-08-15 00:47:14 +02:00
parent 73de946329
commit c30e227b84
Signed by: Bandie
GPG Key ID: 843D7FA93BA46312
4 changed files with 7 additions and 64 deletions

View File

@ -4,10 +4,10 @@ Show an owner when grub is booting up.
It is looking like this:
```
##########################
# Owner: #
# Alex Alexsen <a@a.tld> #
##########################
##########################
# Owner: #
# Alex Alexsen <a@a.tld> #
##########################
```

View File

@ -1,6 +0,0 @@
# Name and mail address of owner
#OWNER="John Doe <john@doe.tld>"
# Amounts of seconds for how long the owner information is displayed. It is skippable via ESC. Default: 5
#OWNER_TIMEOUT=5

View File

@ -1,51 +0,0 @@
#!/bin/sh
# Author: Bandie <bandie@chaospott.de>
# Copyright: Bandie, 2019, GNU-GPLv3
set -e
## Get params from /etc/default/grub
OWNER=$(cat /etc/default/grub | egrep "^OWNER=.*$" | sed "s/.*=\(.*\)/\1/;s/\"//g;s/'//g")
OWNER_TIMEOUT=$(cat /etc/default/grub | egrep "^OWNER_TIMEOUT=.*$" | sed "s/.*=\(.*\)/\1/;s/\"//g;s/'//g")
## Check if OWNER is set
if [ -z "$OWNER" ]; then
echo "/etc/default/grub: No OWNER set." >&2
exit 0
fi
## Notify user about ownership
echo "Show ==> $OWNER <== as owner" >&2
## Generate spaces in case if the owner has a very short name
for ((i=${#OWNER}; i<6; i++)); do
NSP="$NSP "
done
## Generate border around the owner message
B="##########"
for ((i=6; i<${#OWNER}; i++)); do
B="${B}#"
SPACE="$SPACE "
done
## Check if OWNER_TIMEOUT is set. If not, default 5
if ! [[ $OWNER_TIMEOUT =~ ^[0-9]+$ ]]; then
OWNER_TIMEOUT=5
echo "/etc/default/grub: No OWNER_TIMEOUT set. Using default: 5 seconds." >&2
fi
## Write it into the grub.cfg
cat << EOF
echo ""
echo "$B"
echo "# Owner: ${SPACE}#"
echo "# $OWNER $NSP#"
echo "$B"
echo ""
echo ""
sleep -i $OWNER_TIMEOUT
EOF

View File

@ -25,7 +25,7 @@ for ((i=${#OWNER}; i<6; i++)); do
done
## Generate border around the owner message
B="##########"
B=" ##########"
for ((i=6; i<${#OWNER}; i++)); do
B="${B}#"
SPACE="$SPACE "
@ -42,8 +42,8 @@ fi
cat << EOF
echo ""
echo "$B"
echo "# Owner: ${SPACE}#"
echo "# $OWNER $NSP#"
echo " # Owner: ${SPACE}#"
echo " # $OWNER $NSP#"
echo "$B"
echo ""
echo ""