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

View file

@ -356,6 +356,8 @@ CHECK_URL () {
lynx -dump -force_html "$script_dir/url_output" | head --lines 20 | tee --append "$test_result" lynx -dump -force_html "$script_dir/url_output" | head --lines 20 | tee --append "$test_result"
echo -e "\e[0m" echo -e "\e[0m"
if [ $show_resources -eq 1 ]
then
# Get all the resources for the main page of the app. # Get all the resources for the main page of the app.
local HTTP_return local HTTP_return
local moved=0 local moved=0
@ -414,6 +416,7 @@ CHECK_URL () {
fi fi
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")" 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 "" echo ""
fi fi
fi fi