dh_installchangelogs
dh_installdocs
dh_installman manpages/grml-scripts.1 manpages/grml-bind.8 manpages/reread_partition_table.8 manpages/gtf.1 manpages/random-hostname.1 \
- manpages/grml-setkeyboard.8 manpages/grml-setlang.8 manpages/getsf.1 manpages/grml-iptstate.8 manpages/fma.1
+ manpages/grml-setkeyboard.8 manpages/grml-setlang.8 manpages/getsf.1 manpages/grml-iptstate.8 manpages/fma.1 manpages/grml-swapon.8
# cp --no-dereference man/*.1.gz debian/grml-scripts/usr/share/man/man1/
dh_link /usr/sbin/blacklist /usr/sbin/unblacklist
dh_link /usr/share/man/man1/grml-scripts.1.gz /usr/share/man/man1/align.1.gz
--- /dev/null
+.TH grml-swapon 8
+.SH "NAME"
+grml\-swapon \- activate swap partitions with taking care of suspend signatures
+.SH SYNOPSIS
+.B grml\-swapon
+.RI [ OPTIONS ]
+.SH DESCRIPTION
+
+grml-swapon is a small script for enabling swap partitions found in /etc/fstab.
+Starting with grml 0.9 booting the live-cd system does not activate swap
+parititions by default anymore. It is possible to force usage of swap partitions
+via booting with the bootoption "swap". In case you forgot to use this
+bootoption but want to use swap partition(s) anyway you could do that by running
+"swapon -a". But the command "swapon" does not take of suspend signatures -
+therefore the existance of grml-swapon. grml-swapon acts based on the
+information found in /etc/fstab. If your /etc/fstab is not up to date rebuild it
+running "grml-rebuildfstab".
+
+.SH OPTIONS
+.TP
+.B \-h, \-\-help
+Show help text.
+.TP
+.B \-\-force
+Force usage of swap partitions, activate them also if suspend signature is present.
+.SH SEE ALSO
+.BR grml-rebuildfstab (8).
+.SH AUTHOR
+grml-swapon was written by Michael Prokop <mika@grml.org>.
+.PP
+This manual page was written by Michael Prokop <mika@grml.org>
+for the grml project (but may be used by others).
--- /dev/null
+#!/bin/zsh
+# Filename: grml-swapon
+# Purpose: activate swap partitions with taking care of suspend signatures
+# Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
+# Bug-Reports: see http://grml.org/bugs/
+# License: This file is licensed under the GPL v2.
+# Latest change: Son Nov 26 18:04:13 CET 2006 [mika]
+################################################################################
+
+set -e # exit on any error
+
+. /etc/grml/script-functions
+. /etc/grml/lsb-functions
+. /etc/grml/autoconfig.functions
+
+check4root || exit 1
+check4progs dd blkid swapon || exit 2
+
+checkbootparam "anyswap" && export ANYSWAP='yes' || export ANYSWAP=""
+
+case $1 in
+ --force)
+ ANYSWAP='yes'
+ ;;
+ -h*|--h*)
+ ewarn 'grml-swapon: activate swap partitions defined in /etc/fstab'
+ eindent
+ ewarn 'Usage: grml-swapon [--help|-h] [--force]'
+ ewarn 'Tip: execute grml-rebuildfstab for rebuilding /etc/fstab'
+ eoutdent
+ eend 1
+ ;;
+esac
+
+einfo "Searching for swap partition(s) as requested."
+eindent
+
+[ -n "$ANYSWAP" ] && einfo "Option --force set, forcing usage of swap partitions."
+
+while read p m f relax; do
+ case "$p" in *fd0*|*proc*|*sys*|*\#*) continue;; esac
+ partoptions="users,exec"
+ fnew=""
+ case "$f" in swap)
+ case "$(dd if=$p bs=1 count=6 skip=4086 2>/dev/null)" in
+ S1SUSP|S2SUSP|pmdisk|[zZ]*)
+ if [ -n "$ANYSWAP" ] ; then
+ einfo "Using swap partition ${WHITE}${p}${NORMAL} [bootoption anyswap found]."
+ swapon $p 2>>$DEBUG ; eend $?
+ else
+ ewarn "Suspend signature on ${WHITE}${p}${NORMAL} found, not using as swap. Force usage via option: --force"
+ fi
+ ;;
+ *)
+ if [[ "$p" == LABEL* ]] ; then
+ p=$(blkid -t $p | awk -F: '{print $1}')
+ fi
+ if grep -q $p /proc/swaps ; then
+ ewarn "Not using swap partition ${WHITE}${p}${NORMAL} as it is already in use." ; eend 0
+ else
+ einfo "Using swap partition ${WHITE}${p}${NORMAL}."
+ swapon $p 2>>$DEBUG ; eend $?
+ fi
+ ;;
+ esac
+ continue
+ ;;
+ esac
+ done <<EOT
+$(cat /etc/fstab)
+EOT
+
+eoutdent