r2830 - configs/daniel/desktop/config/chroot_local-includes/usr/local/bin
daniel at alioth.debian.org
daniel at alioth.debian.org
Mon Sep 3 18:47:59 UTC 2007
Author: daniel
Date: 2007-09-03 18:47:59 +0000 (Mon, 03 Sep 2007)
New Revision: 2830
Added:
configs/daniel/desktop/config/chroot_local-includes/usr/local/bin/gpg-decrypt
Modified:
configs/daniel/desktop/config/chroot_local-includes/usr/local/bin/gpg-encrypt
Log:
Copied: configs/daniel/desktop/config/chroot_local-includes/usr/local/bin/gpg-decrypt (from rev 2829, configs/daniel/desktop/config/chroot_local-includes/usr/local/bin/gpg-encrypt)
===================================================================
--- configs/daniel/desktop/config/chroot_local-includes/usr/local/bin/gpg-decrypt (rev 0)
+++ configs/daniel/desktop/config/chroot_local-includes/usr/local/bin/gpg-decrypt 2007-09-03 18:47:59 UTC (rev 2830)
@@ -0,0 +1,55 @@
+#!/bin/bash
+
+# gpg-decrypt.sh - Decrypt files (including filenames).
+#
+# This script is written by Daniel Baumann <daniel at debian.org>
+# and hereby placed in the public domain (no rights reserved).
+
+set -e
+
+# FIXME:
+# . ${RANDOM} is a bashism
+#
+# . autodetect secret key
+# . configure gpg options
+# . review gpg command calls
+#
+# . save/restore owner and permissions
+# . hide processing and show progressbar
+# . recursive?
+# . scale up and use better random ciphers
+
+Passphrase ()
+{
+ echo -n " * Enter passphrase: "
+ read -s -t 60 PASSPHRASE
+ echo
+ echo
+
+ if [ -z "${PASSPHRASE}" ]
+ then
+ Passphrase
+ fi
+
+ trap "if [ ! -z ${PASSPHRASE} ]; then export PASSPHRASE=; fi; exit 0" 0 2 15
+}
+
+Decrypt ()
+{
+ for FILE in ${@}
+ do
+ echo "${PASSPHRASE}" | gpg --quiet --passphrase-fd 0 --output "`basename ${FILE} .gpg`" --decrypt "${FILE}"
+
+ rm -f "${FILE}"
+ done
+
+ for FILE in *-control
+ do
+ sh "${FILE}"
+
+ rm -f "${FILE}"
+ done
+}
+
+Passphrase
+Decrypt "${@}"
Modified: configs/daniel/desktop/config/chroot_local-includes/usr/local/bin/gpg-encrypt
===================================================================
--- configs/daniel/desktop/config/chroot_local-includes/usr/local/bin/gpg-encrypt 2007-09-03 18:43:14 UTC (rev 2829)
+++ configs/daniel/desktop/config/chroot_local-includes/usr/local/bin/gpg-encrypt 2007-09-03 18:47:59 UTC (rev 2830)
@@ -53,7 +53,7 @@
Encrypt ()
{
- for OBJECT in `echo $1 | sed -e 's/"//g'`
+ for OBJECT in ${@}
do
if [ -d "${OBJECT}" ]
then
@@ -141,58 +141,6 @@
done
}
-Decrypt ()
-{
- for FILE in *.gpg
- do
- echo "${PASSPHRASE}" | gpg --quiet --passphrase-fd 0 --output "`basename ${FILE} .gpg`" --decrypt "${FILE}"
-
- rm -f "${FILE}"
- done
-
- for FILE in *-control
- do
- sh "${FILE}"
-
- rm -f "${FILE}"
- done
-}
-
-Main ()
-{
- case "${1}" in
- -d|--decrypt)
- Passphrase;
- Decrypt "${2}";
- ;;
-
- -e|--encrypt)
- Key;
- Passphrase
- Encrypt "${2}";
- ;;
-
- -h|--help)
- echo "gpg-encrypt.sh - Encrypt files (including filenames)."
- echo
- echo -e "Usage: `basename ${0}` [OPTION] \"[FILE] || [EXPRESSION]\""
- echo
- echo "Options:"
- echo -e " -e, --encrypt: encrypt data"
- echo -e " -d, --decrypt: decrypt data"
- echo
- echo "File/Expression:"
- echo -e " On encrypting data, you can enter either a specific file"
- echo -e " or a file pattern. Note that you have to enter it in quotes."
- echo -e " On decrypting data, no file or expression is needed. All"
- echo -e " encrypted data in the current directory will be decrypted."
- exit 1
- ;;
-
- *)
- "${0}" --help
- ;;
- esac
-}
-
-Main "$@"
+Key
+Passphrase
+Encrypt "${@}"
More information about the debian-live-changes
mailing list