Update reset.sh
This commit is contained in:
parent
e6e13795f1
commit
ff85b80c30
1 changed files with 16 additions and 10 deletions
26
src/reset.sh
26
src/reset.sh
|
|
@ -24,7 +24,7 @@ echo "❯ For support visit $SUPPORT"
|
|||
: "${RAM_SIZE:="1G"}" # Maximum RAM amount
|
||||
: "${RAM_CHECK:="Y"}" # Check available RAM
|
||||
: "${DISK_SIZE:="16G"}" # Initial data disk size
|
||||
: "${BOOT_INDEX:="10"}" # Boot index of CD drive
|
||||
: "${BOOT_INDEX:="9"}" # Boot index of CD drive
|
||||
|
||||
# Helper variables
|
||||
|
||||
|
|
@ -81,13 +81,18 @@ SPACE_GB=$(( (SPACE + 1073741823)/1073741824 ))
|
|||
echo "❯ CPU: ${CPU} | RAM: $AVAIL_GB/$TOTAL_GB GB | DISK: $SPACE_GB GB (${FS}) | HOST: ${SYS}..."
|
||||
echo
|
||||
|
||||
# Check compatibilty
|
||||
|
||||
if [[ "${FS,,}" == "ecryptfs" ]] || [[ "${FS,,}" == "tmpfs" ]]; then
|
||||
DISK_IO="threads"
|
||||
DISK_CACHE="writeback"
|
||||
fi
|
||||
|
||||
# Check memory
|
||||
|
||||
if [[ "$RAM_CHECK" != [Nn]* ]]; then
|
||||
if (( (RAM_WANTED + RAM_SPARE) > RAM_AVAIL )); then
|
||||
error "Your configured RAM_SIZE of $WANTED_GB GB is too high for the $AVAIL_GB GB of memory available, please set a lower value."
|
||||
exit 17
|
||||
fi
|
||||
if [[ "$RAM_CHECK" != [Nn]* ]] && (( (RAM_WANTED + RAM_SPARE) > RAM_AVAIL )); then
|
||||
error "Your configured RAM_SIZE of $WANTED_GB GB is too high for the $AVAIL_GB GB of memory available, please set a lower value."
|
||||
exit 17
|
||||
fi
|
||||
|
||||
# Helper functions
|
||||
|
|
@ -194,13 +199,14 @@ addPackage() {
|
|||
|
||||
hasDisk() {
|
||||
|
||||
[ -b "/disk" ] && return 0
|
||||
[ -b "/disk1" ] && return 0
|
||||
[ -b "/dev/disk1" ] && return 0
|
||||
[ -s "/boot.img" ] && return 0
|
||||
[ -s "/boot.qcow2" ] && return 0
|
||||
[ -b "${DEVICE:-}" ] && return 0
|
||||
[ -s "$STORAGE/data.img" ] && return 0
|
||||
[ -s "$STORAGE/data.qcow2" ] && return 0
|
||||
|
||||
[ -z "${DISK_NAME:-}" ] && DISK_NAME="data"
|
||||
[ -s "$STORAGE/$DISK_NAME.img" ] && return 0
|
||||
[ -s "$STORAGE/$DISK_NAME.qcow2" ] && return 0
|
||||
|
||||
return 1
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue