Skip to content

Commit

Permalink
PADD v3.11.0 (#338)
Browse files Browse the repository at this point in the history
  • Loading branch information
yubiuser authored May 27, 2023
2 parents a968126 + 09a28ab commit bd2bc34
Show file tree
Hide file tree
Showing 8 changed files with 114 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
steps:
-
name: Checkout repository
uses: actions/checkout@v3.3.0
uses: actions/checkout@v3.5.2
-
name: Spell-Checking
uses: codespell-project/actions-codespell@master
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/editorconfig-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ jobs:
name: editorconfig-checker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.3.0
- uses: actions/checkout@v3.5.2
- uses: editorconfig-checker/action-editorconfig-checker@main # current tag v1.0.0 is really out-of-date
- run: editorconfig-checker
28 changes: 24 additions & 4 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,44 @@ name: Mark stale issues

on:
schedule:
- cron: "0 8 * * *"
- cron: '0 8 * * *'
workflow_dispatch:
issue_comment:

env:
stale_label: stale

jobs:
stale:
stale_action:
if: github.event_name != 'issue_comment'
runs-on: ubuntu-latest
permissions:
issues: write

steps:
- uses: actions/stale@v7.0.0
- uses: actions/stale@v8.0.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
days-before-stale: 30
days-before-close: 5
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."
stale-issue-label: "stale"
stale-issue-label: $stale_label
exempt-issue-labels: "Bug, WIP, Fixed In Next Release, Internal, Never Stale"
exempt-all-issue-assignees: true
operations-per-run: 300
close-issue-reason: "not_planned"

remove_stale: # trigger "stale" removal immediately when stale issues are commented on
if: github.event_name == 'issue_comment'
permissions:
contents: read # for actions/checkout
issues: write # to edit issues label
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: Remove 'stale' label
run: gh issue edit ${{ github.event.issue.number }} --remove-label $stale_label
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

2 changes: 1 addition & 1 deletion .github/workflows/stale_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
pull-requests: write

steps:
- uses: actions/stale@v7.0.0
- uses: actions/stale@v8.0.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
# Do not automatically mark PR/issue as stale
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sync-back-to-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
name: Syncing branches
steps:
- name: Checkout
uses: actions/checkout@v3.3.0
uses: actions/checkout@v3.5.2
- name: Opening pull request
run: gh pr create -B development -H master --title 'Sync master back into development' --body 'Created by Github action' --label 'Internal'
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/version_bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
echo "latest_tag=$LATEST_TAG" >> $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@v3.2.0
uses: actions/checkout@v3.5.2
with:
ref: 'development'

Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,14 @@ cd ~ ; echo "if [ \"\$TERM\" == \"linux\" ] ; then\n while :\n do\n ./padd.
- Reboot your Pi-Hole by running `sudo reboot`. PADD should now run when your Pi-Hole has completed booting.

## Updating PADD
- Just run the same commands you used to install
- Simply run

```bash
./padd.sh -u
```

- or run the same commands you used to install

```bash
cd ~
wget -O padd.sh https://install.padd.sh
Expand Down
85 changes: 77 additions & 8 deletions padd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export LC_NUMERIC=C
############################################ VARIABLES #############################################

# VERSION
padd_version="v3.10.1"
padd_version="v3.11.0"

# LastChecks
LastCheckVersionInformation=$(date +%s)
Expand Down Expand Up @@ -162,12 +162,15 @@ GetSystemInformation() {

# CPU temperature
if [ -d "/sys/devices/platform/coretemp.0/hwmon/" ]; then
cpu=$(cat "$(find /sys/devices/platform/coretemp.0/hwmon/ -maxdepth 2 -name "temp1_input" 2>/dev/null | head -1)")
elif [ -f /sys/class/thermal/thermal_zone0/temp ]; then
cpu=$(cat "$(find /sys/devices/platform/coretemp.0/hwmon/ -maxdepth 2 -name "temp1_input" 2>/dev/null | head -1)" 2>/dev/null)
fi
if [ -z "${cpu}" ] && [ -f /sys/class/thermal/thermal_zone0/temp ]; then
cpu=$(cat /sys/class/thermal/thermal_zone0/temp)
elif [ -f /sys/class/hwmon/hwmon0/temp1_input ]; then
fi
if [ -z "${cpu}" ] && [ -f /sys/class/hwmon/hwmon0/temp1_input ]; then
cpu=$(cat /sys/class/hwmon/hwmon0/temp1_input)
else
fi
if [ -z "${cpu}" ]; then
cpu=0
fi

Expand Down Expand Up @@ -722,7 +725,7 @@ PrintLogo() {
if [ -n "${DOCKER_VERSION}" ]; then
version_info="Docker ${docker_version_heatmap}${DOCKER_VERSION}${reset_text}"
else
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}"
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}"
fi

# Screen size checks
Expand Down Expand Up @@ -755,7 +758,7 @@ PrintDashboard() {
if [ -n "${DOCKER_VERSION}" ]; then
version_info="Docker ${docker_version_heatmap}${DOCKER_VERSION}${reset_text}"
else
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}"
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}"
fi
# Move cursor to (0,0).
printf '\e[H'
Expand Down Expand Up @@ -1195,6 +1198,23 @@ OutputJSON() {
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}}"
}

ShowVersion() {
# source version file to check if $DOCKER_VERSION is set
. /etc/pihole/versions
GetPADDInformation
if [ -z "${padd_version_latest}" ]; then
padd_version_latest="N/A"
fi
if [ -n "${DOCKER_VERSION}" ]; then
# Check for latest Docker version
GetVersionInformation
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})"
version_info="Docker ${docker_version_heatmap}${DOCKER_VERSION}${reset_text}"
else
printf "%s${clear_line}\n" " PADD version is ${padd_version_heatmap}${padd_version}${reset_text} (Latest: ${padd_version_latest})"
fi
}

StartupRoutine(){
# Get config variables
. /etc/pihole/setupVars.conf
Expand Down Expand Up @@ -1370,6 +1390,52 @@ NormalPADD() {
done
}

Update() {
# source version file to check if $DOCKER_VERSION is set
. /etc/pihole/versions

if [ -n "${DOCKER_VERSION}" ]; then
echo "${check_box_info} Update is not supported for Docker"
exit 1
fi

GetPADDInformation

if [ "${padd_out_of_date_flag}" = "true" ]; then
echo "${check_box_info} Updating PADD from ${padd_version} to ${padd_version_latest}"

padd_script_path=$(realpath "$0")

if which wget > /dev/null 2>&1; then
echo "${check_box_info} Downloading PADD update via wget ..."
if wget -qO "${padd_script_path}" https://install.padd.sh > /dev/null 2>&1; then
echo "${check_box_good} ... done. Restart PADD for the update to take effect"
else
echo "${check_box_bad} Cannot download PADD update via wget"
echo "${check_box_info} Go to https://install.padd.sh to download the update manually"
exit 1
fi
elif which curl > /dev/null 2>&1; then
echo "${check_box_info} Downloading PADD update via curl ..."
if curl -sSL https://install.padd.sh -o "${padd_script_path}" > /dev/null 2>&1; then
echo "${check_box_good} ... done. Restart PADD for the update to take effect"
else
echo "${check_box_bad} Cannot download PADD update via curl"
echo "${check_box_info} Go to https://install.padd.sh to download the update manually"
exit 1
fi
else
echo "${check_box_bad} Cannot download, neither wget nor curl are available"
echo "${check_box_info} Go to https://install.padd.sh to download the update manually"
exit 1
fi
else
echo "${check_box_good} You are already using the latest PADD version ${padd_version}"
fi

exit 0
}

DisplayHelp() {
cat << EOM
Expand All @@ -1381,10 +1447,11 @@ DisplayHelp() {
::: -xoff [num] set the x-offset, reference is the upper left corner, disables auto-centering
::: -yoff [num] set the y-offset, reference is the upper left corner, disables auto-centering
::: -j, --json output stats as JSON formatted string and exit
::: -u, --update update to the latest version
::: -v, --version show PADD version info
::: -h, --help display this help text
EOM
exit 0
}

CleanExit(){
Expand Down Expand Up @@ -1448,7 +1515,9 @@ main(){
while [ "$#" -gt 0 ]; do
case "$1" in
"-j" | "--json" ) OutputJSON; exit 0;;
"-u" | "--update" ) Update;;
"-h" | "--help" ) DisplayHelp; exit 0;;
"-v" | "--version" ) ShowVersion; exit 0;;
"-xoff" ) xOffset="$2"; xOffOrig="$2"; shift;;
"-yoff" ) yOffset="$2"; yOffOrig="$2"; shift;;
* ) DisplayHelp; exit 1;;
Expand Down

0 comments on commit bd2bc34

Please sign in to comment.