Koha/debian/rules
Tomas Cohen Arazi fd0e8ff0ad Bug 10003: bash-completion for koha-list and other scripts
This patch implements bash-completion for the following commands:

 - koha-list
 - koha-enable
 - koha-disable
 - koha-email-enable
 - koha-email-disable
 - koha-enable-sip
 - koha-start-sip
 - koha-restart-sip
 - koha-stop-sip
 - koha-start-zebra
 - koha-stop-zebra
 - koha-restart-zebra

It is implemented in a way that it removes already used or mutually
exclusive parameters (instance names, option switches).
I already have written completion for other (more complex) commands,
but I belive a simpler patch is better to start with.

IMPORTANT: this patch relies on having the koha-list command available
in the path.

To test:
 - Make sure you have bash-completion installed and enabled (IRC might
   help us if you encounter problems).
 - Apply the patch.
Option 1:
 - Pick the debian/koha-common.bash-completion file and do
   $ cp debian/koha-common.bash-completion /etc/bash_completion.d/koha-common
 - Open a new bash shell (I do it opening a new terminal on my Ubuntu box).
 - Type one of the listed commands...
  And repeatedly press <TAB>.
 - Enjoy, and signoff if you belive it is usable. Otherwise report back.
Option 2:
 - run:
   $ . debian/koha-common.bash-completion
 - Type one of the listed commands...
  And repeatedly press <TAB>.
 - Enjoy, and signoff if you belive it is usable. Otherwise report back.

Tests:
- Some koha-list option switches are mutually exclusive, -h should be
  available in any context
- koha-enable should only autocomplete disabled instances
- koha-disable should only autocomplete enabled instances
- koha-email-enable should only autocomplete email-disabled instances
- koha-email-disable should only autocomplete email-enabled instances
- koha-*-zebra scripts should only autocomplete enabled instances.
- koha-*-sip scripts should only autocomplete sip-enabled instances.

Regards
To+

Note: writing bash-completion routines is a bit hacky, I tried to make
it the simplest way I could. Your comments are welcome.

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Dobrica Pavlinusic <dpavlin@rot13.org>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-05 16:03:00 +00:00

109 lines
5.8 KiB
Makefile
Executable file

