All pastes #1345499 Raw Edit

Stuff

public shellscript v1 · immutable
#1345499 ·published 2009-02-24 03:33 UTC
rendered paste body
#!/bin/shdd_bs=1dd_ct=512dd_if=/dev/urandomdevswp=/dev/sda5dm=/dev/mapper/cswpmapdev="cswp"cs_opton="-q -c aes -d - create"cs_optoff="remove"case "$1" in        start)            dd if=/dev/urandom bs=1 count=512 | cryptsetup -q -c aes -d - create $mapdev $devswp            mkswap $dm            swapon $dm            if [ "$?" == 0 ]; then                echo "Started temporary swap device successfully."            else                echo "Failed to create temporary swap device."            fi            ;;        stop)            swapoff $dm            cryptsetup $cs_optoff $mapdev            if [ "$?" == 0 ]; then                echo "Removed temporary swap device successfully."            else                echo "Failed to remove temporary swap device."            fi            ;;        *)            echo "Usage: /etc/init.d/mkcswap {start|stop}"            exit 1            ;;esacexit 0