Compare commits
No commits in common. "d2a2c43386a24afd9eb32ed85aa60f831aa731f1" and "822d58734cbef459fbcc28974e1ecc610e301330" have entirely different histories.
d2a2c43386
...
822d58734c
134
adafruit/gpgkey
134
adafruit/gpgkey
@ -1,134 +0,0 @@
|
||||
#!/bin/bash
|
||||
FILE=/tmp/$RANDOM
|
||||
TOP=1
|
||||
LEFT=3
|
||||
|
||||
# Additional heading space
|
||||
HEADINGNEXTPAGE=36
|
||||
HEADINGLEFT=1
|
||||
HEADINGRIGHT=20
|
||||
|
||||
# GPG Space
|
||||
NEXTPAGE=62
|
||||
NEXTFIELDBOTTOM=11
|
||||
NEXTFIELDRIGHT=31
|
||||
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:
|
||||
==================
|
||||
| VISAS || VISAS |
|
||||
==================
|
||||
| 0 | 1 || 4 | 5 |
|
||||
|---|---||---|---|
|
||||
| 2 | 3 || 6 | 7 |
|
||||
==================
|
||||
"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PAGE=$(($1 / 4))
|
||||
FIELD=$(($1 % 4))
|
||||
|
||||
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 heading() {
|
||||
moveDown
|
||||
|
||||
|
||||
if [ $(($FIELD % 2)) -eq 0 ]; then
|
||||
SPACE=$HEADINGLEFT
|
||||
else
|
||||
SPACE=$HEADINGRIGHT
|
||||
fi
|
||||
|
||||
if [ $PAGE -eq 1 ]; then
|
||||
makeLeft $HEADINGNEXTPAGE $FILE
|
||||
fi
|
||||
|
||||
makeLeft $LEFT $FILE
|
||||
makeLeft $SPACE $FILE
|
||||
|
||||
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 $FILE
|
||||
fi
|
||||
makeLeft $LEFT $FILE
|
||||
makeLeft $(($SPACE + 2)) $FILE
|
||||
printf "$1 $2 $3 $4" >> $FILE
|
||||
resetLetters $FILE
|
||||
printf "\n" >> $FILE
|
||||
shift 4
|
||||
|
||||
smallLetters $FILE
|
||||
if [ $PAGE -eq 1 ]; then
|
||||
makeLeft $NEXTPAGE $FILE
|
||||
fi
|
||||
makeLeft $LEFT $FILE
|
||||
makeLeft $(($SPACE + 2)) $FILE
|
||||
printf "$1 $2 $3 $4" >> $FILE
|
||||
resetLetters $FILE
|
||||
printf "\n" >> $FILE
|
||||
shift 4
|
||||
|
||||
smallLetters $FILE
|
||||
if [ $PAGE -eq 1 ]; then
|
||||
makeLeft $NEXTPAGE $FILE
|
||||
fi
|
||||
makeLeft $LEFT $FILE
|
||||
makeLeft $(($SPACE + 2)) $FILE
|
||||
printf "$1 $2" >> $FILE
|
||||
resetLetters $FILE
|
||||
printf "\n" >> $FILE
|
||||
shift 2
|
||||
|
||||
smallLetters $FILE
|
||||
if [ $PAGE -eq 1 ]; then
|
||||
makeLeft $NEXTPAGE $FILE
|
||||
fi
|
||||
makeLeft $LEFT $FILE
|
||||
makeLeft $(($SPACE + 2)) $FILE
|
||||
|
||||
if [ -n "$EVENT" ]; then
|
||||
printf "$EVENT, $(date -I)" >> $FILE
|
||||
else
|
||||
printf "$(date -I)" >> $FILE
|
||||
fi
|
||||
}
|
||||
|
||||
source ../include/nixdorf
|
||||
init
|
||||
|
||||
makeNewline $TOP $FILE
|
||||
heading
|
||||
insertFP $@
|
||||
|
||||
printFile $FILE
|
||||
rm $FILE
|
122
adafruit/iro
122
adafruit/iro
@ -1,122 +0,0 @@
|
||||
#!/bin/bash
|
||||
FILE=/tmp/$RANDOM
|
||||
TOP=1
|
||||
LEFT=5
|
||||
|
||||
# Additional heading space
|
||||
HEADINGNEXTPAGE=19
|
||||
HEADINGLEFT=1
|
||||
HEADINGRIGHT=10
|
||||
|
||||
# GPG Space
|
||||
NEXTPAGE=34
|
||||
NEXTPAGESMALL=60
|
||||
NEXTFIELDBOTTOM=13
|
||||
NEXTFIELDRIGHT=18
|
||||
NEXTFIELDRIGHTSMALL=30
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo -e "$0: Syntax:\n$0 FIELD\n\nExample:\n$0 7\n\n\nFields:
|
||||
==================
|
||||
| VISAS || VISAS |
|
||||
==================
|
||||
| 0 | 1 || 4 | 5 |
|
||||
|---|---||---|---|
|
||||
| 2 | 3 || 6 | 7 |
|
||||
==================
|
||||
"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PAGE=$(($1 / 4))
|
||||
FIELD=$(($1 % 4))
|
||||
|
||||
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 heading() {
|
||||
moveDown
|
||||
|
||||
|
||||
if [ $(($FIELD % 2)) -eq 0 ]; then
|
||||
HSPACE=$HEADINGLEFT
|
||||
SPACE=0
|
||||
else
|
||||
HSPACE=$HEADINGRIGHT
|
||||
SPACE=$NEXTFIELDRIGHT
|
||||
fi
|
||||
|
||||
|
||||
if [ $PAGE -eq 1 ]; then
|
||||
makeLeft $NEXTPAGE $FILE
|
||||
fi
|
||||
makeLeft 3 $FILE
|
||||
makeLeft $SPACE $FILE
|
||||
italicLetters $FILE
|
||||
printf "INTERGALACTIC\n" >> $FILE
|
||||
|
||||
if [ $PAGE -eq 1 ]; then
|
||||
makeLeft $NEXTPAGE $FILE
|
||||
fi
|
||||
makeLeft 3 $FILE
|
||||
makeLeft $SPACE $FILE
|
||||
printf "REGISTRATION\n" >> $FILE
|
||||
bigLetters $FILE
|
||||
|
||||
if [ $PAGE -eq 1 ]; then
|
||||
makeLeft $HEADINGNEXTPAGE $FILE
|
||||
if [ $(($FIELD % 2)) -eq 1 ]; then
|
||||
makeLeft $(($HSPACE - 1)) $FILE
|
||||
fi
|
||||
else
|
||||
makeLeft 1 $FILE
|
||||
makeLeft $HSPACE $FILE
|
||||
fi
|
||||
printf "OFFICE\n" >> $FILE
|
||||
resetLetters $FILE
|
||||
|
||||
}
|
||||
|
||||
function insertDate() {
|
||||
if [ $(($FIELD % 2 )) -eq 0 ]; then
|
||||
SPACE=0
|
||||
else
|
||||
SPACE=$NEXTFIELDRIGHTSMALL
|
||||
fi
|
||||
|
||||
smallLetters $FILE
|
||||
if [ $PAGE -eq 1 ]; then
|
||||
makeLeft $NEXTPAGESMALL $FILE
|
||||
fi
|
||||
makeLeft $LEFT $FILE
|
||||
makeLeft $(($SPACE + 2)) $FILE
|
||||
if [ -n "$EVENT" ]; then
|
||||
printf "$EVENT, $(date -I)" >> $FILE
|
||||
else
|
||||
printf "$(date -I)" >> $FILE
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
source ../include/nixdorf
|
||||
init
|
||||
|
||||
makeNewline $TOP $FILE
|
||||
heading
|
||||
insertDate
|
||||
|
||||
printFile $FILE
|
||||
rm $FILE
|
@ -1,18 +0,0 @@
|
||||
#!/bin/bash
|
||||
FILE=/tmp/$RANDOM
|
||||
|
||||
source ../include/nixdorf
|
||||
init
|
||||
smallLetters $FILE
|
||||
|
||||
#printf "\x1b\x33\x0a" >> $FILE
|
||||
printf "\x1b\x33\x0e" >> $FILE
|
||||
|
||||
#for j in $(seq 0 10); do
|
||||
for i in $(seq 0 100); do
|
||||
printf " $i\n" >> $FILE
|
||||
done
|
||||
#done
|
||||
|
||||
printFile $FILE
|
||||
rm $FILE
|
52
adafruit/reg
52
adafruit/reg
@ -1,52 +0,0 @@
|
||||
#!/bin/bash
|
||||
FILE=/tmp/$RANDOM
|
||||
TOP=56
|
||||
NEXTFIELD=5
|
||||
LEFT=22
|
||||
AUTHLEFT=56
|
||||
DATELEFT=37
|
||||
MAXLENGTH=17
|
||||
|
||||
GIVENNAME=$1
|
||||
SURNAME=$2
|
||||
HOME=$3
|
||||
|
||||
|
||||
if [ ${#GIVENNAME} -gt $MAXLENGTH ] || [ ${#SURNAME} -gt $MAXLENGTH ] || [ ${#HOME} -gt $MAXLENGTH ]; then
|
||||
echo "MAXLENGTH EXCEEDED."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
source ../include/nixdorf
|
||||
init
|
||||
smallLetters $FILE
|
||||
printf "\x1b\x33\x0e" >> $FILE
|
||||
makeNewline $TOP $FILE
|
||||
makeLeft $LEFT $FILE
|
||||
printf "$GIVENNAME" >> $FILE
|
||||
|
||||
# Authority field
|
||||
makeNewline 2 $FILE
|
||||
makeLeft $AUTHLEFT $FILE
|
||||
printf "Intergalactic Reg. Office" >> $FILE
|
||||
|
||||
makeNewline 3 $FILE
|
||||
makeLeft $LEFT $FILE
|
||||
printf "$SURNAME" >> $FILE
|
||||
|
||||
makeNewline $NEXTFIELD $FILE
|
||||
makeLeft $LEFT $FILE
|
||||
printf "$HOME" >> $FILE
|
||||
|
||||
makeNewline 4 $FILE
|
||||
makeLeft $DATELEFT $FILE
|
||||
|
||||
if [ -n "$EVENT" ]; then
|
||||
printf "/ $EVENT, $(date -I)" >> $FILE
|
||||
else
|
||||
printf "/ $(date -I)" >> $FILE
|
||||
fi
|
||||
|
||||
printFile $FILE
|
||||
rm $FILE
|
@ -6,8 +6,7 @@ function init() {
|
||||
# \x1b\x47 - Double Strike
|
||||
# \x1b\x78\x01 - Standard Letter Mode
|
||||
# \x1b\x52\x02 - German
|
||||
# \x1b\x33\x20 - 20/180 inch line spacing (standard)
|
||||
printf "\x1b\x47\x1b\x78\x01\x1b\x52\x02\x1b\x33\x20" >> "$DEVICE"
|
||||
printf "\x1b\x47\x1b\x78\x01\x1b\x52\x02" >> "$DEVICE"
|
||||
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ function insertFP() {
|
||||
|
||||
smallLetters $FILE
|
||||
if [ $PAGE -eq 1 ]; then
|
||||
makeLeft $NEXTPAGE $FILE
|
||||
makeLeft $NEXTPAGE
|
||||
fi
|
||||
makeLeft $LEFT $FILE
|
||||
makeLeft $(($SPACE + 2)) $FILE
|
||||
|
5
jhp/iro
5
jhp/iro
@ -14,6 +14,7 @@ NEXTPAGESMALL=48
|
||||
NEXTFIELDBOTTOM=7
|
||||
NEXTFIELDRIGHT=14
|
||||
NEXTFIELDRIGHTSMALL=25
|
||||
MAXLENGTH=22
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo -e "$0: Syntax:\n$0 FIELD\n\nExample:\n$0 7\n\n\nFields:
|
||||
@ -61,7 +62,7 @@ function heading() {
|
||||
|
||||
|
||||
if [ $PAGE -eq 1 ]; then
|
||||
makeLeft $NEXTPAGE $FILE
|
||||
makeLeft $NEXTPAGE
|
||||
fi
|
||||
makeLeft 1 $FILE
|
||||
makeLeft $SPACE $FILE
|
||||
@ -69,7 +70,7 @@ function heading() {
|
||||
printf "INTERGALACTIC\n" >> $FILE
|
||||
|
||||
if [ $PAGE -eq 1 ]; then
|
||||
makeLeft $NEXTPAGE $FILE
|
||||
makeLeft $NEXTPAGE
|
||||
fi
|
||||
makeLeft 1 $FILE
|
||||
makeLeft $SPACE $FILE
|
||||
|
1
jhp/test
Normal file
1
jhp/test
Normal file
@ -0,0 +1 @@
|
||||
./JunghackerPass "Foobert" "van Barbert" "Erde / Earth" "37C3, $(date -I)"
|
171
start
171
start
@ -108,7 +108,7 @@ function jhpPrintGPG() {
|
||||
function jhpPrintReg() {
|
||||
diaBox "Insert Passport" "Please insert passport (First page, name, planet, date) into the printer."
|
||||
cd jhp
|
||||
./reg "$FNAME" "$SNAME" "$PLANET"
|
||||
./JunghackerPass "$FNAME" "$SNAME" "$PLANET"
|
||||
cd ..
|
||||
return 0
|
||||
}
|
||||
@ -227,175 +227,14 @@ function jhpmenu() {
|
||||
unset FIELD
|
||||
}
|
||||
|
||||
|
||||
function adaAskForField() {
|
||||
text="$1: Please choose a free field on the passport.\n
|
||||
------------------\n
|
||||
| VISAS || VISAS |\n
|
||||
==================\n
|
||||
| 0 | 1 || 4 | 5 |\n
|
||||
|---|---||---|---|\n
|
||||
| 2 | 3 || 6 | 7 |\n
|
||||
==================\n
|
||||
"
|
||||
askStr 2 "Select a field" "$text" "" 18
|
||||
if [ $? -eq 1 ]; then
|
||||
return 1
|
||||
fi
|
||||
FIELD=$(cat $TMP)
|
||||
if ! [[ "$FIELD" =~ ^[0-9]+$ ]] || [ -z "$FIELD" ] || [ $FIELD -lt 0 ] || [ $FIELD -gt 7 ]; then
|
||||
adaAskForField
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
function adaPrintGPG() {
|
||||
adaAskForField "GPG fingerprint"
|
||||
if [ $? -eq 0 ]; then
|
||||
diaBox "Insert Passport" "Please insert passport (Visas) into the printer."
|
||||
cd adafruit
|
||||
./gpgkey $FIELD $FP
|
||||
cd ..
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function adaPrintReg() {
|
||||
diaBox "Insert Passport" "Please insert passport (First page, name, place) into the printer."
|
||||
cd adafruit
|
||||
./reg "$FNAME" "$SNAME" "$PLANET"
|
||||
cd ..
|
||||
return 0
|
||||
}
|
||||
|
||||
function adaIROStamp() {
|
||||
adaAskForField "IRO stamp"
|
||||
if [ $? -eq 0 ]; then
|
||||
diaBox "Insert Passport" "Please insert passport (Visas) into the printer."
|
||||
cd adafruit
|
||||
./iro $FIELD
|
||||
cd ..
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function adaGPG() {
|
||||
askStr 49 "GPG Fingerprint" "Enter GPG fingerprint WITH SPACES. E.g.:\n 1234 5678 9ABC DEF0 1234 5678 9ABC DEF0 1234 5678"
|
||||
if [ $? -eq 0 ]; then
|
||||
FP=$(cat $TMP)
|
||||
rm $TMP
|
||||
if ! [[ $FP =~ ^([[:xdigit:]]{4} ){9}[[:xdigit:]]{4}$ ]]; then
|
||||
diaBox "GPG Fingerprint" "This does not match the RegEx of a GPG fingerprint.\nPlease type in the whole fingerprint."
|
||||
adaGPG
|
||||
fi
|
||||
FP=$(echo "$FP" | tr [a-f] [A-F])
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
if [ "$1" == "no-confirm" ]; then
|
||||
return 0
|
||||
else
|
||||
confirm "GPG Fingerprint" " GPG:\n $FP"
|
||||
return $?
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function adaReg() {
|
||||
askStr 25 "Forename/Nickname" "Enter forename/nickname"
|
||||
if [ $? -eq 1 ]; then
|
||||
return 1
|
||||
fi
|
||||
FNAME=$(cat $TMP)
|
||||
|
||||
askStr 25 "Surename" "Enter surename"
|
||||
if [ $? -eq 1 ]; then
|
||||
return 1
|
||||
fi
|
||||
SNAME=$(cat $TMP)
|
||||
|
||||
askStr 25 "Place" "Enter place" "Earth, Chaospott"
|
||||
if [ $? -eq 1 ]; then
|
||||
return 1
|
||||
fi
|
||||
PLANET=$(cat $TMP)
|
||||
|
||||
confirm=" Forename: $FNAME\n Surename: $SNAME\n Place: $PLANET"
|
||||
|
||||
ynBox "IRO Stamp" "Does this being want to have a IRO stamp?"
|
||||
if [ $? -eq 0 ]; then
|
||||
STAMP=true
|
||||
else
|
||||
STAMP=false
|
||||
fi
|
||||
|
||||
ynBox "GPG" "Does the being have a GPG key to register?"
|
||||
if [ $? -eq 0 ]; then
|
||||
adaGPG no-confirm
|
||||
if [ $? -eq 0 ]; then
|
||||
confirm="$confirm\n GPG:\n $FP"
|
||||
fi
|
||||
fi
|
||||
|
||||
confirm "Everything" "$confirm"
|
||||
return $?
|
||||
|
||||
}
|
||||
|
||||
function adamenu() {
|
||||
dialog --backtitle "$BT" \
|
||||
--menu "Select ID type:" 14 40 3 \
|
||||
1 "Registration" \
|
||||
2 "IRO Stamp" \
|
||||
3 "GPG" \
|
||||
9 "Back" 2> $TMP
|
||||
|
||||
choice=$(cat $TMP)
|
||||
|
||||
case $choice in
|
||||
1) adaReg
|
||||
if [ $? -eq 0 ]; then
|
||||
adaPrintReg
|
||||
if [ "$STAMP" == "true" ]; then
|
||||
adaIROStamp
|
||||
fi
|
||||
if [ -n "$FP" ]; then
|
||||
adaPrintGPG
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
2) adaIROStamp
|
||||
;;
|
||||
3) adaGPG
|
||||
if [ $? -eq 0 ]; then
|
||||
adaPrintGPG
|
||||
fi
|
||||
;;
|
||||
|
||||
esac
|
||||
unset FNAME
|
||||
unset SNAME
|
||||
unset PLANET
|
||||
unset FP
|
||||
unset FIELD
|
||||
}
|
||||
|
||||
|
||||
|
||||
while [ true ]; do
|
||||
|
||||
dialog --backtitle "$BT" \
|
||||
--menu "Select ID type:" 10 40 3 \
|
||||
1 "Junghackerpass" \
|
||||
2 "New Adafruit passport" \
|
||||
9 "Usual" 2> $TMP
|
||||
2 "Usual" 2> $TMP
|
||||
|
||||
if [ $? -eq 9 ]; then
|
||||
if [ $? -eq 1 ]; then
|
||||
break
|
||||
fi
|
||||
|
||||
@ -405,9 +244,7 @@ while [ true ]; do
|
||||
case $TYPE in
|
||||
1) jhpmenu
|
||||
;;
|
||||
2) adamenu
|
||||
;;
|
||||
9) exit 0
|
||||
2) exit 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user