#!/bin/bash #dstuff - a script to decrypt files produced by estuff or estuffdir #Copyright (C) 2005 Daniel Brewer #This program is free software; you can redistribute it and/or #modify it under the terms of the GNU General Public License #as published by the Free Software Foundation; either version 2 #of the License, or (at your option) any later version. #This program is distributed in the hope that it will be useful, #but WITHOUT ANY WARRANTY; without even the implied warranty of #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #GNU General Public License for more details. #http://www.gnu.org/copyleft/gpl.html if [ $# -eq 0 ] then echo "$0 : You must supply at least one tarred encrypted file" exit 1 fi for file in "$@" do arg="`echo $file | sed 's/\..*//'`" if [ $arg == $file ] then arg="$arg""_dir" fi echo "Outputting contents of $file to directory \"$arg\"" gpg --decrypt $file > $arg.out if [ $? -ne 0 ] then echo "$file is not an encypted gpg file ... skipping" continue fi mkdir $arg cd $arg mv ../$arg.out . tar xf $arg.out if [ `ls | wc -l` -eq 1 ] then echo "$file was not tarred. Ouput file $arg.out" mv $arg.out ../ cd .. rm -rf $arg else rm $arg.out cd .. fi done exit $?