Commit d7f8dffc authored by Claude's avatar Claude 👌🏽

Merge branch 'QA' into 'master'

QA

See merge request !9
parents 4f01b633 4f760819
Pipeline #5659 passed with stage
in 12 seconds
#
# rawtherapee-install:.gitlab-ci.yml
# xnviewmp-install:.gitlab-ci.yml
#
# see https://docs.gitlab.com/ce/ci/yaml/README.html
#
......
......@@ -17,12 +17,14 @@ function usage {
Install XnViewMP on Mint for Debian based linux.
Usage:
$( basename "$0" ) --help
$( basename "$0" ) --list
$( basename "$0" ) --list-fullname
$( basename "$0" ) --install [--home DIR] [--version VER|--last-default-version]
Actions
Actions:
-h, --help Display this message and exit.
-l, --list List version number available on server
--list-fullname
......@@ -33,6 +35,7 @@ Actions
If you dont run command using root, then sudo will be use.
Options:
--home DIR Set download directory
(default value: '$( compute_DEFAULT_DEB_FILES_INSTALL_HOME )')
-V VER, --version VER
......@@ -46,7 +49,7 @@ EOF
# P: get_required_next_param
# Usage: varname="$( P "$@" )" && shift
function P {
if [[ $# -gt 0 ]] && ! [[ "$1" =~ ^--.* ]] ; then
if [ "$#" -gt 0 ] && ! [[ "$1" =~ ^--.* ]] ; then
echo "$1"
return 0
fi
......@@ -156,14 +159,14 @@ function remove_xnview {
function update_or_install_nxview_if_needed {
local -r url="$1"
local -r download_directory="$2"
local -r param_download_directory="$2"
local -r local_filename="$3"
if [ ! -d "${download_directory}" ] ; then
${SUDO_IF_NEEDED} mkdir -p "${download_directory}"
if [ ! -d "${param_download_directory}" ] ; then
${SUDO_IF_NEEDED} mkdir -p "${param_download_directory}"
fi
pushd "${download_directory}" >/dev/null || exit 1
pushd "${param_download_directory}" >/dev/null || exit 1
if [ -f "${local_filename}" ] ; then
echo "File '$( realpath "${local_filename}" )' already present, skip download." >&2 || exit 1
......@@ -237,7 +240,7 @@ function download_and_install_if_needed {
nxview_arch="$( get_arch_for_xnview )" || exit 1
case "${nxview_version}" in
case "${param_nxview_version}" in
'currentlast')
local tag= # no version in filename, use download date to have new name (so file will be downloaded and install at every run).
......@@ -252,7 +255,7 @@ function download_and_install_if_needed {
;;
*)
local -r fullversion="${nxview_version}-linux${nxview_arch}" # 090-linux-x64
local -r fullversion="${param_nxview_version}-linux${nxview_arch}" # 090-linux-x64
filename="$( build_output_filename '' "${fullversion}" )" || exit 1
url="$( get_specific_xnviewmp_version "${fullversion}" )"
......@@ -261,18 +264,18 @@ function download_and_install_if_needed {
update_or_install_nxview_if_needed \
"${url}" \
"${download_directory:-$( compute_DEFAULT_DEB_FILES_INSTALL_HOME )}" \
"${param_download_directory:-$( compute_DEFAULT_DEB_FILES_INSTALL_HOME )}" \
"${filename}" || exit 1
}
function main {
local url=
local download_directory=
local nxview_version='latest'
local action='--install'
local param_download_directory=
local param_nxview_version='latest'
local param=
while [ $# -gt 0 ] ; do
local param="$1"
while [ "$#" -gt 0 ] ; do
param="$1"
shift
case "${param}" in
......@@ -295,26 +298,26 @@ function main {
'-i'|'--install' ) action='--install' ;;
'--home')
download_directory="$( P "$@" )" && shift
param_download_directory="$( P "$@" )" && shift
;;
'-V'|'--version')
nxview_version="$( P "$@" )" && shift
param_nxview_version="$( P "$@" )" && shift
;;
'-L0'|'--last-default-version')
nxview_version='currentlast'
param_nxview_version='currentlast'
;;
*) # unknown option
echo "Undefined parameter '${param}'." >&2
*)
echo "Unknown option: '${param}'." >&2
usage >&2
exit 1
;;
esac
done
if [ -z "${nxview_version}" ] ; then
if [ -z "${param_nxview_version}" ] ; then
echo 'A version number is expected when using option --version.' >&2
usage >&2
exit 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment