Skip to content

Commit c3a2335

Browse files
committed
dependency check adjustment
Signed-off-by: Michael Woolweaver <[email protected]>
1 parent 589b6df commit c3a2335

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

Diff for: README.md

+6
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ 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+
4955
### Authentication
5056

5157
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,15 +1516,31 @@ 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
1534+
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}" = true ]; then
1542+
printf "%b" "\n Please install the dependencies noted above.\n"
1543+
exit 1
15281544
fi
15291545
}
15301546

0 commit comments

Comments
 (0)