Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jan 9, 2020. It is now read-only.

Add better tsschecker binary check/error messaging#1

Open
deepfriedfilth wants to merge 2 commits into
dora2ios:masterfrom
deepfriedfilth:dev
Open

Add better tsschecker binary check/error messaging#1
deepfriedfilth wants to merge 2 commits into
dora2ios:masterfrom
deepfriedfilth:dev

Conversation

@deepfriedfilth

Copy link
Copy Markdown

I have tsschecker v244 installed at /usr/local/bin/tsschecker (via @stek29's homebrew tap) but receive "Please put tsschecker" as terminal output/error when attempting to run getshsh.sh. Running on macOS 10.13.6

I'd suggest labeling the error better, by appending "binary in project directory" to that error message or checking if tsschecker is installed in /usr/local/bin, use that version

@stek29

stek29 commented Jan 29, 2019

Copy link
Copy Markdown

Just use command -v tsschecker to get one in PATH.

@deepfriedfilth

deepfriedfilth commented Jan 29, 2019

Copy link
Copy Markdown
Author

Thing is, /usr/local/bin is included in my PATH for both fish + bash, but the original shell script references a local copy of tsschecker here, here, and here.. so at minimum a tsschecker symlink would need to be created in the project directory.

My pull is meant to simplify the process: if tsschecker can't be found, return a more detailed error message that doesn't require you to be fluent in shell script to remedy ¯_(ツ)_/¯

@stek29

stek29 commented Jan 31, 2019

Copy link
Copy Markdown

I'm saying that your PR is a bad idea -- PATH exists for a reason. Instead of trying to find tsschecker in some predefined list, it should just let shell do it, and one of the ways to get path to a binary in PATH is command -v tsschecker.

@stek29 stek29 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently old behavior is broken too -- if there's no tsschecker in PATH, it won't use tsschecker in current directory.

Comment thread getshsh.sh
if [ ! -e "tsschecker" ]; then
echo "Please put tsschecker."

if [ ! -z $(command -v tsschecker) ]; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Path can have spaces in it -- use "$(...)"

Comment thread getshsh.sh
do
echo "ApNonce: "$nonce""
./tsschecker -i $1 —d $2 --boardconfig $3 -e $4 --save-path $5 -s --apnonce $nonce 2>/dev/null >/dev/null &
$TSS -i $1 —d $2 --boardconfig $3 -e $4 --save-path $5 -s --apnonce $nonce 2>/dev/null >/dev/null &

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same thing

Comment thread getshsh.sh
do
echo "ApNonce: "$nonce""
./tsschecker -i $1 —d $2 --boardconfig $3 -e $4 --save-path $5 -s --apnonce $nonce 2>/dev/null >/dev/null
$TSS -i $1 —d $2 --boardconfig $3 -e $4 --save-path $5 -s --apnonce $nonce 2>/dev/null >/dev/null

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here

Comment thread getshsh.sh
## Stopper ##
echo "ApNonce: 05fe405753166f125559e7c9ac558654f107c7e9 (=0x0000000000000000 SHA1)"
./tsschecker -i $1 —d $2 --boardconfig $3 -e $4 --save-path $5 -s --apnonce 05fe405753166f125559e7c9ac558654f107c7e9
$TSS -i $1 —d $2 --boardconfig $3 -e $4 --save-path $5 -s --apnonce 05fe405753166f125559e7c9ac558654f107c7e9

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Comment thread getshsh.sh
echo "Please put tsschecker."

if [ ! -z $(command -v tsschecker) ]; then
TSS=$(command -v tsschecker)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same thing

Comment thread getshsh.sh

if [ ! -z $(command -v tsschecker) ]; then
TSS=$(command -v tsschecker)
elif [ -z $(command -v tsschecker) ]; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just else would be enough

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants