mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-02-24 13:30:02 +08:00
Colors in log
This commit is contained in:
parent
da0d32ba2d
commit
aa5429d2fe
15
run/run.sh
15
run/run.sh
@ -10,16 +10,19 @@ set -Eeuo pipefail
|
||||
: ${DISK_SIZE:='16G'} # Initial data disk size
|
||||
: ${RAM_SIZE:='512M'} # Maximum RAM amount
|
||||
|
||||
echo "Starting Virtual DSM for Docker v${VERSION}..."
|
||||
trap 'echo >&2 "Error status $? for: ${BASH_COMMAND} (line $LINENO/$BASH_LINENO)"' ERR
|
||||
error () { echo -e >&2 "\E[1;31m❯ ERROR: $1\E[0m" }
|
||||
info () { echo -e "\E[1;34m❯\E[1;36m INFO: $1\E[0m" }
|
||||
|
||||
[ ! -f "/run/run.sh" ] && echo "ERROR: Script must run inside Docker container!" && exit 11
|
||||
[ "$(id -u)" -ne "0" ] && echo "ERROR: Script must be executed with root privileges." && exit 12
|
||||
info "Starting Virtual DSM for Docker v${VERSION}..."
|
||||
trap 'error "Error status $? for: ${BASH_COMMAND} (line $LINENO/$BASH_LINENO)"' ERR
|
||||
|
||||
[ ! -f "/run/run.sh" ] && error "Script must run inside Docker container!" && exit 11
|
||||
[ "$(id -u)" -ne "0" ] && error "Script must be executed with root privileges." && exit 12
|
||||
|
||||
STORAGE="/storage"
|
||||
KERNEL=$(uname -r | cut -b 1)
|
||||
|
||||
[ ! -d "$STORAGE" ] && echo "ERROR: Storage folder (${STORAGE}) not found!" && exit 13
|
||||
[ ! -d "$STORAGE" ] && error "Storage folder (${STORAGE}) not found!" && exit 13
|
||||
|
||||
if [ -f "$STORAGE"/dsm.ver ]; then
|
||||
BASE=$(cat "${STORAGE}/dsm.ver")
|
||||
@ -58,7 +61,7 @@ else
|
||||
fi
|
||||
|
||||
if [ -n "${KVM_ERR}" ]; then
|
||||
echo "ERROR: KVM acceleration not detected ${KVM_ERR}, please enable it."
|
||||
error "KVM acceleration not detected ${KVM_ERR}, please enable it."
|
||||
[[ "${DEBUG}" == [Yy1]* ]] && exit 88
|
||||
else
|
||||
KVM_OPTS=",accel=kvm -enable-kvm -cpu host"
|
||||
|
Loading…
x
Reference in New Issue
Block a user