diff --git a/packages/cfengine/build.sh b/packages/cfengine/build.sh index 57d0d7e07..2514b1b85 100644 --- a/packages/cfengine/build.sh +++ b/packages/cfengine/build.sh @@ -1,22 +1,41 @@ TERMUX_PKG_HOMEPAGE=https://cfengine.com/ TERMUX_PKG_DESCRIPTION="CFEngine is a configuration management technology." TERMUX_PKG_LICENSE="GPL-3.0" -TERMUX_PKG_VERSION=3.15.2 -TERMUX_PKG_SRCURL=(https://cfengine-package-repos.s3.amazonaws.com/tarballs/cfengine-3.15.2.tar.gz - https://cfengine-package-repos.s3.amazonaws.com/tarballs/cfengine-masterfiles-3.15.2.tar.gz) -TERMUX_PKG_SHA256=(d1c570b7a0f47794a92f66e21cccdc86b8f56a7028a389780e705db41bfd3cab - 932d882cb6231db0cd9cfcaa8a0130e069355bc1a7307f8038ababd1320d99a8) -TERMUX_PKG_DEPENDS="liblmdb, openssl, libandroid-glob, pcre" +TERMUX_PKG_VERSION=3.17.0a1-termux +TERMUX_PKG_SRCURL=(https://github.com/cfengine/core/archive/ec47889f4bef53c6c5a15add60d34c44c6ef1634.zip + https://github.com/cfengine/masterfiles/archive/83c4e0cf9dddffdd192d49f98a30a9bb705edfc4.zip + https://github.com/cfengine/libntech/archive/10f1112b118b05cf9ccc2aedcf4b1ee09090fcd0.zip) +TERMUX_PKG_SHA256=(53feaf799db0ac7e9579f7101c1ab87dc9bba7e383f3da1a74828e4a6dc005e1 + 3ea7759125acc6501c49ba58f98cef9cea598f5da810352eda86e1efa4d19b8e + b0458087ab526b5b73bc9e399e420dcef31d4e649898954346f8bd2594bd9446) +TERMUX_PKG_DEPENDS="liblmdb, openssl, libandroid-glob, pcre, libyaml, libxml2" # core doesn't work with out-of-tree builds TERMUX_PKG_BUILD_IN_SRC=true -TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--with-workdir=$TERMUX_PREFIX/var/lib/cfengine --without-pam --without-selinux-policy --without-systemd-service --with-lmdb=$TERMUX_PREFIX --with-openssl=$TERMUX_PREFIX --with-pcre=$TERMUX_PREFIX" +TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--with-workdir=$TERMUX_PREFIX/var/lib/cfengine --without-pam --without-selinux-policy --without-systemd-service --with-lmdb=$TERMUX_PREFIX --with-openssl=$TERMUX_PREFIX --with-yaml=$TERMUX_PREFIX --with-pcre=$TERMUX_PREFIX --with-prefix=$TERMUX_PREFIX --with-libxml2=$TERMUX_PREFIX" termux_step_post_get_source() { - cd cfengine-masterfiles-${TERMUX_PKG_VERSION} - EXPLICIT_VERSION=${TERMUX_PKG_VERSION} ./configure --prefix=$TERMUX_PREFIX/var/lib/cfengine --bindir=$TERMUX_PREFIX/bin - make install + # commit-based zips from github include the commit sha so rename to normalize for later steps + mv masterfiles-* masterfiles + rm -rf libntech + mv libntech-* libntech } termux_step_pre_configure() { + EXPLICIT_VERSION=${TERMUX_PKG_VERSION} LDFLAGS+=" -landroid-glob" + NO_CONFIGURE=1 ./autogen.sh $TERMUX_PKG_EXTRA_CONFIGURE_ARGS --prefix=$TERMUX_PREFIX/var/lib/cfengine --bindir=$TERMUX_PREFIX/bin + + cd masterfiles + ./autogen.sh --prefix=$TERMUX_PREFIX/var/lib/cfengine --bindir=$TERMUX_PREFIX/bin + make install +} + +termux_step_create_debscripts() { + cat << EOF > ./postinst + #!$TERMUX_PREFIX/bin/sh + # Generate a host key + if [ ! -f $TERMUX_PREFIX/var/lib/cfengine/ppkeys/localhost.priv ]; then + $TERMUX_PREFIX/bin/cf-key >/dev/null || : + fi +EOF } diff --git a/packages/cfengine/fixup-for-termux.patch b/packages/cfengine/fixup-for-termux.patch deleted file mode 100644 index e5f2e742b..000000000 --- a/packages/cfengine/fixup-for-termux.patch +++ /dev/null @@ -1,66 +0,0 @@ -diff --git a/cf-agent/cf-agent.c b/cf-agent/cf-agent.c -index 8c6341059..1b454325b 100644 ---- a/cf-agent/cf-agent.c -+++ b/cf-agent/cf-agent.c -@@ -365,8 +365,7 @@ static void ConfigureBootstrap(GenericAgentConfig *config, const char *argument) - - if(IsLoopbackAddress(argument)) - { -- Log(LOG_LEVEL_ERR, "Cannot bootstrap to a loopback address"); -- DoCleanupAndExit(EXIT_FAILURE); -+ Log(LOG_LEVEL_WARNING, "Bootstrapping to loopback interface (localhost), other hosts will not be able to bootstrap to this server"); - } - - // temporary assure that network functions are working - -diff --git a/libutils/file_lib.c b/libutils/file_lib.c -index 816d719..d96a27e 100644 ---- a/libntech/libutils/file_lib.c -+++ b/libntech/libutils/file_lib.c -@@ -564,6 +540,9 @@ int safe_open_create_perms( - return open(pathname, flags, create_perms); - #else // !__MINGW32__ - -+#ifdef __TERMUX__ -+ return open(pathname, flags, create_perms); -+#endif - const size_t path_bufsize = strlen(pathname) + 1; - char path[path_bufsize]; - const size_t res_len = StringCopy(pathname, path, path_bufsize); - -diff --git a/libutils/platform.h b/libutils/platform.h -index 964adaa..af6e8d7 100644 ---- a/libntech/libutils/platform.h -+++ b/libntech/libutils/platform.h -@@ -178,6 +178,9 @@ struct utsname - #endif - - #include -+#ifdef __ANDROID__ -+#include -+#endif - - #ifdef __MINGW32__ - # define LOG_LOCAL0 (16<<3) - -diff --git a/libutils/known_dirs.c b/libutils/known_dirs.c -index 386f6ec..6d0955b 100644 ---- a/libntech/libutils/known_dirs.c -+++ b/libntech/libutils/known_dirs.c -@@ -89,7 +89,6 @@ const char *GetDefaultDir_helper(char *dir, const char *root_dir, - } - } - --#endif - - #define GET_DEFAULT_DIRECTORY_DEFINE(FUNC, STATIC, GLOBAL, FOLDER) \ - const char *GetDefault##FUNC##Dir(void) \ -@@ -106,6 +105,8 @@ GET_DEFAULT_DIRECTORY_DEFINE(Master, master, MASTERDIR, "masterfiles") - GET_DEFAULT_DIRECTORY_DEFINE(Input, input, INPUTDIR, "inputs") - GET_DEFAULT_DIRECTORY_DEFINE(State, state, STATEDIR, "state") - -+#endif -+ - /*******************************************************************/ - - const char *GetWorkDir(void) diff --git a/packages/cfengine/libpromises-patches-copy-not-link.patch b/packages/cfengine/libpromises-patches-copy-not-link.patch deleted file mode 100644 index 621fa9d56..000000000 --- a/packages/cfengine/libpromises-patches-copy-not-link.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff --git a/libpromises/patches.c b/libpromises/patches.c -index 40407eb1f..9bc1fadbd 100644 ---- a/libpromises/patches.c -+++ b/libpromises/patches.c -@@ -34,6 +34,10 @@ - - #include - -+#ifdef __TERMUX__ -+#include -+#endif -+ - static char *cf_format_strtimestamp(struct tm *tm, char *buf); - - /*********************************************************/ -@@ -193,6 +197,8 @@ bool LinkOrCopy(const char *from, const char *to, int sym) - return false; - } - -+#elif __TERMUX__ // link() not supported on android/termux so use rename() instead -+ return File_Copy(from, to); - #else /* !__MINGW32__ */ - - if (sym) diff --git a/packages/cfengine/unix_iface.patch b/packages/cfengine/unix_iface.patch deleted file mode 100644 index a4b8b352f..000000000 --- a/packages/cfengine/unix_iface.patch +++ /dev/null @@ -1,51 +0,0 @@ -diff --git a/libenv/unix_iface.c b/libenv/unix_iface.c -index 65e359921..905e13c84 100644 ---- a/libenv/unix_iface.c -+++ b/libenv/unix_iface.c -@@ -147,7 +147,7 @@ static void GetMacAddress(EvalContext *ctx, ARG_UNUSED int fd, struct ifreq *ifr - return; - } - --# if defined(SIOCGIFHWADDR) && defined(HAVE_STRUCT_IFREQ_IFR_HWADDR) -+# if defined(SIOCGIFHWADDR) && defined(HAVE_STRUCT_IFREQ_IFR_HWADDR) && !defined(__TERMUX__) - char hw_mac[CF_MAXVARSIZE]; - - if ((ioctl(fd, SIOCGIFHWADDR, ifr) == -1)) -@@ -173,9 +173,8 @@ static void GetMacAddress(EvalContext *ctx, ARG_UNUSED int fd, struct ifreq *ifr - - # elif defined(HAVE_GETIFADDRS) && !defined(__sun) - char hw_mac[CF_MAXVARSIZE]; -- char *m; - struct ifaddrs *ifaddr, *ifa; -- struct sockaddr_dl *sdl; -+ struct sockaddr_ll *sdl; - - if (getifaddrs(&ifaddr) == -1) - { -@@ -190,18 +189,16 @@ static void GetMacAddress(EvalContext *ctx, ARG_UNUSED int fd, struct ifreq *ifr - { - if ( strcmp(ifa->ifa_name, ifp->ifr_name) == 0) - { -- if (ifa->ifa_addr->sa_family == AF_LINK) -+ if (ifa->ifa_addr != NULL && ifa->ifa_addr->sa_family == AF_PACKET) - { -- sdl = (struct sockaddr_dl *)ifa->ifa_addr; -- m = (char *) LLADDR(sdl); -- -+ sdl = (struct sockaddr_ll*)ifa->ifa_addr; - snprintf(hw_mac, sizeof(hw_mac), "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x", -- (unsigned char) m[0], -- (unsigned char) m[1], -- (unsigned char) m[2], -- (unsigned char) m[3], -- (unsigned char) m[4], -- (unsigned char) m[5]); -+ sdl->sll_addr[0], -+ sdl->sll_addr[1], -+ sdl->sll_addr[2], -+ sdl->sll_addr[3], -+ sdl->sll_addr[4], -+ sdl->sll_addr[5]); - - EvalContextVariablePutSpecial(ctx, SPECIAL_SCOPE_SYS, name, hw_mac, CF_DATA_TYPE_STRING, "source=agent"); - RlistAppend(hardware, hw_mac, RVAL_TYPE_SCALAR);