From 7845adf3e2d7abb23505a40526a0bddb5c51e4c7 Mon Sep 17 00:00:00 2001 From: Oliver Schmidhauser Date: Thu, 31 Jan 2019 21:59:58 +0100 Subject: [PATCH 01/10] Initial Draft for termux-services --- packages/busybox/build.sh | 1 + packages/termux-services/build.sh | 10 +++++ packages/termux-services/start-services.sh | 2 + packages/termux-services/termux-services | 47 ++++++++++++++++++++++ 4 files changed, 60 insertions(+) create mode 100644 packages/termux-services/build.sh create mode 100644 packages/termux-services/start-services.sh create mode 100755 packages/termux-services/termux-services diff --git a/packages/busybox/build.sh b/packages/busybox/build.sh index e77d0f05a..554a8e9d7 100644 --- a/packages/busybox/build.sh +++ b/packages/busybox/build.sh @@ -71,5 +71,6 @@ termux_step_post_make_install() { echo '#!/bin/sh' > telnetd/run echo 'exec busybox telnetd -F' >> telnetd/run chmod +x */run + touch telnetd/down lftp/down } diff --git a/packages/termux-services/build.sh b/packages/termux-services/build.sh new file mode 100644 index 000000000..c92e79286 --- /dev/null +++ b/packages/termux-services/build.sh @@ -0,0 +1,10 @@ +TERMUX_PKG_HOMEPAGE=https://termux.com/ +TERMUX_PKG_DESCRIPTION="Service daemon for Termux" +TERMUX_PKG_VERSION=0.01 +TERMUX_PKG_PLATFORM_INDEPENDENT=yes + +termux_step_make_install () { + cp -p $TERMUX_PKG_BUILDER_DIR/termux-services $TERMUX_PREFIX/bin/ + mkdir -p $TERMUX_PREFIX/etc/profile.d/ + cp -p $TERMUX_PKG_BUILDER_DIR/start-services.sh $TERMUX_PREFIX/etc/profile.d/ +} diff --git a/packages/termux-services/start-services.sh b/packages/termux-services/start-services.sh new file mode 100644 index 000000000..65411c942 --- /dev/null +++ b/packages/termux-services/start-services.sh @@ -0,0 +1,2 @@ +export SVDIR=$PREFIX/var/service +(termux-services start >/dev/null 2>&1 & ) diff --git a/packages/termux-services/termux-services b/packages/termux-services/termux-services new file mode 100755 index 000000000..cf079fa58 --- /dev/null +++ b/packages/termux-services/termux-services @@ -0,0 +1,47 @@ +#!/data/data/com.termux/files/usr/bin/sh +# Quick start-stop-daemon example, derived from Debian /etc/init.d/ssh +set -e +start(){ + start-stop-daemon -q -S -b -m -p "$PIDFILE" -x "$DAEMON" -- $DAEMON_OPTS +} +stop(){ + start-stop-daemon -K -s 1 -o -p "$PIDFILE" -q + tail -f --pid=`cat "$PIDFILE"` /dev/null + for f in "$SVDIR"/*/supervise "$SVDIR"/*/log/supervise;do + if [ -e "$f" ];then + kill -9 `cat "$f"/pid` 2>/dev/null ||: + rm -rf "$f" + fi + done +} +# Must be a valid filename +NAME=termux-serivces +PIDFILE="$PREFIX/var/run/$NAME.pid" +#This is the command to be run, give the full pathname +DAEMON="$PREFIX/bin/applets/runsvdir" +DAEMON_OPTS="$SVDIR" + +case "$1" in + start) + echo -n "Starting daemon: $NAME" + start + echo "." + ;; + stop) + echo -n "Stopping daemon: $NAME" + stop + echo "." + ;; + restart) + echo -n "Restarting daemon: $NAME" + stop + start + echo "." + ;; + + *) + echo "Usage: "$1" {start|stop|restart}" + exit 1 +esac + +exit 0 From d3cfccddbe59e3a82dbb10b3a37a3ee68946e8f8 Mon Sep 17 00:00:00 2001 From: Oliver Schmidhauser Date: Wed, 6 Mar 2019 01:18:45 +0100 Subject: [PATCH 02/10] have zsh run profile too, so services would get executed --- packages/zsh/etc-zshrc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/zsh/etc-zshrc b/packages/zsh/etc-zshrc index a9e2783b3..91636e3fa 100644 --- a/packages/zsh/etc-zshrc +++ b/packages/zsh/etc-zshrc @@ -1,5 +1,8 @@ +. @TERMUX_PREFIX@/etc/profile command_not_found_handler() { @TERMUX_PREFIX@/libexec/termux/command-not-found $1 } - +#set nomatch so *.sh would not error if no file is available +setopt +o nomatch +. @TERMUX_PREFIX@/etc/profile PS1='%# ' From 5ea9aa6ab834e26e1e15dfedb688328292831390 Mon Sep 17 00:00:00 2001 From: Oliver Schmidhauser Date: Wed, 6 Mar 2019 01:19:08 +0100 Subject: [PATCH 03/10] build termux-services from external repository --- packages/termux-services/build.sh | 14 +++---- packages/termux-services/start-services.sh | 2 - packages/termux-services/termux-services | 47 ---------------------- 3 files changed, 6 insertions(+), 57 deletions(-) delete mode 100644 packages/termux-services/start-services.sh delete mode 100755 packages/termux-services/termux-services diff --git a/packages/termux-services/build.sh b/packages/termux-services/build.sh index c92e79286..e485ef9b8 100644 --- a/packages/termux-services/build.sh +++ b/packages/termux-services/build.sh @@ -1,10 +1,8 @@ -TERMUX_PKG_HOMEPAGE=https://termux.com/ +TERMUX_PKG_HOMEPAGE=https://github.com/Neo-Oli/termux-services/ TERMUX_PKG_DESCRIPTION="Service daemon for Termux" -TERMUX_PKG_VERSION=0.01 +TERMUX_PKG_VERSION=0.0.3 +TERMUX_PKG_SHA256=5cb368761401b26e15529f113c8ce0b8e735fa0e911269fb7476cb8d42223c95 +TERMUX_PKG_SRCURL=https://github.com/Neo-Oli/termux-services/archive/$TERMUX_PKG_VERSION.tar.gz +TERMUX_PKG_DEPENDS="coreutils" TERMUX_PKG_PLATFORM_INDEPENDENT=yes - -termux_step_make_install () { - cp -p $TERMUX_PKG_BUILDER_DIR/termux-services $TERMUX_PREFIX/bin/ - mkdir -p $TERMUX_PREFIX/etc/profile.d/ - cp -p $TERMUX_PKG_BUILDER_DIR/start-services.sh $TERMUX_PREFIX/etc/profile.d/ -} +TERMUX_PKG_BUILD_IN_SRC=yes diff --git a/packages/termux-services/start-services.sh b/packages/termux-services/start-services.sh deleted file mode 100644 index 65411c942..000000000 --- a/packages/termux-services/start-services.sh +++ /dev/null @@ -1,2 +0,0 @@ -export SVDIR=$PREFIX/var/service -(termux-services start >/dev/null 2>&1 & ) diff --git a/packages/termux-services/termux-services b/packages/termux-services/termux-services deleted file mode 100755 index cf079fa58..000000000 --- a/packages/termux-services/termux-services +++ /dev/null @@ -1,47 +0,0 @@ -#!/data/data/com.termux/files/usr/bin/sh -# Quick start-stop-daemon example, derived from Debian /etc/init.d/ssh -set -e -start(){ - start-stop-daemon -q -S -b -m -p "$PIDFILE" -x "$DAEMON" -- $DAEMON_OPTS -} -stop(){ - start-stop-daemon -K -s 1 -o -p "$PIDFILE" -q - tail -f --pid=`cat "$PIDFILE"` /dev/null - for f in "$SVDIR"/*/supervise "$SVDIR"/*/log/supervise;do - if [ -e "$f" ];then - kill -9 `cat "$f"/pid` 2>/dev/null ||: - rm -rf "$f" - fi - done -} -# Must be a valid filename -NAME=termux-serivces -PIDFILE="$PREFIX/var/run/$NAME.pid" -#This is the command to be run, give the full pathname -DAEMON="$PREFIX/bin/applets/runsvdir" -DAEMON_OPTS="$SVDIR" - -case "$1" in - start) - echo -n "Starting daemon: $NAME" - start - echo "." - ;; - stop) - echo -n "Stopping daemon: $NAME" - stop - echo "." - ;; - restart) - echo -n "Restarting daemon: $NAME" - stop - start - echo "." - ;; - - *) - echo "Usage: "$1" {start|stop|restart}" - exit 1 -esac - -exit 0 From c6ea4d5708e7f6bccd23aaa89a346964645bc20c Mon Sep 17 00:00:00 2001 From: Oliver Schmidhauser Date: Wed, 6 Mar 2019 01:19:28 +0100 Subject: [PATCH 04/10] make busybox services not run by default --- packages/busybox/build.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/busybox/build.sh b/packages/busybox/build.sh index 554a8e9d7..c9902274e 100644 --- a/packages/busybox/build.sh +++ b/packages/busybox/build.sh @@ -65,12 +65,14 @@ termux_step_post_make_install() { # Setup some services mkdir -p $TERMUX_PREFIX/var/service cd $TERMUX_PREFIX/var/service - mkdir -p ftpd telnetd + mkdir -p ftpd/log telnetd/log echo '#!/bin/sh' > ftpd/run echo 'exec busybox tcpsvd -vE 0.0.0.0 8021 ftpd /data/data/com.termux/files/home' >> ftpd/run echo '#!/bin/sh' > telnetd/run echo 'exec busybox telnetd -F' >> telnetd/run chmod +x */run - touch telnetd/down lftp/down + touch telnetd/down ftpd/down + ln -sf $PREFIX/share/termux-services/svlogger telnetd/log/run + ln -sf $PREFIX/share/termux-services/svlogger ftpd/log/run } From f8ccb086a1f58d57964a3aa673095b67548d32ef Mon Sep 17 00:00:00 2001 From: Oliver Schmidhauser Date: Wed, 6 Mar 2019 01:19:40 +0100 Subject: [PATCH 05/10] add sshd service --- packages/openssh/build.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/openssh/build.sh b/packages/openssh/build.sh index eef05d14a..db769fb81 100644 --- a/packages/openssh/build.sh +++ b/packages/openssh/build.sh @@ -80,6 +80,16 @@ termux_step_post_make_install() { mkdir -p $TERMUX_PREFIX/etc/ssh/ cp $TERMUX_PKG_SRCDIR/moduli $TERMUX_PREFIX/etc/ssh/moduli + + # Setup sshd services + mkdir -p $TERMUX_PREFIX/var/service + cd $TERMUX_PREFIX/var/service + mkdir -p sshd/log + echo '#!/bin/sh' > sshd/run + echo 'exec sshd -D -e 2>&1' >> sshd/run + chmod +x sshd/run + touch sshd/down + ln -sf $PREFIX/share/termux-services/svlogger sshd/log/run } termux_step_post_massage() { From 63761bafd2f310fb12448ea326414edd119e9074 Mon Sep 17 00:00:00 2001 From: Oliver Schmidhauser Date: Wed, 6 Mar 2019 01:20:43 +0100 Subject: [PATCH 06/10] bump changed packages --- packages/busybox/build.sh | 2 +- packages/openssh/build.sh | 2 +- packages/zsh/build.sh | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/busybox/build.sh b/packages/busybox/build.sh index c9902274e..fa39e536d 100644 --- a/packages/busybox/build.sh +++ b/packages/busybox/build.sh @@ -2,7 +2,7 @@ TERMUX_PKG_HOMEPAGE=https://busybox.net/ TERMUX_PKG_DESCRIPTION="Tiny versions of many common UNIX utilities into a single small executable" TERMUX_PKG_LICENSE="GPL-2.0" TERMUX_PKG_VERSION=1.30.1 -TERMUX_PKG_REVISION=7 +TERMUX_PKG_REVISION=8 TERMUX_PKG_SRCURL=https://busybox.net/downloads/busybox-${TERMUX_PKG_VERSION}.tar.bz2 TERMUX_PKG_SHA256=3d1d04a4dbd34048f4794815a5c48ebb9eb53c5277e09ffffc060323b95dfbdc TERMUX_PKG_BUILD_IN_SRC=yes diff --git a/packages/openssh/build.sh b/packages/openssh/build.sh index db769fb81..9fc5331a4 100644 --- a/packages/openssh/build.sh +++ b/packages/openssh/build.sh @@ -2,7 +2,7 @@ TERMUX_PKG_HOMEPAGE=https://www.openssh.com/ TERMUX_PKG_DESCRIPTION="Secure shell for logging into a remote machine" TERMUX_PKG_LICENSE="BSD" TERMUX_PKG_VERSION=8.0p1 -TERMUX_PKG_REVISION=1 +TERMUX_PKG_REVISION=2 TERMUX_PKG_SHA256=bd943879e69498e8031eb6b7f44d08cdc37d59a7ab689aa0b437320c3481fd68 TERMUX_PKG_SRCURL=https://fastly.cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-${TERMUX_PKG_VERSION}.tar.gz TERMUX_PKG_DEPENDS="libandroid-support, ldns, openssl, libedit, termux-auth, krb5, zlib" diff --git a/packages/zsh/build.sh b/packages/zsh/build.sh index 8b86f873a..bc896b1b3 100644 --- a/packages/zsh/build.sh +++ b/packages/zsh/build.sh @@ -2,6 +2,7 @@ TERMUX_PKG_HOMEPAGE=https://www.zsh.org TERMUX_PKG_DESCRIPTION="Shell with lots of features" TERMUX_PKG_LICENSE="BSD" TERMUX_PKG_VERSION=5.7.1 +TERMUX_PKG_REVISION=1 TERMUX_PKG_SHA256=7260292c2c1d483b2d50febfa5055176bd512b32a8833b116177bf5f01e77ee8 TERMUX_PKG_SRCURL=https://fossies.org/linux/misc/zsh-${TERMUX_PKG_VERSION}.tar.xz # Remove hard link to bin/zsh as Android does not support hard links: From ae93faa21fefef2e118dd3c50817afeceac99e11 Mon Sep 17 00:00:00 2001 From: Henrik Grimler Date: Sat, 27 Jul 2019 15:00:36 +0200 Subject: [PATCH 07/10] termux-services: termux-services->service-daemon --- packages/termux-services/start-services.sh.patch | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 packages/termux-services/start-services.sh.patch diff --git a/packages/termux-services/start-services.sh.patch b/packages/termux-services/start-services.sh.patch new file mode 100644 index 000000000..305afbbe7 --- /dev/null +++ b/packages/termux-services/start-services.sh.patch @@ -0,0 +1,7 @@ +--- ../start-services.sh.orig 2019-07-27 14:03:44.761403867 +0200 ++++ ./start-services.sh 2019-07-27 14:01:49.473403949 +0200 +@@ -1,3 +1,3 @@ + export SVDIR=$PREFIX/var/service + export LOGDIR=$PREFIX/var/log +-(termux-services start >/dev/null 2>&1 & ) ++(service-daemon start >/dev/null 2>&1 & ) From 36a039d5fd6c8c8cc9211f1f2c557c3348ea4a69 Mon Sep 17 00:00:00 2001 From: Henrik Grimler Date: Sun, 11 Aug 2019 20:44:39 +0200 Subject: [PATCH 08/10] termux-services: add busybox as dependency --- packages/termux-services/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/termux-services/build.sh b/packages/termux-services/build.sh index e485ef9b8..d3e5124f9 100644 --- a/packages/termux-services/build.sh +++ b/packages/termux-services/build.sh @@ -3,6 +3,6 @@ TERMUX_PKG_DESCRIPTION="Service daemon for Termux" TERMUX_PKG_VERSION=0.0.3 TERMUX_PKG_SHA256=5cb368761401b26e15529f113c8ce0b8e735fa0e911269fb7476cb8d42223c95 TERMUX_PKG_SRCURL=https://github.com/Neo-Oli/termux-services/archive/$TERMUX_PKG_VERSION.tar.gz -TERMUX_PKG_DEPENDS="coreutils" +TERMUX_PKG_DEPENDS="busybox, coreutils" TERMUX_PKG_PLATFORM_INDEPENDENT=yes TERMUX_PKG_BUILD_IN_SRC=yes From 2aa2cd2a9d03b55b0ae5330377d9e1566ee0ca2b Mon Sep 17 00:00:00 2001 From: Henrik Grimler Date: Sun, 11 Aug 2019 20:51:28 +0200 Subject: [PATCH 09/10] termux-services: set license to custom until we have another one --- packages/termux-services/build.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/termux-services/build.sh b/packages/termux-services/build.sh index d3e5124f9..26b882bbd 100644 --- a/packages/termux-services/build.sh +++ b/packages/termux-services/build.sh @@ -1,8 +1,9 @@ TERMUX_PKG_HOMEPAGE=https://github.com/Neo-Oli/termux-services/ TERMUX_PKG_DESCRIPTION="Service daemon for Termux" TERMUX_PKG_VERSION=0.0.3 -TERMUX_PKG_SHA256=5cb368761401b26e15529f113c8ce0b8e735fa0e911269fb7476cb8d42223c95 +TERMUX_PKG_LICENSE="custom" TERMUX_PKG_SRCURL=https://github.com/Neo-Oli/termux-services/archive/$TERMUX_PKG_VERSION.tar.gz +TERMUX_PKG_SHA256=5cb368761401b26e15529f113c8ce0b8e735fa0e911269fb7476cb8d42223c95 TERMUX_PKG_DEPENDS="busybox, coreutils" TERMUX_PKG_PLATFORM_INDEPENDENT=yes TERMUX_PKG_BUILD_IN_SRC=yes From 442a4335b145757a817f97da6329ae57b4b56e09 Mon Sep 17 00:00:00 2001 From: Henrik Grimler Date: Sun, 11 Aug 2019 21:32:20 +0200 Subject: [PATCH 10/10] termux-services: switch to github.com/termux repo --- packages/termux-services/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/termux-services/build.sh b/packages/termux-services/build.sh index 26b882bbd..4857852e7 100644 --- a/packages/termux-services/build.sh +++ b/packages/termux-services/build.sh @@ -2,7 +2,7 @@ TERMUX_PKG_HOMEPAGE=https://github.com/Neo-Oli/termux-services/ TERMUX_PKG_DESCRIPTION="Service daemon for Termux" TERMUX_PKG_VERSION=0.0.3 TERMUX_PKG_LICENSE="custom" -TERMUX_PKG_SRCURL=https://github.com/Neo-Oli/termux-services/archive/$TERMUX_PKG_VERSION.tar.gz +TERMUX_PKG_SRCURL=https://github.com/termux/termux-services/archive/$TERMUX_PKG_VERSION.tar.gz TERMUX_PKG_SHA256=5cb368761401b26e15529f113c8ce0b8e735fa0e911269fb7476cb8d42223c95 TERMUX_PKG_DEPENDS="busybox, coreutils" TERMUX_PKG_PLATFORM_INDEPENDENT=yes