home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / boot / i386 / rescue / usr / lib / hal / scripts / linux / hal-luks-setup-linux < prev    next >
Text File  |  2006-11-29  |  1KB  |  34 lines

  1. #!/bin/bash
  2.  
  3. # Copyright (C) 2005 W. Michael Petullo <mike@flyn.org>
  4. # Copyright (C) 2006 David Zeuthen <davidz@redhat.com>
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License version 2.
  7.  
  8. read PASSWORD 
  9.  
  10. CRYPTSETUP=/sbin/cryptsetup
  11.  
  12. if [ ! -f $CRYPTSETUP ]; then
  13.     echo org.freedesktop.Hal.Device.Volume.Crypto.SetupError >&2
  14.     echo Error setting up $HAL_PROP_BLOCK_DEVICE - $CRYPTSETUP not found >&2
  15.     exit 1
  16. fi
  17.  
  18. if [ -e /dev/mapper/luks_crypto_$HAL_PROP_VOLUME_UUID ]; then
  19.     echo org.freedesktop.Hal.Device.Volume.Crypto.SetupError >&2
  20.     echo $HAL_PROP_BLOCK_DEVICE is already setup? >&2
  21.     exit 1
  22. fi
  23.  
  24. if ! echo "$PASSWORD" | $CRYPTSETUP luksOpen $HAL_PROP_BLOCK_DEVICE luks_crypto_$HAL_PROP_VOLUME_UUID  2> /dev/null; then
  25.     echo org.freedesktop.Hal.Device.Volume.Crypto.SetupPasswordError >&2
  26.     echo Error setting up $HAL_PROP_BLOCK_DEVICE - bad password? >&2
  27.     exit 1
  28. fi
  29.  
  30. hal-set-property --udi=$UDI --key="info.callouts.remove" --strlist-pre="hal-luks-remove" > /dev/null 2>&1
  31.  
  32. exit 0
  33.