Skip to content

Commit

Permalink
Change to system-wide install rather than per user
Browse files Browse the repository at this point in the history
This is to prepare for creation of an AUR package.
  • Loading branch information
bulletmark committed Aug 21, 2016
1 parent 111042c commit f36e4dd
Show file tree
Hide file tree
Showing 7 changed files with 120 additions and 119 deletions.
6 changes: 3 additions & 3 deletions Makefile
Expand Up @@ -17,13 +17,13 @@ DOC = README.md
DOCOUT = $(DOC:.md=.html)

all:
@echo "Type make install or uninstall"
@echo "Type sudo make install|uninstall"

install:
@./install.sh
@./encfsui-setup -d "$(DESTDIR)" install

uninstall:
@./install.sh -r
@./encfsui-setup -d "$(DESTDIR)" uninstall

doc: $(DOCOUT)

Expand Down
63 changes: 30 additions & 33 deletions README.md
Expand Up @@ -21,48 +21,35 @@ click access to a single encrypted personal directory. I do not want my
passphrase cached anywhere, and I want an single click way to close off
access.

A sample desktop launcher file (`encfsui.desktop`) is included.

Home: <http://github.com/bulletmark/encfsui>
Home: <http://github.com/bulletmark/encfsui>
Author: Mark Blakeney, <markb@berlios.de>

### PREREQUISITES

