added further check for release upgrade before attempting to query it

This commit is contained in:
pyr0ball 2023-03-19 21:58:31 -07:00
parent 70b3aa3ee8
commit 7e8ba12964
2 changed files with 28 additions and 27 deletions

View file

@ -28,37 +28,37 @@ curl
# OS distribution auto-detection # OS distribution auto-detection
if type lsb_release >/dev/null 2>&1; then if type lsb_release >/dev/null 2>&1; then
# linuxbase.org # linuxbase.org
OS=$(lsb_release -si) OS=$(lsb_release -si)
VER=$(lsb_release -sr) VER=$(lsb_release -sr)
elif [ -f /etc/debian_version ]; then elif [ -f /etc/debian_version ]; then
# Older Debian/Ubuntu/etc. # Older Debian/Ubuntu/etc.
OS=Debian OS=Debian
VER=$(cat /etc/debian_version) VER=$(cat /etc/debian_version)
elif [ -f /etc/os-release ]; then elif [ -f /etc/os-release ]; then
# freedesktop.org and systemd # freedesktop.org and systemd
. /etc/os-release . /etc/os-release
OS=$NAME OS=$NAME
VER=$VERSION_ID VER=$VERSION_ID
elif [ -f /etc/lsb-release ]; then elif [ -f /etc/lsb-release ]; then
# For some versions of Debian/Ubuntu without lsb_release command # For some versions of Debian/Ubuntu without lsb_release command
. /etc/lsb-release . /etc/lsb-release
OS=$DISTRIB_ID OS=$DISTRIB_ID
VER=$DISTRIB_RELEASE VER=$DISTRIB_RELEASE
elif [ -f /etc/debian_version ]; then elif [ -f /etc/debian_version ]; then
# Older Debian/Ubuntu/etc. # Older Debian/Ubuntu/etc.
OS=Debian OS=Debian
VER=$(cat /etc/debian_version) VER=$(cat /etc/debian_version)
elif [ -f /etc/SuSe-release ]; then elif [ -f /etc/SuSe-release ]; then
# Older SuSE/etc. # Older SuSE/etc.
... ...
elif [ -f /etc/redhat-release ]; then elif [ -f /etc/redhat-release ]; then
# Older Red Hat, CentOS, etc. # Older Red Hat, CentOS, etc.
OS=$(cat /etc/redhat-release | awk '{print $1}') OS=$(cat /etc/redhat-release | awk '{print $1}')
else else
# Fall back to uname, e.g. "Linux <version>", also works for BSD, etc. # Fall back to uname, e.g. "Linux <version>", also works for BSD, etc.
OS=$(uname -s) OS=$(uname -s)
VER=$(uname -r) VER=$(uname -r)
fi fi
# Add apt-notifier-common required packages # Add apt-notifier-common required packages
@ -156,7 +156,6 @@ userinstall(){
fi fi
fi fi
# Copy functions first # Copy functions first
cp ${rundir}/functions ${installdir}/functions cp ${rundir}/functions ${installdir}/functions
@ -227,7 +226,7 @@ globalinstall(){
warn "Some of the utilities needed by this script are missing" warn "Some of the utilities needed by this script are missing"
echo -e "Missing utilities:" echo -e "Missing utilities:"
echo -e "$bins_missing" echo -e "$bins_missing"
echo -e "Would you like to install? (this will require root password)" echo -e "Would you like to install them? (this will require root password)"
utilsmissing_menu=( utilsmissing_menu=(
"$(boxline "${green_check} Yes")" "$(boxline "${green_check} Yes")"
"$(boxline "${red_x} No")" "$(boxline "${red_x} No")"

View file

@ -241,7 +241,9 @@ fi
# Check for release upgrade # Check for release upgrade
if [ -x /usr/lib/ubuntu-release-upgrader/release-upgrade-motd ]; then if [ -x /usr/lib/ubuntu-release-upgrader/release-upgrade-motd ]; then
release_upgrade=$(cat /var/lib/ubuntu-release-upgrader/release-upgrade-available) if [ -f /var/lib/ubuntu-release-upgrader/release-upgrade-available ] ; then
release_upgrade=$(cat /var/lib/ubuntu-release-upgrader/release-upgrade-available)
fi
fi fi
if [ "$(lsb_release -sd | cut -d ' ' -f4)" = "(development" ]; then if [ "$(lsb_release -sd | cut -d ' ' -f4)" = "(development" ]; then
unset release_upgrade unset release_upgrade