Commit 7717af42 authored by notklaatu's avatar notklaatu

autotools

parent c13acda7
Klaatu <klaatu@member.fsf.org>
* Mon Jul 22 2019 Klaatu <klaatu@fedorapeople.org> - 2.4-1
- Moved to Autotools
Install
=======
# Install trashy
There are several ways to install trashy:
## Autotools
Generic
-------
If you downloaded an official release of trashy, then on most POSIX systems, you can do this:
On just about any POSIX system, run the install script included with
the trashy source code.
```
$ ./configure
$ make
$ sudo make install
```
$ sudo ./install.sh
If you have obtained the source code for trashy from its Git repository, then you have to generate the Autotools files first:
```
$ autoreconf --install
$ automake
$ ./configure
$ make
$ sudo make install
```
Manual
------
### Packagers
If that fails, the really simple and dirty method is to copy the
trashy script into your PATH, such as ~/bin or /usr/local/bin, or
whatever you have available to you.
If you are packaging trashy for distribution, you probably want to do this:
```
$ make dist
```
Slackware
---------
That generates a tar.gz of only the necessary files for building and installing.
You can use that tarball to create a package for your distribution or port tree.
On Slackware Linux, run the SlackBuild script included with the trashy
source code.
$ su -
# ./trashy.SlackBuild
## Generic
A generic install script is provided, but it requires some adaptation.
You must define the VERSION and BASKET variables in the script (GNU Autotools usually does that), and you must gather ``trashy``,``trashy.8``,and ``install.sh`` in the same directory for it to be able to run to completion.
RPM
---
## Manual
If that fails, you can manually install.
You must define the VERSION and BASKET variables in the script (GNU Autotools usually does that).
Then just copy the ``trashy`` script into your PATH, such as ``~/bin`` or ``/usr/local/bin``, or whatever you have available to you.
## Slackware
On Slackware Linux, use the SlackBuild script included with the trashy source code.
```
$ su -
# ./trashy.SlackBuild
```
## RPM
If you use a distribution that uses RPMs, a package may be available
at http://klaatu.fedorapeople.org/trashy
Manual RPM
----------
### Manual RPM
If not, build an RPM from the trashy.spec file included with the
trashy source code. First, install the toolchain:
# dnf install rpmdevtools
```
# dnf install rpmdevtools
```
Set up the RPM environment:
$ pmdev-setuptree
```
$ pmdev-setuptree
```
Copy the SPEC file into your tree:
$ cp path/to/trashy.spec ~/rpmbuild/SPECS
```
$ cp path/to/trashy.spec ~/rpmbuild/SPECS
```
Place the source into your tree:
Create a distribution package (.tar.gz) using ``make dist`` and then place that into your tree:
$ cp path/to/trashy-source.tar.bz2 ~/rpmbuild/SOURCES
```
$ cp path/to/trashy-x.y.z.tar.gz ~/rpmbuild/SOURCES
```
Build:
$ rpmbuild -ba ~/rpmbuild/SPECS/trashy.spec
```
$ rpmbuild -ba ~/rpmbuild/SPECS/trashy.spec
```
Install:
$ sudo dnf install ~/rpmbuild/RPMS/noarch/trash*rpm
```
$ sudo dnf install ~/rpmbuild/RPMS/noarch/trash*rpm
```
If you need help, don't hesitate to contact Klaatu at member.fsf.org
or in irc.freenode.net (message 'notklaatu').
......
AUTOMAKE_OPTIONS = foreign subdir-objects
dist_bin_SCRIPTS = bin/trashy
dist_man_MANS = man/trashy.8
EXTRA_DIST = slackware/trashy.info slackware/doinst.sh slackware/slack-desc slackware/trashy.SlackBuild slackware/trashy.spec
all-am: trashy
trashy: bin/trashy
if DARWIN
@sed -i "s|__BASKETVAR__|~/.Trash|" bin/$@
else
@sed -i "s|__BASKETVAR__|~/.local/share/Trash|" bin/$@
endif
@sed -i "s|__VERNUMVAR__|@PACKAGE_VERSION@|" bin/$@
nuke:
@rm config.status configure config.log
@rm Makefile
@rm -r autom4te.cache/
@rm aclocal.m4
@rm compile install-sh missing Makefile.in
ChangeLog
\ No newline at end of file
README.md
\ No newline at end of file
Trashy
======
# Trashy
Get trashy!: A **mostly** Freedesktop-compliant rubbish bin interface for the shell, written entirely in BASH.
Get trashy! A **mostly** Freedesktop-compliant rubbish bin interface for the shell, written entirely in Bash.
The sane `rm` intermediary
-----------------
## The sane `rm` intermediary
Hi! If you're looking at [**trashy**](http://slackermedia.info/trashy) right now, you've probably just accidentally rm'd a superImportantFile by accident. You're cursing God, UNIX, GNU, computers, and yourself. While there's no hope for your already deleted file — that's gone, sorry—with `trashy`, you'll never have to go through that ever again!
If you're looking at [**trashy**](http://slackermedia.info/trashy) right now, you've probably just accidentally rm'd a superImportantFile by accident.
You're cursing God, UNIX, GNU, computers, and yourself.
There's [little](https://www.redhat.com/sysadmin/find-lost-files-scalpel) [hope](https://www.redhat.com/sysadmin/recover-partition-files-testdisk) for your already deleted file, with ``trashy``, you'll never have to go through that ever again!
`Trashy` is a simple shell script that enables you to restore superImportantFile simply and painlessly. Just type:
``Trashy`` is a simple shell script that enables you to restore superImportantFile simply and painlessly. Just type:
trash --restore foo
```
trash --restore foo
```
and 'foo' is put back where it belongs.
`Trashy` also serves as a trashcan for the command line. Issue this command:
``Trashy`` also serves as a trashcan for the command line. Issue this command:
trash foo bar
```
trash foo bar
```
and `trashy` will move the files 'foo' and 'bar' to your system trash. Or type:
and ``trashy`` moves the files 'foo' and 'bar' to your system trash. Or type:
trash foo\ bar
```
trash foo\ bar
```
to move the file 'foo bar' to your system trash.
When you're really, *really* sure that you want to nuke everything in your trash out of existence, issue the command:
trash --empty
```
trash --empty
```
and `trashy` will empty your system trash.
and ``trashy`` empties your system trash.
Why trashy?
-----------------
## Why trashy?
The `rm` command doesn't account for human error. Even if you like your UNIX to be
responsive and obedient, you'll still make mistakes. Trashy offers a buffer between you and deleted-file disasters.
The ``rm`` command doesn't account for human error.
Even if you like your UNIX to be responsive and obedient, you'll still make mistakes.
Trashy offers a buffer between you and deleted-file disasters.
`Trashy` is BASHy, meaning that it's very portable; anything
that can run BASH can run it. You can easily install it on GNU Linux, freeBSD, and netBSD. It's also been
tested on Solaris and Open Solaris families, and even Mac (obviously
not Freedesktop-compliant, so features are missing) OS.
``Trashy`` is Bashy, meaning that it's very portable; anything that can run BASH can run it.
You can easily install it on GNU Linux, freeBSD, and netBSD.
It's also been tested on Solaris and Open Solaris families, and even macOS (obviously not Freedesktop-compliant, so features are missing).
Projects similar to `trashy` do exist. One, [trash-cli](https://github.com/andreafrancia/trash-cli), uses Python and offers some
really neat and fancy features. Check it out if you're on a Linux box,
or if you don't mind a bit of set-up on non-Free Desktop UNIX systems.
Projects similar to ``trashy`` do exist.
One, [trash-cli](https://github.com/andreafrancia/trash-cli), uses Python and offers some really neat and fancy features.
Check it out if you're on a Linux box, or if you don't mind a bit of set-up on non-Free Desktop UNIX systems.
System Trash
---------------
## System Trash
`Trashy` defines a *system trash* on Linux, BSD, and Solaris-based
operating systems in accordance to the Open Desktop standard:
``Trashy`` defines a *system trash* on Linux, BSD, and Solaris-based operating systems in accordance to the Open Desktop standard:
~/.local/share/Trash
```
~/.local/share/Trash
```
Because `trashy` leverages the Open Desktop standard, you can use it
alongside the usual Trash. Files you add to your trash with `trashy` go
to the same place as files you add to your trash via drag-and-drop on your desktop.
Because ``trashy`` uses the Open Desktop standard, you can use it alongside the usual desktop Trash.
Files you add to your trash with ``trashy`` go to the same place as files you drag-and-drop to the Trash on your desktop.
On systems that do not not to follow the Open Desktop standard or that use a graphical desktop, `trashy` tries to conform with what
is available. If all else fails, it uses ``$HOME/.trash``.
On systems that do not not to follow the Open Desktop standard or that do not use a graphical desktop, ``trashy`` tries to conform with what is available.
If all else fails, it uses ``$HOME/.Trash``.
Aliases
-----------
## Aliases
Many of us had `rm` beat into our heads early on, so getting out of
the habit of using it is actually really hard. If you find yourself
using `rm` in spite of `trashy`, you can `alias rm='trashy'` in
your `.bashrc` file. This works quite well. And if you ever
want to override your alias, just use:
Many of us had ``rm`` beat into our heads early on, so getting out of the habit of using it is actually really hard.
If you find yourself using ``rm`` in spite of ``trashy``, you can ``alias rm='trashy'`` in your ``.bashrc`` file.
This works quite well. And if you ever want to override your alias, just use:
\rm foo
```
\rm foo
```
or
/bin/rm foo
```
/bin/rm foo
```
Simple as that.
Until you get used to typing 'trash' instead of 'rm' when you want to delete a file, the
alias helps.
Until you get used to typing ``trash`` instead of ``rm`` when you want to delete a file, the alias helps.
Removing the Alias
--------------------
### Removing the Alias
Once you've gotten used to using `rm` to permanently delete something,
and using `trashy` to move to a trash bin, delete the alias from your `.bashrc` file.
Once you've gotten used to using ``rm`` to permanently delete something, and using ``trashy`` to move to a trash bin, delete the alias from your ``.bashrc`` file.
Bugs
-----
`Trashy` has improved substantially since its original implementation, but surely new bugs will emerge under the right testing circumstances. Give it a
go and if you find one, please report it. I can't promise I'll fix bugs
immediately, but they'll definitely make my list.
## Bugs
What's Next: Features
----------------------
Bugs are sure to emerge under the right testing circumstances.
Give it a go and if you find one, please report it. I can't promise I'll fix bugs immediately, but they'll definitely make my list.
Otherwise, feel free to fix a bug and send me a patch, or a merge request on Gitlab.
The top-priority plan is to provide better handling of files not in one's home folder—that is, do not copy file to local
filesystem to "trash" it, but use a hidden .trash dir on the remote file
system (or at least provide this option).
## What's Next: Features
Contact
--------
Please email klaatu at the domain of member dot fsf dot org.
The top-priority plan is to provide better handling of files not in one's home folder — that is, do not copy file to local file system to "trash" it, but use a hidden .trash dir on the remote file system (or at least provide this option).
## Contact
You can email klaatu at the domain of member dot fsf dot org.
#!/usr/bin/env bash
VERSION=2.2
VERSION=__VERNUMVAR__
# trash - the command line trashcan
#
# Copyright (C) 2011-17 Klaatu la Terible
......@@ -18,13 +18,15 @@ VERSION=2.2
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# find the system trash
case "$(uname | tr [:upper:] [:lower:] )" in
linux|bsd|sun) BASKET=~/.local/share/Trash ;;
darwin) BASKET=~/.Trash ;; # TODO check when around a mac
*) BASKET=~/.trash ;;
esac
# find the system trash without Autotools
#case "$(uname | tr [:upper:] [:lower:] )" in
# linux|bsd|sun) BASKET=~/.local/share/Trash ;;
# darwin) BASKET=~/.Trash ;; # TODO check when around a mac
# *) BASKET=~/.trash ;;
#esac
# this is set by ./configure && make
BASKET=__BASKETVAR__
test -d $BASKET/info || mkdir -m 700 -p $BASKET/info 2> /dev/null
test -d $BASKET/files || mkdir -m 700 -p $BASKET/files 2> /dev/null
......
AC_INIT([trashy], [2.4.0], [klaatu@member.fsf.org])
AM_INIT_AUTOMAKE
AC_PROG_CC
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
AM_CONDITIONAL([DARWIN], [test $(uname -s) == "Darwin"])
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