Requires bash + encfs + zenity + xdg-open. For ubuntu, xdg-open is part
of xdg-utils and is installed by default. E.g. for ubuntu, you can
install [encfs](http://www.arg0.net/encfs) and
[zenity](http://live.gnome.org/Zenity) with the following command:

sudo apt-get install encfs zenity

*Note zenity seems installed by default now in Ubuntu 12.04.*

### INSTALLATION

Unpack this archive, or git pull a copy of the sources.

To install for your own personal use, type:

make install

which copies encfsui to `$HOME/bin/` and encfsui.desktop to
`$HOME/.local/share/applications/`.

Alternately, to install in a system area for all users type:
NOTE: Arch users can just install [_encfsui from the
AUR_](https://aur.archlinux.org/packages/encfsui/) and skip to the next
section. Other users can install the following:

# Install encfs zenity xdg-utils
git clone http://github.com/bulletmark/arch-upgrade
cd arch-upgrade
sudo make install

which copies encfsui to `/usr/bin/` and encfsui.desktop to
`/usr/share/applications/`.
### USAGE

The installation procedure creates a desktop application _encfsui_ which
you can run from your DE. By default, _encfsui_ mounts your encrypted
`~/.Private` dir to unencrypted `~/Private` with an in-activity timeout
of 60 minutes. So you should first create an
[encfs](http://www.arg0.net/encfs) `~/.Private` directory.
See `man encfs` for details on how to do this.

On Ubuntu Unity or Gnome Shell, you can search for encfsui in your
applications list to start it, or drag add it to your Unity or Gnome
Shell launcher for convenience. Of course you can create multiple encfs
source + target directories, each with corresponding desktop
launchers, if you want to specify their commands with different source
and target dirs in the command line as described next.
You can also copy the
`/usr/share/applications/encfsui.desktop` launcher to your own Desktop
Launcher in `~/.local/share/applications/` (with a custom name) to
use different directory names or timeout etc.

### USAGE
The utility can also be run from the command line. The usage is:

encfsui [-options] source_enc_dir target_mount_dir

Expand All @@ -74,6 +61,16 @@ and target dirs in the command line as described next.
-p (make public mount, can only be done by root)
-o (don't open target dir in gui mode)

### CLEANUP OF OLD CONFIGURATION

Note that _encfsui_ now installs system-wide but old versions installed
as local user files so to ensure that any old user configuration is
removed type the following as your normal user (i.e. not sudo/root).

encfsui-setup clean

You can type this any time so no harm is done running it to make sure.

### LICENSE

Copyright (C) 2012 Mark Blakeney. This program is distributed under the
Expand Down
2 changes: 1 addition & 1 deletion encfsui
Expand Up @@ -104,7 +104,7 @@ if ! encfsctl "$src" &>/dev/null; then
if ! xterm -fa monospace -fs 10 -T "$TITLE" \
-e "encfs $PUBLIC $MINS \"$src\" \"$tgt\"" &>/dev/null; then
zenity $CLS --title "$TITLE" --error --text \
"$src is not an encfs filesystem.\n\nCreate it manually with encfs."
"$src does not exist or is not an encfs filesystem.\n\nCreate it manually with encfs."
exit 1
fi

Expand Down
84 changes: 84 additions & 0 deletions encfsui-setup
@@ -0,0 +1,84 @@
#!/bin/bash
# User setup script.
# (C) Mark Blakeney, markb@berlios.de, Aug 2016.

PROG="$(basename $0)"
NAME=${PROG%-*}

BINDIR="/usr/bin"
APPDIR="/usr/share/applications"
ICOBAS="/usr/share/icons/hicolor"
ICODIR="$ICOBAS/128x128/apps"
DOCDIR="/usr/share/doc/$NAME"

usage() {
echo "Usage:"
echo "As root: sudo $PROG install|uninstall"
echo "As user: $PROG clean"
echo
echo "(-d option sets DESTDIR for install/uninstall)"
exit 1
}

# Process command line options
DESTDIR=""
while getopts d: c; do
case $c in
d) DESTDIR="$OPTARG";;
\?) usage;;
esac
done

shift $((OPTIND - 1))

if [ $# -ne 1 ]; then
usage
fi

cmd="$1"

if [ $cmd = "install" -o $cmd = "uninstall" ]; then
DESTDIR=$(echo "$DESTDIR" | sed 's:/*$::')
if [ -z "$DESTDIR" -a "$(id -un)" != "root" ]; then
echo "Install or uninstall must be run as sudo/root."
exit 1
fi

if [ $cmd = "install" ]; then
install -CDv -m 755 -t $DESTDIR$BINDIR $NAME-setup
install -CDv -m 755 -t $DESTDIR$BINDIR $NAME
install -CDv -m 644 -t $DESTDIR$APPDIR $NAME.desktop
install -CDv -m 644 -t $DESTDIR$ICODIR $NAME.png
install -CDv -m 644 -t $DESTDIR$DOCDIR README.md
else
rm -rfv $DESTDIR$BINDIR/$NAME
rm -rfv $DESTDIR$APPDIR/$NAME.desktop
rm -rfv $DESTDIR$ICODIR/$NAME.png
rm -rfv $DESTDIR$DOCDIR
rm -rfv $DESTDIR$BINDIR/$NAME-setup
fi

if [ -z "$DESTDIR" ]; then
if [ -x /usr/bin/gtk-update-icon-cache ]; then
/usr/bin/gtk-update-icon-cache $ICOBAS
fi
if [ -x /usr/bin/update-desktop-database ]; then
/usr/bin/update-desktop-database -q
fi
fi
elif [ $cmd = "clean" ]; then
if [ "$(id -un)" = "root" ]; then
echo "This command must be run as your own user."
exit 1
fi

# Remove any old configuration from earlier versions of program
rm -fv ~/bin/$NAME
rm -fv ~/.local/bin/$NAME
rm -fv ~/.local/share/applications/$NAME.desktop
rm -fv ~/.local/share/icons/$NAME.png
else
usage
fi

exit 0
4 changes: 2 additions & 2 deletions encfsui.desktop
Expand Up @@ -2,7 +2,7 @@
Type=Application
Terminal=false
Name=Encfsui
Icon=/usr/share/seahorse/icons/hicolor/48x48/apps/seahorse-key-personal.png
Exec=encfsui -i60 .Private Private
Exec=/usr/bin/encfsui -i60 .Private Private
Icon=encfsui
Categories=Security;Settings;
StartupWMClass=EncFSUI
Binary file added encfsui.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
80 changes: 0 additions & 80 deletions install.sh

This file was deleted.

0 comments on commit f36e4dd

Please sign in to comment.