mirror of https://github.com/debauchee/barrier.git
Fix shellcheck warnings
This commit is contained in:
parent
9bb25d8887
commit
486545527b
|
@ -1,10 +1,10 @@
|
|||
#!/bin/sh
|
||||
cd "$(dirname $0)" || exit 1
|
||||
cd "$(dirname "$0")" || exit 1
|
||||
# some environments have cmake v2 as 'cmake' and v3 as 'cmake3'
|
||||
# check for cmake3 first then fallback to just cmake
|
||||
B_CMAKE=`type cmake3 2>/dev/null`
|
||||
if [ $? -eq 0 ]; then
|
||||
B_CMAKE=`echo $B_CMAKE | cut -d' ' -f3`
|
||||
B_CMAKE=`echo "$B_CMAKE" | cut -d' ' -f3`
|
||||
else
|
||||
B_CMAKE=cmake
|
||||
fi
|
||||
|
@ -26,7 +26,7 @@ B_CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=$B_BUILD_TYPE $B_CMAKE_FLAGS"
|
|||
rm -rf build
|
||||
mkdir build || exit 1
|
||||
cd build || exit 1
|
||||
echo Starting Barrier $B_BUILD_TYPE build...
|
||||
echo "Starting Barrier $B_BUILD_TYPE build..."
|
||||
$B_CMAKE $B_CMAKE_FLAGS .. || exit 1
|
||||
make || exit 1
|
||||
echo "Build completed successfully"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Use the same verbose variable as CMake
|
||||
[ "$VERBOSE" == "1" ] && set -x
|
||||
[ "$VERBOSE" = "1" ] && set -x
|
||||
|
||||
# Exit on unset variables or pipe errors
|
||||
set -uo pipefail
|
||||
|
@ -14,10 +14,10 @@ B_BARRIERC="Barrier.app/Contents/MacOS/barrierc"
|
|||
B_BARRIERS="Barrier.app/Contents/MacOS/barriers"
|
||||
|
||||
# Colorized output
|
||||
function info() { tput bold; echo "$@" ; tput sgr0 ;}
|
||||
function error() { tput bold; tput setaf 1; echo "$@"; tput sgr0 ; }
|
||||
function success() { tput bold; tput setaf 2; echo "$@"; tput sgr0 ; }
|
||||
function warn() { tput bold; tput setaf 3; echo "$@"; tput sgr0 ; }
|
||||
info() { tput bold; echo "$@"; tput sgr0 ; }
|
||||
error() { tput bold; tput setaf 1; echo "$@"; tput sgr0 ; }
|
||||
success() { tput bold; tput setaf 2; echo "$@"; tput sgr0 ; }
|
||||
warn() { tput bold; tput setaf 3; echo "$@"; tput sgr0 ; }
|
||||
|
||||
info "Checking for bundle contents"
|
||||
if [ ! -d "Barrier.app/Contents" ]; then
|
||||
|
@ -40,7 +40,7 @@ if which -s port ; then
|
|||
info "MacPorts found, searching for macdeployqt"
|
||||
DEPLOYQT="$(port contents qt5-qttools | grep --only --max-count 1 '/.*macdeployqt')"
|
||||
if [ ! -x "$DEPLOYQT" ]; then
|
||||
error Please install package qt5-qttools
|
||||
error "Please install package qt5-qttools"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
@ -50,13 +50,13 @@ if which -s brew ; then
|
|||
info "Homebrew found, searching for macdeployqt"
|
||||
DEPLOYQT="$(brew list qt@5 | grep --only '/.*macdeployqt' | head -1)"
|
||||
if [ ! -x "$DEPLOYQT" ]; then
|
||||
error Please install package qt
|
||||
error "Please install package qt"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Use macdeployqt to include libraries and create dmg
|
||||
if [ "$B_BUILDTYPE" == "Release" ]; then
|
||||
if [ "$B_BUILDTYPE" = "Release" ]; then
|
||||
info "Building Release disk image (dmg)"
|
||||
"$DEPLOYQT" Barrier.app -dmg \
|
||||
-executable="$B_BARRIERC" \
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
#!/bin/sh
|
||||
|
||||
# add warning for users running manually
|
||||
function warn() { tput bold; tput setaf 3; echo "$@"; tput sgr0 ; }
|
||||
warn() { tput bold; tput setaf 3; echo "$@"; tput sgr0 ; }
|
||||
warn "The scripts build_installer.sh and reref_dylibs.sh have been deprecated."
|
||||
warn "Please use build_dist.sh instead to deploy using macdeployqt"
|
||||
|
||||
# change this to rename the installer package
|
||||
B_DMG="Barrier-@BARRIER_VERSION@.dmg"
|
||||
|
||||
cd "$( dirname '$0' )"
|
||||
cd "$( dirname "$0" )"
|
||||
OWNDIR="$( pwd )"
|
||||
|
||||
B_REREF_SCRIPT="$OWNDIR/reref_dylibs.sh"
|
||||
if [ ! -x $B_REREF_SCRIPT ]; then
|
||||
echo Missing script: $B_REREF_SCRIPT
|
||||
if [ ! -x "$B_REREF_SCRIPT" ]; then
|
||||
echo "Missing script: $B_REREF_SCRIPT"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# remove any old copies so there's no confusion about whether this
|
||||
# process completes successfully or not
|
||||
rm -rf temp.dmg $B_DMG
|
||||
rm -rf temp.dmg "$B_DMG"
|
||||
|
||||
cd Barrier.app/Contents 2>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
echo Please make sure that the build completed successfully
|
||||
echo before trying to create the installer.
|
||||
echo "Please make sure that the build completed successfully"
|
||||
echo "before trying to create the installer."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -77,7 +77,7 @@ hdiutil create -size 64m -fs HFS+ -volname "Barrier" temp.dmg || exit 1
|
|||
hdiutil attach temp.dmg -mountpoint mnt || exit 1
|
||||
cp -r Barrier.app mnt/ || exit 1
|
||||
hdiutil detach mnt || exit 1
|
||||
hdiutil convert temp.dmg -format UDZO -o $B_DMG || exit 1
|
||||
hdiutil convert temp.dmg -format UDZO -o "$B_DMG" || exit 1
|
||||
rm temp.dmg
|
||||
|
||||
echo "dmg $B_DMB created successfully"
|
||||
echo "dmg $B_DMG created successfully"
|
||||
|
|
|
@ -5,28 +5,28 @@ B_TARGET=$1
|
|||
if [ "x$B_TARGET" = "x" ]; then
|
||||
|
||||
# add warning for users running manually
|
||||
function warn() { tput bold; tput setaf 3; echo "$@"; tput sgr0 ; }
|
||||
warn() { tput bold; tput setaf 3; echo "$@"; tput sgr0 ; }
|
||||
warn "The scripts build_installer.sh and reref_dylibs.sh have been deprecated."
|
||||
warn "Please use build_dist.sh instead to deploy using macdeployqt"
|
||||
|
||||
echo Which binary needs to be re-referenced?
|
||||
echo "Which binary needs to be re-referenced?"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd $(dirname $B_TARGET) || exit 1
|
||||
cd "$(dirname "$B_TARGET")" || exit 1
|
||||
|
||||
# where to find non-system libraries relative to target's directory.
|
||||
# the vast majority of the time this should be empty
|
||||
B_REL_PATH=$2
|
||||
|
||||
# we're in target's directory now. trim off the path
|
||||
B_TARGET=$(basename $B_TARGET)
|
||||
B_TARGET=$(basename "$B_TARGET")
|
||||
|
||||
# get a list of non-system libraries and make local copies
|
||||
B_LIBS=$(otool -XL $B_TARGET | awk '{ print $1 }' | grep -Ev '^(/usr/lib|/System)')
|
||||
B_LIBS=$(otool -XL "$B_TARGET" | awk '{ print $1 }' | grep -Ev '^(/usr/lib|/System)')
|
||||
[ $? -ne 0 ] && exit 1
|
||||
for B_LIB in $B_LIBS; do
|
||||
B_LIB_NAME=$(basename $B_LIB)
|
||||
B_LIB_NAME=$(basename "$B_LIB")
|
||||
# otool reports barrier as "barrier:" which fails self-reference test below
|
||||
B_LIB_NAME=${B_LIB_NAME//:}
|
||||
|
||||
|
@ -34,16 +34,16 @@ for B_LIB in $B_LIBS; do
|
|||
[ "$B_TARGET" = "$B_LIB_NAME" ] && continue
|
||||
|
||||
B_DST=${B_REL_PATH}${B_LIB_NAME}
|
||||
if [ ! -e $B_DST ]; then
|
||||
cp $B_LIB $B_DST || exit 1
|
||||
chmod u+rw $B_DST || exit 1
|
||||
if [ ! -e "$B_DST" ]; then
|
||||
cp "$B_LIB" "$B_DST" || exit 1
|
||||
chmod u+rw "$B_DST" || exit 1
|
||||
# recursively call this script on libraries purposefully not passing
|
||||
# $B_REL_PATH so that it is only used explicitly
|
||||
$0 $B_DST
|
||||
$0 "$B_DST"
|
||||
fi
|
||||
|
||||
# adjust the target's metadata to point to the local copy
|
||||
# rather than the system-wide copy which would only exist on
|
||||
# a development machine
|
||||
install_name_tool -change $B_LIB @loader_path/$B_DST $B_TARGET || exit 1
|
||||
install_name_tool -change "$B_LIB" "@loader_path/$B_DST" "$B_TARGET" || exit 1
|
||||
done
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Checks if directory exists, otherwise asks to install package.
|
||||
function check_dir_exists() {
|
||||
check_dir_exists() {
|
||||
local path=$1
|
||||
local package=$2
|
||||
|
||||
|
@ -11,7 +11,7 @@ function check_dir_exists() {
|
|||
fi
|
||||
}
|
||||
|
||||
if [ ! $BARRIER_BUILD_ENV ]; then
|
||||
if [ -z "$BARRIER_BUILD_ENV" ]; then
|
||||
check_dir_exists '/Applications/Xcode.app' 'Xcode'
|
||||
|
||||
printf "Modifying environment for Barrier build...\n"
|
||||
|
|
|
@ -4,7 +4,7 @@ if ! which magick >/dev/null 2>&1; then
|
|||
echo "Need ImageMagic for this"
|
||||
exit 10
|
||||
fi
|
||||
cd $(dirname $0) || exit $?
|
||||
cd "$(dirname "$0")" || exit $?
|
||||
if [ ! -r barrier.png ]; then
|
||||
echo "Use inkscape (or another vector graphics editor) to create barrier.png from barrier.svg first"
|
||||
exit 10
|
||||
|
@ -12,11 +12,11 @@ fi
|
|||
rm -rf work || exit $?
|
||||
mkdir -p work || exit $?
|
||||
for s in 16 24 32 48 64 128 256 512 1024; do
|
||||
magick convert barrier.png -resize ${s}x${s} -depth 8 work/${s}.png || exit $?
|
||||
magick convert barrier.png -resize "${s}x${s}" -depth 8 "work/${s}.png" || exit $?
|
||||
done
|
||||
# windows icon
|
||||
magick convert work/{16,24,32,48,64,128}.png barrier.png barrier.ico || exit $?
|
||||
# macos icon
|
||||
png2icns $ICNS_BASE/Barrier.icns work/{16,32,256,512,1024}.png || exit $?
|
||||
png2icns "$ICNS_BASE/Barrier.icns" work/{16,32,256,512,1024}.png || exit $?
|
||||
rm -rf work
|
||||
echo Done
|
||||
|
|
Loading…
Reference in New Issue