#!/usr/bin/make -f
TMP = $(CURDIR)/debian/tmp
# Make "perl Makefile.PL" be non-interactive.
export PERL_MM_USE_DEFAULT=1
%:
dh $@ --fail-missing --with bash-completion
override_dh_gencontrol:
debian/bd-to-depends >> debian/koha-common.substvars
dh_gencontrol
override_dh_auto_install:
dh_auto_install
rm $(TMP)/etc/koha/README.txt
rm $(TMP)/etc/koha/SIPconfig.xml
rm -r $(TMP)/usr/share/koha/doc
rm -r $(TMP)/var/run
rm -r $(TMP)/var/lock
rm $(TMP)/var/log/koha/README
rm $(TMP)/etc/koha/searchengine/solr/config.yaml
rm $(TMP)/etc/koha/searchengine/solr/indexes.yaml
rm $(TMP)/etc/koha/solr/indexes.yaml
rm -r \
$(TMP)/usr/share/koha/intranet/htdocs/intranet-tmpl/lib/tiny_mce
ln -s /usr/share/tinymce/www \
$(TMP)/usr/share/koha/intranet/htdocs/intranet-tmpl/lib/tiny_mce
rm -r \
$(TMP)/usr/share/koha/intranet/htdocs/intranet-tmpl/prog/en/lib/yui
ln -s /usr/share/javascript/yui \
$(TMP)/usr/share/koha/intranet/htdocs/intranet-tmpl/prog/en/lib/yui
rm -r \
$(TMP)/usr/share/koha/opac/htdocs/opac-tmpl/lib/yui
ln -s /usr/share/javascript/yui \
$(TMP)/usr/share/koha/opac/htdocs/opac-tmpl/lib/yui
install -d $(TMP)/etc/apache2/sites-available
install -d $(TMP)/etc/apache2/sites-enabled
install -d $(TMP)/etc/apache2/conf.d
ln -s ../../koha/koha-httpd.conf $(TMP)/etc/apache2/sites-available/koha
ln -s ../sites-available/koha $(TMP)/etc/apache2/sites-enabled/koha
install -m 0644 debian/koha.apache-ports $(TMP)/etc/apache2/conf.d/koha
sed -i '/^<VirtualHost 127.0.1.1:/s//<VirtualHost *:/' \
$(TMP)/etc/koha/koha-httpd.conf
mv $(TMP)/etc/koha/koha-conf.xml $(TMP)/usr/share/koha/koha-conf.xml.in
sed -i $(TMP)/usr/share/koha/koha-conf.xml.in \
-e '/^ <user>/s/>.*</>_DBC_DBUSER_</' \
-e '/^ <pass>/s/>.*</>_DBC_DBPASS_</'
install -m 0644 koha-tmpl/opac-tmpl/lib/yui/skin.css \
koha-tmpl/opac-tmpl/lib/yui/reset-fonts-grids.css \
$(TMP)/usr/share/koha/intranet/htdocs/intranet-tmpl/prog/en/css
install -m 0644 koha-tmpl/opac-tmpl/lib/yui/skin.css \
koha-tmpl/opac-tmpl/lib/yui/reset-fonts-grids.css \
$(TMP)/usr/share/koha/opac/htdocs/opac-tmpl/prog/en/css
install -m 0644 koha-tmpl/opac-tmpl/lib/yui/skin.css \
koha-tmpl/opac-tmpl/lib/yui/reset-fonts-grids.css \
$(TMP)/usr/share/koha/opac/htdocs/opac-tmpl/ccsr/en/css
install -m 0644 koha-tmpl/intranet-tmpl/prog/en/lib/yui/menu-button-arrow-disabled.png \
$(TMP)/usr/share/koha/opac/htdocs/opac-tmpl/prog/en/css
install -m 0644 koha-tmpl/intranet-tmpl/prog/en/lib/yui/menu-button-arrow-disabled.png \
$(TMP)/usr/share/koha/intranet/htdocs/intranet-tmpl/prog/en/css
install -m 0644 koha-tmpl/intranet-tmpl/prog/en/lib/yui/menu-button-arrow.png \
$(TMP)/usr/share/koha/opac/htdocs/opac-tmpl/prog/en/css
install -m 0644 koha-tmpl/intranet-tmpl/prog/en/lib/yui/menu-button-arrow.png \
$(TMP)/usr/share/koha/intranet/htdocs/intranet-tmpl/prog/en/css
install -m 0644 koha-tmpl/intranet-tmpl/prog/en/lib/yui/split-button-arrow-active.png \
$(TMP)/usr/share/koha/opac/htdocs/opac-tmpl/prog/en/css
install -m 0644 koha-tmpl/intranet-tmpl/prog/en/lib/yui/split-button-arrow-active.png \
$(TMP)/usr/share/koha/intranet/htdocs/intranet-tmpl/prog/en/css
install -m 0644 koha-tmpl/intranet-tmpl/prog/en/lib/yui/split-button-arrow-disabled.png \
$(TMP)/usr/share/koha/opac/htdocs/opac-tmpl/prog/en/css
install -m 0644 koha-tmpl/intranet-tmpl/prog/en/lib/yui/split-button-arrow-disabled.png \
$(TMP)/usr/share/koha/intranet/htdocs/intranet-tmpl/prog/en/css
install -m 0644 koha-tmpl/intranet-tmpl/prog/en/lib/yui/split-button-arrow-focus.png \
$(TMP)/usr/share/koha/opac/htdocs/opac-tmpl/prog/en/css
install -m 0644 koha-tmpl/intranet-tmpl/prog/en/lib/yui/split-button-arrow-focus.png \
$(TMP)/usr/share/koha/intranet/htdocs/intranet-tmpl/prog/en/css
install -m 0644 koha-tmpl/intranet-tmpl/prog/en/lib/yui/split-button-arrow-hover.png \
$(TMP)/usr/share/koha/opac/htdocs/opac-tmpl/prog/en/css
install -m 0644 koha-tmpl/intranet-tmpl/prog/en/lib/yui/split-button-arrow-hover.png \
$(TMP)/usr/share/koha/intranet/htdocs/intranet-tmpl/prog/en/css
install -m 0644 koha-tmpl/intranet-tmpl/prog/en/lib/yui/split-button-arrow.png \
$(TMP)/usr/share/koha/opac/htdocs/opac-tmpl/prog/en/css
install -m 0644 koha-tmpl/intranet-tmpl/prog/en/lib/yui/split-button-arrow.png \
$(TMP)/usr/share/koha/intranet/htdocs/intranet-tmpl/prog/en/css
install -m 0644 koha-tmpl/intranet-tmpl/prog/en/lib/yui/sprite.png \
$(TMP)/usr/share/koha/opac/htdocs/opac-tmpl/prog/en/css
install -m 0644 koha-tmpl/intranet-tmpl/prog/en/lib/yui/sprite.png \
$(TMP)/usr/share/koha/intranet/htdocs/intranet-tmpl/prog/en/css
sed -i -e 's:url(.*/reset-fonts-grids.css.*):url("/opac-tmpl/lib/yui/reset-fonts-grids/reset-fonts-grids.css"):' \
-e 's:url(.*/skin.css.*):url("/opac-tmpl/lib/yui/assets/skins/sam/skin.css"):' \
$(TMP)/usr/share/koha/opac/htdocs/opac-tmpl/*/en/css/opac.css \
$(TMP)/usr/share/koha/opac/htdocs/opac-tmpl/*/en/css/sco.css
sed -i -e 's:href="/opac-tmpl/lib/yui/reset-fonts-grids.css":href="/opac-tmpl/lib/yui/reset-fonts-grids/reset-fonts-grids.css":' \
-e 's:href="/opac-tmpl/lib/yui/skin.css":href="/opac-tmpl/lib/yui/assets/skins/sam/skin.css":' \
$(TMP)/usr/share/koha/opac/htdocs/opac-tmpl/ccsr/en/includes/doc-head-close.inc
sed -i -e 's:url(.*/reset-fonts-grids.css.*):url(reset-fonts-grids.css):' \
-e 's:url(.*/skin.css.*):url(skin.css):' \
$(TMP)/usr/share/koha/intranet/htdocs/intranet-tmpl/prog/en/css/staff-global*.css
mkdir -p $(TMP)/debian/tmp_docbook
xt/verify-debian-docbook.t
xsltproc --output $(TMP)/debian/tmp_docbook/ \
/usr/share/xml/docbook/stylesheet/docbook-xsl/manpages/docbook.xsl \
debian/docs/*.xml
override_dh_compress:
# exclude history.txt from compression as about.pl needs it uncompressed
dh_compress --exclude=history.txt