Commit 2a575339 authored by Klaatu von Schlacker's avatar Klaatu von Schlacker
Browse files

fixed install.sh for os x and other systems lacking a usr local bin and made...

fixed install.sh for os x and other systems lacking a usr local bin and made trash return a cleaner friendlier message
parent 3f86c641
#!/bin/sh
# install the humble but useful trash command
cp ./trash /usr/local/bin/trash
cp ./empty /usr/local/bin/empty
chmod +x /usr/local/bin/trash /usr/local/bin/empty
OS=$(uname)
if [ "X$OS" == "XDarwin" ]
then INSTDIR=/usr/bin
else INSTDIR=/usr/local/bin
fi
cp -f ./trash $INSTDIR/trash
cp -f ./empty $INSTDIR/empty
chmod +x $INSTDIR/trash $INSTDIR/empty
PROCHK=$(cat /etc/profile | sed -n '/alias rm="trash"/p' )
if [ "X$PROCHK" == "X" ]
......@@ -11,7 +17,7 @@ if [ "X$PROCHK" == "X" ]
echo 'alias rm="trash"' >> /etc/profile
source /etc/profile
fi
CHECK=$(ls /usr/local/bin | grep trash)
CHECK=$(ls $INSTDIR | grep trash)
if [ "X$CHECK" == "X" ]
then echo "Install encountered some errors. You might try copying the apps to your home directory (into ~/bin for instance) and use them locally."
else echo "Installation script complete."
......
#!/bin/bash
ARG="$@"
CHECK=$(ls -a ~ | grep .trash)
CHECK=$(ls -a ~ | grep -i .trash)
if [ "X$CHECK" == "X" ]
then mkdir ~/.trash
fi
......@@ -14,7 +14,8 @@ if [ "X$ARG" == "X.trash" ]
if [ "X$ARG" != "X" ]
then
mv "$ARG" ~/.trash/
echo "$ARG moved to Trash. Your Trash is currently $(du -h ~/.trash | cut -f1 | tail -n -1) in size."
RETURN=$(basename $ARG)
echo "$RETURN moved to Trash. Your Trash is currently $(du -h ~/.trash | cut -f1 | tail -n -1) in size."
else
echo "Your trash is currently $(du -h ~/.trash | cut -f1) in size."
fi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment