chore: refactor and enhance dependency checking in build scripts (#908)

This refactors the way that the build shell-scripts check for dependencies
in order to cut down on code duplication, and also adds additional
dependency-checks that were missing previously.

Change-Type: minor
This commit is contained in:
Andrew Scheller 2016-11-29 23:37:31 +00:00 committed by Juan Cruz Viotti
parent 2397b5d2aa
commit b8ffd24cce
15 changed files with 151 additions and 56 deletions

View File

@ -21,6 +21,13 @@ set -u
set -e
set -x
function check_dep() {
if ! command -v $1 2>/dev/null 1>&2; then
echo "Dependency missing: $1" 1>&2
exit 1
fi
}
OS=`uname`
if [[ "$OS" != "Darwin" ]]; then
echo "This script is only meant to be run in OS X" 1>&2

View File

@ -21,6 +21,13 @@ set -u
set -e
set -x
function check_dep() {
if ! command -v $1 2>/dev/null 1>&2; then
echo "Dependency missing: $1" 1>&2
exit 1
fi
}
OS=`uname`
if [[ "$OS" != "Linux" ]]; then
echo "This script is only meant to be run in GNU/Linux" 1>&2
@ -103,6 +110,8 @@ if [ "$COMMAND" == "installer-debian" ]; then
fi
if [ "$COMMAND" == "installer-appimage" ]; then
check_dep zip
./scripts/unix/dependencies.sh -p \
-r "$ARCH" \
-v "$ELECTRON_VERSION" \

View File

@ -19,16 +19,24 @@
set -u
set -e
function check_dep() {
if ! command -v $1 2>/dev/null 1>&2; then
echo "Dependency missing: $1" 1>&2
exit 1
fi
}
OS=$(uname)
if [[ "$OS" != "Darwin" ]]; then
echo "This script is only meant to be run in OS X" 1>&2
exit 1
fi
if ! command -v afsctool 2>/dev/null 1>&2; then
echo "Dependency missing: afsctool" 1>&2
exit 1
fi
check_dep hdiutil
check_dep xattr
check_dep tiffutil
check_dep osascript
check_dep afsctool
function usage() {
echo "Usage: $0"

View File

@ -19,6 +19,15 @@
set -u
set -e
function check_dep() {
if ! command -v $1 2>/dev/null 1>&2; then
echo "Dependency missing: $1" 1>&2
exit 1
fi
}
check_dep zip
OS=$(uname)
if [[ "$OS" != "Darwin" ]]; then
echo "This script is only meant to be run in OS X" 1>&2

View File

@ -19,12 +19,21 @@
set -u
set -e
function check_dep() {
if ! command -v $1 2>/dev/null 1>&2; then
echo "Dependency missing: $1" 1>&2
exit 1
fi
}
OS=$(uname)
if [[ "$OS" != "Darwin" ]]; then
echo "This script is only meant to be run in OS X" 1>&2
exit 1
fi
check_dep /usr/libexec/PlistBuddy
function usage() {
echo "Usage: $0"
echo ""

View File

@ -19,12 +19,22 @@
set -u
set -e
function check_dep() {
if ! command -v $1 2>/dev/null 1>&2; then
echo "Dependency missing: $1" 1>&2
exit 1
fi
}
OS=$(uname)
if [[ "$OS" != "Darwin" ]]; then
echo "This script is only meant to be run in OS X" 1>&2
exit 1
fi
check_dep codesign
check_dep spctl
function usage() {
echo "Usage: $0"
echo ""

View File

@ -19,21 +19,21 @@
set -u
set -e
function check_dep() {
if ! command -v $1 2>/dev/null 1>&2; then
echo "Dependency missing: $1" 1>&2
exit 1
fi
}
OS=$(uname)
if [[ "$OS" != "Linux" ]]; then
echo "This script is only meant to be run in GNU/Linux" 1>&2
exit 1
fi
if ! command -v upx 2>/dev/null 1>&2; then
echo "Dependency missing: upx" 1>&2
exit 1
fi
if ! command -v wget 2>/dev/null 1>&2; then
echo "Dependency missing: wget" 1>&2
exit 1
fi
check_dep upx
check_dep wget
function usage() {
echo "Usage: $0"

View File

@ -19,16 +19,20 @@
set -u
set -e
function check_dep() {
if ! command -v $1 2>/dev/null 1>&2; then
echo "Dependency missing: $1" 1>&2
exit 1
fi
}
OS=$(uname)
if [[ "$OS" != "Linux" ]]; then
echo "This script is only meant to be run in GNU/Linux" 1>&2
exit 1
fi
if ! command -v electron-installer-debian 2>/dev/null 1>&2; then
echo "Dependency missing: electron-installer-debian" 1>&2
exit 1
fi
check_dep electron-installer-debian
function usage() {
echo "Usage: $0"

View File

@ -19,6 +19,13 @@
set -u
set -e
function check_dep() {
if ! command -v $1 2>/dev/null 1>&2; then
echo "Dependency missing: $1" 1>&2
exit 1
fi
}
OS=$(uname)
if [[ "$OS" != "Linux" ]]; then
echo "This script is only meant to be run in GNU/Linux" 1>&2

View File

@ -20,16 +20,20 @@
set -u
set -e
function check_dep() {
if ! command -v $1 2>/dev/null 1>&2; then
echo "Dependency missing: $1" 1>&2
exit 1
fi
}
check_dep aws
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <file>" 1>&2
exit 1
fi
if ! command -v aws 1>/dev/null 2>/dev/null; then
echo "Dependency missing: aws cli" 1>&2
exit 1
fi
ETCHER_VERSION=`node -e "console.log(require('./package.json').version)"`
S3_BUCKET="resin-production-downloads"

View File

@ -1,7 +1,34 @@
#!/bin/bash
###
# Copyright 2016 resin.io
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
###
set -u
set -e
function check_dep() {
if ! command -v $1 2>/dev/null 1>&2; then
echo "Dependency missing: $1" 1>&2
exit 1
fi
}
check_dep curl
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <debfile>" 1>&2
exit 1

View File

@ -19,10 +19,14 @@
set -u
set -e
if ! command -v asar 2>/dev/null 1>&2; then
echo "Dependency missing: asar" 1>&2
exit 1
fi
function check_dep() {
if ! command -v $1 2>/dev/null 1>&2; then
echo "Dependency missing: $1" 1>&2
exit 1
fi
}
check_dep asar
function usage() {
echo "Usage: $0"

View File

@ -19,20 +19,16 @@
set -u
set -e
if ! command -v npm 2>/dev/null 1>&2; then
echo "Dependency missing: npm" 1>&2
exit 1
fi
function check_dep() {
if ! command -v $1 2>/dev/null 1>&2; then
echo "Dependency missing: $1" 1>&2
exit 1
fi
}
if ! command -v bower 2>/dev/null 1>&2; then
echo "Dependency missing: bower" 1>&2
exit 1
fi
if ! command -v python 2>/dev/null 1>&2; then
echo "Dependency missing: python" 1>&2
exit 1
fi
check_dep npm
check_dep bower
check_dep python
function usage() {
echo "Usage: $0"

View File

@ -19,10 +19,15 @@
set -u
set -e
if ! command -v wget 2>/dev/null 1>&2; then
echo "Dependency missing: wget" 1>&2
exit 1
fi
function check_dep() {
if ! command -v $1 2>/dev/null 1>&2; then
echo "Dependency missing: $1" 1>&2
exit 1
fi
}
check_dep wget
check_dep unzip
function usage() {
echo "Usage: $0"

View File

@ -19,20 +19,16 @@
set -u
set -e
if ! command -v browserify 2>/dev/null 1>&2; then
echo "Dependency missing: browserify" 1>&2
exit 1
fi
function check_dep() {
if ! command -v $1 2>/dev/null 1>&2; then
echo "Dependency missing: $1" 1>&2
exit 1
fi
}
if ! command -v wget 2>/dev/null 1>&2; then
echo "Dependency missing: wget" 1>&2
exit 1
fi
if ! command -v rsync 2>/dev/null 1>&2; then
echo "Dependency missing: rsync" 1>&2
exit 1
fi
check_dep browserify
check_dep wget
check_dep rsync
function usage() {
echo "Usage: $0"