Ich habe mir folgendes Script runter geladen um aus Nautilus per mausklick einfach dateien entpacken zu könnnen
Leider bin ich total am verzweifeln, da das entpacken von ace dateien nicht funktionert. Das skript hängt sich einfach auf, ohne rückmeldung, in der logdatei steht garnichts. Unter 'top' steht unace dann an oberster stelle mit 95% Prozessorlast, aber es werden keine dateien entpackt. (Unter 'user' steht mein Benutzername)
Das komische ist, das wenn ich die selbe kommandozeile eingebe, wie sie unter ps aux|grep unace steht, dann wird sofort ohne probleme entpackt. Anscheinend wird das programm vom skript aus doch etwas anders gestartet. Kann sich das vielleicht jemand erklären?
Code: Alles auswählen
#!/bin/bash
# This script tests the file type of the file then extracts
# it with the correct program. If the program supports it,
# it will prompt you for a directory to extract it to.
#
# Distributed under the terms of GNU GPL version 2 or later
#
# Copyright (C) Keith Conger <acid@twcny.rr.com>
#
# Install in your ~/Nautilus/scripts directory.
# You need to be running Nautilus 1.0.3+, gnome-utils, unrar,
# unace, unarj and unzip. The rest should already be installed.
DEFAULT_DIR=~/tmp/
UNRAR_PATH=/usr/local/bin #Path to unrar binary.
UNZIP_PATH=/usr/bin #Path to unzip binary.
UNACE_PATH=/usr/bin #Path to unace binary.
UNARJ_PATH=/usr/bin #Path to unarj binary.
BUNZIP2_PATH=/usr/bin #Path to bzip2 binary.
GUNZIP_PATH=/usr/bin #Path to gunzip binary.
TAR_PATH=/bin #Path to tar binary.
FILES=$(echo -e "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | awk 'BEGIN {FS = "\n" } { printf "%s", $1 }' | sed -e s#\"\"##)
FILE_TYPE=$(file -b "$FILES"|awk '{ print $1}')
MIME_TYPE=$(file -b "$FILES")
DEFAULT_DIR=$(echo "$FILES"|sed -e's/\.\(zip\|rar\|ace\)$//')
if
ext=`echo "$1" | grep [.][aA][cC][eE]$ 2>&1`
[ "$ext" != "" ]
then
FILE_TYPE=ACE
fi
if [ "$FILE_TYPE" = "bzip2" ]; then
TAR_TEST=$(echo "$FILES"|grep .tar.)
if [ $TAR_TEST = "$FILES" ]; then
$BUNZIP2_PATH/bzcat "$FILES"|tar xv >> /tmp/extract-script.log
gdialog --separate-output --title "Extraction Log" --textbox /tmp/extract-script.log 50 70 2>&1
rm /tmp/extract-script.log
else
$BUNZIP2_PATH/bunzip2 -d "$FILES" >> /tmp/extract-script.log
gdialog --separate-output --title "Extraction Log" --textbox /tmp/extract-script.log 50 70 2>&1
rm /tmp/extract-script.log
fi
elif [ "$FILE_TYPE" = "RAR" ]; then
DIR=$(gdialog --title "Extract compressed file to..." --inputbox "Directory to extract to:" 200 400 "$DEFAULT_DIR" 2>&1)
mkdir "$DIR"
$UNRAR_PATH/unrar x -kb "$FILES" "$DIR"/ >> /tmp/extract-script.log
gdialog --separate-output --title "Extraction Log" --textbox /tmp/extract-script.log 50 70 2>&1
rm /tmp/extract-script.log
elif [ "$FILE_TYPE" = "Zip" ]; then
DIR=$(gdialog --title "Extract compressed file to..." --inputbox "Directory to extract to:" 200 400 "$DEFAULT_DIR" 2>&1)
mkdir "$DIR"
$UNZIP_PATH/unzip "$FILES" -d "$DIR"/ >> /tmp/extract-script.log
gdialog --separate-output --title "Extraction Log" --textbox /tmp/extract-script.log 50 70 2>&1
rm /tmp/extract-script.log
elif [ "$FILE_TYPE" = "gzip" ]; then
TAR_TEST=$(echo "$FILES"|grep .tar.)
if [ $TAR_TEST = "$FILES" ]; then
TAR="1"
fi
TAR_TEST=$(echo "$FILES"|grep .tgz)
if [ $TAR_TEST = "$FILES" ]; then
TAR="1"
fi
if [ $TAR = 1 ]; then
$TAR_PATH/tar zxvf "$FILES" >> /tmp/extract-script.log
gdialog --separate-output --title "Extraction Log" --textbox /tmp/extract-script.log 50 70 2>&1
rm /tmp/extract-script.log
else
$GUNZIP_PATH/gunzip "$FILES" >> /tmp/extract-script.log
gdialog --separate-output --title "Extraction Log" --textbox /tmp/extract-script.log 50 70 2>&1
rm /tmp/extract-script.log
fi
elif [ "$FILE_TYPE" = "ARJ" ]; then
$UNARJ_PATH/unarj x "$FILES" >> /tmp/extract-script.log
gdialog --separate-output --title "Extraction Log" --textbox /tmp/extract-script.log 50 70 2>&1
rm /tmp/extract-script.log
elif [ "$FILE_TYPE" = "ACE" ]; then
DIR=$(gdialog --title "Extract compressed file to..." --inputbox "Directory to extract to:" 200 400 "$DEFAULT_DIR" 2>&1)
mkdir "$DIR"
cd "$DIR"
$UNACE_PATH/unace x "$FILES" >> /tmp/extract-script.log
gdialog --separate-output --title "Extraction Log" --textbox /tmp/extract-script.log 50 70 2>&1
rm /tmp/extract-script.log
elif [ "$FILE_TYPE" = "GNU" ]; then
$TAR_PATH/tar xvf "$FILES" >> /tmp/extract-script.log
gdialog --separate-output --title "Extraction Log" --textbox /tmp/extract-script.log 50 70 2>&1
rm /tmp/extract-script.log
else
echo -e "\007"
gdialog --separate-output --title "File error" --msgbox " File $FILES is not a known archive type. File type reported as: $MIME_TYPE " 50 100 2>&1
fi