Allow install script to install FTL instead of the checkout script. Utilises the /etc/pihole/ftlbranch file.
Signed-off-by: Adam Warner <adamw@rner.email>
This commit is contained in:
parent
d26ea2b948
commit
fbab930cb1
|
@ -19,7 +19,6 @@ source "${PI_HOLE_FILES_DIR}/automated install/basic-install.sh"
|
||||||
# setupVars set in basic-install.sh
|
# setupVars set in basic-install.sh
|
||||||
|
|
||||||
source "${setupVars}"
|
source "${setupVars}"
|
||||||
update="false"
|
|
||||||
|
|
||||||
coltable="/opt/pihole/COL_TABLE"
|
coltable="/opt/pihole/COL_TABLE"
|
||||||
source ${coltable}
|
source ${coltable}
|
||||||
|
@ -33,40 +32,6 @@ check_download_exists() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
FTLinstall() {
|
|
||||||
# Download and install FTL binary
|
|
||||||
local binary
|
|
||||||
binary="${1}"
|
|
||||||
local path
|
|
||||||
path="${2}"
|
|
||||||
local str
|
|
||||||
str="Installing FTL"
|
|
||||||
echo -ne " ${INFO} ${str}..."
|
|
||||||
|
|
||||||
if curl -sSL --fail "https://ftl.pi-hole.net/${path}" -o "/tmp/${binary}"; then
|
|
||||||
# Get sha1 of the binary we just downloaded for verification.
|
|
||||||
curl -sSL --fail "https://ftl.pi-hole.net/${path}.sha1" -o "/tmp/${binary}.sha1"
|
|
||||||
# Check if we just downloaded text, or a binary file.
|
|
||||||
cd /tmp || return 1
|
|
||||||
if sha1sum --status --quiet -c "${binary}".sha1; then
|
|
||||||
echo -n "transferred... "
|
|
||||||
stop_service pihole-FTL &> /dev/null
|
|
||||||
install -T -m 0755 "/tmp/${binary}" "/usr/bin/pihole-FTL"
|
|
||||||
rm "/tmp/${binary}" "/tmp/${binary}.sha1"
|
|
||||||
start_service pihole-FTL &> /dev/null
|
|
||||||
echo -e "${OVER} ${TICK} ${str}"
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
echo -e "${OVER} ${CROSS} ${str}"
|
|
||||||
echo -e " ${COL_LIGHT_RED}Error: Download of binary from ftl.pi-hole.net failed${COL_NC}"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo -e "${OVER} ${CROSS} ${str}"
|
|
||||||
echo -e " ${COL_LIGHT_RED}Error: URL not found${COL_NC}"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
get_binary_name() {
|
get_binary_name() {
|
||||||
local machine
|
local machine
|
||||||
machine=$(uname -m)
|
machine=$(uname -m)
|
||||||
|
@ -176,11 +141,6 @@ checkout_pull_branch() {
|
||||||
git checkout "${branch}" --quiet || return 1
|
git checkout "${branch}" --quiet || return 1
|
||||||
echo -e "${OVER} ${TICK} $str"
|
echo -e "${OVER} ${TICK} $str"
|
||||||
|
|
||||||
|
|
||||||
if [[ "$(git diff "${oldbranch}" | grep -c "^")" -gt "0" ]]; then
|
|
||||||
update="true"
|
|
||||||
fi
|
|
||||||
|
|
||||||
git_pull=$(git pull || return 1)
|
git_pull=$(git pull || return 1)
|
||||||
|
|
||||||
if [[ "$git_pull" == *"up-to-date"* ]]; then
|
if [[ "$git_pull" == *"up-to-date"* ]]; then
|
||||||
|
@ -257,7 +217,6 @@ checkout() {
|
||||||
local path
|
local path
|
||||||
path="development/${binary}"
|
path="development/${binary}"
|
||||||
echo "development" > /etc/pihole/ftlbranch
|
echo "development" > /etc/pihole/ftlbranch
|
||||||
FTLinstall "${binary}" "${path}"
|
|
||||||
elif [[ "${1}" == "master" ]] ; then
|
elif [[ "${1}" == "master" ]] ; then
|
||||||
# Shortcut to check out master branches
|
# Shortcut to check out master branches
|
||||||
echo -e " ${INFO} Shortcut \"master\" detected - checking out master branches..."
|
echo -e " ${INFO} Shortcut \"master\" detected - checking out master branches..."
|
||||||
|
@ -272,7 +231,6 @@ checkout() {
|
||||||
local path
|
local path
|
||||||
path="master/${binary}"
|
path="master/${binary}"
|
||||||
echo "master" > /etc/pihole/ftlbranch
|
echo "master" > /etc/pihole/ftlbranch
|
||||||
FTLinstall "${binary}" "${path}"
|
|
||||||
elif [[ "${1}" == "core" ]] ; then
|
elif [[ "${1}" == "core" ]] ; then
|
||||||
str="Fetching branches from ${piholeGitUrl}"
|
str="Fetching branches from ${piholeGitUrl}"
|
||||||
echo -ne " ${INFO} $str"
|
echo -ne " ${INFO} $str"
|
||||||
|
@ -335,7 +293,6 @@ checkout() {
|
||||||
if check_download_exists "$path"; then
|
if check_download_exists "$path"; then
|
||||||
echo " ${TICK} Branch ${2} exists"
|
echo " ${TICK} Branch ${2} exists"
|
||||||
echo "${2}" > /etc/pihole/ftlbranch
|
echo "${2}" > /etc/pihole/ftlbranch
|
||||||
FTLinstall "${binary}" "${path}"
|
|
||||||
else
|
else
|
||||||
echo " ${CROSS} Requested branch \"${2}\" is not available"
|
echo " ${CROSS} Requested branch \"${2}\" is not available"
|
||||||
ftlbranches=( $(git ls-remote https://github.com/pi-hole/ftl | grep 'heads' | sed 's/refs\/heads\///;s/ //g' | awk '{print $2}') )
|
ftlbranches=( $(git ls-remote https://github.com/pi-hole/ftl | grep 'heads' | sed 's/refs\/heads\///;s/ //g' | awk '{print $2}') )
|
||||||
|
@ -350,7 +307,7 @@ checkout() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Force updating everything
|
# Force updating everything
|
||||||
if [[ ( ! "${1}" == "web" && ! "${1}" == "ftl" ) && "${update}" == "true" ]]; then
|
if [[ ! "${1}" == "web" ]]; then
|
||||||
echo -e " ${INFO} Running installer to upgrade your installation"
|
echo -e " ${INFO} Running installer to upgrade your installation"
|
||||||
if "${PI_HOLE_FILES_DIR}/automated install/basic-install.sh" --unattended; then
|
if "${PI_HOLE_FILES_DIR}/automated install/basic-install.sh" --unattended; then
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in New Issue