Skip to content
Permalink
Browse files

Fix (or silence) install-port shellcheck warnings

  • Loading branch information
neverpanic committed Mar 11, 2018
1 parent c6bf5ba commit 54bc9b659bde45ffe2e8e93f78a6bbf238d0e1f3
Showing with 10 additions and 6 deletions.
  1. +10 −6 mpbb-install-port
@@ -34,7 +34,7 @@ install-port() {
# prepare the log files and make sure to start with empty ones
mkdir -p "${option_log_dir}"
#> "$log_port_contents"
> "$log_port_stats"
:> "$log_port_stats"

# $option_prefix and $thisdir are set in mpbb
# shellcheck disable=SC2154
@@ -50,11 +50,10 @@ install-port() {
local time_stop
time_start=$(date +%s)
# $option_prefix is set in mpbb
# shellcheck disable=SC2154
# shellcheck disable=SC2154,SC2086
if "${option_prefix}/bin/port" -dkn install "$port" $portvariants; then
# Remove failcache if it exists
failcache_success "$@"
if [ $? -ne 0 ]; then
if ! failcache_success "$@"; then
err "failcache_success" "$@" "failed."
return 1
fi
@@ -63,8 +62,7 @@ install-port() {
# log: summary for the portwatcher
echo "Building '$port' ... [ERROR] maintainers: $(get-maintainers "$port")." >> "$log_subports_progress"
# update failcache
failcache_failure "$@"
if [ $? -ne 0 ]; then
if ! failcache_failure "$@"; then
err "failcache_failure" "$@" "failed."
return 1
fi
@@ -87,9 +85,11 @@ install-port() {
local print_arg_workdir="ERROR"
local print_arg_destdir="ERROR"
# First, compute port_workdir_size and port_destdir_size
# shellcheck disable=SC2086
port_workdir=$("${option_prefix}/bin/port" work "$port" $portvariants)
if [ -n "$port_workdir" ]; then
port_workdir_size=$(du -ks "$port_workdir" | sed 's/^ *//' | tr '\t' '\n' | head -n 1)
# shellcheck disable=SC2181
if [ $? -eq 0 ] && [ -n "$port_workdir_size" ]; then
print_arg_workdir="${port_workdir_size}k"
fi
@@ -100,6 +100,7 @@ install-port() {
print_arg_destdir="-"
if [ -d "$port_destdir" ]; then
port_destdir_size=$(du -ks "$port_destdir" | sed 's/^ *//' | tr '\t' '\n' | head -n 1)
# shellcheck disable=SC2181
if [ $? -eq 0 ] && [ -n "$port_destdir_size" ]; then
print_arg_destdir="${port_destdir_size}k"
fi
@@ -112,7 +113,10 @@ install-port() {

# log: main.log
local port_mainlog
# portvariants is not quoted on purpose
# shellcheck disable=SC2086
port_mainlog=$("${option_prefix}/bin/port" logfile "$port" $portvariants)
# shellcheck disable=SC2181
if [ $? -eq 0 ] && [ -f "$port_mainlog" ]; then
cp -f "$port_mainlog" "$log_port_main"
fi

0 comments on commit 54bc9b6

Please sign in to comment.
You can’t perform that action at this time.