From 436dd2aa3e0f48b082021a0238270e2688317f2c Mon Sep 17 00:00:00 2001 From: Klaatu Date: Wed, 17 Jun 2015 16:17:42 +0700 Subject: system/trashy: Added (freedesktop rubbish bin for the shell). Signed-off-by: Willy Sudiarto Raharjo --- system/trashy/README | 43 ++++++++++++++++ system/trashy/slack-desc | 19 +++++++ system/trashy/trashy.8 | 108 ++++++++++++++++++++++++++++++++++++++++ system/trashy/trashy.SlackBuild | 61 +++++++++++++++++++++++ system/trashy/trashy.info | 10 ++++ 5 files changed, 241 insertions(+) create mode 100644 system/trashy/README create mode 100644 system/trashy/slack-desc create mode 100644 system/trashy/trashy.8 create mode 100644 system/trashy/trashy.SlackBuild create mode 100644 system/trashy/trashy.info diff --git a/system/trashy/README b/system/trashy/README new file mode 100644 index 000000000000..758535659727 --- /dev/null +++ b/system/trashy/README @@ -0,0 +1,43 @@ +A (mostly) Freedesktop compliant rubbish bin interface for the shell written entirely in BASH. + +http://slackermedia.info/trashy + +Usage +------- + +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. + +or... + + $ 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: +~/.local/share/Trash + +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 000000000000..8e2dd2cf5fec --- /dev/null +++ b/system/trashy/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# 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: Trashy is a (mostly) freedesktop-compliant rubbish bin for the shell +trashy: to encourage people to avoid using 'rm' so often. +trashy: +trashy: http://slackermedia.info/trashy +trashy: +trashy: +trashy: +trashy: +trashy: diff --git a/system/trashy/trashy.8 b/system/trashy/trashy.8 new file mode 100644 index 000000000000..76bc857651d5 --- /dev/null +++ b/system/trashy/trashy.8 @@ -0,0 +1,108 @@ +.\" trashy - an rm intermediary +.TH "trashy" "8" "" "Klaatu" "" +.SH "NAME" +trashy \- trash in the shell +.SH "SYNOPSIS" +\fBtrash\fP file1 file2... +.nf +\fBempty\fP [option] +.SH "DESCRIPTION" +.PP +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 +\fBrm\fP. +.PP +\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. +.PP +.SH "USAGE" +.TP +Issue this command: +.PP +\fBtrash\fP foo +.PP +and foo will be moved to the system trash. +.PP +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? +.PP +When you're really really sure that everything in +your Trash wants to be nuked out of existance, then you can +issue the command: +.PP +trask --empty +.PP +and your Trash will be emptied. +.PP +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 +it: +.PP +\fBtrash\fP foo\\ bar +.PP +If you issue \fBtrash\fP without any arguments, it tells you the +current size of your system trash. +.SH OPTIONS +.PP +.TP +.B -l, --list +Lists the contents of your trash can. +.TP +.B -v, --verbose +Makes \fBtrashy\fP verbose. +.TP +.B -w, --version, --which +Returns the version of trashy you are currently running. -w because -v +was already taken by verbose :-) +.TP +.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. +.PP +.SH "SYSTEM TRASH LOCATIONS" +.PP +On Linux, BSD, Ilumos, and Solaris, the system trash, by default, is +that defined by the Free Desktop specification: ~/.local/share/Trash +.PP +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. +.PP +If all else fails, a ~/.trash directory is created and used. +.PP +.SH "BUGS AND ISSUES" +.PP +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. +.PP +.SH "ALTERNATIVES" +.PP +\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. +.SH "SEE ALSO" +.nf +.I rm (1) +.I mv (1) +.URL http://slackermedia.info/trashy +.URL https://github.com/andreafrancia/trash-cli +.fi +.PP +.SH "AUTHORS" +.nf +Klaatu (klaatu@member.fsf.org) +.fi +.PP +.SH "BUGS" +Email bugs reports or fixes to klaatu@member.fsf.org +.fi diff --git a/system/trashy/trashy.SlackBuild b/system/trashy/trashy.SlackBuild new file mode 100644 index 000000000000..d60a292c552a --- /dev/null +++ b/system/trashy/trashy.SlackBuild @@ -0,0 +1,61 @@ +#!/bin/sh + +# Slackware build script for trashy +# Copyright 2014 Klaatu @member.fsf.org + +# 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. + +PRGNAM=trashy +VERSION=${VERSION:-1.0} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +ARCH=noarch + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +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 +) + +#man +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 +cp -a $CWD/README $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/trashy.info b/system/trashy/trashy.info new file mode 100644 index 000000000000..3ddddfd227fe --- /dev/null +++ b/system/trashy/trashy.info @@ -0,0 +1,10 @@ +PRGNAM="trashy" +VERSION="1.0" +HOMEPAGE="http://slackermedia.info/trashy" +DOWNLOAD="https://gitlab.com/trashy/trashy/repository/archive.tar.bz2" +MD5SUM="6a66b885a6c0fb11099d716441474ab4" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="Klaatu" +EMAIL="klaatu@member.fsf.org" -- cgit v1.2.3