#!/bin/bash ### Inserisci qui la partizione SWAP del sistema SWAP=/dev/hda666 ### Inserisci qui la partizione LOOP da usare LOOP=/dev/loop1 ### Seleziona un algoritmo di compressione ### decommentando quello preferito ALG=twofish #ALG=sha256 #ALG= serpent #ALG=des #ALG=cast5 #ALG=sha512 #ALG=sha1 #ALG=cast6 #ALG=blowfish #ALG=aes case "$1" in start) echo -n "Initializing encrypted swap space...." /bin/dd if=/dev/urandom bs=1c count=32 \ 2> /dev/null | /usr/bin/mimencode | \ /sbin/losetup -p0 -e $ALG $LOOP $SWAP /sbin/mkswap $LOOP > /dev/null 2>&1 /sbin/swapon $LOOP echo "done." ;; stop) echo -n "Umounting encrypted swap space..." /sbin/swapoff $LOOP /sbin/losetup -d $LOOP /bin/sync echo "done." ;; status) /bin/cat /proc/swaps ;; restart) $0 stop $0 start ;; *) echo "Usage: $0{start|stop|restart|status}" exit 1 esac