aboutsummaryrefslogtreecommitdiff
path: root/share/trashman
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2020-08-08 08:19:46 -0300
committerSilvio Rhatto <rhatto@riseup.net>2020-08-08 08:19:46 -0300
commit0ccaea92faf3911d054fd7d120d04a4ff0d68a0d (patch)
tree201af574f7c1b455a4de128b99fbf5028a53b974 /share/trashman
parent823ff53f995eb4e5f29a971fa7341d701eef3cff (diff)
downloadtrashman-0ccaea92faf3911d054fd7d120d04a4ff0d68a0d.tar.gz
trashman-0ccaea92faf3911d054fd7d120d04a4ff0d68a0d.tar.bz2
Adds grub-serial-console and swapfile
Diffstat (limited to 'share/trashman')
-rw-r--r--share/trashman/grub-serial-console/info1
-rwxr-xr-xshare/trashman/grub-serial-console/unix/linux/debian/install29
-rw-r--r--share/trashman/swapfile/info1
-rwxr-xr-xshare/trashman/swapfile/unix/linux/debian/install36
4 files changed, 67 insertions, 0 deletions
diff --git a/share/trashman/grub-serial-console/info b/share/trashman/grub-serial-console/info
new file mode 100644
index 0000000..7047634
--- /dev/null
+++ b/share/trashman/grub-serial-console/info
@@ -0,0 +1 @@
+setup serial console for GNU Grub
diff --git a/share/trashman/grub-serial-console/unix/linux/debian/install b/share/trashman/grub-serial-console/unix/linux/debian/install
new file mode 100755
index 0000000..8832fdd
--- /dev/null
+++ b/share/trashman/grub-serial-console/unix/linux/debian/install
@@ -0,0 +1,29 @@
+#!/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
diff --git a/share/trashman/swapfile/info b/share/trashman/swapfile/info
new file mode 100644
index 0000000..3c41c3f
--- /dev/null
+++ b/share/trashman/swapfile/info
@@ -0,0 +1 @@
+configure a swapfile for hibernation
diff --git a/share/trashman/swapfile/unix/linux/debian/install b/share/trashman/swapfile/unix/linux/debian/install
new file mode 100755
index 0000000..548629d
--- /dev/null
+++ b/share/trashman/swapfile/unix/linux/debian/install
@@ -0,0 +1,36 @@
+#!/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