]> gitweb.fluxo.info Git - trashman.git/commitdiff
Adds grub-serial-console and swapfile
authorSilvio Rhatto <rhatto@riseup.net>
Sat, 8 Aug 2020 11:19:46 +0000 (08:19 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sat, 8 Aug 2020 11:19:46 +0000 (08:19 -0300)
share/trashman/grub-serial-console/info [new file with mode: 0644]
share/trashman/grub-serial-console/unix/linux/debian/install [new file with mode: 0755]
share/trashman/swapfile/info [new file with mode: 0644]
share/trashman/swapfile/unix/linux/debian/install [new file with mode: 0755]

diff --git a/share/trashman/grub-serial-console/info b/share/trashman/grub-serial-console/info
new file mode 100644 (file)
index 0000000..7047634
--- /dev/null
@@ -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 (executable)
index 0000000..8832fdd
--- /dev/null
@@ -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 (file)
index 0000000..3c41c3f
--- /dev/null
@@ -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 (executable)
index 0000000..548629d
--- /dev/null
@@ -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