diff options
author Klaatu2015-06-17 11:17:42 +0200
committer Willy Sudiarto Raharjo2015-06-17 11:17:42 +0200
commit436dd2aa3e0f48b082021a0238270e2688317f2c (patch)
parente7edfef3e9b6430a214c031f1a74053741cef365 (diff)
system/trashy: Added (freedesktop rubbish bin for the shell).
Signed-off-by: Willy Sudiarto Raharjo <>
5 files changed, 241 insertions, 0 deletions
diff --git a/system/trashy/README b/system/trashy/README
new file mode 100644
index 0000000000..7585356597
--- /dev/null
+++ b/system/trashy/README
@@ -0,0 +1,43 @@
+A (mostly) Freedesktop compliant rubbish bin interface for the shell written entirely in BASH.
+Trashy is a simple shell script that introduces the idea of a trash
+can for the command line. Meaning that you can issue this command:
+ $ trash foo bar
+and the files 'foo' and 'bar' will be moved to your system trash.
+ $ trash baz\ quux
+and the file 'baz quux' will be moved to your system trash.
+Simple as that. When you're really really sure that everything in
+your Trash wants to be nuked out of existence, then you can
+issue the command:
+ $ trash --empty
+and your system trash will be emptied.
+System Trash
+Trashy defines a "system trash" on Linux, BSD, and Solaris-based
+operating systems in accordance to the Open Desktop standard:
+On systems that do not use a desktop, trashy simply creates a ~/.trash
+folder (unless you sometimes use a desktop, in which case your
+desktop's tash will be continued to be used).
+On systems that do have a desktop but do not follow the Open Desktop
+standard, trashy tries to conform with what they do use. If all else
+fails, ~/.trash is used.
diff --git a/system/trashy/slack-desc b/system/trashy/slack-desc
new file mode 100644
index 0000000000..8e2dd2cf5f
--- /dev/null
+++ b/system/trashy/slack-desc
@@ -0,0 +1,19 @@
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+ |-----handy-ruler------------------------------------------------------|
+trashy: trashy (freedesktop rubbish bin for the shell)
+trashy: Trashy is a (mostly) freedesktop-compliant rubbish bin for the shell
+trashy: to encourage people to avoid using 'rm' so often.
diff --git a/system/trashy/trashy.8 b/system/trashy/trashy.8
new file mode 100644
index 0000000000..76bc857651
--- /dev/null
+++ b/system/trashy/trashy.8
@@ -0,0 +1,108 @@
+.\" trashy - an rm intermediary
+.TH "trashy" "8" "" "Klaatu" ""
+trashy \- trash in the shell
+\fBtrash\fP file1 file2...
+\fBempty\fP [option]
+There is an unhealthy habit that arises with many a POSIX user: the
+careless and wreckless use of the dreaded \fBrm\fP command. \fBTrashy\fP
+is a helpful intermediary that intervenes when you would otherwise use
+\fBtrashy\fP attempts to be compliant with the Free Desktop specification for
+desktop trash, meaning that you can use \fBtrashy\fP in conjunction
+with a desktop environment and find your files in your desktop trash
+just as if you had dragged and dropped them there yourself. You can
+also restore the files by right-clicking and selecting `restore`, or
+whatever method your desktop defines for that process.
+Issue this command:
+\fBtrash\fP foo
+and foo will be moved to the system trash.
+At this point, you have not yet removed the file from your system, so
+if you wish to recover it, go and fetch it from your trash. There, now
+isn't that nicer than \fBrm\fP?
+When you're really really sure that everything in
+your Trash wants to be nuked out of existance, then you can
+issue the command:
+trask --empty
+and your Trash will be emptied.
+If there are spaces in your filenames, first of all stop using spaces
+in your filenames. Secondly, you must escape the space when you trash
+\fBtrash\fP foo\\ bar
+If you issue \fBtrash\fP without any arguments, it tells you the
+current size of your system trash.
+.B -l, --list
+Lists the contents of your trash can.
+.B -v, --verbose
+Makes \fBtrashy\fP verbose.
+.B -w, --version, --which
+Returns the version of trashy you are currently running. -w because -v
+was already taken by verbose :-)
+.B -d, --dry-run, --dryrun
+Does not actually move or remove files, just shows what will happen if
+you really did. The --empty process is verbose by default.
+On Linux, BSD, Ilumos, and Solaris, the system trash, by default, is
+that defined by the Free Desktop specification: ~/.local/share/Trash
+If you do not use an environment that plays nice with the Free Desktop
+spec (ie, Mac OS) then trashy will attempt to detect and use
+your actual system trash.
+If all else fails, a ~/.trash directory is created and used.
+Things can get a little messy when you're trashing files from an
+external drive because \fBtrash\fP currently moves the file from your external
+drive to your system harddrive. It works, but it's not as graceful as,
+say, creating a .trash folder on that external drive and hiding stuff
+there until later.
+\fBTrashy\fP depends on BASH. There is a similar application called
+trash-cli, which is Python-based. At this point, they do mostly the
+same thing, but obviously if you do not run BASH or ZSH or similar,
+then you might prefer a Python-based solution.
+.I rm (1)
+.I mv (1)
+Klaatu (
+Email bugs reports or fixes to
diff --git a/system/trashy/trashy.SlackBuild b/system/trashy/trashy.SlackBuild
new file mode 100644
index 0000000000..d60a292c55
--- /dev/null
+++ b/system/trashy/trashy.SlackBuild
@@ -0,0 +1,61 @@
+# Slackware build script for trashy
+# Copyright 2014 Klaatu
+# GNU All-Permissive License
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved. This file is offered as-is,
+# without any warranty.
+set -e
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+tar xvf $CWD/archive.tar.bz2 || tar xvf $CWD/archive.tar.bz2?ref={master,1.0}
+cd $PRGNAM.git
+chown -R root:root .
+find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+#make install
+mkdir -p $PKG/usr/bin
+cp $PRGNAM $PKG/usr/bin/$PRGNAM
+ cd $PKG/usr/bin
+ ln -s $PRGNAM trash
+mkdir -p $PKG/usr/man/man8/
+cp $CWD/$PRGNAM.8 $PKG/usr/man/man8/$PRGNAM.8
+gzip $PKG/usr/man/man8/$PRGNAM.8
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
diff --git a/system/trashy/ b/system/trashy/
new file mode 100644
index 0000000000..3ddddfd227
--- /dev/null
+++ b/system/trashy/
@@ -0,0 +1,10 @@