Compare commits
3 Commits
unsupporte
...
ec8df55f0d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ec8df55f0d | ||
|
|
2acb7098d8 | ||
|
|
f2af7c8970 |
6
.github/workflows/codeql-analysis.yml
vendored
6
.github/workflows/codeql-analysis.yml
vendored
@@ -29,12 +29,12 @@ jobs:
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
-
|
||||
name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@9e907b5e64f6b83e7804b09294d44122997950d6 #v4.32.3
|
||||
uses: github/codeql-action/init@89a39a4e59826350b863aa6b6252a07ad50cf83e #v4.32.4
|
||||
with:
|
||||
languages: 'python'
|
||||
-
|
||||
name: Autobuild
|
||||
uses: github/codeql-action/autobuild@9e907b5e64f6b83e7804b09294d44122997950d6 #v4.32.3
|
||||
uses: github/codeql-action/autobuild@89a39a4e59826350b863aa6b6252a07ad50cf83e #v4.32.4
|
||||
-
|
||||
name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@9e907b5e64f6b83e7804b09294d44122997950d6 #v4.32.3
|
||||
uses: github/codeql-action/analyze@89a39a4e59826350b863aa6b6252a07ad50cf83e #v4.32.4
|
||||
|
||||
2
.github/workflows/stale.yml
vendored
2
.github/workflows/stale.yml
vendored
@@ -17,7 +17,7 @@ jobs:
|
||||
issues: write
|
||||
|
||||
steps:
|
||||
- uses: actions/stale@997185467fa4f803885201cee163a9f38240193d #v10.1.1
|
||||
- uses: actions/stale@b5d41d4e1d5dceea10e7104786b73624c18a190f #v10.2.0
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
days-before-stale: 30
|
||||
|
||||
2
.github/workflows/stale_pr.yml
vendored
2
.github/workflows/stale_pr.yml
vendored
@@ -17,7 +17,7 @@ jobs:
|
||||
pull-requests: write
|
||||
|
||||
steps:
|
||||
- uses: actions/stale@997185467fa4f803885201cee163a9f38240193d #v10.1.1
|
||||
- uses: actions/stale@b5d41d4e1d5dceea10e7104786b73624c18a190f #v10.2.0
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
# Do not automatically mark PR/issue as stale
|
||||
|
||||
@@ -41,22 +41,6 @@ warning1() {
|
||||
}
|
||||
|
||||
checkout() {
|
||||
|
||||
local skipFTL additionalFlag
|
||||
skipFTL=false
|
||||
# Check arguments
|
||||
for var in "$@"; do
|
||||
case "$var" in
|
||||
"--skipFTL") skipFTL=true ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "${skipFTL}" == true ]; then
|
||||
additionalFlag="--skipFTL"
|
||||
else
|
||||
additionalFlag=""
|
||||
fi
|
||||
|
||||
local corebranches
|
||||
local webbranches
|
||||
|
||||
@@ -251,7 +235,7 @@ checkout() {
|
||||
# Force updating everything
|
||||
if [[ ! "${1}" == "web" && ! "${1}" == "ftl" ]]; then
|
||||
echo -e " ${INFO} Running installer to upgrade your installation"
|
||||
if "${PI_HOLE_FILES_DIR}/automated install/basic-install.sh" --unattended ${additionalFlag}; then
|
||||
if "${PI_HOLE_FILES_DIR}/automated install/basic-install.sh" --unattended; then
|
||||
exit 0
|
||||
else
|
||||
echo -e " ${COL_RED} Error: Unable to complete update, please contact support${COL_NC}"
|
||||
|
||||
@@ -149,37 +149,31 @@ main() {
|
||||
echo -e " ${INFO} Web Interface:\\t${COL_GREEN}up to date${COL_NC}"
|
||||
fi
|
||||
|
||||
# Allow the user to skip this check if they are using a self-compiled FTL binary from an unsupported architecture
|
||||
if [ "${skipFTL}" != true ]; then
|
||||
local funcOutput
|
||||
funcOutput=$(get_binary_name) #Store output of get_binary_name here
|
||||
local binary
|
||||
binary="pihole-FTL${funcOutput##*pihole-FTL}" #binary name will be the last line of the output of get_binary_name (it always begins with pihole-FTL)
|
||||
local funcOutput
|
||||
funcOutput=$(get_binary_name) #Store output of get_binary_name here
|
||||
local binary
|
||||
binary="pihole-FTL${funcOutput##*pihole-FTL}" #binary name will be the last line of the output of get_binary_name (it always begins with pihole-FTL)
|
||||
|
||||
if FTLcheckUpdate "${binary}" &>/dev/null; then
|
||||
FTL_update=true
|
||||
echo -e " ${INFO} FTL:\\t\\t${COL_YELLOW}update available${COL_NC}"
|
||||
else
|
||||
case $? in
|
||||
1)
|
||||
echo -e " ${INFO} FTL:\\t\\t${COL_GREEN}up to date${COL_NC}"
|
||||
;;
|
||||
2)
|
||||
echo -e " ${INFO} FTL:\\t\\t${COL_RED}Branch is not available.${COL_NC}\\n\\t\\t\\tUse ${COL_GREEN}pihole checkout ftl [branchname]${COL_NC} to switch to a valid branch."
|
||||
exit 1
|
||||
;;
|
||||
3)
|
||||
echo -e " ${INFO} FTL:\\t\\t${COL_RED}Something has gone wrong, cannot reach download server${COL_NC}"
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
echo -e " ${INFO} FTL:\\t\\t${COL_RED}Something has gone wrong, contact support${COL_NC}"
|
||||
exit 1
|
||||
esac
|
||||
FTL_update=false
|
||||
fi
|
||||
if FTLcheckUpdate "${binary}" &>/dev/null; then
|
||||
FTL_update=true
|
||||
echo -e " ${INFO} FTL:\\t\\t${COL_YELLOW}update available${COL_NC}"
|
||||
else
|
||||
echo -e " ${INFO} FTL:\\t\\t${COL_YELLOW}--skipFTL set - update check skipped${COL_NC}"
|
||||
case $? in
|
||||
1)
|
||||
echo -e " ${INFO} FTL:\\t\\t${COL_GREEN}up to date${COL_NC}"
|
||||
;;
|
||||
2)
|
||||
echo -e " ${INFO} FTL:\\t\\t${COL_RED}Branch is not available.${COL_NC}\\n\\t\\t\\tUse ${COL_GREEN}pihole checkout ftl [branchname]${COL_NC} to switch to a valid branch."
|
||||
exit 1
|
||||
;;
|
||||
3)
|
||||
echo -e " ${INFO} FTL:\\t\\t${COL_RED}Something has gone wrong, cannot reach download server${COL_NC}"
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
echo -e " ${INFO} FTL:\\t\\t${COL_RED}Something has gone wrong, contact support${COL_NC}"
|
||||
exit 1
|
||||
esac
|
||||
FTL_update=false
|
||||
fi
|
||||
|
||||
@@ -228,14 +222,7 @@ main() {
|
||||
fi
|
||||
|
||||
if [[ "${FTL_update}" == true || "${core_update}" == true ]]; then
|
||||
local addionalFlag
|
||||
|
||||
if [[ ${skipFTL} == true ]]; then
|
||||
addionalFlag="--skipFTL"
|
||||
else
|
||||
addionalFlag=""
|
||||
fi
|
||||
${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh --repair --unattended ${addionalFlag} || \
|
||||
${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh --repair --unattended || \
|
||||
echo -e "${basicError}" && exit 1
|
||||
fi
|
||||
|
||||
@@ -255,15 +242,8 @@ main() {
|
||||
exit 0
|
||||
}
|
||||
|
||||
CHECK_ONLY=false
|
||||
skipFTL=false
|
||||
|
||||
# Check arguments
|
||||
for var in "$@"; do
|
||||
case "$var" in
|
||||
"--check-only") CHECK_ONLY=true ;;
|
||||
"--skipFTL") skipFTL=true ;;
|
||||
esac
|
||||
done
|
||||
if [[ "$1" == "--check-only" ]]; then
|
||||
CHECK_ONLY=true
|
||||
fi
|
||||
|
||||
main
|
||||
|
||||
@@ -10,32 +10,32 @@
|
||||
|
||||
function get_local_branch() {
|
||||
# Return active branch
|
||||
cd "${1}" 2>/dev/null || return 1
|
||||
git rev-parse --abbrev-ref HEAD || return 1
|
||||
cd "${1}" 2>/dev/null || { echo "null"; return; }
|
||||
git rev-parse --abbrev-ref HEAD || echo "null"
|
||||
}
|
||||
|
||||
function get_local_version() {
|
||||
# Return active version
|
||||
cd "${1}" 2>/dev/null || return 1
|
||||
git describe --tags --always 2>/dev/null || return 1
|
||||
cd "${1}" 2>/dev/null || { echo "null"; return; }
|
||||
git describe --tags --always 2>/dev/null || echo "null"
|
||||
}
|
||||
|
||||
function get_local_hash() {
|
||||
cd "${1}" 2>/dev/null || return 1
|
||||
git rev-parse --short=8 HEAD || return 1
|
||||
cd "${1}" 2>/dev/null || { echo "null"; return; }
|
||||
git rev-parse --short=8 HEAD || echo "null"
|
||||
}
|
||||
|
||||
function get_remote_version() {
|
||||
# if ${2} is = "master" we need to use the "latest" endpoint, otherwise, we simply return null
|
||||
if [[ "${2}" == "master" ]]; then
|
||||
curl -s "https://api.github.com/repos/pi-hole/${1}/releases/latest" 2>/dev/null | jq --raw-output .tag_name || return 1
|
||||
curl -s "https://api.github.com/repos/pi-hole/${1}/releases/latest" 2>/dev/null | jq --raw-output .tag_name || echo "null"
|
||||
else
|
||||
echo "null"
|
||||
fi
|
||||
}
|
||||
|
||||
function get_remote_hash() {
|
||||
git ls-remote "https://github.com/pi-hole/${1}" --tags "${2}" | awk '{print substr($0, 1,8);}' || return 1
|
||||
git ls-remote "https://github.com/pi-hole/${1}" --tags "${2}" | awk '{print substr($0, 1,8);}' || echo "null"
|
||||
}
|
||||
|
||||
# Source the utils file for addOrEditKeyValPair()
|
||||
|
||||
@@ -13,14 +13,23 @@ cachedVersions="/etc/pihole/versions"
|
||||
|
||||
if [ -f ${cachedVersions} ]; then
|
||||
# shellcheck source=/dev/null
|
||||
. "$cachedVersions"
|
||||
. "${cachedVersions}"
|
||||
else
|
||||
echo "Could not find /etc/pihole/versions. Running update now."
|
||||
pihole updatechecker
|
||||
# shellcheck source=/dev/null
|
||||
. "$cachedVersions"
|
||||
. "${cachedVersions}"
|
||||
fi
|
||||
|
||||
# Convert "null" or empty values to "N/A" for display
|
||||
normalize_version() {
|
||||
if [ -z "${1}" ] || [ "${1}" = "null" ]; then
|
||||
echo "N/A"
|
||||
else
|
||||
echo "${1}"
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
local details
|
||||
details=false
|
||||
@@ -33,21 +42,21 @@ main() {
|
||||
|
||||
if [ "${details}" = true ]; then
|
||||
echo "Core"
|
||||
echo " Version is ${CORE_VERSION:=N/A} (Latest: ${GITHUB_CORE_VERSION:=N/A})"
|
||||
echo " Branch is ${CORE_BRANCH:=N/A}"
|
||||
echo " Hash is ${CORE_HASH:=N/A} (Latest: ${GITHUB_CORE_HASH:=N/A})"
|
||||
echo " Version is $(normalize_version "${CORE_VERSION}") (Latest: $(normalize_version "${GITHUB_CORE_VERSION}"))"
|
||||
echo " Branch is $(normalize_version "${CORE_BRANCH}")"
|
||||
echo " Hash is $(normalize_version "${CORE_HASH}") (Latest: $(normalize_version "${GITHUB_CORE_HASH}"))"
|
||||
echo "Web"
|
||||
echo " Version is ${WEB_VERSION:=N/A} (Latest: ${GITHUB_WEB_VERSION:=N/A})"
|
||||
echo " Branch is ${WEB_BRANCH:=N/A}"
|
||||
echo " Hash is ${WEB_HASH:=N/A} (Latest: ${GITHUB_WEB_HASH:=N/A})"
|
||||
echo " Version is $(normalize_version "${WEB_VERSION}") (Latest: $(normalize_version "${GITHUB_WEB_VERSION}"))"
|
||||
echo " Branch is $(normalize_version "${WEB_BRANCH}")"
|
||||
echo " Hash is $(normalize_version "${WEB_HASH}") (Latest: $(normalize_version "${GITHUB_WEB_HASH}"))"
|
||||
echo "FTL"
|
||||
echo " Version is ${FTL_VERSION:=N/A} (Latest: ${GITHUB_FTL_VERSION:=N/A})"
|
||||
echo " Branch is ${FTL_BRANCH:=N/A}"
|
||||
echo " Hash is ${FTL_HASH:=N/A} (Latest: ${GITHUB_FTL_HASH:=N/A})"
|
||||
echo " Version is $(normalize_version "${FTL_VERSION}") (Latest: $(normalize_version "${GITHUB_FTL_VERSION}"))"
|
||||
echo " Branch is $(normalize_version "${FTL_BRANCH}")"
|
||||
echo " Hash is $(normalize_version "${FTL_HASH}") (Latest: $(normalize_version "${GITHUB_FTL_HASH}"))"
|
||||
else
|
||||
echo "Core version is ${CORE_VERSION:=N/A} (Latest: ${GITHUB_CORE_VERSION:=N/A})"
|
||||
echo "Web version is ${WEB_VERSION:=N/A} (Latest: ${GITHUB_WEB_VERSION:=N/A})"
|
||||
echo "FTL version is ${FTL_VERSION:=N/A} (Latest: ${GITHUB_FTL_VERSION:=N/A})"
|
||||
echo "Core version is $(normalize_version "${CORE_VERSION}") (Latest: $(normalize_version "${GITHUB_CORE_VERSION}"))"
|
||||
echo "Web version is $(normalize_version "${WEB_VERSION}") (Latest: $(normalize_version "${GITHUB_WEB_VERSION}"))"
|
||||
echo "FTL version is $(normalize_version "${FTL_VERSION}") (Latest: $(normalize_version "${GITHUB_FTL_VERSION}"))"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -188,27 +188,14 @@ PIHOLE_META_DEPS_APK=(
|
||||
# The runUnattended flag is one example of this
|
||||
repair=false
|
||||
runUnattended=false
|
||||
skipFTL=false
|
||||
# Check arguments for the undocumented flags
|
||||
for var in "$@"; do
|
||||
case "${var}" in
|
||||
"--repair") repair=true ;;
|
||||
"--unattended") runUnattended=true ;;
|
||||
"--skipFTL") skipFTL=true ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ "${runUnattended}" == true ]]; then
|
||||
# In order to run an unattended setup, a pre-seeded /etc/pihole/pihole.toml must exist
|
||||
if [[ ! -f "${PI_HOLE_CONFIG_DIR}/pihole.toml" ]]; then
|
||||
printf " %b Error: \"%s\" not found. Cannot run unattended setup\\n" "${CROSS}" "${PI_HOLE_CONFIG_DIR}/pihole.toml"
|
||||
exit 1
|
||||
fi
|
||||
printf " %b Performing unattended setup, no dialogs will be displayed\\n" "${INFO}"
|
||||
# also disable debconf-apt-progress dialogs
|
||||
export DEBIAN_FRONTEND="noninteractive"
|
||||
fi
|
||||
|
||||
# If the color table file exists,
|
||||
if [[ -f "${coltable}" ]]; then
|
||||
# source it
|
||||
@@ -2335,18 +2322,21 @@ main() {
|
||||
|
||||
# Check if there is a usable FTL binary available on this architecture - do
|
||||
# this early on as FTL is a hard dependency for Pi-hole
|
||||
# Allow the user to skip this check if they are using a self-compiled FTL binary from an unsupported architecture
|
||||
if [ "${skipFTL}" != true ]; then
|
||||
# Get the binary name for the current architecture
|
||||
local funcOutput
|
||||
funcOutput=$(get_binary_name) #Store output of get_binary_name here
|
||||
# Abort early if this processor is not supported (get_binary_name returns empty string)
|
||||
if [[ "${funcOutput}" == "" ]]; then
|
||||
printf " %b Upgrade/install aborted\\n" "${CROSS}" "${DISTRO_NAME}"
|
||||
exit 1
|
||||
local funcOutput
|
||||
funcOutput=$(get_binary_name) #Store output of get_binary_name here
|
||||
# Abort early if this processor is not supported (get_binary_name returns empty string)
|
||||
if [[ "${funcOutput}" == "" ]]; then
|
||||
printf " %b Upgrade/install aborted\\n" "${CROSS}" "${DISTRO_NAME}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "${fresh_install}" == false ]]; then
|
||||
# if it's running unattended,
|
||||
if [[ "${runUnattended}" == true ]]; then
|
||||
printf " %b Performing unattended setup, no dialogs will be displayed\\n" "${INFO}"
|
||||
# also disable debconf-apt-progress dialogs
|
||||
export DEBIAN_FRONTEND="noninteractive"
|
||||
fi
|
||||
else
|
||||
printf " %b %b--skipFTL set - skipping architecture check%b\\n" "${INFO}" "${COL_YELLOW}" "${COL_NC}"
|
||||
fi
|
||||
|
||||
if [[ "${fresh_install}" == true ]]; then
|
||||
@@ -2379,18 +2369,13 @@ main() {
|
||||
create_pihole_user
|
||||
|
||||
# Download and install FTL
|
||||
# Allow the user to skip this check if they are using a self-compiled FTL binary from an unsupported architecture
|
||||
if [ "${skipFTL}" != true ]; then
|
||||
local binary
|
||||
binary="pihole-FTL${funcOutput##*pihole-FTL}" #binary name will be the last line of the output of get_binary_name (it always begins with pihole-FTL)
|
||||
local theRest
|
||||
theRest="${funcOutput%pihole-FTL*}" # Print the rest of get_binary_name's output to display (cut out from first instance of "pihole-FTL")
|
||||
if ! FTLdetect "${binary}" "${theRest}"; then
|
||||
printf " %b FTL Engine not installed\\n" "${CROSS}"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
printf " %b %b--skipFTL set - skipping FTL binary installation%b\\n" "${INFO}" "${COL_YELLOW}" "${COL_NC}"
|
||||
local binary
|
||||
binary="pihole-FTL${funcOutput##*pihole-FTL}" #binary name will be the last line of the output of get_binary_name (it always begins with pihole-FTL)
|
||||
local theRest
|
||||
theRest="${funcOutput%pihole-FTL*}" # Print the rest of get_binary_name's output to display (cut out from first instance of "pihole-FTL")
|
||||
if ! FTLdetect "${binary}" "${theRest}"; then
|
||||
printf " %b FTL Engine not installed\\n" "${CROSS}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Install and log everything to a file
|
||||
|
||||
19
pihole
19
pihole
@@ -125,22 +125,7 @@ repairPiholeFunc() {
|
||||
if [ -n "${DOCKER_VERSION}" ]; then
|
||||
unsupportedFunc
|
||||
else
|
||||
local skipFTL additionalFlag
|
||||
skipFTL=false
|
||||
# Check arguments
|
||||
for var in "$@"; do
|
||||
case "$var" in
|
||||
"--skipFTL") skipFTL=true ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "${skipFTL}" == true ]; then
|
||||
additionalFlag="--skipFTL"
|
||||
else
|
||||
additionalFlag=""
|
||||
fi
|
||||
|
||||
/etc/.pihole/automated\ install/basic-install.sh --repair ${additionalFlag}
|
||||
/etc/.pihole/automated\ install/basic-install.sh --repair
|
||||
exit 0;
|
||||
fi
|
||||
}
|
||||
@@ -616,7 +601,7 @@ case "${1}" in
|
||||
"-d" | "debug" ) debugFunc "$@";;
|
||||
"-f" | "flush" ) flushFunc "$@";;
|
||||
"-up" | "updatePihole" ) updatePiholeFunc "$@";;
|
||||
"-r" | "repair" ) repairPiholeFunc "$@";;
|
||||
"-r" | "repair" ) repairPiholeFunc;;
|
||||
"-g" | "updateGravity" ) updateGravityFunc "$@";;
|
||||
"-l" | "logging" ) piholeLogging "$@";;
|
||||
"uninstall" ) uninstallFunc;;
|
||||
|
||||
Reference in New Issue
Block a user