Browse Source

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

master
Bandie 1 year ago
parent
commit
c30e227b84
Signed by: Bandie <bandie@chaospott.de> GPG Key ID: 843D7FA93BA46312
4 changed files with 7 additions and 64 deletions
  1. 4
    4
      README.md
  2. 0
    6
      build/etc/default/grub
  3. 0
    51
      build/etc/grub.d/000_ownership
  4. 3
    3
      etc/grub.d/000_ownership

+ 4
- 4
README.md View File

@@ -4,10 +4,10 @@ Show an owner when grub is booting up.
4 4
 It is looking like this:
5 5
 
6 6
 ```
7
-##########################
8
-# Owner:                 #
9
-# Alex Alexsen <a@a.tld> #
10
-##########################
7
+    ##########################
8
+    # Owner:                 #
9
+    # Alex Alexsen <a@a.tld> #
10
+    ##########################
11 11
 ```
12 12
 
13 13
 

+ 0
- 6
build/etc/default/grub View File

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

+ 0
- 51
build/etc/grub.d/000_ownership View File

@@ -1,51 +0,0 @@
1
-#!/bin/sh
2
-# Author: Bandie <bandie@chaospott.de>
3
-# Copyright: Bandie, 2019, GNU-GPLv3
4
-
5
-set -e
6
-
7
-## Get params from /etc/default/grub
8
-OWNER=$(cat /etc/default/grub | egrep "^OWNER=.*$" | sed "s/.*=\(.*\)/\1/;s/\"//g;s/'//g")
9
-OWNER_TIMEOUT=$(cat /etc/default/grub | egrep "^OWNER_TIMEOUT=.*$" | sed "s/.*=\(.*\)/\1/;s/\"//g;s/'//g")
10
-
11
-
12
-## Check if OWNER is set
13
-if [ -z "$OWNER" ]; then
14
-	echo "/etc/default/grub: No OWNER set." >&2
15
-	exit 0
16
-fi
17
-
18
-## Notify user about ownership
19
-echo "Show ==> $OWNER <== as owner" >&2
20
-
21
-
22
-## Generate spaces in case if the owner has a very short name
23
-for ((i=${#OWNER}; i<6; i++)); do
24
-	NSP="$NSP "
25
-done
26
-
27
-## Generate border around the owner message
28
-B="##########"
29
-for ((i=6; i<${#OWNER}; i++)); do
30
-	B="${B}#"
31
-	SPACE="$SPACE "
32
-done
33
-
34
-
35
-## Check if OWNER_TIMEOUT is set. If not, default 5
36
-if ! [[ $OWNER_TIMEOUT =~ ^[0-9]+$ ]]; then
37
-	OWNER_TIMEOUT=5
38
-	echo "/etc/default/grub: No OWNER_TIMEOUT set. Using default: 5 seconds." >&2
39
-fi
40
-
41
-## Write it into the grub.cfg
42
-cat << EOF
43
-echo ""
44
-echo "$B"
45
-echo "# Owner: ${SPACE}#"
46
-echo "# $OWNER $NSP#"
47
-echo "$B"
48
-echo ""
49
-echo ""
50
-sleep -i $OWNER_TIMEOUT
51
-EOF

+ 3
- 3
etc/grub.d/000_ownership View File

@@ -25,7 +25,7 @@ for ((i=${#OWNER}; i<6; i++)); do
25 25
 done
26 26
 
27 27
 ## Generate border around the owner message
28
-B="##########"
28
+B="    ##########"
29 29
 for ((i=6; i<${#OWNER}; i++)); do
30 30
 	B="${B}#"
31 31
 	SPACE="$SPACE "
@@ -42,8 +42,8 @@ fi
42 42
 cat << EOF
43 43
 echo ""
44 44
 echo "$B"
45
-echo "# Owner: ${SPACE}#"
46
-echo "# $OWNER $NSP#"
45
+echo "    # Owner: ${SPACE}#"
46
+echo "    # $OWNER $NSP#"
47 47
 echo "$B"
48 48
 echo ""
49 49
 echo ""

Loading…
Cancel
Save