Skip to content

Commit

Permalink
v1.5 update
Browse files Browse the repository at this point in the history
  • Loading branch information
JayBrown committed Jun 16, 2016
1 parent 82433ae commit 7e3763d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ Only necessary if for some reason you want to run this from the shell or another
* My own minisign public key for releases on Github will be created in `${HOME}/Documents/minisign`

## To-do
- [ ] Notification if update is available
- [ ] Switch private keys directory to `${HOME}/.minisign` (pending `minisign` update)

## Screengrabs
Expand Down
11 changes: 10 additions & 1 deletion minisign-sign.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/bin/bash

# minisign-sign v1.4.1 (shell script version)
# minisign-sign v1.5 (shell script version)

LANG=en_US.UTF-8
export PATH=/usr/local/bin:$PATH
ACCOUNT=$(who am i | /usr/bin/awk '{print $1}')
CURRENT_VERSION="1.5"

# determine correct Mac OS name
MACOS2NO=$(/usr/bin/sw_vers -productVersion | /usr/bin/awk -F. '{print $2}')
Expand Down Expand Up @@ -97,6 +98,14 @@ if [[ ! -e "$PUBKEY_LOC" ]] ; then
echo -e "untrusted comment: minisign public key 37D030AC5E03C787\nRWSHxwNerDDQN8RlBeFUuLkB9bPqsR2T6es0jmzguvpvqWiXjxzTfaRY" > "$PUBKEY_LOC"
fi

# check for update
NEWEST_VERSION=$(/usr/bin/curl --silent https://api.github.com/repos/JayBrown/minisign-misc/releases/latest | /usr/bin/awk '/tag_name/ {print $2}' | xargs)
NEWEST_VERSION=${NEWEST_VERSION//,}
if [[ $NEWEST_VERSION>$CURRENT_VERSION ]] ; then
notify "Update available" "Minisign Miscellanea v$NEWEST_VERSION"
/usr/bin/open "https://github.com/JayBrown/minisign-misc/releases/latest"
fi

# check for false input
SIGN_FILE="$1"
TARGET_NAME=$(/usr/bin/basename "$SIGN_FILE")
Expand Down
21 changes: 15 additions & 6 deletions minisign-verify.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/bin/bash

# minisign-verify v1.4.1 (shell script version)
# minisign-verify v1.5 (shell script version)

LANG=en_US.UTF-8
export PATH=/usr/local/bin:$PATH
ACCOUNT=$(who am i | /usr/bin/awk '{print $1}')
CURRENT_VERSION="1.5"

# set notification function
notify () {
Expand Down Expand Up @@ -68,17 +69,25 @@ if [[ -e "$CACHE_DIR/lcars.base64" ]] ; then
rm -rf "$CACHE_DIR/lcars.base64"
fi

# look for minisign binary
MINISIGN=$(which minisign 2>&1)
if [[ "$MINISIGN" == "minisign not found" ]] || [[ "$MINISIGN" == "which: no minisign in"* ]] ; then
notify "Error: minisign not found" "Please install minisign first"
exit
fi

# touch JayBrown public key file
if [[ ! -e "$PUBKEY_LOC" ]] ; then
touch "$PUBKEY_LOC"
echo -e "untrusted comment: minisign public key 37D030AC5E03C787\nRWSHxwNerDDQN8RlBeFUuLkB9bPqsR2T6es0jmzguvpvqWiXjxzTfaRY" > "$PUBKEY_LOC"
fi

# look for minisign binary
MINISIGN=$(which minisign 2>&1)
if [[ "$MINISIGN" == "minisign not found" ]] || [[ "$MINISIGN" == "which: no minisign in"* ]] ; then
notify "Error: minisign not found" "Please install minisign first"
exit
# check for update
NEWEST_VERSION=$(/usr/bin/curl --silent https://api.github.com/repos/JayBrown/minisign-misc/releases/latest | /usr/bin/awk '/tag_name/ {print $2}' | xargs)
NEWEST_VERSION=${NEWEST_VERSION//,}
if [[ $NEWEST_VERSION>$CURRENT_VERSION ]] ; then
notify "Update available" "Minisign Miscellanea v$NEWEST_VERSION"
/usr/bin/open "https://github.com/JayBrown/minisign-misc/releases/latest"
fi

# check for false input
Expand Down

0 comments on commit 7e3763d

Please sign in to comment.