add zram config
This commit is contained in:
parent
d9a77e1458
commit
496d4fc26e
2 changed files with 28 additions and 0 deletions
26
configure-zram.bash
Executable file
26
configure-zram.bash
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
if [ $(whoami) == "root" ]; then
|
||||
echo "Run as a normal user, not root"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# only fedora is up-to-date
|
||||
|
||||
command_exists() { type "$1" &>/dev/null; }
|
||||
|
||||
if command_exists "apt-get"; then
|
||||
sudo apt-get install kitty -y
|
||||
echo "Please install SchildiChat, nvim/neovim"
|
||||
elif command_exists "dnf"; then
|
||||
sudo dnf remove zram-generator -y
|
||||
echo 'zram' | sudo tee /etc/modules-load.d/zram.conf
|
||||
echo 'ACTION=="add", KERNEL=="zram0", ATTR{initstate}=="0", ATTR{comp_algorithm}="zstd", ATTR{disksize}="48G", RUN="/usr/bin/mkswap -U clear %N", TAG+="systemd"' | sudo tee /etc/udev/rules.d/99-zram.rules
|
||||
zram_fstab='/dev/zram0 none swap defaults,discard,pri=160 0 0'
|
||||
if ! grep -q "$zram_fstab" /etc/fstab; then
|
||||
echo "$zram_fstab" | sudo tee -a /etc/fstab
|
||||
fi
|
||||
echo '@reboot bash -c "mkswap -U clear /dev/zram0; swapon --discard --priority 160 /dev/zram0"' | sudo crontab -
|
||||
fi
|
||||
|
|
@ -23,6 +23,8 @@ chmod 700 ./*.bash
|
|||
./install-podman.sh
|
||||
cd ..
|
||||
|
||||
./configure-zram.bash
|
||||
|
||||
cd ./dotfiles
|
||||
chmod 700 run-distro-de-script.sh
|
||||
./run-distro-de-script.sh
|
||||
|
|
Loading…
Add table
Reference in a new issue