added box-purge functionnality

This commit is contained in:
age 2005-10-21 15:59:56 +00:00
parent 7ac7e0bdb6
commit 28cc0be47f

View file

@ -315,6 +315,7 @@ function box_purge()
local device=$(find_harddisk) local device=$(find_harddisk)
log_msg "Purging $device ..." log_msg "Purging $device ..."
dd if=/dev/zero of=$device bs=1M count=1 dd if=/dev/zero of=$device bs=1M count=1
log_msg " "
} }
@ -440,9 +441,6 @@ case "$ACTION" in
else echo -n "'$0' box-init-bg" | at now else echo -n "'$0' box-init-bg" | at now
fi fi
;; ;;
box-purge )
box_purge
;;
is_crypto_mounted ) is_crypto_mounted )
is_crypto_mounted is_crypto_mounted
;; ;;
@ -478,6 +476,13 @@ case "$ACTION" in
diskinfo ) diskinfo )
$SFDISK -L -q -l `find_harddisk` $SFDISK -L -q -l `find_harddisk`
;; ;;
box-purge )
log_msg "Cleaning the CryptoBox ..."
$0 crypto-down
$0 config-down
box_purge
$0 diskinfo
;;
poweroff ) poweroff )
is_crypto_mounted && umount_crypto is_crypto_mounted && umount_crypto
log_msg "Turning off the CryptoBox ..." log_msg "Turning off the CryptoBox ..."
@ -488,15 +493,6 @@ case "$ACTION" in
log_msg "Rebooting the CryptoBox ..." log_msg "Rebooting the CryptoBox ..."
echo "reboot" | at now echo "reboot" | at now
;; ;;
clean )
# only for development
log_msg "Cleaning the CryptoBox ..."
device=$(find_harddisk)
$0 crypto-down
$0 config-down
# TODO: test this!
echo -e ";\n;\n;\n;\n" | $SFDISK "$device"
;;
* ) * )
echo "Syntax: `basename $0` ACTION [PARAMS]" echo "Syntax: `basename $0` ACTION [PARAMS]"
echo " config-up - scan for configuration partition and mount it" echo " config-up - scan for configuration partition and mount it"
@ -520,8 +516,8 @@ case "$ACTION" in
echo " set_config NAME VALUE - change a configuration setting" echo " set_config NAME VALUE - change a configuration setting"
echo " get_config NAME - retrieve a configuration setting" echo " get_config NAME - retrieve a configuration setting"
echo " diskinfo - show the partition table of the harddisk" echo " diskinfo - show the partition table of the harddisk"
echo " box-purge - destroy partitiontable of the harddisk (delete everything)"
echo " poweroff - shutdown the cryptobox" echo " poweroff - shutdown the cryptobox"
echo " clean - remove all partitions [only for development]"
echo " reboot - reboot the cryptobox" echo " reboot - reboot the cryptobox"
echo echo
;; ;;