diff options
author | Ting-Wei Lan <lantw44@gmail.com> | 2019-02-28 21:34:11 +0800 |
---|---|---|
committer | Ting-Wei Lan <lantw44@gmail.com> | 2019-02-28 21:34:11 +0800 |
commit | 637ce024792d9ad570a581a48351d045f4b7fd44 (patch) | |
tree | fd769891dfb89d4bcac2019afc43a31480a50606 | |
parent | c0ba16c220900a5d8417018c99c4e70a9f3d4bd7 (diff) | |
download | wspkg-data-637ce024792d9ad570a581a48351d045f4b7fd44.tar.gz wspkg-data-637ce024792d9ad570a581a48351d045f4b7fd44.tar.zst wspkg-data-637ce024792d9ad570a581a48351d045f4b7fd44.zip |
Fix all warnings reported by shellcheck
-rwxr-xr-x | 217-mrtg.sh | 28 | ||||
-rwxr-xr-x | build.sh | 4 | ||||
-rwxr-xr-x | wsbsd.files/patches-apply.sh | 10 | ||||
-rwxr-xr-x | wsbsd.files/patches-update.sh | 12 |
4 files changed, 27 insertions, 27 deletions
diff --git a/217-mrtg.sh b/217-mrtg.sh index ce50701..fd42945 100755 --- a/217-mrtg.sh +++ b/217-mrtg.sh @@ -26,33 +26,33 @@ unset GIT_DIR # Update sources for repo in wspkg wspkg-data; do - if [ '!' -d "${WRKDIR}/${repo}" ]; then - echo_cmd git clone "${REPODIR}/${repo}.git" "${WRKDIR}/${repo}" + if [ ! -d "${WRKDIR}/${repo}" ]; then + echo_cmd git clone -- "${REPODIR}/${repo}.git" "${WRKDIR}/${repo}" else echo_cmd cd "${WRKDIR}/${repo}" - echo_cmd git pull "${REPODIR}/${repo}.git" + echo_cmd git pull -- "${REPODIR}/${repo}.git" fi done # Fetch new index file -cd "${PORTSDIR}" +cd "${PORTSDIR}" || exit [ -z "${DEBUG}" ] && echo_cmd make fetchindex # Setup wspkg -cd "${WRKDIR}/wspkg" +cd "${WRKDIR}/wspkg" || exit echo_cmd make ASCIIDOC=true PANDOC=true # Generate lists from wslinux -cd "${WRKDIR}/wspkg-data" +cd "${WRKDIR}/wspkg-data" || exit echo_cmd ./build.sh wslinux wslinux/out/wslinux.list exec 3< "wslinux/out/wslinux.list" exec 4> "${WRKDIR}/wslinux.html" -while read pkg 0<&3; do +while read -r pkg 0<&3; do case "${pkg}" in tigervnc*) write_string_to_fd 4 "<li><a target='_blank' href='http://neuro.debian.net/pkgs/${pkg}.html'>${pkg}</a></li>" @@ -71,13 +71,13 @@ exec 4>&- # Generate pages for wsbsd -cd "${WRKDIR}/wspkg-data" +cd "${WRKDIR}/wspkg-data" || exit echo_cmd ./build.sh wsbsd wsbsd/out/wsbsd.ports exec 3< "wsbsd/out/wsbsd.ports" exec 4> "${WRKDIR}/wsbsd.html" -while read pkg origin flavor 0<&3; do +while read -r pkg origin _ 0<&3; do write_string_to_fd 4 "<li><a target='_blank' href='https://www.freshports.org/${origin}'>${pkg}</a></li>" done @@ -86,13 +86,13 @@ exec 4>&- # Generate lists from pclab -cd "${WRKDIR}/wspkg-data" +cd "${WRKDIR}/wspkg-data" || exit echo_cmd ./build.sh pclab pclab/out/pclab.list exec 3< "pclab/out/pclab.list" exec 4> "${WRKDIR}/pclab.html" -while read pkg 0<&3; do +while read -r pkg 0<&3; do write_string_to_fd 4 "<li><a target='_blank' href='http://packages.ubuntu.com/trusty/${pkg}'>${pkg}</a></li>" done @@ -101,14 +101,14 @@ exec 4>&- # Copy to mrtg.csie.ntu.edu.tw -echo_cmd scp -i /usr/local/git/ssh-keys/to-mrtg \ +echo_cmd scp -i /usr/local/git/ssh-keys/to-mrtg -- \ "${WRKDIR}/wslinux.html" \ pkgbuild@mrtg.csie.ntu.edu.tw:/var/www/wslinux.html -echo_cmd scp -i /usr/local/git/ssh-keys/to-mrtg \ +echo_cmd scp -i /usr/local/git/ssh-keys/to-mrtg -- \ "${WRKDIR}/wsbsd.html" \ pkgbuild@mrtg.csie.ntu.edu.tw:/var/www/wsbsd.html -echo_cmd scp -i /usr/local/git/ssh-keys/to-mrtg \ +echo_cmd scp -i /usr/local/git/ssh-keys/to-mrtg -- \ "${WRKDIR}/pclab.html" \ pkgbuild@mrtg.csie.ntu.edu.tw:/var/www/pclab.html @@ -22,13 +22,13 @@ else fi shift -: ${MAKE:="make"} +: "${MAKE:="make"}" printf '\033[1;33mRunning\033[m: %s -f "%s" WSPKGDIR="%s"' "${MAKE}" "$makefile" "$WSPKGDIR" for arg in "$@"; do printf ' %s' "$arg" done printf '\n\n' -if ${MAKE} -f "$makefile" WSPKGDIR="$WSPKGDIR" "$@"; then +if "${MAKE}" -f "$makefile" WSPKGDIR="$WSPKGDIR" "$@"; then printf '\n\033[1;32mDone! ;-)\033[m\n' else printf '\n\033[1;31mSorry... :(\033[m\n' diff --git a/wsbsd.files/patches-apply.sh b/wsbsd.files/patches-apply.sh index 2f07999..c948d7d 100755 --- a/wsbsd.files/patches-apply.sh +++ b/wsbsd.files/patches-apply.sh @@ -1,15 +1,15 @@ #!/bin/sh -: ${PORTSDIR:="/usr/ports"} -[ '!' -d "${PORTSDIR}/.svn" ] && \ - printf '%s is not a svn checkout\n' "${PORTSDIR}" && exit 1 +: "${PORTSDIR:="/usr/ports"}" +[ ! -d "${PORTSDIR}/.svn" ] && \ + printf '%s is not a svn checkout\n' "${PORTSDIR}" && exit 1 shdir="$(realpath "$(dirname "$0")")" -: ${shdir:="."} +: "${shdir:="."}" patchdir="${shdir}/patches" -cd ${PORTSDIR} +cd "${PORTSDIR}" || exit for patch_file in "${patchdir}"/*; do if patch -s -C -f -p0 < "${patch_file}"; then printf '==> Applying %s\n' "${patch_file}" diff --git a/wsbsd.files/patches-update.sh b/wsbsd.files/patches-update.sh index 6292f48..a51a476 100755 --- a/wsbsd.files/patches-update.sh +++ b/wsbsd.files/patches-update.sh @@ -1,21 +1,21 @@ #!/bin/sh -: ${PORTSDIR:="/usr/ports"} -[ '!' -d "${PORTSDIR}/.svn" ] && \ +: "${PORTSDIR:="/usr/ports"}" +[ ! -d "${PORTSDIR}/.svn" ] && \ printf '%s is not a svn checkout\n' "${PORTSDIR}" && exit 1 shdir="$(realpath "$(dirname "$0")")" -: ${shdir:="."} +: "${shdir:="."}" patchdir="${shdir}/patches" -cd ${PORTSDIR} +cd "${PORTSDIR}" || exit echo '==> Running svn status ...' svn status | sed -e '/^?/d' -e 's#^[A-Z]* *\([^/]*\/[^/]*\)\(/.*\)*$#\1#' | \ sort | uniq | ( - while read oneline; do + while read -r oneline; do printf '==> Generating patch for %s\n' "${oneline}" patch_name="$(printf '%s\n' "${oneline}" | tr '/' '_')" - svn diff --patch-compatible "${oneline}" \ + svn diff --patch-compatible -- "${oneline}" \ > "${patchdir}/${patch_name}.patch" done ) |