Skip to content

Commit

Permalink
Bugfix
Browse files Browse the repository at this point in the history
- fixed bug in install routine if package is found in multiple sources where the correct version is downloaded but installation fails
- fixed bug in install routine which doesn't always install latest version if package is available in multiple sources
- fixed bug in upgrade routine which doesn't always install latest version if package is available in multiple source
  • Loading branch information
ich777 committed Nov 10, 2022
1 parent ff7de1d commit 7fabb32
Showing 1 changed file with 26 additions and 8 deletions.
34 changes: 26 additions & 8 deletions source/usr/local/emhttp/plugins/un-get/un-get
Original file line number Diff line number Diff line change
Expand Up @@ -241,18 +241,21 @@ install() {
if [[ "$response" =~ ^(yes|y)$ ]]; then
for p in ${PACKAGE_LIST}
do
PACKAGE="$(grep -R -H -i -w "$p-[0-9]\+" /tmp/un-get/ | awk '{print $1, $NF}' | grep -E ".tbz|.tlz|.tgz|.txz" | grep -v -E ".*\.asc|.*\.md5" | cut -d '.' -f1- | sort -V | grep -v "\-$p-[0-9]\+" | tail -1)"
LAT_V="$(grep -R -H -i -w "$p-[0-9]\+" /tmp/un-get/ | awk '{print $1, $NF}' | grep -E ".tbz|.tlz|.tgz|.txz" | grep -v -E ".*\.asc|.*\.md5" | rev | cut -d '/' -f1 | rev | sort -V | tail -1)"
PACKAGE="$(grep -R -H -i -w "$LAT_V" /tmp/un-get/ | awk '{print $1, $NF}' | grep -E ".tbz|.tlz|.tgz|.txz" | grep -v -E ".*\.asc|.*\.md5" | cut -d '.' -f1- | sort -V | tail -1)"
TOP_URL="$(awk '{print $2}' <<< ${PACKAGE} | sed 's/^[.]//')"
REPO_LINE="$(awk '{print $2}' /boot/config/plugins/un-get/sources.list | grep -n "$(awk '{print $1}' <<< "${PACKAGE}" | cut -d ':' -f1 | sed 's:.*-::' | sort -V | tail -1)" | cut -d ':' -f1)"
URL="$(awk -v line=$REPO_LINE 'NR==line' /boot/config/plugins/un-get/sources.list | awk '{print $1}' | sed 's:/*$::')"
download_package "$p" "${URL}" "${TOP_URL}"
done
for p in ${PACKAGE_LIST}
do
PACKAGE="$(grep -R -H -i -w "$p-[0-9]\+" /tmp/un-get/ | awk '{print $1, $NF}' | grep -E ".tbz|.tlz|.tgz|.txz" | grep -v -E ".*\.asc|.*\.md5" | cut -d '.' -f1- | sort -V | grep -v "\-$p-[0-9]\+" | tail -1)"
LAT_V="$(grep -R -H -i -w "$p-[0-9]\+" /tmp/un-get/ | awk '{print $1, $NF}' | grep -E ".tbz|.tlz|.tgz|.txz" | grep -v -E ".*\.asc|.*\.md5" | rev | cut -d '/' -f1 | rev | sort -V | tail -1)"
PACKAGE="$(grep -R -H -i -w "$LAT_V" /tmp/un-get/ | awk '{print $1, $NF}' | grep -E ".tbz|.tlz|.tgz|.txz" | grep -v -E ".*\.asc|.*\.md5" | cut -d '.' -f1- | sort -V | tail -1)"
TOP_URL="$(awk '{print $2}' <<< ${PACKAGE} | sed 's/^[.]//')"
REPO_LINE="$(awk '{print $2}' /boot/config/plugins/un-get/sources.list | grep -n "$(awk '{print $1}' <<< "${PACKAGE}" | cut -d ':' -f1 | sed 's:.*-::' | sort -V | tail -1)" | cut -d ':' -f1)"
REPO="$(awk -v line=$REPO_LINE 'NR==line' /boot/config/plugins/un-get/sources.list | awk '{print $2}')"
PACKAGE_NAME="$(grep "/$p-[0-9]" <<< "${PACKAGES_AVAILABLE}" | sort -V | tail -1)"
PACKAGE_NAME="$(grep "/$p-[0-9]" <<< "${PACKAGES_AVAILABLE}" | grep "${TOP_URL}" | sort -V | tail -1)"
install_package "${PACKAGE_NAME##*/}" "${REPO}"
done
else
Expand Down Expand Up @@ -291,18 +294,21 @@ ${p}"
if [[ "$response" =~ ^(yes|y)$ ]]; then
for p in ${UPGRADE_PACKAGES}
do
PACKAGE="$(grep -R -H -i -w "$p-[0-9]" /tmp/un-get/ | awk '{print $1, $NF}' | grep -E ".tbz|.tlz|.tgz|.txz" | grep -v -E ".*\.asc|.*\.md5" | cut -d '.' -f1- | sort -V | tail -1)"
LAT_V="$(grep -R -H -i -w "$p-[0-9]\+" /tmp/un-get/ | awk '{print $1, $NF}' | grep -E ".tbz|.tlz|.tgz|.txz" | grep -v -E ".*\.asc|.*\.md5" | rev | cut -d '/' -f1 | rev | sort -V | tail -1)"
PACKAGE="$(grep -R -H -i -w "$LAT_V" /tmp/un-get/ | awk '{print $1, $NF}' | grep -E ".tbz|.tlz|.tgz|.txz" | grep -v -E ".*\.asc|.*\.md5" | cut -d '.' -f1- | sort -V | tail -1)"
TOP_URL="$(awk '{print $2}' <<< ${PACKAGE} | sed 's/^[.]//')"
REPO_LINE="$(awk '{print $2}' /boot/config/plugins/un-get/sources.list | grep -n "$(awk '{print $1}' <<< "${PACKAGE}" | cut -d ':' -f1 | sed 's:.*-::' | sort -V | tail -1)" | cut -d ':' -f1)"
URL="$(awk -v line=$REPO_LINE 'NR==line' /boot/config/plugins/un-get/sources.list | awk '{print $1}' | sed 's:/*$::')"
upgrade_package "$p" "${URL}" "${TOP_URL}"
done
for p in ${UPGRADE_PACKAGES}
do
PACKAGE="$(grep -R -H -i -w "$p-[0-9]" /tmp/un-get/ | awk '{print $1, $NF}' | grep -E ".tbz|.tlz|.tgz|.txz" | grep -v -E ".*\.asc|.*\.md5" | cut -d '.' -f1- | sort -V | tail -1)"
LAT_V="$(grep -R -H -i -w "$p-[0-9]\+" /tmp/un-get/ | awk '{print $1, $NF}' | grep -E ".tbz|.tlz|.tgz|.txz" | grep -v -E ".*\.asc|.*\.md5" | rev | cut -d '/' -f1 | rev | sort -V | tail -1)"
PACKAGE="$(grep -R -H -i -w "$LAT_V" /tmp/un-get/ | awk '{print $1, $NF}' | grep -E ".tbz|.tlz|.tgz|.txz" | grep -v -E ".*\.asc|.*\.md5" | cut -d '.' -f1- | sort -V | tail -1)"
TOP_URL="$(awk '{print $2}' <<< ${PACKAGE} | sed 's/^[.]//')"
REPO_LINE="$(awk '{print $2}' /boot/config/plugins/un-get/sources.list | grep -n "$(awk '{print $1}' <<< "${PACKAGE}" | cut -d ':' -f1 | sed 's:.*-::' | sort -V | tail -1)" | cut -d ':' -f1)"
REPO="$(awk -v line=$REPO_LINE 'NR==line' /boot/config/plugins/un-get/sources.list | awk '{print $2}')"
PACKAGE_NAME="$(grep "/$p-[0-9]" <<< "${PACKAGES_AVAILABLE}" | sort -V | tail -1)"
PACKAGE_NAME="$(grep "/$p-[0-9]" <<< "${PACKAGES_AVAILABLE}" | grep "${TOP_URL}" | sort -V | tail -1)"
install_package "${PACKAGE_NAME##*/}" "${REPO}"
done
else
Expand Down Expand Up @@ -449,8 +455,8 @@ usage_remove() {

version() {
echo "Written by Christoph Hummer for unRAID."
echo "Version: 0.18"
echo "Date: 2022-10-27"
echo "Version: 0.19"
echo "Date: 2022-11-10"
echo "Dual-licensed under MIT or UNLICENSE."
exit 0
}
Expand Down Expand Up @@ -606,6 +612,18 @@ changelog() {
echo "- fix for search/install routine when package list doesn't follow the"
echo " Slackware standard"
echo "- minor changes and cleanup to search/install/upgrade routine"
echo
echo "----------------------------------------"
echo
echo "Version: 0.19"
echo "Date: 2022-11-10"
echo
echo "- fixed bug in install routine if package is found in multiple sources"
echo " where the correct version is downloaded but installation fails"
echo "- fixed bug in install routine which doesn't always install latest version"
echo " if package is available in multiple sources"
echo "- fixed bug in upgrade routine which doesn't always install latest version"
echo " if package is available in multiple source"
}

if [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
Expand Down

0 comments on commit 7fabb32

Please sign in to comment.