Skip to content

Commit 60b5980

Browse files
committed
dependency check adjustment
Signed-off-by: Michael Woolweaver <[email protected]> list dependencies in readme for usage from other machines Signed-off-by: Michael Woolweaver <[email protected]>
1 parent 386477e commit 60b5980

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

Diff for: README.md

+7
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ PADD (formerly Chronometer2) is a more expansive version of the original chronom
4646
./padd.sh --server <DOMAIN|IP>
4747
```
4848

49+
#### Dependencies
50+
- curl
51+
- jq
52+
- dig
53+
- tput
54+
55+
4956
### Authentication
5057

5158
Pi-hole v6 uses a completely new API with a new authentication mechanism

Diff for: padd.sh

+19-3
Original file line numberDiff line numberDiff line change
@@ -1516,16 +1516,32 @@ secretRead() {
15161516
}
15171517

15181518
check_dependencies() {
1519+
local hasDeps=true
15191520
# Check for required dependencies
15201521
if ! command -v curl >/dev/null 2>&1; then
15211522
printf "%b" "${check_box_bad} Error!\n 'curl' is missing but required.\n"
1522-
exit 1
1523+
hasDeps=false
15231524
fi
15241525

15251526
if ! command -v jq >/dev/null 2>&1; then
1526-
printf "%b" "${check_box_bad} Error!\n 'jq' is missing but required.\n"
1527-
exit 1
1527+
printf "%b" "${check_box_bad} Error!\n 'jq' is missing but required.\n"
1528+
hasDeps=false
1529+
fi
1530+
1531+
if ! command -v dig >/dev/null 2>&1; then
1532+
printf "%b" "${check_box_bad} Error!\n 'dig' is missing but required.\n"
1533+
hasDeps=false
15281534
fi
1535+
1536+
if ! command -v tput >/dev/null 2>&1; then
1537+
printf "%b" "${check_box_bad} Error!\n 'tput' is missing but required.\n"
1538+
hasDeps=false
1539+
fi
1540+
1541+
if [ "${hasDeps}" = false ]; then
1542+
printf "%b" "\n Please install the dependencies noted above.\n"
1543+
exit 1
1544+
fi
15291545
}
15301546

15311547
########################################## MAIN FUNCTIONS ##########################################

0 commit comments

Comments
 (0)