From a6ef853e2b1ab048d20fc5568935a82eaed48999 Mon Sep 17 00:00:00 2001 From: Rayson zhu Date: Sun, 20 Nov 2016 01:29:16 +0800 Subject: [PATCH 1/3] will not print user name --- src/utils.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/utils.c b/src/utils.c index 4c7a7660..9f201450 100644 --- a/src/utils.c +++ b/src/utils.c @@ -104,7 +104,6 @@ run_as(const char *user) { #ifndef __MINGW32__ if (user[0]) { - printf("user: %s\n", user); /* Convert user to a long integer if it is a non-negative number. * -1 means it is a user name. */ long uid = -1; From 48d159504f590494880e2dd9de865fda6e8d9bdf Mon Sep 17 00:00:00 2001 From: Rayson zhu Date: Sun, 20 Nov 2016 01:22:47 +0800 Subject: [PATCH 2/3] fix -l completion --- completions/bash/ss-local | 4 ++-- completions/bash/ss-manager | 4 ++-- completions/bash/ss-redir | 4 ++-- completions/bash/ss-tunnel | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/completions/bash/ss-local b/completions/bash/ss-local index bb1a1d2b..96fec2e2 100644 --- a/completions/bash/ss-local +++ b/completions/bash/ss-local @@ -9,7 +9,7 @@ _ss_local() -c|-f|--acl) _filedir || COMPREPLY=( $(compgen -o plusdirs -f ${cur}) ) ;; - -s|-b|-l) + -s|-b) _known_hosts_real -- "${cur}" || OMPREPLY=( $(compgen -A hostname -- ${cur}) ) ;; -m) @@ -18,7 +18,7 @@ _ss_local() -a) _allowed_users || COMPREPLY=( $(compgen -u -- ${cur}) ) ;; - -p|-k|-t|-n|--mtu) + -p|-k|-t|-n|--mtu|-l) ;; -i) _available_interfaces -a || true diff --git a/completions/bash/ss-manager b/completions/bash/ss-manager index 4fb3a332..cfe941ed 100644 --- a/completions/bash/ss-manager +++ b/completions/bash/ss-manager @@ -9,7 +9,7 @@ _ss_manager() -c|-f|--executable) _filedir || COMPREPLY=( $(compgen -o plusdirs -f ${cur}) ) ;; - -s|-b|-l) + -s|-b) _known_hosts_real -- "${cur}" || OMPREPLY=( $(compgen -A hostname -- ${cur}) ) ;; -L) @@ -22,7 +22,7 @@ _ss_manager() -a) _allowed_users || COMPREPLY=( $(compgen -u -- ${cur}) ) ;; - -p|-k|-t|-n|--mtu) + -p|-k|-t|-n|--mtu|-l) ;; -i) _available_interfaces -a || true diff --git a/completions/bash/ss-redir b/completions/bash/ss-redir index ad2ddee6..86f55001 100644 --- a/completions/bash/ss-redir +++ b/completions/bash/ss-redir @@ -9,7 +9,7 @@ _ss_redir() -c|-f) _filedir || COMPREPLY=( $(compgen -o plusdirs -f ${cur}) ) ;; - -s|-b|-l) + -s|-b) _known_hosts_real -- "${cur}" || OMPREPLY=( $(compgen -A hostname -- ${cur}) ) ;; -m) @@ -18,7 +18,7 @@ _ss_redir() -a) _allowed_users || COMPREPLY=( $(compgen -u -- ${cur}) ) ;; - -p|-k|-t|-n|--mtu) + -p|-k|-t|-n|--mtu|-l) ;; *) COMPREPLY+=( $(compgen -W "${opts}" -- ${cur}) ) diff --git a/completions/bash/ss-tunnel b/completions/bash/ss-tunnel index 057801b0..b3c16eb7 100644 --- a/completions/bash/ss-tunnel +++ b/completions/bash/ss-tunnel @@ -10,7 +10,7 @@ _ss_tunnel() -c|-f) _filedir || COMPREPLY=( $(compgen -o plusdirs -f ${cur}) ) ;; - -s|-b|-l) + -s|-b) _known_hosts_real -- "${cur}" || OMPREPLY=( $(compgen -A hostname -- ${cur}) ) ;; -L) @@ -23,7 +23,7 @@ _ss_tunnel() -a) _allowed_users || COMPREPLY=( $(compgen -u -- ${cur}) ) ;; - -p|-k|-t|-n|--mtu) + -p|-k|-t|-n|--mtu|-l) ;; -i) _available_interfaces -a || true From 9754edda9c2ae2e695770f2cfc31d76b0a0e1742 Mon Sep 17 00:00:00 2001 From: Rayson zhu Date: Sun, 20 Nov 2016 01:23:33 +0800 Subject: [PATCH 3/3] package bash completion files --- debian/shadowsocks-libev.install | 1 + rpm/SPECS/shadowsocks-libev.spec.in | 16 +++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/debian/shadowsocks-libev.install b/debian/shadowsocks-libev.install index f6cd2247..bee58a6e 100644 --- a/debian/shadowsocks-libev.install +++ b/debian/shadowsocks-libev.install @@ -2,3 +2,4 @@ debian/config.json usr/share/shadowsocks-libev debian/shadowsocks-libev-*.service lib/systemd/system usr/bin/ usr/share/man/ +completions/bash/* usr/share/bash-completion/completions/ diff --git a/rpm/SPECS/shadowsocks-libev.spec.in b/rpm/SPECS/shadowsocks-libev.spec.in index f0a71f69..2b486762 100644 --- a/rpm/SPECS/shadowsocks-libev.spec.in +++ b/rpm/SPECS/shadowsocks-libev.spec.in @@ -8,10 +8,10 @@ License: GPLv3+ URL: https://github.com/shadowsocks/%{name} Source0: %{url}/archive/v%{version}.tar.gz -BuildRequires: make automake gcc openssl-devel pcre-devel asciidoc xmlto +BuildRequires: make gcc openssl-devel pcre-devel asciidoc xmlto Requires: openssl -%if 0%{?rhel} != 6 +%if 0%{?rhel} > 6 Requires(post): systemd Requires(preun): systemd Requires(postun): systemd @@ -49,17 +49,18 @@ install -m 644 %{_builddir}/%{buildsubdir}/debian/shadowsocks-libev.service %{bu install -m 644 %{_builddir}/%{buildsubdir}/debian/shadowsocks-libev-*.service %{buildroot}%{_unitdir}/ %endif install -m 644 %{_builddir}/%{buildsubdir}/debian/config.json %{buildroot}%{_sysconfdir}/shadowsocks-libev/config.json - +mkdir -p %{buildroot}%{_datadir}/bash-completion/completions/ +install -m 644 %{_builddir}/%{buildsubdir}/completions/bash/* %{buildroot}%{_datadir}/bash-completion/completions/ %post -%if 0%{?rhel} == 6 +%if 0%{?rhel} <= 6 /sbin/chkconfig --add shadowsocks-libev %else %systemd_post shadowsocks-libev.service %endif %preun -%if 0%{?rhel} == 6 +%if 0%{?rhel} <= 6 if [ $1 -eq 0 ]; then /sbin/service shadowsocks-libev stop /sbin/chkconfig --del shadowsocks-libev @@ -68,7 +69,7 @@ fi %systemd_preun shadowsocks-libev.service %endif -%if 0%{?rhel} != 6 +%if 0%{?rhel} > 6 %postun %systemd_postun_with_restart shadowsocks-libev.service %endif @@ -85,8 +86,9 @@ fi %{_bindir}/* %{_libdir}/* %config(noreplace) %{_sysconfdir}/shadowsocks-libev/config.json +%{_datadir}/bash-completion/completions/* %doc %{_mandir}/* -%if 0%{?rhel} == 6 +%if 0%{?rhel} <= 6 %{_initddir}/shadowsocks-libev %else %{_unitdir}/shadowsocks-libev.service