Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Print system info #472

Merged
merged 8 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ cd /run

trap - ERR

info "Booting image${BOOT_DESC} on a ${CPU} using QEMU v${VERS} with kernel $(uname -r)..."
info "Booting image${BOOT_DESC}..."

[[ "$DEBUG" == [Yy1]* ]] && set -x
exec qemu-system-x86_64 ${ARGS:+ $ARGS}
12 changes: 10 additions & 2 deletions src/reset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ trap 'error "Status $? while: $BASH_COMMAND (line $LINENO/$BASH_LINENO)"' ERR

echo "❯ Starting $APP for Docker v$(</run/version)..."
echo "❯ For support visit $SUPPORT"
echo

# Docker environment variables

Expand Down Expand Up @@ -43,7 +42,7 @@ HOST=$(hostname -s)
KERNEL=$(uname -r | cut -b 1)
MINOR=$(uname -r | cut -d '.' -f2)
ARCH=$(dpkg --print-architecture)
VERS=$(qemu-system-x86_64 --version | head -n 1 | cut -d '(' -f 1 | awk '{ print $NF }')
RAM="$(free -g | grep Mem: | awk '{print $4}')/$(free -g | grep Mem: | awk '{print $2}') GB"
CPU=$(lscpu | grep 'Model name' | cut -f 2 -d ":" | awk '{$1=$1}1' | sed 's# @.*##g' | sed s/"(R)"//g | sed 's/[^[:alnum:] ]\+/ /g' | sed 's/ */ /g')

# Check system
Expand All @@ -60,6 +59,15 @@ if [ ! -d "$STORAGE" ]; then
error "Storage folder ($STORAGE) not found!" && exit 13
fi

# Print system info
FS=$(stat -f -c %T "$STORAGE")
FS="${FS/ext2\/ext3/ext4}";
SPACE=$(df --output=avail -B 1 "$STORAGE" | tail -n 1)
SPACE_GB=$(( (SPACE + 1073741823)/1073741824 ))

echo "❯ CPU: ${CPU} | RAM: ${RAM} | DISK: $SPACE_GB GB (${FS}) | HOST: $(uname -r)..."
echo

# Helper functions

isAlive() {
Expand Down
Loading