mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-11-19 18:37:41 +01:00
@@ -111,11 +111,11 @@ cd
|
|||||||
|
|
||||||
###### SWAP File
|
###### SWAP File
|
||||||
source <(/home/admin/config.scripts/blitz.data.sh status)
|
source <(/home/admin/config.scripts/blitz.data.sh status)
|
||||||
if [ ${isSwapExternal} -eq 0 ]; then
|
if [ ${bootFromSD} -eq 0 ] && [ ${swapActive} -eq 0 ]; then
|
||||||
echo "No external SWAP found - creating ... "
|
echo "No SWAP found - creating ... "
|
||||||
/home/admin/config.scripts/blitz.data.sh swap on
|
/home/admin/config.scripts/blitz.data.sh swap on
|
||||||
else
|
else
|
||||||
echo "SWAP already OK"
|
echo "SWAP already OK - dont add swap when running from SD card or already active"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
####### FIREWALL - just install (not configure)
|
####### FIREWALL - just install (not configure)
|
||||||
|
|||||||
@@ -51,6 +51,9 @@ storageFullMinGB=890
|
|||||||
dataMinGB=32
|
dataMinGB=32
|
||||||
systemMinGB=32
|
systemMinGB=32
|
||||||
|
|
||||||
|
# swap file path
|
||||||
|
swapFilePath="/swapfile"
|
||||||
|
|
||||||
# check if started with sudo
|
# check if started with sudo
|
||||||
if [ "$EUID" -ne 0 ]; then
|
if [ "$EUID" -ne 0 ]; then
|
||||||
echo "error='run as root'"
|
echo "error='run as root'"
|
||||||
@@ -78,7 +81,6 @@ fi
|
|||||||
if [ "$action" = "swap" ]; then
|
if [ "$action" = "swap" ]; then
|
||||||
|
|
||||||
swapAction=$2
|
swapAction=$2
|
||||||
swapFilePath="/swapfile"
|
|
||||||
swapSizeGB=8
|
swapSizeGB=8
|
||||||
|
|
||||||
if [ "$swapAction" = "on" ]; then
|
if [ "$swapAction" = "on" ]; then
|
||||||
@@ -115,7 +117,7 @@ if [ "$action" = "swap" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
# make permanent
|
# make permanent
|
||||||
if ! grep -q "${swapFilePath} none swap sw 0 0" /etc/fstab; then
|
if ! grep -q "${swapFilePath}" /etc/fstab; then
|
||||||
echo "${swapFilePath} none swap sw 0 0" >> /etc/fstab
|
echo "${swapFilePath} none swap sw 0 0" >> /etc/fstab
|
||||||
echo "# Added swapfile to /etc/fstab"
|
echo "# Added swapfile to /etc/fstab"
|
||||||
fi
|
fi
|
||||||
@@ -137,9 +139,9 @@ if [ "$action" = "swap" ]; then
|
|||||||
echo "# Swapfile ${swapFilePath} is not active."
|
echo "# Swapfile ${swapFilePath} is not active."
|
||||||
fi
|
fi
|
||||||
# remove from fstab
|
# remove from fstab
|
||||||
if grep -q "${swapFilePath} none swap sw 0 0" /etc/fstab; then
|
if grep -q "${swapFilePath}" /etc/fstab; then
|
||||||
echo "# Removing swapfile entry from /etc/fstab ..."
|
echo "# Removing swapfile entry from /etc/fstab ..."
|
||||||
sed -i "\#${swapFilePath} none swap sw 0 0#d" /etc/fstab
|
sed -i "\#^${swapFilePath}#d" /etc/fstab
|
||||||
fi
|
fi
|
||||||
# delete file
|
# delete file
|
||||||
if [ -f "${swapFilePath}" ]; then
|
if [ -f "${swapFilePath}" ]; then
|
||||||
@@ -174,10 +176,9 @@ if [ "$action" = "status" ]; then
|
|||||||
|
|
||||||
##########################
|
##########################
|
||||||
# CHECK SWAP STATUS
|
# CHECK SWAP STATUS
|
||||||
isSwapExternal=0
|
swapActive=0
|
||||||
swapFilePath="/swapfile"
|
|
||||||
if swapon --show | grep -q "${swapFilePath}"; then
|
if swapon --show | grep -q "${swapFilePath}"; then
|
||||||
isSwapExternal=1
|
swapActive=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
##########################
|
##########################
|
||||||
@@ -915,7 +916,7 @@ if [ "$action" = "status" ]; then
|
|||||||
echo "combinedDataStorage='${combinedDataStorage}'"
|
echo "combinedDataStorage='${combinedDataStorage}'"
|
||||||
echo "bootFromStorage='${bootFromStorage}'"
|
echo "bootFromStorage='${bootFromStorage}'"
|
||||||
echo "bootFromSD='${bootFromSD}'"
|
echo "bootFromSD='${bootFromSD}'"
|
||||||
echo "isSwapExternal='${isSwapExternal}'"
|
echo "swapActive='${swapActive}'"
|
||||||
|
|
||||||
# save to cache when -inspect
|
# save to cache when -inspect
|
||||||
if [ ${userWantsInspect} -eq 1 ]; then
|
if [ ${userWantsInspect} -eq 1 ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user