mirror of
https://github.com/ublue-os/bazzite.git
synced 2025-02-25 21:41:02 +00:00
fix(just): Address issues with memory resizing
- Recursive invokations need to be done with --unstable - Add zram-size declaration if it doesn't exist - Only fetch the current size, not the entire file contents
This commit is contained in:
parent
3eb3f67728
commit
0710ca3feb
@ -81,7 +81,7 @@ deckswap-off:
|
||||
resize-deckswap:
|
||||
#!/usr/bin/env bash
|
||||
CONFIG='/etc/default/deckswap'
|
||||
CURRENT_SIZE=$(cat "${CONFIG}" | sed 's/SWAP_SIZE=//g')
|
||||
CURRENT_SIZE=$(cat "${CONFIG}" | grep "SWAP_SIZE" | sed 's/SWAP_SIZE=//g')
|
||||
echo 'Current size: '${CURRENT_SIZE}
|
||||
read -p 'Enter new size (1-16) in gigabytes (1G): ' NEW_SIZE
|
||||
if [ -z "${NEW_SIZE//[0-9]}" ]; then
|
||||
@ -93,11 +93,11 @@ resize-deckswap:
|
||||
echo 'Current size: '${NEW_SIZE}'G. Please reboot.'
|
||||
else
|
||||
echo 'Error: Input out of range (1-16). Running again.'
|
||||
just resize-deckswap
|
||||
just --unstable resize-deckswap
|
||||
fi
|
||||
else
|
||||
echo 'Error: Input is not an integer. Running again.'
|
||||
just resize-deckswap
|
||||
just --unstable resize-deckswap
|
||||
fi
|
||||
|
||||
enable-duperemove:
|
||||
@ -130,7 +130,11 @@ zram-off:
|
||||
resize-zram:
|
||||
#!/usr/bin/env bash
|
||||
CONFIG='/etc/systemd/zram-generator.conf'
|
||||
CURRENT_SIZE=$(cat "${CONFIG}" | sed 's/zram-size=//g')
|
||||
if grep "zram-size" <<< $(cat ${CONFIG}); then
|
||||
CURRENT_SIZE=$(cat "${CONFIG}" | grep "zram-size" | sed 's/zram-size=//g')
|
||||
else
|
||||
CURRENT_SIZE=1024
|
||||
fi
|
||||
echo 'Current size: '${CURRENT_SIZE}
|
||||
read -p 'Enter new size (512-4096) in megabytes (1024): ' NEW_SIZE
|
||||
if [ -z "${NEW_SIZE//[0-9]}" ]; then
|
||||
@ -138,15 +142,19 @@ resize-zram:
|
||||
NEW_SIZE=1024
|
||||
fi
|
||||
if ((${NEW_SIZE} >= 512 && ${NEW_SIZE} <= 4096)); then
|
||||
sudo sed -i 's/zram-size='${CURRENT_SIZE}'/zram-size='${NEW_SIZE}'/g' ${CONFIG}
|
||||
if grep "zram-size" <<< $(cat ${CONFIG}); then
|
||||
sudo sed -i 's/zram-size='${CURRENT_SIZE}'/zram-size='${NEW_SIZE}'/g' ${CONFIG}
|
||||
else
|
||||
sudo -A echo "zram-size=${NEW_SIZE}" >> ${CONFIG}
|
||||
fi
|
||||
echo 'Current size: '${NEW_SIZE}'. Please reboot.'
|
||||
else
|
||||
echo 'Error: Input out of range (512-4096). Running again.'
|
||||
just resize-zram
|
||||
just --unstable resize-zram
|
||||
fi
|
||||
else
|
||||
echo 'Error: Input is not an integer. Running again.'
|
||||
just resize-zram
|
||||
just --unstable resize-zram
|
||||
fi
|
||||
|
||||
hide-grub:
|
||||
|
@ -69,7 +69,11 @@ zram-off:
|
||||
resize-zram:
|
||||
#!/usr/bin/env bash
|
||||
CONFIG='/etc/systemd/zram-generator.conf'
|
||||
CURRENT_SIZE=$(cat "${CONFIG}" | sed 's/zram-size=//g')
|
||||
if grep "zram-size" <<< $(cat ${CONFIG}); then
|
||||
CURRENT_SIZE=$(cat "${CONFIG}" | grep "zram-size" | sed 's/zram-size=//g')
|
||||
else
|
||||
CURRENT_SIZE=1024
|
||||
fi
|
||||
echo 'Current size: '${CURRENT_SIZE}
|
||||
read -p 'Enter new size (512-4096) in megabytes (1024): ' NEW_SIZE
|
||||
if [ -z "${NEW_SIZE//[0-9]}" ]; then
|
||||
@ -77,15 +81,19 @@ resize-zram:
|
||||
NEW_SIZE=1024
|
||||
fi
|
||||
if ((${NEW_SIZE} >= 512 && ${NEW_SIZE} <= 4096)); then
|
||||
sudo sed -i 's/zram-size='${CURRENT_SIZE}'/zram-size='${NEW_SIZE}'/g' ${CONFIG}
|
||||
if grep "zram-size" <<< $(cat ${CONFIG}); then
|
||||
sudo sed -i 's/zram-size='${CURRENT_SIZE}'/zram-size='${NEW_SIZE}'/g' ${CONFIG}
|
||||
else
|
||||
sudo -A echo "zram-size=${NEW_SIZE}" >> ${CONFIG}
|
||||
fi
|
||||
echo 'Current size: '${NEW_SIZE}'. Please reboot.'
|
||||
else
|
||||
echo 'Error: Input out of range (512-4096). Running again.'
|
||||
just resize-zram
|
||||
just --unstable resize-zram
|
||||
fi
|
||||
else
|
||||
echo 'Error: Input is not an integer. Running again.'
|
||||
just resize-zram
|
||||
just --unstable resize-zram
|
||||
fi
|
||||
|
||||
hide-grub:
|
||||
|
Loading…
x
Reference in New Issue
Block a user