Do not show unavailable ressources if not asking for it

This commit is contained in:
Maniack Crudelis 2019-05-22 00:37:33 +02:00
parent 85bee3d9b7
commit de56cf144d
2 changed files with 69 additions and 57 deletions

View file

@ -50,6 +50,7 @@ interrupt=0
notice=0
build_lxc=0
bash_mode=0
show_resources=0
# If no arguments provided
if [ "$#" -eq 0 ]
@ -70,6 +71,7 @@ else
arguments[$i]=${arguments[$i]//--help/-h}
arguments[$i]=${arguments[$i]//--build-lxc/-l}
arguments[$i]=${arguments[$i]//--bash-mode/-y}
arguments[$i]=${arguments[$i]//--show-resources/-r}
done
# Read and parse all the arguments
@ -83,7 +85,7 @@ else
# Initialize the index of getopts
OPTIND=1
# Parse with getopts only if the argument begin by -
getopts ":b:fihly" parameter || true
getopts ":b:fihlyr" parameter || true
case $parameter in
b)
# --branch=branch-name
@ -115,6 +117,11 @@ else
bash_mode=1
shift_value=1
;;
r)
# --show-resources
show_resources=1
shift_value=1
;;
\?)
echo "Invalid argument: -${OPTARG:-}"
notice=1
@ -166,6 +173,8 @@ package_check.sh [OPTION]... PACKAGE_TO_CHECK
Install LXC and build the container if necessary.
-y, --bash-mode
Do not ask for continue check. Ignore auto_remove.
-r, --show-resources
Show the unavailable resources when accessing the url.
EOF
exit 0
fi

View file

@ -356,6 +356,8 @@ CHECK_URL () {
lynx -dump -force_html "$script_dir/url_output" | head --lines 20 | tee --append "$test_result"
echo -e "\e[0m"
if [ $show_resources -eq 1 ]
then
# Get all the resources for the main page of the app.
local HTTP_return
local moved=0
@ -414,6 +416,7 @@ CHECK_URL () {
fi
fi
done <<< "$(cd "$package_path"; LC_ALL=C wget --adjust-extension --page-requisites --no-check-certificate $check_domain$curl_check_path 2>&1 | grep "^--.*-- http\|^HTTP request sent")"
fi
echo ""
fi
fi