fix new battery plugin to work better with multiple batteries present
[wmiirc-lua.git] / src / install-wmiirc-lua.in
blob871063c71a0e87c49332e461200af56f5c4e22be
1 #!/bin/sh
2 # Copyright (c) 2007, Bart Trojanowski <bart@jukie.net>
4 # This script installs wmiirc-lua files into $HOME/.wmii-lua
6 set -e
8 prog=$(basename $0)
10 SRC_DIR="%RC_DIR%"
11 DST_DIR=$(eval echo "%HOME_WMII%")
13 SRC_WMIIRC="${SRC_DIR}/wmiirc.lua"
14 DST_WMIIRC="${DST_DIR}/wmiirc"
16 INSTALL="install"
17 FORCE=
19 do_install () {
20 echo >&2 "Installing in $DST_DIR"
22 ${INSTALL} -m 755 -d "${DST_DIR}"
23 ${INSTALL} -m 744 -T "${SRC_WMIIRC}" "${DST_WMIIRC}"
25 echo >&2 "DONE"
26 exit 0
29 while test -n "$1" ; do
30 cmd=$1 ; shift
31 case $cmd in
32 --force)
33 FORCE=true
35 --backup)
36 FORCE=true
37 INSTALL="$INSTALL -b"
40 echo >&2 "Invalid option $cmd"
41 exit 1
43 esac
44 done
46 if test -z "$FORCE" ; then
48 if ! test -f "${SRC_WMIIRC}" ; then
49 echo >&2 "System wide files for wmiirc-lua not installed."
50 exit 1
53 if test -f "${DST_WMIIRC}" ; then
54 echo >&2 "You already have files installed in ${DST_WMIIRC}."
55 echo >&2 ""
56 echo >&2 "Please select one of the following options and rerun this script:"
57 echo >&2 ""
58 echo >&2 " $prog --force - overwrite existing files"
59 echo >&2 " $prog --backup - backup existing files"
60 exit 1
65 do_install
66 # vim: set et sw=8 ts=8 :