move initinstall.d/05-vm-profile to separate package volumes-profile-alt-server-v

This commit is contained in:
Andrew A. Vasilyev 2023-04-12 20:13:29 +03:00
parent 10982dd990
commit b992ae9029

View File

@ -1,53 +0,0 @@
#!/bin/sh
# see also http://www.altlinux.org/Autoinstall
message() { echo "vm-profile: $*" >>/tmp/vm-profile.log; }
ROOT_MIN=7 # In Gb
VAR_MIN=1 # In Gb
mem="$(sed -n '/^MemTotal/s/[^0-9]//gp' /proc/meminfo)" # in kB
# feel free to suggest better defaults
if [ "$mem" -le 1048576 ]; then
swap="$[ 2*$mem ]"
else
swap=2097152
fi
# don't do RAID in a VM, reduce swap to a minimum
if grep -qE '(101300b8)|(80eebeef)|(14ad0405)' /proc/bus/pci/devices; then
methods='plain'
swap=131072
else
methods='raid plain'
fi
root_min="$[ $ROOT_MIN*1024*1024 ]"
var_min="$[ $VAR_MIN*1024*1024 ]"
message "mem=$mem k"
message "swap=$swap k"
message "root_min=$root_min k"
message "var_min=$var_min k"
# EVMS deals with sectors
swap="$[ 2*$swap ]"
root_min="$[ 2*$root_min ]"
var_min="$[ 2*$var_min ]"
cat > /var/cache/alterator/vm-profile.scm << _EOF_
((rootonly
(title . "Minimal server (rootfs only /)")
(action . trivial)
(actiondata
("swap" (size . $swap) (fsim . "SWAPFS") (methods $methods))
("/" (size $root_min . #t) (fsim . "Ext2/3") (methods $methods))))
(server
(title . "Generic server KVM/Docker/LXD/Podman/CRI-O/PVE (large /var)")
(action . trivial)
(actiondata
("swap" (size . $swap) (fsim . "SWAPFS") (methods $methods))
("/" (size $root_min . $[2*$root_min]) (fsim . "Ext2/3") (methods $methods))
("/var" (size $var_min . #t) (fsim . "Ext2/3") (methods $methods)))))
_EOF_