Commit fb90eba7 authored by Vitaly Lipatov's avatar Vitaly Lipatov

make shellcheck more happy

parent a0be2778
......@@ -33,7 +33,7 @@ rpmvendor()
[ "$DISTRIB_ID" = "LinuxXP" ] && echo "lxp" && return
[ "$DISTRIB_ID" = "TinyCoreLinux" ] && echo "tcl" && return
[ "$DISTRIB_ID" = "VoidLinux" ] && echo "void" && return
echo "$DISTRIB_ID" | tr "[A-Z]" "[a-z]"
echo "$DISTRIB_ID" | tr "A-Z" "a-z"
}
# Translate DISTRIB_ID name to package manner (like in the package release name)
......
......@@ -356,7 +356,7 @@ check_option()
check_filenames()
{
local opt
for opt in $* ; do
for opt in "$@" ; do
# files can be with full path or have extension via .
if [ -f "$opt" ] && echo "$opt" | grep -q "[/\.]" ; then
pkg_files="$pkg_files $opt"
......@@ -406,7 +406,7 @@ pkg_filenames=$(strip_spaces "$pkg_files $pkg_names")
if [ -z "$epm_cmd" ] ; then
print_version
echo
fatstr="Unknown command in $@ arg(s)"
fatstr="Unknown command in $* arg(s)"
[ -n "$*" ] || fatstr="That program needs be running with some command"
fatal "$fatstr. Run $ $PROGNAME --help to get help."
fi
......
......@@ -46,7 +46,7 @@ case $DISTRNAME in
;;
autoimports)
[ -n "$DISTRVERSION" ] || fatal "Empty DISTRVERSION"
repo="$repo.$(echo "$DISTRVERSION" | tr "[A-Z]" "[a-z]")"
repo="$repo.$(echo "$DISTRVERSION" | tr "A-Z" "a-z")"
esac
assure_exists apt-repo
......
......@@ -76,7 +76,7 @@ print_pkgname()
print_srcname()
{
print_name $(print_srcpkgname "$@")
print_name "$(print_srcpkgname "$@")"
}
print_specname()
......@@ -137,7 +137,7 @@ EOF
"name")
[ -n "$1" ] || fatal "Arg is missed"
if [ -n "$FNFLAG" ] ; then
print_name $(print_pkgname "$@")
print_name "$(print_pkgname "$@")"
elif [ -n "$PKFLAG" ] ; then
query_package_field "name" "$@"
else
......@@ -147,7 +147,7 @@ EOF
"version")
[ -n "$1" ] || fatal "Arg is missed"
if [ -n "$FNFLAG" ] ; then
print_version $(print_pkgname "$@")
print_version "$(print_pkgname "$@")"
elif [ -n "$PKFLAG" ] ; then
query_package_field "version" "$@"
else
......@@ -157,7 +157,7 @@ EOF
"release")
[ -n "$1" ] || fatal "Arg is missed"
if [ -n "$FNFLAG" ] ; then
print_release $(print_pkgname "$@")
print_release "$(print_pkgname "$@")"
elif [ -n "$PKFLAG" ] ; then
query_package_field "release" "$@"
else
......@@ -222,6 +222,6 @@ epm_print()
{
[ -n "$pkg_filenames" ] || fatal "Missed args. Use epm print help for get help."
__epm_print $(eval echo $quoted_args)
__epm_print "$(eval echo $quoted_args)"
}
......@@ -27,7 +27,7 @@ case $DISTRNAME in
autoimports)
info "remove autoimports repo"
[ -n "$DISTRVERSION" ] || fatal "Empty DISTRVERSION"
repo="$repo.$(echo "$DISTRVERSION" | tr "[A-Z]" "[a-z]")"
repo="$repo.$(echo "$DISTRVERSION" | tr "A-Z" "a-z")"
;;
esac
......
......@@ -44,7 +44,7 @@ epm_requires_files()
epm_requires_names()
{
local pkg_names="$@"
local pkg_names="$*"
local CMD
[ -n "$pkg_names" ] || return
......
......@@ -132,7 +132,7 @@ __epm_search_make_grep()
#list=$(strip_spaces $list | sed -e "s/ /|/g")
listN=$(strip_spaces $listN | sed -e "s/ /|/g" | sed -e "s/\^//g")
if [ "$short" ] ; then
if [ -n "$short" ] ; then
echon " | sed -e \"s| .*||g\""
fi
......
......@@ -81,7 +81,7 @@ epm_upgrade()
;;
homebrew)
#CMD="brew upgrade"
docmd "brew upgrade `brew outdated`"
docmd "brew upgrade $(brew outdated)"
return
;;
ipkg)
......
......@@ -61,13 +61,13 @@ is_service_autostart()
LANG=C $SUDO chkconfig $1 --list | grep -q "[35]:on"
;;
service-initd|service-update)
test -L $(echo /etc/rc5.d/S??$1)
test -L "$(echo /etc/rc5.d/S??$1)"
;;
systemd)
$SUDO systemctl is-enabled $1
;;
runit)
test -L /var/service/$SERVICE
test -L "/var/service/$SERVICE"
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
......
......@@ -3,5 +3,15 @@
# http://mywiki.wooledge.org/Bashism
# https://wiki.ubuntu.com/DashAsBinSh
EXCL=-eSC2086,SC2039,SC2034,SC2068,SC2155
if [ -n "$1" ] ; then
shellcheck $EXCL "$1"
exit
fi
checkbashisms -f bin/*
checkbashisms -f Makefile
shellcheck $EXCL \
bin/epm bin/distr_info bin/epm-* bin/serv-* bin/tools_*
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