mirror of
https://github.com/pi-hole/pi-hole
synced 2024-12-22 14:58:08 +00:00
Improve dependency package output
Signed-off-by: Christian König <github@yubiuser.dev>
This commit is contained in:
parent
d030492664
commit
83224e7729
@ -480,7 +480,16 @@ build_dependency_package(){
|
|||||||
echo "${PIHOLE_META_PACKAGE_CONTROL_APT}" > "${tempdir}"/DEBIAN/control
|
echo "${PIHOLE_META_PACKAGE_CONTROL_APT}" > "${tempdir}"/DEBIAN/control
|
||||||
|
|
||||||
# Build the package
|
# Build the package
|
||||||
dpkg-deb --build --root-owner-group "${tempdir}" pihole-meta.deb
|
local str="Building dependency package pihole-meta.deb"
|
||||||
|
printf " %b %s..." "${INFO}" "${str}"
|
||||||
|
|
||||||
|
if dpkg-deb --build --root-owner-group "${tempdir}" pihole-meta.deb &>/dev/null; then
|
||||||
|
printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}"
|
||||||
|
else
|
||||||
|
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
||||||
|
printf "%b Error: Building pihole-meta.deb failed. %b\\n" "${COL_LIGHT_RED}" "${COL_NC}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Move back into the directory the user started in
|
# Move back into the directory the user started in
|
||||||
popd &> /dev/null || return 1
|
popd &> /dev/null || return 1
|
||||||
@ -504,7 +513,16 @@ build_dependency_package(){
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Build the package
|
# Build the package
|
||||||
rpmbuild -bb "${tempdir}"/SPECS/pihole-meta.spec --define "_topdir ${tempdir}"
|
local str="Building dependency package pihole-meta.rpm"
|
||||||
|
printf " %b %s..." "${INFO}" "${str}"
|
||||||
|
|
||||||
|
if rpmbuild -bb "${tempdir}"/SPECS/pihole-meta.spec --define "_topdir ${tempdir}" &>/dev/null; then
|
||||||
|
printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}"
|
||||||
|
else
|
||||||
|
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
||||||
|
printf "%b Error: Building pihole-meta.rpm failed. %b\\n" "${COL_LIGHT_RED}" "${COL_NC}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Move the package to the /tmp directory
|
# Move the package to the /tmp directory
|
||||||
mv "${tempdir}"/RPMS/noarch/pihole-meta*.rpm /tmp/pihole-meta.rpm
|
mv "${tempdir}"/RPMS/noarch/pihole-meta*.rpm /tmp/pihole-meta.rpm
|
||||||
@ -1507,23 +1525,37 @@ notify_package_updates_available() {
|
|||||||
|
|
||||||
install_dependent_packages() {
|
install_dependent_packages() {
|
||||||
# Install meta dependency package
|
# Install meta dependency package
|
||||||
|
local str="Installing Pi-hole dependency package"
|
||||||
|
printf " %b %s..." "${INFO}" "${str}"
|
||||||
|
|
||||||
# Install Debian/Ubuntu packages
|
# Install Debian/Ubuntu packages
|
||||||
if is_command apt-get; then
|
if is_command apt-get; then
|
||||||
if [ -f /tmp/pihole-meta.deb ]; then
|
if [ -f /tmp/pihole-meta.deb ]; then
|
||||||
eval "${PKG_INSTALL}" "/tmp/pihole-meta.deb"
|
if eval "${PKG_INSTALL}" "/tmp/pihole-meta.deb" &>/dev/null; then
|
||||||
rm /tmp/pihole-meta.deb
|
printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}"
|
||||||
|
rm /tmp/pihole-meta.deb
|
||||||
|
else
|
||||||
|
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
||||||
|
printf " %b Error: Unable to install Pi-hole dependency package.\\n" "${COL_LIGHT_RED}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
printf " %b Error: Unable to find Pi-hole dependency meta package.\\n" "${COL_LIGHT_RED}"
|
printf " %b Error: Unable to find Pi-hole dependency package.\\n" "${COL_LIGHT_RED}"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
# Install Fedora/CentOS packages
|
# Install Fedora/CentOS packages
|
||||||
elif is_command rpm; then
|
elif is_command rpm; then
|
||||||
if [ -f /tmp/pihole-meta.rpm ]; then
|
if [ -f /tmp/pihole-meta.rpm ]; then
|
||||||
eval "${PKG_INSTALL}" "/tmp/pihole-meta.rpm"
|
if eval "${PKG_INSTALL}" "/tmp/pihole-meta.rpm" &>/dev/null; then
|
||||||
rm /tmp/pihole-meta.rpm
|
printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}"
|
||||||
|
rm /tmp/pihole-meta.rpm
|
||||||
|
else
|
||||||
|
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
||||||
|
printf " %b Error: Unable to install Pi-hole dependency package.\\n" "${COL_LIGHT_RED}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
printf " %b Error: Unable to find Pi-hole dependency meta package.\\n" "${COL_LIGHT_RED}"
|
printf " %b Error: Unable to find Pi-hole dependency package.\\n" "${COL_LIGHT_RED}"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -2354,7 +2386,6 @@ main() {
|
|||||||
build_dependency_package
|
build_dependency_package
|
||||||
|
|
||||||
# Install Pi-hole dependencies
|
# Install Pi-hole dependencies
|
||||||
printf " %b Installing required dependencies ...\\n" "${INFO}"
|
|
||||||
install_dependent_packages
|
install_dependent_packages
|
||||||
|
|
||||||
# Check that the installed OS is officially supported - display warning if not
|
# Check that the installed OS is officially supported - display warning if not
|
||||||
|
Loading…
Reference in New Issue
Block a user