147 lines
2.3 KiB
Plaintext
147 lines
2.3 KiB
Plaintext
|
#!/bin/bash
|
||
|
FILE=/tmp/$RANDOM
|
||
|
TOP=0
|
||
|
LEFT=3
|
||
|
|
||
|
# Additional heading space
|
||
|
HEADINGNEXTPAGE=28
|
||
|
HEADINGLEFT=1
|
||
|
HEADINGRIGHT=15
|
||
|
|
||
|
# GPG Space
|
||
|
NEXTPAGE=48
|
||
|
NEXTFIELDBOTTOM=7
|
||
|
NEXTFIELDRIGHT=25
|
||
|
MAXLENGTH=22
|
||
|
|
||
|
if [ $# -eq 0 ]; then
|
||
|
echo -e "$0: Syntax:\n$0 FIELD GPG FINGERPRINT WITH SPACES\n\nExample:\n$0 7 1234 5678 1234 1234 1234 1234 1234 1234 1234 ABCD\n\n\nFields:
|
||
|
==================
|
||
|
| 0 | 1 || 6 | 7 |
|
||
|
|---|---||---|---|
|
||
|
| 2 | 3 || 8 | 9 |
|
||
|
|---|---||---|---|
|
||
|
| 4 | 5 || 10| 11|
|
||
|
==================
|
||
|
"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
PAGE=$(($1 / 6))
|
||
|
FIELD=$(($1 % 6))
|
||
|
|
||
|
shift 1
|
||
|
|
||
|
|
||
|
echo "PAGE: $PAGE, FIELD: $FIELD"
|
||
|
|
||
|
|
||
|
|
||
|
function moveDown() {
|
||
|
for((i=0; i<$(($FIELD / 2)); i++)); do
|
||
|
for((j=0; j<$NEXTFIELDBOTTOM; j++)); do
|
||
|
printf "\n" >> $FILE
|
||
|
done
|
||
|
done
|
||
|
}
|
||
|
|
||
|
function makeNewline() {
|
||
|
for((i=0; i<$1; i++)); do
|
||
|
printf "\n" >> $FILE
|
||
|
done
|
||
|
}
|
||
|
|
||
|
function makeLeft() {
|
||
|
for((i=0; i<$1; i++)); do
|
||
|
printf " " >> $FILE
|
||
|
done
|
||
|
}
|
||
|
|
||
|
|
||
|
function heading() {
|
||
|
moveDown
|
||
|
|
||
|
|
||
|
if [ $(($FIELD % 2)) -eq 0 ]; then
|
||
|
SPACE=$HEADINGLEFT
|
||
|
else
|
||
|
SPACE=$HEADINGRIGHT
|
||
|
fi
|
||
|
|
||
|
if [ $PAGE -eq 1 ]; then
|
||
|
makeLeft $HEADINGNEXTPAGE
|
||
|
fi
|
||
|
|
||
|
makeLeft $LEFT
|
||
|
makeLeft $SPACE
|
||
|
|
||
|
bigLetters $FILE
|
||
|
printf "GPG" >> $FILE
|
||
|
resetLetters $FILE
|
||
|
printf "\n" >> $FILE
|
||
|
}
|
||
|
|
||
|
function insertFP() {
|
||
|
if [ $(($FIELD % 2 )) -eq 0 ]; then
|
||
|
SPACE=0
|
||
|
else
|
||
|
SPACE=$NEXTFIELDRIGHT
|
||
|
fi
|
||
|
|
||
|
smallLetters $FILE
|
||
|
if [ $PAGE -eq 1 ]; then
|
||
|
makeLeft $NEXTPAGE
|
||
|
fi
|
||
|
makeLeft $LEFT
|
||
|
makeLeft $(($SPACE + 2))
|
||
|
printf "$1 $2 $3 $4" >> $FILE
|
||
|
resetLetters $FILE
|
||
|
printf "\n" >> $FILE
|
||
|
shift 4
|
||
|
|
||
|
smallLetters $FILE
|
||
|
if [ $PAGE -eq 1 ]; then
|
||
|
makeLeft $NEXTPAGE
|
||
|
fi
|
||
|
makeLeft $LEFT
|
||
|
makeLeft $(($SPACE + 2))
|
||
|
printf "$1 $2 $3 $4" >> $FILE
|
||
|
resetLetters $FILE
|
||
|
printf "\n" >> $FILE
|
||
|
shift 4
|
||
|
|
||
|
smallLetters $FILE
|
||
|
if [ $PAGE -eq 1 ]; then
|
||
|
makeLeft $NEXTPAGE
|
||
|
fi
|
||
|
makeLeft $LEFT
|
||
|
makeLeft $(($SPACE + 2))
|
||
|
printf "$1 $2" >> $FILE
|
||
|
resetLetters $FILE
|
||
|
printf "\n" >> $FILE
|
||
|
shift 2
|
||
|
|
||
|
smallLetters $FILE
|
||
|
if [ $PAGE -eq 1 ]; then
|
||
|
makeLeft $NEXTPAGE
|
||
|
fi
|
||
|
makeLeft $LEFT
|
||
|
makeLeft $(($SPACE + 2))
|
||
|
|
||
|
if [ -n "$EVENT" ]; then
|
||
|
printf "$EVENT, $(date -I)" >> $FILE
|
||
|
else
|
||
|
printf "$(date -I)" >> $FILE
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
source ../include/nixdorf
|
||
|
init
|
||
|
|
||
|
makeNewline $TOP
|
||
|
heading
|
||
|
insertFP $@
|
||
|
|
||
|
printFile $FILE
|
||
|
rm $FILE
|