summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorskydrome2019-11-07 03:52:02 -0500
committerskydrome2019-11-07 03:52:02 -0500
commit787b06d83552c20796d5dd8886edb73cdc4ccef0 (patch)
tree1d26e4dbf34defe7c0e7ca39edc4ccdb8bd72cbc
parent7154f7551cf69e9da2de58279244fcedd2d5f7d4 (diff)
downloadaur-787b06d83552c20796d5dd8886edb73cdc4ccef0.tar.gz
add i2prouter bash completion
remove unneeded status command
-rw-r--r--PKGBUILD11
-rw-r--r--i2prouter.bash12
-rw-r--r--i2prouter.sh35
3 files changed, 35 insertions, 23 deletions
diff --git a/PKGBUILD b/PKGBUILD
index b83eb4fde17b..fe656bbce44c 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -27,16 +27,18 @@ validpgpkeys=('2D3D2D03910C6504C1210C65EE60C0C8EE7256A8')
_url="https://launchpad.net/i2p/trunk/${pkgver}/+download"
source=("${_url}/i2psource_${pkgver}.tar.bz2"{,.sig}
- 'i2prouter.service' 'i2p.tmpfiles' 'i2prouter.sh' 'wrapper.config' 'router.config'
+ 'i2prouter.service' 'i2p.tmpfiles' 'wrapper.config' 'router.config'
+ 'i2prouter.bash' 'i2prouter.sh'
gettext-0.20.patch::'https://github.com/i2p/i2p.i2p/commit/eef6c5cb33d8292ce247fcd49578cc9fa1acf6cb.patch')
sha256sums=('beb2a3c62efce826cd5aa3e296b483143ad2c581ddb038677f960f7d110df81c'
'SKIP'
'644b771ec7f5db3efab3206bf1f896566cdb00d410a54608fda85bdb4c2ad876'
'df26da04c8415ac24ec73b0dd08d3459a8964553bb77e5da5ab9833b0a31d865'
- 'ae1ff9026f0a9180718249e6d8a973ffe03501bf55491cb3866d72230e89dc8a'
'5d134ee5bc614b54ec48de7c5214f6dbe08abcfab7d286c5b1c7616e39b478ed'
'7a4688db826c3dddb762976cd8c9a5d465255c3577069243d8e5af941a4126e2'
+ '7a19b9f90c8792460fd58e8b8aa435a065e34d29a942479850472510e9d3078a'
+ 'b5f1a5bb354552acebe2857b9579410f7fd589f2f7d6b12fbbfe4127a2d33fd8'
'a3be87c6ed2a253a393ef39b47bb0c8d91bbbd80111557e412753e78c590e5b8')
prepare() {
@@ -70,6 +72,11 @@ package() {
install -Dm644 "$srcdir/router.config" "opt/i2p/router.config"
install -Dm644 "$srcdir/wrapper.config" "opt/i2p/wrapper.config"
install -Dm755 "$srcdir/i2prouter.sh" "opt/i2p/i2prouter"
+
+ install -Dm644 "$srcdir/i2prouter.bash" "usr/share/bash-completion/completions/i2prouter"
+ install -Dm644 "$srcdir/$pkgname-$pkgver/installer/resources/bash-completion/eepget" \
+ "usr/share/bash-completion/completions/eepget"
+
install -Dm644 "opt/i2p/man/eepget.1" "usr/share/man/man1/eepget.1"
install -Dm644 "opt/i2p/LICENSE.txt" "usr/share/licenses/i2p/LICENSE"
mv opt/i2p/licenses/* "usr/share/licenses/i2p/"
diff --git a/i2prouter.bash b/i2prouter.bash
new file mode 100644
index 000000000000..d95158603133
--- /dev/null
+++ b/i2prouter.bash
@@ -0,0 +1,12 @@
+_i2prouter()
+{
+ local cur prev opts
+ _init_completion || return
+
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ opts="console start stop graceful restart dump"
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+}
+complete -F _i2prouter i2prouter
diff --git a/i2prouter.sh b/i2prouter.sh
index 8d52e58666ea..f4e7ac9a411d 100644
--- a/i2prouter.sh
+++ b/i2prouter.sh
@@ -147,11 +147,6 @@ _graceful() {
fi
}
-_status() {
- [[ "$pid" ]] &&
- echo "I2P Router is running: PID:$pid" || echo "I2P Router is not running."
-}
-
_dump() {
if [[ "$pid" ]]; then
echo "Dumping threads..."
@@ -164,9 +159,22 @@ _dump() {
}
#-----------------------------------------------------------------------------
+[[ "$1" != @(console|start|stop|graceful|restart|dump) ]] && {
+ echo "Usage: $(basename $0) [command]"
+ echo
+ echo "Commands:"
+ echo " console Launch in the current console"
+ echo " start Start in the background as a daemon process"
+ echo " stop Stop if running as a daemon or in another console"
+ echo " graceful Stop gracefully, may take up to 11 minutes for all tunnels to close"
+ echo " restart Restart the JVM"
+ echo " dump Request a Java thread dump if running"
+ exit
+}
+
check_user "$@"
-init_vars
check_if_running
+init_vars
case "$1" in
'console') _console
@@ -179,21 +187,6 @@ case "$1" in
;;
'restart') _restart
;;
- 'status') _status
- ;;
'dump') _dump
;;
-
- *) echo "Usage: $(basename $0) [command]"
- echo
- echo "Commands:"
- echo " console Launch in the current console"
- echo " start Start in the background as a daemon process"
- echo " stop Stop if running as a daemon or in another console"
- echo " graceful Stop gracefully, may take up to 11 minutes for all tunnels to close"
- echo " restart Restart the JVM"
- echo " status Query the current status"
- echo " dump Request a Java thread dump if running"
- echo
- ;;
esac