Files
dotfiles/installer/03-install-swap.sh
T
gitadmin 156b7261db refactor: migrate from shell-based sync to mise dotfiles management
- Replace sync-config/sync-script with mise.toml [dotfiles] directives
- Convert installer scripts to mise tasks (shells, desktop, theme, webapps)
- Remove config/nvim-old (deprecated neovim config)
- Add omarchy theme system with multi-app configs (btop, hyprland, kitty, foot, tmux, etc.)
- Move SSH hosts to config.d/* include pattern
- Add Tera templates for dynamic config generation (git-local, dofiles.conf)
- Update pi agent settings (0.80.10, packages list)
- Add mise tasks for pi plugin setup and nvim tooling
2026-07-18 06:11:59 +00:00

27 lines
795 B
Bash
Executable File

#!/usr/bin/sudo /bin/sh
if [[ $UID != 0 ]]; then
echo "need to be root"
exit 0;
fi
MOUNT_DIR=$(mktemp -d)
mount $(df --output=source / | tail -n 1) $MOUNT_DIR
btrfs subvolume create $MOUNT_DIR/@swap
chmod 700 $MOUNT_DIR/\@swap
mkdir /swap
echo $(df --output=source / | tail -n 1)" /swap btrfs rw,noatime,compress=none,ssd,space_cache,subvol=@swap 0 0" | tee -a /etc/fstab
systemctl daemon-reload
mount /swap
truncate -s 0 /swap/swapfile
chattr +C /swap/swapfile
# error btrfs property set /swap/swapfile compression none
fallocate -l $(free --giga | awk 'NR == 2 {print $2}')G /swap/swapfile
chmod 600 /swap/swapfile
mkswap /swap/swapfile
swapon /swap/swapfile
echo "/swap/swapfile none swap defaults 0 0" | tee -a /etc/fstab
systemctl daemon-reload
umount $MOUNT_DIR
rmdir $MOUNT_DIR