Changeset a2c0986 in wspkg


Ignore:
Timestamp:
Feb 28, 2019, 9:32:07 PM (3 years ago)
Author:
Ting-Wei Lan <lantw44@…>
Branches:
master
Children:
ceb9ea4
Parents:
f6d5ca1
Message:

Fix all warnings reported by shellcheck

Files:
8 edited

Legend:

Unmodified
Added
Removed
  • arch/arch.deps.sh

    rf6d5ca1 ra2c0986  
    1010
    1111list_file="$1"
    12 : ${list_file:="arch.list"}
    13 : ${TAR:="tar"}
    14 : ${ARCH_DBPATH:="/var/lib/pacman"}
     12: "${list_file:="arch.list"}"
     13: "${TAR:="tar"}"
     14: "${ARCH_DBPATH:="/var/lib/pacman"}"
    1515dbpath_sync="${ARCH_DBPATH}/sync"
    1616
     
    3838for db in "${dbpath_sync}"/*.db; do
    3939        msg "==> Loading package database ${db}"
    40         tmpdir="`mktemp -d`"
    41         if [ -z "${tmpdir}" ] || [ "`dirname "${tmpdir}"`" = "/" ]; then
     40        tmpdir="$(mktemp -d)"
     41        if [ -z "${tmpdir}" ] || [ "$(dirname "${tmpdir}")" = "/" ]; then
    4242                msg "==> Invalid temporary directory ${tmpdir}"
    4343                exit 1
    4444        fi
    45         ${TAR} -xf "${db}" -C "${tmpdir}"
     45        "${TAR}" -xf "${db}" -C "${tmpdir}"
    4646        for desc in "${tmpdir}"/*/desc; do
    4747                have_groups=0
    48                 case "`cat "${desc}"`" in
     48                case "$(cat "${desc}")" in
    4949                        *%GROUPS%*)
    5050                                have_groups=1
     
    9292                done < "${desc}"
    9393        done
    94         rm -rf "${tmpdir}"
     94        rm -r -- "${tmpdir}"
    9595done
    9696
    9797loop_first=1
    9898msg "==> Expanding all groups"
    99 for pkg_or_group in `cat "${list_file}"`; do
    100         pkgs="`pkg_groups_find "${pkg_or_group}"`"
     99while read -r pkg_or_group; do
     100        pkgs="$(pkg_groups_find "${pkg_or_group}")"
    101101        if [ -z "${pkgs}" ]; then
    102102                pkgs="${pkg_or_group}"
     
    110110                loop_first=0
    111111        done
    112 done
     112done < "${list_file}"
  • debian/debian.deps.sh

    rf6d5ca1 ra2c0986  
    22
    33list_file="$1"
    4 : ${list_file:="debian.list"}
     4: "${list_file:="debian.list"}"
    55
    66loop_first=1
    7 for pkg in `cat "${list_file}"`; do
     7while read -r pkg; do
    88        if [ "${loop_first}" = "1" ]; then
    99                printf '%s' "${pkg}"
     
    1212        fi
    1313        loop_first=0
    14 done
     14done < "${list_file}"
  • freebsd/freebsd.deps.sh

    rf6d5ca1 ra2c0986  
    22
    33ports_file="$1"
    4 : ${ports_file:="freebsd.ports"}
     4: "${ports_file:="freebsd.ports"}"
    55
    66exec 4< "${ports_file}"
  • freebsd/freebsd.install.sh

    rf6d5ca1 ra2c0986  
    33msg_and_copy () {
    44    printf '==> Copying %s to %s\n' "$1" "$2" 1>&2
    5     cp -r "$1" "$2"
     5    cp -r -- "$1" "$2"
    66}
    77
    88msg_and_mkdir () {
    99    printf '==> Creating directory %s\n' "$1" 1>&2
    10     mkdir -p "$1"
     10    mkdir -p -- "$1"
    1111}
    1212
    13 if [ -z "$4" ]; then
     13if [ "$#" -lt "4" ]; then
    1414    printf 'Usage: %s category cat_makefile cat_makefile_inc dir\n' "$0"
    1515    printf 'Example: %s local local.makefile local.makefile.inc 217 will do\n' "$0"
     
    2121fi
    2222
    23 : ${PORTSDIR:="/usr/ports"}
     23: "${PORTSDIR:="/usr/ports"}"
    2424category="$1"
    2525cat_makefile="$2"
     
    2727dir="$4"
    2828
    29 [ '!' -d "${PORTSDIR}/${category}" ] && \
     29[ ! -d "${PORTSDIR}/${category}" ] && \
    3030    msg_and_mkdir "${PORTSDIR}/${category}"
    31 [ '!' -f "${PORTSDIR}/${category}/Makefile" ] && \
     31[ ! -f "${PORTSDIR}/${category}/Makefile" ] && \
    3232    msg_and_copy "${cat_makefile}" "${PORTSDIR}/${category}/Makefile"
    33 [ '!' -f "${PORTSDIR}/${category}/Makefile.inc" ] && \
     33[ ! -f "${PORTSDIR}/${category}/Makefile.inc" ] && \
    3434    msg_and_copy "${cat_makefile_inc}" "${PORTSDIR}/${category}/Makefile.inc"
    3535
  • freebsd/freebsd.nopkg-deps.sh

    rf6d5ca1 ra2c0986  
    22
    33ports_file="$1"
    4 : ${ports_file:="freebsd.ports"}
     4: "${ports_file:="freebsd.ports"}"
    55
    6 tr '/' '_' < "${ports_file}" | paste "${ports_file}" - | (
    7         while read -r pkg_name pkg_ports pkg_flavor unused pkg_ports_var unused; do
     6# shellcheck disable=SC2094
     7tr '/' '_' < "${ports_file}" | paste -- "${ports_file}" - | (
     8        while read -r _ pkg_ports pkg_flavor _ pkg_ports_var _; do
    89                if [ "${pkg_flavor}" != "@" ]; then
    910                        pkg_ports_var="${pkg_ports_var}_${pkg_flavor}"
    1011                        pkg_ports="${pkg_ports}@${pkg_flavor}"
    1112                fi
     13                # shellcheck disable=SC2016
    1214                printf '    ${WSPKG_PACKAGE_NAME_%s}>=a:%s ^%%' \
    1315                        "${pkg_ports_var}" "${pkg_ports}"
  • freebsd/freebsd.nopkg-setup.sh

    rf6d5ca1 ra2c0986  
    22
    33ports_file="$1"
    4 : ${ports_file:="freebsd.ports"}
     4: "${ports_file:="freebsd.ports"}"
    55
    6 count=`wc -l < "${ports_file}"`
    7 tr '/' '_' < "${ports_file}" | paste "${ports_file}" - | (
     6count=$(wc -l < "${ports_file}")
     7# shellcheck disable=SC2094
     8tr '/' '_' < "${ports_file}" | paste -- "${ports_file}" - | (
    89        index=1
    9         while read -r pkg_name pkg_ports pkg_flavor unused pkg_ports_var unused; do
     10        while read -r _ pkg_ports pkg_flavor _ pkg_ports_var _; do
    1011                if [ "${pkg_flavor}" != "@" ]; then
    1112                        pkg_ports_var="${pkg_ports_var}_${pkg_flavor}"
    1213                        pkg_ports="${pkg_ports} FLAVOR=${pkg_flavor}"
    1314                fi
     15                # shellcheck disable=SC2016
    1416                printf 'WSPKG_PACKAGE_NAME_%-40s != printf '\''\\\\r===> Generating package names (%5d/%5d)'\'' 1>\\&2; $(MAKE) -C ${PORTSDIR}/%-48s -V PKGNAMEPREFIX -V PORTNAME -V PKGNAMESUFFIX \\| tr -d '\''\\\\n'\''%%' \
    1517                        "${pkg_ports_var}" "${index}" "${count}" "${pkg_ports}"
    16                 index=$(( ${index} + 1 ))
     18                index=$(( index + 1 ))
    1719        done )
    1820printf 'WSPKG_PACKAGE_NAME_%-40s != echo 1>\\&2; echo %%' "NULL"
  • freebsd/freebsd.ports.sh

    rf6d5ca1 ra2c0986  
    66
    77[ -z "$1" ] && msg "Usage: $0 list_file" && exit 1
    8 : ${FREEBSD_VERSION:="`uname -r | sed 's|^\([0-9]*\).*$|\1|'`"}
    9 : ${PORTSDIR:="/usr/ports"}
     8: "${FREEBSD_VERSION:="$(uname -r | sed 's|^\([0-9]*\).*$|\1|')"}"
     9: "${PORTSDIR:="/usr/ports"}"
    1010index="${PORTSDIR}/INDEX-${FREEBSD_VERSION}"
    1111
    1212shdir="$(dirname "$0")"
    13 : ${shdir:="."}
     13: "${shdir:="."}"
    1414
    1515msg "==> FreeBSD version is ${FREEBSD_VERSION}"
  • wspkg-sh/packages-cpp.sh

    rf6d5ca1 ra2c0986  
    66
    77[ -z "$1" ] && printf 'Usage: %s input_file cpp_args\n' "$0" && exit 1
    8 [ -z "$2" ] && default="yes"
    98
     9# shellcheck disable=SC2034
    1010input_file="$1"
    1111shift
    1212
    13 : ${CPP:="cpp"}
    14 : ${CPPFLAGS:="-I."}
     13: "${CPP:="cpp"}"
     14: "${CPPFLAGS:="-I."}"
    1515while [ "$1" ]; do
    1616    case "$1" in
    1717        -*)
    18             selarg="$selarg -D`toupper "$1"`"
     18            selarg="$selarg -D$(toupper "$1")"
    1919            ;;
    2020        *)
    21             selarg="$selarg -DWSPKG_`toupper "$1"`"
     21            selarg="$selarg -DWSPKG_$(toupper "$1")"
    2222            ;;
    2323    esac
     
    2525done
    2626
    27 ${CPP} ${CPPFLAGS} $selarg "$input_file" | \
     27eval "${CPP} ${CPPFLAGS} $selarg "'"$input_file"' | \
    2828    sed -e '/^#/d' -e '/^ *$/d' | tr ' ' '\n' | sed '/^ *$/d'
Note: See TracChangeset for help on using the changeset viewer.