Update 3 files
- /software.yml - /home/.chezmoidata.yaml - /home/.chezmoiscripts/linux/run_onchange_before_11-configure-swap.tmpl
This commit is contained in:
parent
8ebce4eb0a
commit
5932fef5e4
3 changed files with 39 additions and 10 deletions
|
@ -817,6 +817,7 @@ softwareGroups:
|
||||||
_Basic-Desktop: &_Basic-Desktop
|
_Basic-Desktop: &_Basic-Desktop
|
||||||
- *_Basic
|
- *_Basic
|
||||||
- *Essentials-Desktop
|
- *Essentials-Desktop
|
||||||
|
- stacer
|
||||||
_Standard: &_Standard
|
_Standard: &_Standard
|
||||||
- *_Basic
|
- *_Basic
|
||||||
- *Backup
|
- *Backup
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
{{ includeTemplate "universal/logg-before" }}
|
{{ includeTemplate "universal/logg-before" }}
|
||||||
|
|
||||||
if [ ! -f /swapfile ]; then
|
if [ ! -f /swapfile ]; then
|
||||||
|
### Determine ideal size of /swapfile
|
||||||
MEMORY_IN_KB="$(grep MemTotal /proc/meminfo | sed 's/.* \(.*\) kB/\1/')"
|
MEMORY_IN_KB="$(grep MemTotal /proc/meminfo | sed 's/.* \(.*\) kB/\1/')"
|
||||||
MEMORY_IN_GB="$((MEMORY_IN_KB / 1024 / 1024))"
|
MEMORY_IN_GB="$((MEMORY_IN_KB / 1024 / 1024))"
|
||||||
|
|
||||||
if [ "$MEMORY_IN_GB" -gt 64 ]; then
|
if [ "$MEMORY_IN_GB" -gt 64 ]; then
|
||||||
SWAP_SPACE="$((MEMORY_IN_GB / 10))"
|
SWAP_SPACE="$((MEMORY_IN_GB / 10))"
|
||||||
elif [ "$MEMORY_IN_GB" -gt 32 ]; then
|
elif [ "$MEMORY_IN_GB" -gt 32 ]; then
|
||||||
|
@ -17,15 +17,29 @@ if [ ! -f /swapfile ]; then
|
||||||
else
|
else
|
||||||
SWAP_SPACE="$MEMORY_IN_GB"
|
SWAP_SPACE="$MEMORY_IN_GB"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
logg info "Creating a $SWAP_SPACE GB /swapfile"
|
### Create /swapfile
|
||||||
sudo fallocate -l "${SWAP_SPACE}G" /swapfile
|
FS_TYPE="$(df -Th | grep ' /$' | sed 's/[^ ]*\s*\([^ ]*\).*/\1/')"
|
||||||
sudo chmod 600 /swapfile
|
if [ "$FS_TYPE" == 'btrfs' ]; then
|
||||||
sudo mkswap /swapfile
|
logg info 'Creating BTRFS /swapfile'
|
||||||
sudo swapon /swapfile
|
sudo btrfs filesystem mkswapfile /swapfile
|
||||||
if cat /etc/fstab | grep "/swapfile"; then
|
elif [ "$FS_TYPE" == 'zfs' ]; then
|
||||||
sudo sed -i '/\/swapfile/\/swapfile none swap sw 0 0/' /etc/fstab
|
logg warn 'ZFS system detected - add logic here to add /swapfile'
|
||||||
else
|
else
|
||||||
echo "/swapfile none swap sw 0 0" | sudo tee -a /etc/fstab
|
logg info "Creating a $SWAP_SPACE GB /swapfile"
|
||||||
|
sudo fallocate -l "${SWAP_SPACE}G" /swapfile
|
||||||
|
sudo chmod 600 /swapfile
|
||||||
|
sudo mkswap /swapfile
|
||||||
|
fi
|
||||||
|
|
||||||
|
### Enable the /swapfile
|
||||||
|
if [ -f /swapfile ]; then
|
||||||
|
logg info 'Running `sudo swapon /swapfile`'
|
||||||
|
sudo swapon /swapfile
|
||||||
|
if cat /etc/fstab | grep "/swapfile"; then
|
||||||
|
sudo sed -i '/\/swapfile/\/swapfile none swap defaults 0 0/' /etc/fstab
|
||||||
|
else
|
||||||
|
echo "/swapfile none swap defaults 0 0" | sudo tee -a /etc/fstab > /dev/null
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
14
software.yml
14
software.yml
|
@ -5863,6 +5863,20 @@ softwarePackages:
|
||||||
npm: pnpm-lock-export
|
npm: pnpm-lock-export
|
||||||
_service: false
|
_service: false
|
||||||
_type: cli
|
_type: cli
|
||||||
|
stacer:
|
||||||
|
_bin: stacer
|
||||||
|
_desc: Popular desktop GUI for monitoring and cleaning Linux systems.
|
||||||
|
_docs: https://github.com/oguzhaninan/Stacer/blob/native/README.md
|
||||||
|
_github: https://github.com/oguzhaninan/Stacer
|
||||||
|
_home: https://oguzhaninan.github.io/Stacer-Web/
|
||||||
|
_name: Stacer
|
||||||
|
appimage: https://github.com/oguzhaninan/Stacer/releases/download/v1.1.0/Stacer-1.1.0-x64.AppImage
|
||||||
|
apt: https://github.com/oguzhaninan/Stacer/releases/download/v1.1.0/stacer_1.1.0_amd64.deb
|
||||||
|
apt:debian: stacer
|
||||||
|
apt:ubuntu: stacer
|
||||||
|
dnf: https://github.com/oguzhaninan/Stacer/releases/download/v1.1.0/stacer-1.1.0-amd64.rpm
|
||||||
|
dnf:fedora: stacer
|
||||||
|
yay: stacer
|
||||||
poetry:
|
poetry:
|
||||||
_bin: poetry
|
_bin: poetry
|
||||||
_desc: '[Poetry](https://python-poetry.org) helps you declare, manage and install dependencies of Python projects, ensuring you have the right stack everywhere.'
|
_desc: '[Poetry](https://python-poetry.org) helps you declare, manage and install dependencies of Python projects, ensuring you have the right stack everywhere.'
|
||||||
|
|
Loading…
Reference in a new issue