--- /dev/null
+#!/usr/bin/env sh
+#
+# Configure a swapfile
+#
+
+# Parameters
+SHARE="$1"
+LIB="$2"
+
+# Include basic functions
+. $LIB/trashman/functions || exit 1
+. $LIB/trashman/debian || exit 1
+
+# Serial console support for VMs not created by a recent kvmx-create
+if ! grep -q "GRUB_TERMINAL=serial" /etc/default/grub; then
+ # Serial console support
+ #echo '' | sudo tee -a /etc/default/grub > /dev/null
+ #echo '# Custom configuration' | sudo tee -a /etc/default/grub > /dev/null
+ #echo 'GRUB_TERMINAL=serial' | sudo tee -a /etc/default/grub > /dev/null
+ #echo 'GRUB_SERIAL_COMMAND="serial --speed=115200"' | sudo tee -a /etc/default/grub > /dev/null
+ #echo 'GRUB_CMDLINE_LINUX="console=ttyS0,115200n8"' | sudo tee -a /etc/default/grub > /dev/null
+ #sudo update-grub
+ echo '' | tee -a /etc/default/grub > /dev/null
+ echo '# Custom configuration' | tee -a /etc/default/grub > /dev/null
+ echo 'GRUB_TERMINAL=serial' | tee -a /etc/default/grub > /dev/null
+ echo 'GRUB_SERIAL_COMMAND="serial --speed=115200"' | tee -a /etc/default/grub > /dev/null
+ echo 'GRUB_CMDLINE_LINUX="console=ttyS0,115200n8"' | tee -a /etc/default/grub > /dev/null
+ update-grub
+fi
--- /dev/null
+#!/usr/bin/env sh
+#
+# Configure a swapfile
+#
+
+# Parameters
+SHARE="$1"
+LIB="$2"
+
+# Include basic functions
+. $LIB/trashman/functions || exit 1
+. $LIB/trashman/debian || exit 1
+
+# Hibernation support
+# https://wiki.archlinux.org/index.php/Swap#Swap_file
+# https://wiki.archlinux.org/index.php/Uswsusp
+if ! grep -q "/swapfile" /etc/fstab; then
+ echo "Configuring hibernation..."
+ #sudo fallocate -l 2G /swapfile
+ #sudo chmod 600 /swapfile
+ #sudo mkswap /swapfile
+ #sudo swapon /swapfile
+ fallocate -l 2G /swapfile
+ chmod 600 /swapfile
+ mkswap /swapfile
+ swapon /swapfile
+
+ #echo "/swapfile none swap defaults 0 0" | sudo tee -a /etc/fstab > /dev/null
+ echo "/swapfile none swap defaults 0 0" | tee -a /etc/fstab > /dev/null
+ #$APT_INSTALL uswsusp
+ trashman_apt_install_packages uswsusp
+ #echo "RESUME=/swapfile" | sudo tee /etc/initramfs-tools/conf.d/resume > /dev/null
+ echo "RESUME=/swapfile" | tee /etc/initramfs-tools/conf.d/resume > /dev/null
+ #sudo update-initramfs -u
+ update-initramfs -u
+fi