1
0
Fork 0
This repository has been archived on 2023-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
raspberrypi-build/run
2017-09-24 17:24:24 +00:00

60 lines
1.5 KiB
Bash
Executable file

#!/bin/bash -e
export PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
export BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
export IMG_NAME='BarnacleOS'
export USERNAME='user'
export PASSWORD='password'
export DEPLOY_DIR="$BASE_DIR/deploy"
export ROOTFS_DIR="$BASE_DIR/rootfs"
export MOUNT_DIR="$BASE_DIR/mnt"
export KEYS_DIR="$BASE_DIR/keys"
export FILES_DIR="$BASE_DIR/files"
export SCRIPTS="$BASE_DIR/scripts"
export IMG_DATE="$(date +%Y-%m-%d)"
export IMG_FILE="$DEPLOY_DIR/$IMG_NAME-${IMG_DATE}.img"
export ZIP_FILE="$DEPLOY_DIR/$IMG_NAME-${IMG_DATE}.zip"
export QUILT_PATCHES="$BASE_DIR/patches"
export QUILT_NO_DIFF_INDEX=1
export QUILT_NO_DIFF_TIMESTAMPS=1
export QUILT_REFRESH_ARGS='-p ab'
# dependencies_check
# $@ Dependnecy files to check
#
# Each dependency is in the form of a tool to test for, optionally followed by
# a : and the name of a package if the package on a Debian-ish system is not
# named for the tool (i.e., qemu-user-static).
dependencies_check() {
local missing
if [[ -f "$1" ]]; then
for dep in $(cat "$1"); do
if ! hash ${dep%:*} 2>/dev/null; then
missing="${missing:+$missing }${dep#*:}"
fi
done
fi
if [[ "$missing" ]]; then
tput setaf 1 # Red color
echo 'Reqired dependencies not installed.'
echo 'This can be resolved on Debian/Raspbian systems by installing the following packages:'
for package_name in $missing; do
echo " * $package_name"
done
tput sgr0 # No color
false
fi
}
dependencies_check "$BASE_DIR/depends"
exec bash -e $@