feat: Check CPU core configuration
This commit is contained in:
parent
a63295d1c1
commit
dcbd77c5bb
1 changed files with 7 additions and 7 deletions
12
src/reset.sh
12
src/reset.sh
|
@ -17,7 +17,6 @@ echo "❯ For support visit $SUPPORT"
|
||||||
|
|
||||||
: "${BOOT:=""}" # URL of the ISO file
|
: "${BOOT:=""}" # URL of the ISO file
|
||||||
: "${DEBUG:="N"}" # Disable debugging
|
: "${DEBUG:="N"}" # Disable debugging
|
||||||
: "${COMMIT:="N"}" # Commit to image
|
|
||||||
: "${MACHINE:="virt"}" # Machine selection
|
: "${MACHINE:="virt"}" # Machine selection
|
||||||
: "${ALLOCATE:=""}" # Preallocate diskspace
|
: "${ALLOCATE:=""}" # Preallocate diskspace
|
||||||
: "${ARGUMENTS:=""}" # Extra QEMU parameters
|
: "${ARGUMENTS:=""}" # Extra QEMU parameters
|
||||||
|
@ -76,6 +75,7 @@ CPU="${CPU// with Radeon Graphics/}"
|
||||||
CPU="${CPU// with Radeon Vega Graphics/}"
|
CPU="${CPU// with Radeon Vega Graphics/}"
|
||||||
|
|
||||||
[ -z "${CPU// /}" ] && CPU="Unknown"
|
[ -z "${CPU// /}" ] && CPU="Unknown"
|
||||||
|
[[ -n ${CPU_CORES//[0-9]} ]] && error "Invalid amount of CPU_CORES: $CPU_CORES" && exit 15
|
||||||
|
|
||||||
# Check system
|
# Check system
|
||||||
|
|
||||||
|
@ -87,13 +87,13 @@ fi
|
||||||
|
|
||||||
# Check folder
|
# Check folder
|
||||||
|
|
||||||
if [[ "$COMMIT" != [Nn]* ]]; then
|
if [[ "${COMMIT:-}" == [Yy1]* ]]; then
|
||||||
STORAGE="/local"
|
STORAGE="/local"
|
||||||
mkdir -p "$STORAGE"
|
mkdir -p "$STORAGE"
|
||||||
else
|
fi
|
||||||
if [ ! -d "$STORAGE" ]; then
|
|
||||||
|
if [ ! -d "$STORAGE" ]; then
|
||||||
error "Storage folder ($STORAGE) not found!" && exit 13
|
error "Storage folder ($STORAGE) not found!" && exit 13
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Read memory
|
# Read memory
|
||||||
|
@ -102,7 +102,7 @@ RAM_AVAIL=$(free -b | grep -m 1 Mem: | awk '{print $7}')
|
||||||
RAM_TOTAL=$(free -b | grep -m 1 Mem: | awk '{print $2}')
|
RAM_TOTAL=$(free -b | grep -m 1 Mem: | awk '{print $2}')
|
||||||
RAM_SIZE=$(echo "${RAM_SIZE^^}" | sed 's/MB/M/g;s/GB/G/g;s/TB/T/g')
|
RAM_SIZE=$(echo "${RAM_SIZE^^}" | sed 's/MB/M/g;s/GB/G/g;s/TB/T/g')
|
||||||
[[ -z ${RAM_SIZE//[0-9]} ]] && [ "$RAM_SIZE" -lt "130" ] && RAM_SIZE="${RAM_SIZE}G"
|
[[ -z ${RAM_SIZE//[0-9]} ]] && [ "$RAM_SIZE" -lt "130" ] && RAM_SIZE="${RAM_SIZE}G"
|
||||||
! numfmt --from=iec "$RAM_SIZE" &>/dev/null && error "Invalid RAM size: $RAM_SIZE" && exit 15
|
! numfmt --from=iec "$RAM_SIZE" &>/dev/null && error "Invalid RAM size: $RAM_SIZE" && exit 16
|
||||||
RAM_WANTED=$(numfmt --from=iec "$RAM_SIZE")
|
RAM_WANTED=$(numfmt --from=iec "$RAM_SIZE")
|
||||||
[ "$RAM_WANTED" -lt "136314880 " ] && error "Invalid RAM size: $RAM_SIZE" && exit 16
|
[ "$RAM_WANTED" -lt "136314880 " ] && error "Invalid RAM size: $RAM_SIZE" && exit 16
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue