Skip to content

Commit bd2bc34

Browse files
authored
PADD v3.11.0 (#338)
2 parents a968126 + 09a28ab commit bd2bc34

8 files changed

+114
-18
lines changed

.github/workflows/codespell.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
steps:
1111
-
1212
name: Checkout repository
13-
uses: actions/checkout@v3.3.0
13+
uses: actions/checkout@v3.5.2
1414
-
1515
name: Spell-Checking
1616
uses: codespell-project/actions-codespell@master

.github/workflows/editorconfig-checker.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ jobs:
99
name: editorconfig-checker
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v3.3.0
12+
- uses: actions/checkout@v3.5.2
1313
- uses: editorconfig-checker/action-editorconfig-checker@main # current tag v1.0.0 is really out-of-date
1414
- run: editorconfig-checker

.github/workflows/stale.yml

+24-4
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,44 @@ name: Mark stale issues
22

33
on:
44
schedule:
5-
- cron: "0 8 * * *"
5+
- cron: '0 8 * * *'
66
workflow_dispatch:
7+
issue_comment:
8+
9+
env:
10+
stale_label: stale
711

812
jobs:
9-
stale:
13+
stale_action:
14+
if: github.event_name != 'issue_comment'
1015
runs-on: ubuntu-latest
1116
permissions:
1217
issues: write
1318

1419
steps:
15-
- uses: actions/stale@v7.0.0
20+
- uses: actions/stale@v8.0.0
1621
with:
1722
repo-token: ${{ secrets.GITHUB_TOKEN }}
1823
days-before-stale: 30
1924
days-before-close: 5
2025
stale-issue-message: "This issue is stale because it has been open 30 days with no activity. Please comment or update this issue or it will be closed in 5 days."
21-
stale-issue-label: "stale"
26+
stale-issue-label: $stale_label
2227
exempt-issue-labels: "Bug, WIP, Fixed In Next Release, Internal, Never Stale"
2328
exempt-all-issue-assignees: true
2429
operations-per-run: 300
2530
close-issue-reason: "not_planned"
31+
32+
remove_stale: # trigger "stale" removal immediately when stale issues are commented on
33+
if: github.event_name == 'issue_comment'
34+
permissions:
35+
contents: read # for actions/checkout
36+
issues: write # to edit issues label
37+
runs-on: ubuntu-latest
38+
steps:
39+
- name: Checkout
40+
uses: actions/[email protected]
41+
- name: Remove 'stale' label
42+
run: gh issue edit ${{ github.event.issue.number }} --remove-label $stale_label
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+

.github/workflows/stale_pr.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
pull-requests: write
1818

1919
steps:
20-
- uses: actions/stale@v7.0.0
20+
- uses: actions/stale@v8.0.0
2121
with:
2222
repo-token: ${{ secrets.GITHUB_TOKEN }}
2323
# Do not automatically mark PR/issue as stale

.github/workflows/sync-back-to-dev.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
name: Syncing branches
1212
steps:
1313
- name: Checkout
14-
uses: actions/checkout@v3.3.0
14+
uses: actions/checkout@v3.5.2
1515
- name: Opening pull request
1616
run: gh pr create -B development -H master --title 'Sync master back into development' --body 'Created by Github action' --label 'Internal'
1717
env:

.github/workflows/version_bump.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
echo "latest_tag=$LATEST_TAG" >> $GITHUB_ENV
2020
2121
- name: Checkout code
22-
uses: actions/checkout@v3.2.0
22+
uses: actions/checkout@v3.5.2
2323
with:
2424
ref: 'development'
2525

README.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,14 @@ cd ~ ; echo "if [ \"\$TERM\" == \"linux\" ] ; then\n while :\n do\n ./padd.
5050
- Reboot your Pi-Hole by running `sudo reboot`. PADD should now run when your Pi-Hole has completed booting.
5151

5252
## Updating PADD
53-
- Just run the same commands you used to install
53+
- Simply run
54+
55+
```bash
56+
./padd.sh -u
57+
```
58+
59+
- or run the same commands you used to install
60+
5461
```bash
5562
cd ~
5663
wget -O padd.sh https://install.padd.sh

padd.sh

+77-8
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export LC_NUMERIC=C
1515
############################################ VARIABLES #############################################
1616

1717
# VERSION
18-
padd_version="v3.10.1"
18+
padd_version="v3.11.0"
1919

2020
# LastChecks
2121
LastCheckVersionInformation=$(date +%s)
@@ -162,12 +162,15 @@ GetSystemInformation() {
162162

163163
# CPU temperature
164164
if [ -d "/sys/devices/platform/coretemp.0/hwmon/" ]; then
165-
cpu=$(cat "$(find /sys/devices/platform/coretemp.0/hwmon/ -maxdepth 2 -name "temp1_input" 2>/dev/null | head -1)")
166-
elif [ -f /sys/class/thermal/thermal_zone0/temp ]; then
165+
cpu=$(cat "$(find /sys/devices/platform/coretemp.0/hwmon/ -maxdepth 2 -name "temp1_input" 2>/dev/null | head -1)" 2>/dev/null)
166+
fi
167+
if [ -z "${cpu}" ] && [ -f /sys/class/thermal/thermal_zone0/temp ]; then
167168
cpu=$(cat /sys/class/thermal/thermal_zone0/temp)
168-
elif [ -f /sys/class/hwmon/hwmon0/temp1_input ]; then
169+
fi
170+
if [ -z "${cpu}" ] && [ -f /sys/class/hwmon/hwmon0/temp1_input ]; then
169171
cpu=$(cat /sys/class/hwmon/hwmon0/temp1_input)
170-
else
172+
fi
173+
if [ -z "${cpu}" ]; then
171174
cpu=0
172175
fi
173176

@@ -722,7 +725,7 @@ PrintLogo() {
722725
if [ -n "${DOCKER_VERSION}" ]; then
723726
version_info="Docker ${docker_version_heatmap}${DOCKER_VERSION}${reset_text}"
724727
else
725-
version_info="Pi-hole® ${core_version_heatmap}${CORE_VERSION}${reset_text}, Web ${web_version_heatmap}${WEB_VERSION}${reset_text}, FTL ${ftl_version_heatmap}${FTL_VERSION}"
728+
version_info="Pi-hole® ${core_version_heatmap}${CORE_VERSION}${reset_text}, Web ${web_version_heatmap}${WEB_VERSION}${reset_text}, FTL ${ftl_version_heatmap}${FTL_VERSION}${reset_text}"
726729
fi
727730

728731
# Screen size checks
@@ -755,7 +758,7 @@ PrintDashboard() {
755758
if [ -n "${DOCKER_VERSION}" ]; then
756759
version_info="Docker ${docker_version_heatmap}${DOCKER_VERSION}${reset_text}"
757760
else
758-
version_info="Pi-hole® ${core_version_heatmap}${CORE_VERSION}${reset_text}, Web ${web_version_heatmap}${WEB_VERSION}${reset_text}, FTL ${ftl_version_heatmap}${FTL_VERSION}"
761+
version_info="Pi-hole® ${core_version_heatmap}${CORE_VERSION}${reset_text}, Web ${web_version_heatmap}${WEB_VERSION}${reset_text}, FTL ${ftl_version_heatmap}${FTL_VERSION}${reset_text}"
759762
fi
760763
# Move cursor to (0,0).
761764
printf '\e[H'
@@ -1195,6 +1198,23 @@ OutputJSON() {
11951198
echo "{\"domains_being_blocked\":${domains_being_blocked_raw},\"dns_queries_today\":${dns_queries_today_raw},\"ads_blocked_today\":${ads_blocked_today_raw},\"ads_percentage_today\":${ads_percentage_today_raw},\"clients\": ${clients}}"
11961199
}
11971200

1201+
ShowVersion() {
1202+
# source version file to check if $DOCKER_VERSION is set
1203+
. /etc/pihole/versions
1204+
GetPADDInformation
1205+
if [ -z "${padd_version_latest}" ]; then
1206+
padd_version_latest="N/A"
1207+
fi
1208+
if [ -n "${DOCKER_VERSION}" ]; then
1209+
# Check for latest Docker version
1210+
GetVersionInformation
1211+
printf "%s${clear_line}\n" " PADD version is ${padd_version} as part of Docker ${docker_version_heatmap}${DOCKER_VERSION}${reset_text} (Latest Docker: ${GITHUB_DOCKER_VERSION})"
1212+
version_info="Docker ${docker_version_heatmap}${DOCKER_VERSION}${reset_text}"
1213+
else
1214+
printf "%s${clear_line}\n" " PADD version is ${padd_version_heatmap}${padd_version}${reset_text} (Latest: ${padd_version_latest})"
1215+
fi
1216+
}
1217+
11981218
StartupRoutine(){
11991219
# Get config variables
12001220
. /etc/pihole/setupVars.conf
@@ -1370,6 +1390,52 @@ NormalPADD() {
13701390
done
13711391
}
13721392

1393+
Update() {
1394+
# source version file to check if $DOCKER_VERSION is set
1395+
. /etc/pihole/versions
1396+
1397+
if [ -n "${DOCKER_VERSION}" ]; then
1398+
echo "${check_box_info} Update is not supported for Docker"
1399+
exit 1
1400+
fi
1401+
1402+
GetPADDInformation
1403+
1404+
if [ "${padd_out_of_date_flag}" = "true" ]; then
1405+
echo "${check_box_info} Updating PADD from ${padd_version} to ${padd_version_latest}"
1406+
1407+
padd_script_path=$(realpath "$0")
1408+
1409+
if which wget > /dev/null 2>&1; then
1410+
echo "${check_box_info} Downloading PADD update via wget ..."
1411+
if wget -qO "${padd_script_path}" https://install.padd.sh > /dev/null 2>&1; then
1412+
echo "${check_box_good} ... done. Restart PADD for the update to take effect"
1413+
else
1414+
echo "${check_box_bad} Cannot download PADD update via wget"
1415+
echo "${check_box_info} Go to https://install.padd.sh to download the update manually"
1416+
exit 1
1417+
fi
1418+
elif which curl > /dev/null 2>&1; then
1419+
echo "${check_box_info} Downloading PADD update via curl ..."
1420+
if curl -sSL https://install.padd.sh -o "${padd_script_path}" > /dev/null 2>&1; then
1421+
echo "${check_box_good} ... done. Restart PADD for the update to take effect"
1422+
else
1423+
echo "${check_box_bad} Cannot download PADD update via curl"
1424+
echo "${check_box_info} Go to https://install.padd.sh to download the update manually"
1425+
exit 1
1426+
fi
1427+
else
1428+
echo "${check_box_bad} Cannot download, neither wget nor curl are available"
1429+
echo "${check_box_info} Go to https://install.padd.sh to download the update manually"
1430+
exit 1
1431+
fi
1432+
else
1433+
echo "${check_box_good} You are already using the latest PADD version ${padd_version}"
1434+
fi
1435+
1436+
exit 0
1437+
}
1438+
13731439
DisplayHelp() {
13741440
cat << EOM
13751441
@@ -1381,10 +1447,11 @@ DisplayHelp() {
13811447
::: -xoff [num] set the x-offset, reference is the upper left corner, disables auto-centering
13821448
::: -yoff [num] set the y-offset, reference is the upper left corner, disables auto-centering
13831449
::: -j, --json output stats as JSON formatted string and exit
1450+
::: -u, --update update to the latest version
1451+
::: -v, --version show PADD version info
13841452
::: -h, --help display this help text
13851453
13861454
EOM
1387-
exit 0
13881455
}
13891456

13901457
CleanExit(){
@@ -1448,7 +1515,9 @@ main(){
14481515
while [ "$#" -gt 0 ]; do
14491516
case "$1" in
14501517
"-j" | "--json" ) OutputJSON; exit 0;;
1518+
"-u" | "--update" ) Update;;
14511519
"-h" | "--help" ) DisplayHelp; exit 0;;
1520+
"-v" | "--version" ) ShowVersion; exit 0;;
14521521
"-xoff" ) xOffset="$2"; xOffOrig="$2"; shift;;
14531522
"-yoff" ) yOffset="$2"; yOffOrig="$2"; shift;;
14541523
* ) DisplayHelp; exit 1;;

0 commit comments

Comments
 (0)