summaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
Diffstat (limited to 'system')
-rw-r--r--system/attr/APKBUILD75
-rw-r--r--system/attr/fix-decls.patch35
-rw-r--r--system/attr/fix-throw.patch33
-rw-r--r--system/attr/test-runner-musl.patch11
-rw-r--r--system/attr/test-runner-perl.patch11
-rw-r--r--system/autoconf/APKBUILD45
-rw-r--r--system/autoconf/autoconf-2.69-fix-perl-regex.patch11
-rw-r--r--system/boost/APKBUILD145
-rw-r--r--system/boost/boost-1.57.0-python-abi_letters.patch62
-rw-r--r--system/boost/boost-1.57.0-python-libpython_dep.patch13
-rw-r--r--system/boost/dual-python.patch27
-rw-r--r--system/boost/libressl.patch146
-rw-r--r--system/busybox/0001-ash-add-support-for-command_not_found_handle-hook-fu.patch63
-rw-r--r--system/busybox/0001-ash-exec-busybox.static.patch25
-rw-r--r--system/busybox/0002-app-location-for-cpio-vi-and-lspci.patch54
-rw-r--r--system/busybox/0003-udhcpc-set-default-discover-retries-to-5.patch35
-rw-r--r--system/busybox/0004-ping-make-ping-work-without-root-privileges.patch197
-rw-r--r--system/busybox/0005-fbsplash-support-console-switching.patch187
-rw-r--r--system/busybox/0006-fbsplash-support-image-and-bar-alignment-and-positio.patch185
-rw-r--r--system/busybox/0007-depmod-support-generating-kmod-binary-index-files.patch516
-rw-r--r--system/busybox/0008-diff-add-support-for-no-dereference.patch63
-rw-r--r--system/busybox/0009-sysklogd-add-Z-option-to-adjust-message-timezones.patch104
-rw-r--r--system/busybox/0010-udhcpc-Don-t-background-if-n-is-given.patch45
-rw-r--r--system/busybox/0011-testsuite-fix-cpio-tests.patch82
-rw-r--r--system/busybox/0012-microcom-segfault.patch31
-rw-r--r--system/busybox/APKBUILD202
-rw-r--r--system/busybox/acpid.logrotate8
-rw-r--r--system/busybox/bbsuid.c106
-rw-r--r--system/busybox/busybox-extras.post-install4
-rw-r--r--system/busybox/busybox-extras.pre-deinstall9
-rw-r--r--system/busybox/busybox.post-install4
-rw-r--r--system/busybox/busybox.post-upgrade26
-rw-r--r--system/busybox/busybox.trigger20
-rw-r--r--system/busybox/busyboxconfig1138
-rw-r--r--system/busybox/busyboxconfig-extras1114
-rw-r--r--system/busybox/dad.if-up8
-rw-r--r--system/busybox/nologin.c38
-rw-r--r--system/busybox/top-buffer-overflow.patch20
-rw-r--r--system/c-ares/APKBUILD46
-rw-r--r--system/ca-certificates/APKBUILD54
-rw-r--r--system/ca-certificates/ca-certificates.post-deinstall7
-rw-r--r--system/ca-certificates/ca-certificates.trigger3
-rw-r--r--system/check/APKBUILD42
-rw-r--r--system/cmake/APKBUILD59
-rw-r--r--system/coreutils/051_all_coreutils-mangen.patch120
-rw-r--r--system/coreutils/APKBUILD79
-rw-r--r--system/coreutils/coreutils.post-deinstall4
-rw-r--r--system/coreutils/disable-mbrtowc-test.patch10
-rw-r--r--system/coreutils/localename-test-fix.patch34
-rw-r--r--system/coreutils/no-doc.patch22
-rw-r--r--system/coreutils/printf-musl.patch53
-rw-r--r--system/coreutils/seq-write-error.patch45
-rw-r--r--system/coreutils/sort-debug-locale.patch79
-rw-r--r--system/curl/APKBUILD93
-rw-r--r--system/curl/curl-do-bounds-check-using-a-double-comparison.patch32
-rw-r--r--system/diffutils/APKBUILD50
-rw-r--r--system/diffutils/disable-mbrtowc-test.patch10
-rw-r--r--system/emacs/APKBUILD140
-rw-r--r--system/emacs/gamedir.patch11
-rw-r--r--system/gamin/APKBUILD58
-rw-r--r--system/gamin/fix-deprecated-const.patch56
-rw-r--r--system/gamin/fix-pthread-mutex.patch11
-rw-r--r--system/git/0001-gc-use-s-type-character-for-fscanf.patch33
-rw-r--r--system/git/APKBUILD255
-rw-r--r--system/git/bb-tar.patch8
-rw-r--r--system/git/dont-test-other-encodings.patch193
-rw-r--r--system/git/git-daemon.confd19
-rw-r--r--system/git/git-daemon.initd13
-rw-r--r--system/iproute2/APKBUILD59
-rw-r--r--system/iproute2/iproute2.post-install6
-rw-r--r--system/iproute2/musl-fixes.patch214
-rw-r--r--system/kyua/APKBUILD41
-rw-r--r--system/libevent/APKBUILD65
-rw-r--r--system/libevent/dont-test-fallback.patch16
-rw-r--r--system/libevent/fix-test-on-32bit.patch11
-rw-r--r--system/libevent/libressl.patch97
-rw-r--r--system/libevent/py3_dumpevents.patch30
-rw-r--r--system/libevent/py3_rpcgen.patch423
-rw-r--r--system/libexecinfo/10-execinfo.patch64
-rw-r--r--system/libexecinfo/20-define-gnu-source.patch24
-rw-r--r--system/libexecinfo/30-linux-makefile.patch44
-rw-r--r--system/libexecinfo/APKBUILD46
-rw-r--r--system/libffi/APKBUILD57
-rw-r--r--system/libffi/disable-ppc-ldvariant.patch11
-rw-r--r--system/libffi/fix-testsuite-longdouble.patch44
-rw-r--r--system/libffi/gnu-linux-define.patch15
-rw-r--r--system/libffi/pax-dlmmap.patch120
-rw-r--r--system/libtool/APKBUILD55
-rw-r--r--system/libtool/libtool-fix-cross-compile.patch36
-rw-r--r--system/libtool/libtool.patch41
-rw-r--r--system/libxml2/APKBUILD77
-rw-r--r--system/libxml2/libxml2-2.9.4-remove-pyverify_fd.patch12
-rw-r--r--system/libxml2/python-segfault-fix.patch36
-rw-r--r--system/libxslt/APKBUILD40
-rw-r--r--system/linux-pam/APKBUILD91
-rw-r--r--system/linux-pam/base-account.pamd3
-rw-r--r--system/linux-pam/base-auth.pamd5
-rw-r--r--system/linux-pam/base-password.pamd3
-rw-r--r--system/linux-pam/base-session-noninteractive.pamd4
-rw-r--r--system/linux-pam/base-session.pamd4
-rw-r--r--system/linux-pam/fix-compat.patch21
-rw-r--r--system/linux-pam/libpam-fix-build-with-eglibc-2.16.patch10
-rw-r--r--system/linux-pam/musl-fix-pam_exec.patch31
-rw-r--r--system/linux-pam/other.pamd6
-rw-r--r--system/linux-pam/su.pamd6
-rw-r--r--system/mkinitfs/0001-features-add-virtio_net-to-network-modules.patch21
-rw-r--r--system/mkinitfs/0001-features-virtio_net-depends-on-virtio_pci.patch23
-rw-r--r--system/mkinitfs/0001-generate-mkinitfs.conf.patch49
-rw-r--r--system/mkinitfs/0001-initramfs-do-not-relocate-mountpoint-for-netboot.patch28
-rw-r--r--system/mkinitfs/0001-nlplug-findfs-add-primitive-support-for-LUKS2-contai.patch31
-rw-r--r--system/mkinitfs/0001-skip-hooks-on-diskless-install.patch30
-rw-r--r--system/mkinitfs/0002-initramfs-init-add-disk-and-network-detection-on-s39.patch97
-rw-r--r--system/mkinitfs/0003-initramfs-init-add-support-for-ssh-installer.patch121
-rw-r--r--system/mkinitfs/APKBUILD48
-rw-r--r--system/mkinitfs/mkinitfs.post-install8
l---------system/mkinitfs/mkinitfs.post-upgrade1
-rw-r--r--system/mkinitfs/mkinitfs.pre-upgrade13
-rw-r--r--system/mkinitfs/mkinitfs.trigger33
-rw-r--r--system/parted/APKBUILD60
-rw-r--r--system/parted/disable-two-tests.patch16
-rw-r--r--system/parted/fix-includes.patch10
-rw-r--r--system/parted/fix-libintl-header-s390x.patch58
-rw-r--r--system/parted/tests-call-name-correctly.patch42
-rw-r--r--system/parted/tests-python3.patch68
-rw-r--r--system/pcre/APKBUILD90
-rw-r--r--system/pcre2/APKBUILD88
-rw-r--r--system/polkit/0001-Bug-50145-make-netgroup-support-optional.patch108
-rw-r--r--system/polkit/APKBUILD80
-rw-r--r--system/polkit/CVE-2013-4288.patch123
-rw-r--r--system/polkit/CVE-2015-3218.patch115
-rw-r--r--system/polkit/CVE-2015-3255.patch67
-rw-r--r--system/polkit/CVE-2015-4625.patch1008
-rw-r--r--system/polkit/automake.patch19
-rw-r--r--system/polkit/disable-ck-test.patch15
-rw-r--r--system/polkit/fix-consolekit-db-stat.patch30
-rw-r--r--system/polkit/fix-parallel-make.patch40
-rw-r--r--system/polkit/fix-test-fgetpwent.patch20
-rw-r--r--system/postgresql/APKBUILD259
-rw-r--r--system/postgresql/conf-unix_socket_directories.patch14
-rw-r--r--system/postgresql/disable-broken-tests.patch119
-rw-r--r--system/postgresql/initdb.patch14
-rw-r--r--system/postgresql/perl-rpath.patch22
-rw-r--r--system/postgresql/pg-restore.confd16
-rw-r--r--system/postgresql/pg-restore.initd36
-rw-r--r--system/postgresql/pltcl_create_tables.sql13
-rw-r--r--system/postgresql/postgresql.confd59
-rw-r--r--system/postgresql/postgresql.initd220
-rw-r--r--system/postgresql/postgresql.pre-upgrade32
-rw-r--r--system/py-mako/APKBUILD51
-rw-r--r--system/rsync/APKBUILD65
-rw-r--r--system/rsync/rsyncd.conf7
-rw-r--r--system/rsync/rsyncd.confd8
-rw-r--r--system/rsync/rsyncd.initd16
-rw-r--r--system/rsync/rsyncd.logrotate9
-rw-r--r--system/sed/APKBUILD49
-rw-r--r--system/sed/disable-mbrtowc-test.patch10
-rw-r--r--system/sed/localename-test-fix.patch34
-rw-r--r--system/sed/sed.post-deinstall6
-rw-r--r--system/spice/APKBUILD43
-rw-r--r--system/ssmtp/APKBUILD52
-rw-r--r--system/ssmtp/generate_config.patch49
-rw-r--r--system/ssmtp/inet6-getaddrinfo.patch12
-rw-r--r--system/ssmtp/libcrypto-underlinking.patch11
-rw-r--r--system/strace/APKBUILD65
-rw-r--r--system/strace/disable-fortify.patch39
-rw-r--r--system/strace/fix-ppc-pt-regs-collision.patch19
-rw-r--r--system/strace/nlattr-fix.patch21
-rw-r--r--system/syslinux/APKBUILD51
-rw-r--r--system/syslinux/syslinux.post-upgrade61
-rw-r--r--system/syslinux/syslinux.trigger3
-rwxr-xr-xsystem/syslinux/update-extlinux252
-rw-r--r--system/syslinux/update-extlinux.conf75
-rw-r--r--system/tzdata/0001-posixtz-fix-up-lseek.patch27
-rw-r--r--system/tzdata/APKBUILD66
-rw-r--r--system/vlc/APKBUILD361
-rw-r--r--system/vlc/check-headless.patch13
-rw-r--r--system/vlc/disable-sub-autodetect-fuzzy-1-test.patch20
-rw-r--r--system/vlc/fribidi-update.patch83
-rw-r--r--system/vlc/omxil-rpi-codecs.patch15
-rw-r--r--system/vlc/tar-compat.patch11
-rw-r--r--system/vlc/test-s390x.patch13
-rw-r--r--system/vlc/vlc-daemon.pre-install15
-rw-r--r--system/vlc/vlc-libs.trigger5
-rw-r--r--system/vlc/vlc.confd15
-rwxr-xr-xsystem/vlc/vlc.initd32
-rw-r--r--system/zsh/APKBUILD160
-rw-r--r--system/zsh/zprofile24
-rw-r--r--system/zsh/zsh.post-install3
-rw-r--r--system/zsh/zsh.post-upgrade19
-rw-r--r--system/zsh/zsh.pre-deinstall3
190 files changed, 10969 insertions, 2693 deletions
diff --git a/system/attr/APKBUILD b/system/attr/APKBUILD
new file mode 100644
index 000000000..1a05e8d7b
--- /dev/null
+++ b/system/attr/APKBUILD
@@ -0,0 +1,75 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=attr
+pkgver=2.4.47
+pkgrel=7
+pkgdesc="Utilities for managing filesystem extended attributes"
+url="https://savannah.nongnu.org/projects/attr"
+arch="all"
+license="GPL2+ LGPL2+"
+depends=""
+options="!checkroot"
+makedepends="libtool autoconf automake bash gzip"
+checkdepends="perl"
+subpackages="$pkgname-dev $pkgname-doc libattr"
+source="http://download.savannah.nongnu.org/releases/attr/attr-$pkgver.src.tar.gz
+ fix-decls.patch
+ fix-throw.patch
+ test-runner-musl.patch
+ test-runner-perl.patch
+ "
+
+prepare() {
+ cd "$builddir"
+ default_prepare
+ update_config_sub
+
+ sed -i -e '/HAVE_ZIPPED_MANPAGES/s:=.*:=false:' \
+ include/builddefs.in
+}
+
+build() {
+ cd "$builddir"
+
+ OPTIMIZER="${CFLAGS}" DEBUG=-DNDEBUG INSTALL_USER=root INSTALL_GROUP=root ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/ \
+ --exec-prefix=/ \
+ --sbindir=/bin \
+ --bindir=/usr/bin \
+ --libdir=/lib \
+ --libexecdir=/usr/lib \
+ --includedir=/usr/include \
+ --mandir=/usr/share/man \
+ --datadir=/usr/share \
+ --disable-gettext
+ make
+}
+
+check() {
+ cd "$builddir"
+ make tests
+}
+
+package() {
+ cd "$builddir"
+ make -j1 DESTDIR="$pkgdir" \
+ install install-lib install-dev
+
+ # provided by man-pages
+ rm -r "$pkgdir"/usr/share/man/man2 \
+ "$pkgdir"/usr/share/man/man5/attr.5
+}
+
+libattr() {
+ pkgdesc="Dynamic library for extended attribute support"
+ replaces="attr"
+ mkdir -p "$subpkgdir"/lib
+ mv "$pkgdir"/lib/lib*.so.* "$subpkgdir"/lib/
+}
+
+sha512sums="2a333f63655758298650cf8f89c175efdc0112dcc4013e8d023e2a9a69f177e4bcb1f1d10b6666d6f2027dca4dec0833d54749952ab153d28367e1a72e6e2831 attr-2.4.47.src.tar.gz
+fa7925f63c611e39b28adbf8fa3838bd91c245e4694957c1a8e212cb8f289eb62e04f50806227f6c1947d432ddf7633a471c13dd08d513d1e2b8a9ac1906cb33 fix-decls.patch
+d758b864bac9bdbc3360df2e7a3bc7d04e06789975cf539b8e2b98b1d874744b55c80f0502e283f7233d6ec41f8a39624fe07b512a7fdc6af8d19dd3af5f9f5a fix-throw.patch
+da4b903ae0ba1c72bae60405745c1135d1c3c1cefd7525fca296f8dc7dac1e60e48eeba0ba80fddb035b24b847b00c5a9926d0d586c5d7989d0428e458d977d3 test-runner-musl.patch
+d10821cc73751171c6b9cc4172cf4c85be9b6e154782090a262a16fd69172a291c5d5c94587aebcf5b5d1e02c27769245d88f0aa86478193cf1a277ac7f4f18e test-runner-perl.patch"
diff --git a/system/attr/fix-decls.patch b/system/attr/fix-decls.patch
new file mode 100644
index 000000000..0de70a93d
--- /dev/null
+++ b/system/attr/fix-decls.patch
@@ -0,0 +1,35 @@
+From 667137acaffb8d0cc62b47821a67a52ba0637d5c Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Fri, 10 Jan 2014 13:56:37 +0000
+Subject: avoid glibc-specific DECLS defines
+
+This matches what we do in all the other headers.
+---
+diff --git a/include/xattr.h b/include/xattr.h
+index 70a84be..070d7c5 100644
+--- a/include/xattr.h
++++ b/include/xattr.h
+@@ -30,8 +30,9 @@
+ #define XATTR_CREATE 0x1 /* set value, fail if attr already exists */
+ #define XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */
+
+-
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+
+ extern int setxattr (const char *__path, const char *__name,
+ const void *__value, size_t __size, int __flags) __THROW;
+@@ -58,6 +59,8 @@ extern int removexattr (const char *__path, const char *__name) __THROW;
+ extern int lremovexattr (const char *__path, const char *__name) __THROW;
+ extern int fremovexattr (int __filedes, const char *__name) __THROW;
+
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+
+ #endif /* __XATTR_H__ */
+--
+cgit v0.9.0.2
diff --git a/system/attr/fix-throw.patch b/system/attr/fix-throw.patch
new file mode 100644
index 000000000..220e3ad28
--- /dev/null
+++ b/system/attr/fix-throw.patch
@@ -0,0 +1,33 @@
+From 92247401984dd9a80d9d0c8c030692323f980678 Mon Sep 17 00:00:00 2001
+From: Emmanuel Dreyfus <manu@netbsd.org>
+Date: Mon, 30 Jun 2014 13:06:05 +0000
+Subject: Portability fixes
+
+- <features.h> is Linux specific
+- Define __THROW for non glibc based systems
+---
+diff --git a/include/xattr.h b/include/xattr.h
+index 070d7c5..fd1f268 100644
+--- a/include/xattr.h
++++ b/include/xattr.h
+@@ -20,7 +20,18 @@
+ #ifndef __XATTR_H__
+ #define __XATTR_H__
+
++#if defined(linux)
+ #include <features.h>
++#endif
++
++/* Portability non glibc c++ build systems */
++#ifndef __THROW
++# if defined __cplusplus
++# define __THROW throw ()
++# else
++# define __THROW
++# endif
++#endif
+
+ #include <errno.h>
+ #ifndef ENOATTR
+--
+cgit v0.9.0.2
diff --git a/system/attr/test-runner-musl.patch b/system/attr/test-runner-musl.patch
new file mode 100644
index 000000000..082217477
--- /dev/null
+++ b/system/attr/test-runner-musl.patch
@@ -0,0 +1,11 @@
+--- attr-2.4.47/test/attr.test.old 2013-05-19 04:53:54.000000000 +0000
++++ attr-2.4.47/test/attr.test 2017-07-01 22:44:23.620785074 +0000
+@@ -11,7 +11,7 @@
+
+ $ touch f
+ $ setfattr -n user -v value f
+- > setfattr: f: Operation not supported
++ > setfattr: f: Not supported
+
+ $ setfattr -n user. -v value f
+ > setfattr: f: Invalid argument
diff --git a/system/attr/test-runner-perl.patch b/system/attr/test-runner-perl.patch
new file mode 100644
index 000000000..67e117034
--- /dev/null
+++ b/system/attr/test-runner-perl.patch
@@ -0,0 +1,11 @@
+--- attr-2.4.47/test/run.old 2013-05-19 04:53:54.000000000 +0000
++++ attr-2.4.47/test/run 2017-07-01 22:43:09.541515814 +0000
+@@ -84,7 +84,7 @@
+ if (defined $line) {
+ # Substitute %VAR and %{VAR} with environment variables.
+ $line =~ s[%(\w+)][$ENV{$1}]eg;
+- $line =~ s[%{(\w+)}][$ENV{$1}]eg;
++ $line =~ s[%\{(\w+)\}][$ENV{$1}]eg;
+ }
+ if (defined $line) {
+ if ($line =~ s/^\s*< ?//) {
diff --git a/system/autoconf/APKBUILD b/system/autoconf/APKBUILD
new file mode 100644
index 000000000..deceea9f9
--- /dev/null
+++ b/system/autoconf/APKBUILD
@@ -0,0 +1,45 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=autoconf
+pkgver=2.69
+pkgrel=1
+pkgdesc="A GNU tool for automatically configuring source code"
+arch="noarch"
+license="GPL2+"
+url="http://www.gnu.org/software/autoconf"
+depends="m4 perl"
+subpackages="$pkgname-doc"
+source="ftp://ftp.gnu.org/pub/gnu/$pkgname/$pkgname-$pkgver.tar.gz
+ autoconf-2.69-fix-perl-regex.patch
+ "
+
+builddir="$srcdir"/$pkgname-$pkgver
+prepare() {
+ update_config_sub
+ default_prepare
+}
+
+build() {
+ cd "$builddir"
+ M4=/usr/bin/m4 ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr
+ make
+}
+
+check() {
+ cd "$builddir"
+ # 38 fails with new perl; 501 fails with new libtool
+ make check TESTSUITEFLAGS="1-37 39-500 502-503"
+}
+
+package() {
+ cd "$builddir"
+ make DESTDIR="$pkgdir" install
+ rm -f "$pkgdir"/usr/share/info/dir
+ # conflict with bintuils
+ rm -f "$pkgdir"/usr/share/info/standards.info
+}
+
+sha512sums="e34c7818bcde14d2cb13cdd293ed17d70740d4d1fd7c67a07b415491ef85d42f450d4fe5f8f80cc330bf75c40a62774c51a4336e06e8da07a4cbc49922d975ee autoconf-2.69.tar.gz
+8b779ecec178091c899b75df4471fb72334a062d6b413502d414e8827fe0c9e2f335a8bef6878ae261e1af1568e3fe71fe82d6b5e53cb54e6585ffd91f069d8d autoconf-2.69-fix-perl-regex.patch"
diff --git a/system/autoconf/autoconf-2.69-fix-perl-regex.patch b/system/autoconf/autoconf-2.69-fix-perl-regex.patch
new file mode 100644
index 000000000..9cccf912b
--- /dev/null
+++ b/system/autoconf/autoconf-2.69-fix-perl-regex.patch
@@ -0,0 +1,11 @@
+--- autoconf-2.69/bin/autoscan.in.old 2012-04-25 02:37:26.000000000 +0000
++++ autoconf-2.69/bin/autoscan.in 2017-08-03 23:59:38.720214631 +0000
+@@ -358,7 +358,7 @@
+ {
+ # Strip out comments and variable references.
+ s/#.*//;
+- s/\${[^\}]*}//g;
++ s/\$\{[^\}]*\}//g;
+ s/@[^@]*@//g;
+
+ # Tokens in the code.
diff --git a/system/boost/APKBUILD b/system/boost/APKBUILD
new file mode 100644
index 000000000..9024cb9fe
--- /dev/null
+++ b/system/boost/APKBUILD
@@ -0,0 +1,145 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=boost
+pkgver=1.62.0
+_pkgver="${pkgver//./_}"
+pkgrel=6
+pkgdesc="Free peer-reviewed portable C++ source libraries"
+url="http://www.boost.org/"
+arch="all"
+license="custom"
+options="!check" # No test suite.
+depends=""
+depends_dev="linux-headers"
+makedepends="$depends_dev python3-dev flex bison bzip2-dev zlib-dev"
+subpackages="$pkgname-dev $pkgname-doc"
+source="http://downloads.sourceforge.net/$pkgname/${pkgname}_$_pkgver.tar.bz2
+ libressl.patch
+ boost-1.57.0-python-abi_letters.patch
+ boost-1.57.0-python-libpython_dep.patch
+ "
+builddir="$srcdir/${pkgname}_${_pkgver}"
+
+_libs="date_time
+ filesystem
+ graph
+ iostreams
+ math
+ prg_exec_monitor
+ program_options
+ python3
+ random
+ regex
+ serialization
+ signals
+ system
+ thread
+ unit_test_framework
+ wave
+ wserialization
+ "
+for _lib in $_libs; do
+ subpackages="$subpackages $pkgname-$_lib:_boostlib"
+done
+
+prepare() {
+ default_prepare || return 1
+
+ cd "$builddir"
+
+ PY3_VERSION="$(_pyversion python3)"
+ abiflags=$(python3-config --abiflags)
+
+
+ # create user-config.jam
+ cat > user-config.jam <<-__EOF__
+
+ using gcc : : $CC : <cxxflags>"${CXXFLAGS}" <linkflags>"${LDFLAGS}" ;
+ using python : ${PY3_VERSION} : /usr/bin/python3 : /usr/include/python${PY3_VERSION}m : : : : $abiflags ;
+
+ __EOF__
+}
+
+case "$CARCH" in
+ armhf|aarch64) _boostarch=arm ;;
+ ppc64*) _boostarch=ppc ;;
+ s390x) _boostarch=s390 ;;
+ pmmx) _boostarch=x86 ;;
+ *) _boostarch=$CARCH ;;
+esac
+_enginedir=tools/build/src/engine
+_bjam="${builddir}/$_enginedir/bin.linux${_boostarch}/bjam"
+[ "$_boostarch" = "s390" ] && _bjam="${builddir}/$_enginedir/bin.linux390/bjam" && \
+ _options_s390="--without-context --without-coroutine --without-coroutine2"
+
+_options="--user-config=\"$builddir/user-config.jam\"
+ --prefix=\"$pkgdir/usr\"
+ release
+ debug-symbols=off
+ threading=single,multi
+ runtime-link=shared
+ link=shared,static
+ cflags=-fno-strict-aliasing
+ -sPYTHON_ROOT=/usr
+ -sTOOLS=gcc
+ --layout=tagged
+ -q
+ -j${JOBS:-2}
+ ${_options_s390}
+ "
+
+build() {
+ export BOOST_ROOT="$builddir"
+
+ msg "Building bjam"
+ cd "$builddir"/$_enginedir
+ CC= ./build.sh cc || return 1
+
+ msg "Building bcp"
+ cd "$builddir"/tools/bcp
+ "$_bjam" -j${JOBS:-2} || return 1
+
+ msg "Building boost"
+ cd "$builddir"
+ "$_bjam" $_options
+}
+
+package() {
+ export BOOST_ROOT="$builddir"
+ cd "$builddir"
+
+ install -Dm755 $_bjam \
+ "$pkgdir"/usr/bin/bjam || return 1
+
+ install -Dm755 dist/bin/bcp "$pkgdir"/usr/bin/bcp || return 1
+
+ install -Dm644 LICENSE_1_0.txt \
+ "$pkgdir"/usr/share/licenses/$pkgname/LICENSE_1_0.txt || return 1
+
+ "$pkgdir"/usr/bin/bjam $_options \
+ --includedir="$pkgdir"/usr/include \
+ --libdir="$pkgdir"/usr/lib \
+ install || return 1
+
+ cd libs/python/pyste/install
+ python3 setup.py install --root="$pkgdir" || return 1
+}
+
+_boostlib() {
+ local name="${subpkgname#$pkgname-}"
+ pkgdesc="Boost $name library"
+ case "$name" in
+ python*) depends="$depends $name"
+ esac
+
+ mkdir -p "$subpkgdir"/usr/lib
+ mv "$pkgdir"/usr/lib/libboost_$name* "$subpkgdir"/usr/lib/
+}
+
+_pyversion() {
+ $1 -c 'import sys; print("%i.%i" % (sys.version_info.major, sys.version_info.minor))'
+}
+
+sha512sums="5385ae3d5255a433a704169ad454d8dc2b0b5bcae3fb23defd6570df4ff7d845cf9fcbeebccdc1c5db0eec9f82ee3d90040de9507c8167467c635d3b215463be boost_1_62_0.tar.bz2
+5804c344b5e5ece17811e744f1965c58840b6695a084dd09c23c9db380f3cbfbca201d6c595b5379bc12ff6f285794509799d28864df6037db6212c63adb2207 libressl.patch
+d96d4d37394a31764ed817d0bc4a99cffa68a75ff1ecfd4417b9e1e5ae2c31a96ed24f948c6f2758ffdac01328d2402c4cf0d33a37107e4f5f721e636daebd66 boost-1.57.0-python-abi_letters.patch
+132c4b62815d605c2d3c9038427fa4f422612a33711d47b2862f2311516af8a371d6b75bf078a7bffe20be863f8d21fb9fe74dc1a1bac3a10d061e9768ec3e02 boost-1.57.0-python-libpython_dep.patch"
diff --git a/system/boost/boost-1.57.0-python-abi_letters.patch b/system/boost/boost-1.57.0-python-abi_letters.patch
new file mode 100644
index 000000000..7df3ee704
--- /dev/null
+++ b/system/boost/boost-1.57.0-python-abi_letters.patch
@@ -0,0 +1,62 @@
+--- boost_1_57_0/tools/build/src/tools/python.jam 2013-05-21 06:14:18.000000000 +0200
++++ boost_1_55_0/tools/build/src/tools/python.jam 2014-05-29 19:09:12.115413877 +0200
+@@ -94,7 +94,7 @@ feature.feature pythonpath : : free opti
+ # using python : 2.3 : /usr/local/bin/python ;
+ #
+ rule init ( version ? : cmd-or-prefix ? : includes * : libraries ?
+- : condition * : extension-suffix ? )
++ : condition * : extension-suffix ? : abi-letters ? )
+ {
+ project.push-current $(.project) ;
+
+@@ -107,7 +107,7 @@ rule init ( version ? : cmd-or-prefix ?
+ }
+ }
+
+- configure $(version) : $(cmd-or-prefix) : $(includes) : $(libraries) : $(condition) : $(extension-suffix) ;
++ configure $(version) : $(cmd-or-prefix) : $(includes) : $(libraries) : $(condition) : $(extension-suffix) : $(abi-letters) ;
+
+ project.pop-current ;
+ }
+@@ -653,7 +653,7 @@ local rule system-library-dependencies (
+
+ # Declare a target to represent Python's library.
+ #
+-local rule declare-libpython-target ( version ? : requirements * )
++local rule declare-libpython-target ( version ? : requirements * : abi-letters ? )
+ {
+ # Compute the representation of Python version in the name of Python's
+ # library file.
+@@ -677,13 +677,13 @@ local rule declare-libpython-target ( ve
+ }
+
+ # Declare it.
+- lib python.lib : : <name>python$(lib-version) $(requirements) ;
++ lib python.lib : : <name>python$(lib-version)$(abi-letters) $(requirements) ;
+ }
+
+
+ # Implementation of init.
+ local rule configure ( version ? : cmd-or-prefix ? : includes * : libraries ? :
+- condition * : extension-suffix ? )
++ condition * : extension-suffix ? : abi-letters ? )
+ {
+ local prefix ;
+ local exec-prefix ;
+@@ -699,6 +699,7 @@ local rule configure ( version ? : cmd-o
+ extension-suffix ?= _d ;
+ }
+ extension-suffix ?= "" ;
++ abi-letters ?= "" ;
+
+ # Normalize and dissect any version number.
+ local major-minor ;
+@@ -922,7 +923,7 @@ local rule configure ( version ? : cmd-o
+ }
+ else
+ {
+- declare-libpython-target $(version) : $(target-requirements) ;
++ declare-libpython-target $(version) : $(target-requirements) : $(abi-letters) ;
+
+ # This is an evil hack. On, Windows, when Python is embedded, nothing
+ # seems to set up sys.path to include Python's standard library
diff --git a/system/boost/boost-1.57.0-python-libpython_dep.patch b/system/boost/boost-1.57.0-python-libpython_dep.patch
new file mode 100644
index 000000000..57bfc2677
--- /dev/null
+++ b/system/boost/boost-1.57.0-python-libpython_dep.patch
@@ -0,0 +1,13 @@
+Index: boost_1_57_0/tools/build/src/tools/python.jam
+===================================================================
+--- boost_1_57_0/tools/build/src/tools/python.jam (revision 50406)
++++ boost_1_57_0/tools/build/src/tools/python.jam (working copy)
+@@ -994,7 +994,7 @@
+ else
+ {
+ alias python_for_extensions
+- :
++ : python
+ : $(target-requirements)
+ :
+ : $(usage-requirements)
diff --git a/system/boost/dual-python.patch b/system/boost/dual-python.patch
new file mode 100644
index 000000000..6a0647888
--- /dev/null
+++ b/system/boost/dual-python.patch
@@ -0,0 +1,27 @@
+diff --git a/tools/build/src/tools/python.jam b/tools/build/src/tools/python.jam
+index cbd6419..0c29df6 100644
+--- a/tools/build/src/tools/python.jam
++++ b/tools/build/src/tools/python.jam
+@@ -907,14 +907,14 @@ local rule configure ( version ? : cmd-or-prefix ? : includes * : libraries ? :
+ # for a particular target OS as the default. This makes it so that we can
+ # select a python interpreter with only knowledge of the target OS. And hence
+ # can configure different Pythons based on the target OS only.
+- local toolset-requirements = [ toolset.requirements ] ;
+- local toolset-target-os-requirements
+- = [ property.evaluate-conditionals-in-context
+- [ $(toolset-requirements).raw ] : <target-os>$(target-os) ] ;
+- if ! <python> in $(toolset-target-os-requirements:G)
+- {
+- toolset.add-requirements <target-os>$(target-os):<python>$(version:E=default) ;
+- }
++# local toolset-requirements = [ toolset.requirements ] ;
++# local toolset-target-os-requirements
++# = [ property.evaluate-conditionals-in-context
++# [ $(toolset-requirements).raw ] : <target-os>$(target-os) ] ;
++# if ! <python> in $(toolset-target-os-requirements:G)
++# {
++# toolset.add-requirements <target-os>$(target-os):<python>$(version:E=default) ;
++# }
+
+ # Register the right suffix for extensions.
+ register-extension-suffix $(extension-suffix) : $(target-requirements) ;
diff --git a/system/boost/libressl.patch b/system/boost/libressl.patch
new file mode 100644
index 000000000..30c13bfcc
--- /dev/null
+++ b/system/boost/libressl.patch
@@ -0,0 +1,146 @@
+diff --git a/boost/asio/ssl/detail/impl/engine.ipp b/boost/asio/ssl/detail/impl/engine.ipp
+index f15f2e3..d33935f 100644
+--- a/boost/asio/ssl/detail/impl/engine.ipp
++++ b/boost/asio/ssl/detail/impl/engine.ipp
+@@ -209,7 +209,7 @@ const boost::system::error_code& engine::map_error_code(
+
+ // SSL v2 doesn't provide a protocol-level shutdown, so an eof on the
+ // underlying transport is passed through.
+-#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
++#if (OPENSSL_VERSION_NUMBER < 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER)
+ if (ssl_->version == SSL2_VERSION)
+ return ec;
+ #endif // (OPENSSL_VERSION_NUMBER < 0x10100000L)
+diff --git a/boost/asio/ssl/detail/impl/openssl_init.ipp b/boost/asio/ssl/detail/impl/openssl_init.ipp
+index 94b67f3..acbd926 100644
+--- a/boost/asio/ssl/detail/impl/openssl_init.ipp
++++ b/boost/asio/ssl/detail/impl/openssl_init.ipp
+@@ -40,7 +40,7 @@ public:
+ ::SSL_load_error_strings();
+ ::OpenSSL_add_all_algorithms();
+
+-#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
++#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER)
+ mutexes_.resize(::CRYPTO_num_locks());
+ for (size_t i = 0; i < mutexes_.size(); ++i)
+ mutexes_[i].reset(new boost::asio::detail::mutex);
+@@ -68,7 +68,7 @@ public:
+ #if (OPENSSL_VERSION_NUMBER < 0x10000000L)
+ ::CRYPTO_set_id_callback(0);
+ #endif // (OPENSSL_VERSION_NUMBER < 0x10000000L)
+-#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
++#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER)
+ ::CRYPTO_set_locking_callback(0);
+ ::ERR_free_strings();
+ ::EVP_cleanup();
+@@ -76,7 +76,7 @@ public:
+ #endif // (OPENSSL_VERSION_NUMBER < 0x10100000L)
+ #if (OPENSSL_VERSION_NUMBER < 0x10000000L)
+ ::ERR_remove_state(0);
+-#elif (OPENSSL_VERSION_NUMBER < 0x10100000L)
++#elif (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER)
+ ::ERR_remove_thread_state(NULL);
+ #endif // (OPENSSL_VERSION_NUMBER < 0x10000000L)
+ #if (OPENSSL_VERSION_NUMBER >= 0x10002000L) \
+@@ -117,7 +117,7 @@ private:
+ }
+ #endif // (OPENSSL_VERSION_NUMBER < 0x10000000L)
+
+-#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
++#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER)
+ static void openssl_locking_func(int mode, int n,
+ const char* /*file*/, int /*line*/)
+ {
+diff --git a/boost/asio/ssl/error.hpp b/boost/asio/ssl/error.hpp
+index 7f85fbd..7e07e65 100644
+--- a/boost/asio/ssl/error.hpp
++++ b/boost/asio/ssl/error.hpp
+@@ -44,7 +44,7 @@ enum stream_errors
+ #if defined(GENERATING_DOCUMENTATION)
+ /// The underlying stream closed before the ssl stream gracefully shut down.
+ stream_truncated
+-#elif (OPENSSL_VERSION_NUMBER < 0x10100000L) && !defined(OPENSSL_IS_BORINGSSL)
++#elif ((OPENSSL_VERSION_NUMBER < 0x10100000L) && !defined(OPENSSL_IS_BORINGSSL)) || defined(LIBRESSL_VERSION_NUMBER)
+ stream_truncated = ERR_PACK(ERR_LIB_SSL, 0, SSL_R_SHORT_READ)
+ #else
+ stream_truncated = 1
+diff --git a/boost/asio/ssl/impl/context.ipp b/boost/asio/ssl/impl/context.ipp
+index aea2cbd..3ef8c86 100644
+--- a/boost/asio/ssl/impl/context.ipp
++++ b/boost/asio/ssl/impl/context.ipp
+@@ -130,7 +130,7 @@ context::context(context::method m)
+ case context::sslv23_server:
+ handle_ = ::SSL_CTX_new(::SSLv23_server_method());
+ break;
+-#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
++#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER)
+ #if defined(SSL_TXT_TLSV1_1)
+ case context::tlsv11:
+ handle_ = ::SSL_CTX_new(::TLSv1_1_method());
+@@ -228,7 +228,7 @@ context::~context()
+ {
+ if (handle_)
+ {
+-#if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
++#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER)
+ void* cb_userdata = ::SSL_CTX_get_default_passwd_cb_userdata(handle_);
+ #else // (OPENSSL_VERSION_NUMBER >= 0x10100000L)
+ void* cb_userdata = handle_->default_passwd_callback_userdata;
+@@ -239,7 +239,7 @@ context::~context()
+ static_cast<detail::password_callback_base*>(
+ cb_userdata);
+ delete callback;
+-#if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
++#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER)
+ ::SSL_CTX_set_default_passwd_cb_userdata(handle_, 0);
+ #else // (OPENSSL_VERSION_NUMBER >= 0x10100000L)
+ handle_->default_passwd_callback_userdata = 0;
+@@ -578,7 +578,7 @@ boost::system::error_code context::use_certificate_chain(
+ bio_cleanup bio = { make_buffer_bio(chain) };
+ if (bio.p)
+ {
+-#if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
++#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER)
+ pem_password_cb* callback = ::SSL_CTX_get_default_passwd_cb(handle_);
+ void* cb_userdata = ::SSL_CTX_get_default_passwd_cb_userdata(handle_);
+ #else // (OPENSSL_VERSION_NUMBER >= 0x10100000L)
+@@ -682,7 +682,7 @@ boost::system::error_code context::use_private_key(
+ {
+ ::ERR_clear_error();
+
+-#if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
++#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER)
+ pem_password_cb* callback = ::SSL_CTX_get_default_passwd_cb(handle_);
+ void* cb_userdata = ::SSL_CTX_get_default_passwd_cb_userdata(handle_);
+ #else // (OPENSSL_VERSION_NUMBER >= 0x10100000L)
+@@ -749,7 +749,7 @@ boost::system::error_code context::use_rsa_private_key(
+ {
+ ::ERR_clear_error();
+
+-#if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
++#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER)
+ pem_password_cb* callback = ::SSL_CTX_get_default_passwd_cb(handle_);
+ void* cb_userdata = ::SSL_CTX_get_default_passwd_cb_userdata(handle_);
+ #else // (OPENSSL_VERSION_NUMBER >= 0x10100000L)
+@@ -988,7 +988,7 @@ int context::verify_callback_function(int preverified, X509_STORE_CTX* ctx)
+ boost::system::error_code context::do_set_password_callback(
+ detail::password_callback_base* callback, boost::system::error_code& ec)
+ {
+-#if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
++#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER)
+ void* old_callback = ::SSL_CTX_get_default_passwd_cb_userdata(handle_);
+ ::SSL_CTX_set_default_passwd_cb_userdata(handle_, callback);
+ #else // (OPENSSL_VERSION_NUMBER >= 0x10100000L)
+diff --git a/boost/asio/ssl/impl/error.ipp b/boost/asio/ssl/impl/error.ipp
+index e82afba..1629794 100644
+--- a/boost/asio/ssl/impl/error.ipp
++++ b/boost/asio/ssl/impl/error.ipp
+@@ -53,7 +53,7 @@ const boost::system::error_category& get_ssl_category()
+ namespace ssl {
+ namespace error {
+
+-#if (OPENSSL_VERSION_NUMBER < 0x10100000L) && !defined(OPENSSL_IS_BORINGSSL)
++#if ((OPENSSL_VERSION_NUMBER < 0x10100000L) && !defined(OPENSSL_IS_BORINGSSL)) || defined(LIBRESSL_VERSION_NUMBER)
+
+ const boost::system::error_category& get_stream_category()
+ {
diff --git a/system/busybox/0001-ash-add-support-for-command_not_found_handle-hook-fu.patch b/system/busybox/0001-ash-add-support-for-command_not_found_handle-hook-fu.patch
new file mode 100644
index 000000000..e4ba6ece5
--- /dev/null
+++ b/system/busybox/0001-ash-add-support-for-command_not_found_handle-hook-fu.patch
@@ -0,0 +1,63 @@
+From f76c1ddd625b3d9912d9e6df2e90fcb94d08be99 Mon Sep 17 00:00:00 2001
+From: William Pitcock <nenolod@dereferenced.org>
+Date: Thu, 19 Oct 2017 17:24:40 +0000
+Subject: [PATCH] ash: add support for command_not_found_handle hook function,
+ like bash
+
+This implements support for the command_not_found_handle hook function, which is
+useful for allowing package managers to suggest packages which could provide the
+command.
+
+Unlike bash, however, we ignore exit codes from the hook function and always return
+the correct POSIX error code (EX_NOTFOUND).
+
+Signed-off-by: William Pitcock <nenolod@dereferenced.org>
+---
+ shell/ash.c | 24 ++++++++++++++++++++++--
+ 1 file changed, 22 insertions(+), 2 deletions(-)
+
+diff --git a/shell/ash.c b/shell/ash.c
+index 88e607f08..c3c4f4e93 100644
+--- a/shell/ash.c
++++ b/shell/ash.c
+@@ -132,6 +132,15 @@
+ //config: you to run the specified command or builtin,
+ //config: even when there is a function with the same name.
+ //config:
++//config:config ASH_COMMAND_NOT_FOUND_HOOK
++//config: bool "command_not_found_handle hook support"
++//config: default y
++//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
++//config: help
++//config: Enable support for the 'command_not_found_handle' hook function,
++//config: from GNU bash, which allows for alternative command not found
++//config: handling.
++//config:
+ //config:endif # ash options
+
+ //applet:IF_ASH(APPLET(ash, BB_DIR_BIN, BB_SUID_DROP))
+@@ -13123,8 +13132,19 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path)
+ /* We failed. If there was an entry for this command, delete it */
+ if (cmdp && updatetbl)
+ delete_cmd_entry();
+- if (act & DO_ERR)
+- ash_msg("%s: %s", name, errmsg(e, "not found"));
++ if (act & DO_ERR) {
++#ifdef CONFIG_ASH_COMMAND_NOT_FOUND_HOOK
++#define HOOKFN_NAME "command_not_found_handle"
++ char hookfn_name[] = HOOKFN_NAME;
++ struct tblentry *hookp = cmdlookup(hookfn_name, 0);
++ if (hookp != NULL && hookp->cmdtype == CMDFUNCTION) {
++ evalfun(hookp->param.func, 2, (char *[]){ hookfn_name, name }, 0);
++ entry->cmdtype = CMDUNKNOWN;
++ return;
++ } else
++#endif
++ ash_msg("%s: %s", name, errmsg(e, "not found"));
++ }
+ entry->cmdtype = CMDUNKNOWN;
+ return;
+
+--
+2.14.2
+
diff --git a/system/busybox/0001-ash-exec-busybox.static.patch b/system/busybox/0001-ash-exec-busybox.static.patch
new file mode 100644
index 000000000..fdf134960
--- /dev/null
+++ b/system/busybox/0001-ash-exec-busybox.static.patch
@@ -0,0 +1,25 @@
+From 134582e8dd1c85cbcf1fc047956a57fcd642e46a Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Thu, 4 Aug 2016 11:03:07 +0200
+Subject: [PATCH 01/11] ash: exec busybox.static
+
+---
+ shell/ash.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/shell/ash.c b/shell/ash.c
+index b7635a823..e613ee6bb 100644
+--- a/shell/ash.c
++++ b/shell/ash.c
+@@ -7721,6 +7721,8 @@ tryexec(IF_FEATURE_SH_STANDALONE(int applet_no,) char *cmd, char **argv, char **
+ }
+ /* re-exec ourselves with the new arguments */
+ execve(bb_busybox_exec_path, argv, envp);
++ execve("/bin/busybox.static",argv,envp);
++ execve("/bin/busybox",argv,envp);
+ /* If they called chroot or otherwise made the binary no longer
+ * executable, fall through */
+ }
+--
+2.13.2
+
diff --git a/system/busybox/0002-app-location-for-cpio-vi-and-lspci.patch b/system/busybox/0002-app-location-for-cpio-vi-and-lspci.patch
new file mode 100644
index 000000000..8c8e4ee7a
--- /dev/null
+++ b/system/busybox/0002-app-location-for-cpio-vi-and-lspci.patch
@@ -0,0 +1,54 @@
+From 8937e2dfb3dbfa23597853e9605f930b3607fa63 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Tue, 27 Dec 2016 20:46:59 +0100
+Subject: [PATCH 02/11] app location for cpio, vi and lspci
+
+Adjust location to where alpine linux installs them
+---
+ archival/cpio.c | 2 +-
+ editors/vi.c | 2 +-
+ util-linux/lspci.c | 2 +-
+ 3 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/archival/cpio.c b/archival/cpio.c
+index 683f0bb1f..45362b6bc 100644
+--- a/archival/cpio.c
++++ b/archival/cpio.c
+@@ -43,7 +43,7 @@
+ //config: help
+ //config: Passthrough mode. Rarely used.
+
+-//applet:IF_CPIO(APPLET(cpio, BB_DIR_BIN, BB_SUID_DROP))
++//applet:IF_CPIO(APPLET(cpio, BB_DIR_USR_BIN, BB_SUID_DROP))
+ //kbuild:lib-$(CONFIG_CPIO) += cpio.o
+
+ //usage:#define cpio_trivial_usage
+diff --git a/editors/vi.c b/editors/vi.c
+index 76d1f261b..73d0a67a9 100644
+--- a/editors/vi.c
++++ b/editors/vi.c
+@@ -163,7 +163,7 @@
+ //config: Unless you want more (or less) frequent "undo points" while typing,
+ //config: you should probably leave this unchanged.
+
+-//applet:IF_VI(APPLET(vi, BB_DIR_BIN, BB_SUID_DROP))
++//applet:IF_VI(APPLET(vi, BB_DIR_USR_BIN, BB_SUID_DROP))
+
+ //kbuild:lib-$(CONFIG_VI) += vi.o
+
+diff --git a/util-linux/lspci.c b/util-linux/lspci.c
+index 8b38a2366..f918f0972 100644
+--- a/util-linux/lspci.c
++++ b/util-linux/lspci.c
+@@ -16,7 +16,7 @@
+ //config:
+ //config: This version uses sysfs (/sys/bus/pci/devices) only.
+
+-//applet:IF_LSPCI(APPLET(lspci, BB_DIR_USR_BIN, BB_SUID_DROP))
++//applet:IF_LSPCI(APPLET(lspci, BB_DIR_USR_SBIN, BB_SUID_DROP))
+
+ //kbuild:lib-$(CONFIG_LSPCI) += lspci.o
+
+--
+2.13.2
+
diff --git a/system/busybox/0003-udhcpc-set-default-discover-retries-to-5.patch b/system/busybox/0003-udhcpc-set-default-discover-retries-to-5.patch
new file mode 100644
index 000000000..5671ee1b0
--- /dev/null
+++ b/system/busybox/0003-udhcpc-set-default-discover-retries-to-5.patch
@@ -0,0 +1,35 @@
+From 18415adc1cd9993a95d100dd773daf69b8ec819e Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Thu, 4 Aug 2016 11:08:35 +0200
+Subject: [PATCH 03/11] udhcpc: set default discover retries to 5
+
+Some slower nics needs more attempts to get a lease
+---
+ networking/udhcp/dhcpc.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
+index 1a66c610e..43aac1b85 100644
+--- a/networking/udhcp/dhcpc.c
++++ b/networking/udhcp/dhcpc.c
+@@ -1191,7 +1191,7 @@ static void client_background(void)
+ //usage: "\n -s,--script PROG Run PROG at DHCP events (default "CONFIG_UDHCPC_DEFAULT_SCRIPT")"
+ //usage: "\n -p,--pidfile FILE Create pidfile"
+ //usage: "\n -B,--broadcast Request broadcast replies"
+-//usage: "\n -t,--retries N Send up to N discover packets (default 3)"
++//usage: "\n -t,--retries N Send up to N discover packets (default 5)"
+ //usage: "\n -T,--timeout SEC Pause between packets (default 3)"
+ //usage: "\n -A,--tryagain SEC Wait if lease is not obtained (default 20)"
+ //usage: "\n -n,--now Exit if lease is not obtained"
+@@ -1274,7 +1274,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
+ llist_t *list_x = NULL;
+ int tryagain_timeout = 20;
+ int discover_timeout = 3;
+- int discover_retries = 3;
++ int discover_retries = 5;
+ uint32_t server_addr = server_addr; /* for compiler */
+ uint32_t requested_ip = 0;
+ uint32_t xid = xid; /* for compiler */
+--
+2.13.2
+
diff --git a/system/busybox/0004-ping-make-ping-work-without-root-privileges.patch b/system/busybox/0004-ping-make-ping-work-without-root-privileges.patch
new file mode 100644
index 000000000..77fa5ed76
--- /dev/null
+++ b/system/busybox/0004-ping-make-ping-work-without-root-privileges.patch
@@ -0,0 +1,197 @@
+From bef770d1ee4179e380dff24305d9b6d899147add Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Tue, 29 Mar 2016 18:59:22 +0200
+Subject: [PATCH 04/11] ping: make ping work without root privileges
+
+---
+ networking/ping.c | 103 +++++++++++++++++++++++++++++++++++++++++++++---------
+ 1 file changed, 87 insertions(+), 16 deletions(-)
+
+diff --git a/networking/ping.c b/networking/ping.c
+index 94fb007f5..26e40e1fc 100644
+--- a/networking/ping.c
++++ b/networking/ping.c
+@@ -155,6 +155,7 @@ enum {
+ pingsock = 0,
+ };
+
++static int using_dgram;
+ static void
+ #if ENABLE_PING6
+ create_icmp_socket(len_and_sockaddr *lsa)
+@@ -171,9 +172,23 @@ create_icmp_socket(void)
+ #endif
+ sock = socket(AF_INET, SOCK_RAW, 1); /* 1 == ICMP */
+ if (sock < 0) {
+- if (errno == EPERM)
+- bb_error_msg_and_die(bb_msg_perm_denied_are_you_root);
+- bb_perror_msg_and_die(bb_msg_can_not_create_raw_socket);
++ if (errno != EPERM)
++ bb_perror_msg_and_die(bb_msg_can_not_create_raw_socket);
++#if defined(__linux__) || defined(__APPLE__)
++ /* We don't have root privileges. Try SOCK_DGRAM instead.
++ * Linux needs net.ipv4.ping_group_range for this to work.
++ * MacOSX allows ICMP_ECHO, ICMP_TSTAMP or ICMP_MASKREQ
++ */
++#if ENABLE_PING6
++ if (lsa->u.sa.sa_family == AF_INET6)
++ sock = socket(AF_INET6, SOCK_DGRAM, IPPROTO_ICMPV6);
++ else
++#endif
++ sock = socket(AF_INET, SOCK_DGRAM, 1); /* 1 == ICMP */
++ if (sock < 0)
++#endif
++ bb_error_msg_and_die(bb_msg_perm_denied_are_you_root);
++ using_dgram = 1;
+ }
+
+ xmove_fd(sock, pingsock);
+@@ -226,10 +241,12 @@ static void ping4(len_and_sockaddr *lsa)
+ bb_perror_msg("recvfrom");
+ continue;
+ }
+- if (c >= 76) { /* ip + icmp */
+- struct iphdr *iphdr = (struct iphdr *) G.packet;
++ if (c >= 76 || using_dgram && (c == 64)) { /* ip + icmp */
++ if(!using_dgram) {
++ struct iphdr *iphdr = (struct iphdr *) G.packet;
+
+- pkt = (struct icmp *) (G.packet + (iphdr->ihl << 2)); /* skip ip hdr */
++ pkt = (struct icmp *) (G.packet + (iphdr->ihl << 2)); /* skip ip hdr */
++ } else pkt = (struct icmp *) G.packet;
+ if (pkt->icmp_id != G.myid)
+ continue; /* not our ping */
+ if (pkt->icmp_type == ICMP_ECHOREPLY)
+@@ -627,19 +644,21 @@ static void unpack_tail(int sz, uint32_t *tp,
+ }
+ static void unpack4(char *buf, int sz, struct sockaddr_in *from)
+ {
+- struct icmp *icmppkt;
+ struct iphdr *iphdr;
++ struct icmp *icmppkt;
+ int hlen;
+
+ /* discard if too short */
+ if (sz < (datalen + ICMP_MINLEN))
+ return;
++ if(!using_dgram) {
++ /* check IP header */
++ iphdr = (struct iphdr *) buf;
++ hlen = iphdr->ihl << 2;
++ sz -= hlen;
++ icmppkt = (struct icmp *) (buf + hlen);
++ } else icmppkt = (struct icmp *) buf;
+
+- /* check IP header */
+- iphdr = (struct iphdr *) buf;
+- hlen = iphdr->ihl << 2;
+- sz -= hlen;
+- icmppkt = (struct icmp *) (buf + hlen);
+ if (icmppkt->icmp_id != myid)
+ return; /* not our ping */
+
+@@ -651,7 +670,7 @@ static void unpack4(char *buf, int sz, struct sockaddr_in *from)
+ tp = (uint32_t *) icmppkt->icmp_data;
+ unpack_tail(sz, tp,
+ inet_ntoa(*(struct in_addr *) &from->sin_addr.s_addr),
+- recv_seq, iphdr->ttl);
++ recv_seq, using_dgram ? 42 : iphdr->ttl);
+ } else if (icmppkt->icmp_type != ICMP_ECHO) {
+ bb_error_msg("warning: got ICMP %d (%s)",
+ icmppkt->icmp_type,
+@@ -695,11 +714,31 @@ static void ping4(len_and_sockaddr *lsa)
+ int sockopt;
+
+ pingaddr.sin = lsa->u.sin;
+- if (source_lsa) {
++ if (source_lsa && !using_dgram) {
+ if (setsockopt(pingsock, IPPROTO_IP, IP_MULTICAST_IF,
+ &source_lsa->u.sa, source_lsa->len))
+ bb_error_msg_and_die("can't set multicast source interface");
+ xbind(pingsock, &source_lsa->u.sa, source_lsa->len);
++ } else if(using_dgram) {
++ struct sockaddr_in sa;
++ socklen_t sl;
++
++ sa.sin_family = AF_INET;
++ sa.sin_port = 0;
++ sa.sin_addr.s_addr = source_lsa ?
++ source_lsa->u.sin.sin_addr.s_addr : 0;
++ sl = sizeof(sa);
++
++ if (bind(pingsock, (struct sockaddr *) &sa, sl) == -1) {
++ perror("bind");
++ exit(2);
++ }
++
++ if (getsockname(pingsock, (struct sockaddr *) &sa, &sl) == -1) {
++ perror("getsockname");
++ exit(2);
++ }
++ myid = sa.sin_port;
+ }
+
+ /* enable broadcast pings */
+@@ -716,6 +755,15 @@ static void ping4(len_and_sockaddr *lsa)
+ setsockopt_int(pingsock, IPPROTO_IP, IP_MULTICAST_TTL, opt_ttl);
+ }
+
++ if(using_dgram) {
++ int hold = 65536;
++ if (setsockopt(pingsock, SOL_IP, IP_RECVTTL, (char *)&hold, sizeof(hold)))
++ perror("WARNING: setsockopt(IP_RECVTTL)");
++ if (setsockopt(pingsock, SOL_IP, IP_RETOPTS, (char *)&hold, sizeof(hold)))
++ perror("WARNING: setsockopt(IP_RETOPTS)");
++
++ }
++
+ signal(SIGINT, print_stats_and_exit);
+
+ /* start the ping's going ... */
+@@ -749,10 +797,33 @@ static void ping6(len_and_sockaddr *lsa)
+ char control_buf[CMSG_SPACE(36)];
+
+ pingaddr.sin6 = lsa->u.sin6;
+- if (source_lsa)
++ if (source_lsa && !using_dgram)
+ xbind(pingsock, &source_lsa->u.sa, source_lsa->len);
++ else if(using_dgram) {
++ struct sockaddr_in6 sa = {0};
++ socklen_t sl;
++
++ sa.sin6_family = AF_INET6;
++ sa.sin6_port = 0;
++ if(source_lsa) {
++ memcpy(&sa.sin6_addr, &source_lsa->u.sin6.sin6_addr, sizeof(struct in6_addr));
++ }
++ sl = sizeof(sa);
++
++ if (bind(pingsock, (struct sockaddr *) &sa, sl) == -1) {
++ perror("bind");
++ exit(2);
++ }
++
++ if (getsockname(pingsock, (struct sockaddr *) &sa, &sl) == -1) {
++ perror("getsockname");
++ exit(2);
++ }
++ myid = sa.sin6_port;
++ }
+
+ #ifdef ICMP6_FILTER
++ if(!using_dgram)
+ {
+ struct icmp6_filter filt;
+ if (!(option_mask32 & OPT_VERBOSE)) {
+@@ -880,7 +951,7 @@ static int common_ping_main(int opt, char **argv)
+ if (opt & OPT_p)
+ G.pattern = xstrtou_range(str_p, 16, 0, 255);
+
+- myid = (uint16_t) getpid();
++ if (!using_dgram) myid = (uint16_t) getpid();
+ hostname = argv[optind];
+ #if ENABLE_PING6
+ {
+--
+2.13.2
+
diff --git a/system/busybox/0005-fbsplash-support-console-switching.patch b/system/busybox/0005-fbsplash-support-console-switching.patch
new file mode 100644
index 000000000..792c2d6c8
--- /dev/null
+++ b/system/busybox/0005-fbsplash-support-console-switching.patch
@@ -0,0 +1,187 @@
+From a8f7d33f47cc28732cd04573ae1fb6a1ca6e9617 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
+Date: Mon, 24 Sep 2012 07:58:29 +0300
+Subject: [PATCH 05/11] fbsplash: support console switching
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Timo Teräs <timo.teras@iki.fi>
+---
+ miscutils/fbsplash.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++-----
+ 1 file changed, 76 insertions(+), 7 deletions(-)
+
+diff --git a/miscutils/fbsplash.c b/miscutils/fbsplash.c
+index fc6c9b953..ec5947314 100644
+--- a/miscutils/fbsplash.c
++++ b/miscutils/fbsplash.c
+@@ -47,7 +47,7 @@
+ //kbuild:lib-$(CONFIG_FBSPLASH) += fbsplash.o
+
+ //usage:#define fbsplash_trivial_usage
+-//usage: "-s IMGFILE [-c] [-d DEV] [-i INIFILE] [-f CMD]"
++//usage: "-s IMGFILE [-c] [-d DEV] [-i INIFILE] [-f CMD] [-T tty]"
+ //usage:#define fbsplash_full_usage "\n\n"
+ //usage: " -s Image"
+ //usage: "\n -c Hide cursor"
+@@ -57,11 +57,17 @@
+ //usage: "\n BAR_R,BAR_G,BAR_B"
+ //usage: "\n -f Control pipe (else exit after drawing image)"
+ //usage: "\n commands: 'NN' (% for progress bar) or 'exit'"
++//usage: "\n -T Switch to TTY to hide all console messages"
+
+ #include "libbb.h"
+ #include "common_bufsiz.h"
+ #include <linux/fb.h>
+
++#include <sys/vt.h>
++#include <sys/ioctl.h>
++#include <linux/tiocl.h>
++#include <linux/kd.h>
++
+ /* If you want logging messages on /tmp/fbsplash.log... */
+ #define DEBUG 0
+
+@@ -73,6 +79,8 @@ struct globals {
+ unsigned char *addr; // pointer to framebuffer memory
+ unsigned ns[7]; // n-parameters
+ const char *image_filename;
++ int silent_tty, fd_tty_s;
++ bool do_not_draw;
+ struct fb_var_screeninfo scr_var;
+ struct fb_fix_screeninfo scr_fix;
+ unsigned bytes_per_pixel;
+@@ -483,6 +491,11 @@ static void init(const char *cfg_filename)
+ config_close(parser);
+ }
+
++static void sighandler(int sig)
++{
++ ioctl(G.fd_tty_s, VT_RELDISP, sig == SIGUSR1 ? 1 : 2);
++ G.do_not_draw = (sig != SIGUSR2);
++}
+
+ int fbsplash_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
+ int fbsplash_main(int argc UNUSED_PARAM, char **argv)
+@@ -492,6 +505,9 @@ int fbsplash_main(int argc UNUSED_PARAM, char **argv)
+ char *num_buf;
+ unsigned num;
+ bool bCursorOff;
++ int fd_tty0, active_vt;
++ struct vt_stat vtstat;
++ struct vt_mode vt;
+
+ INIT_G();
+
+@@ -499,8 +515,10 @@ int fbsplash_main(int argc UNUSED_PARAM, char **argv)
+ fb_device = "/dev/fb0";
+ cfg_filename = NULL;
+ fifo_filename = NULL;
+- bCursorOff = 1 & getopt32(argv, "cs:d:i:f:",
+- &G.image_filename, &fb_device, &cfg_filename, &fifo_filename);
++ opt_complementary = "T+"; // numeric params
++ bCursorOff = 1 & getopt32(argv, "cs:d:i:f:T:",
++ &G.image_filename, &fb_device, &cfg_filename, &fifo_filename,
++ &G.silent_tty);
+
+ // parse configuration file
+ if (cfg_filename)
+@@ -510,11 +528,43 @@ int fbsplash_main(int argc UNUSED_PARAM, char **argv)
+ if (!G.image_filename)
+ bb_show_usage();
+
++ fd_tty0 = get_console_fd_or_die();
++ if (G.silent_tty) {
++ char buf[16];
++
++ /* Initialize TTY */
++ bb_signals((1LL << SIGUSR1) | (1LL << SIGUSR2), sighandler);
++ snprintf(buf, sizeof(buf), "/dev/tty%d", G.silent_tty);
++ G.fd_tty_s = xopen(buf, O_RDWR | O_NOCTTY);
++
++ /* Activate TTY */
++ xioctl(fd_tty0, VT_GETSTATE, &vtstat);
++ active_vt = vtstat.v_active;
++ console_make_active(fd_tty0, G.silent_tty);
++
++ /* Get notifications on console changes */
++ vt.mode = VT_PROCESS;
++ vt.waitv = 0;
++ vt.relsig = SIGUSR1;
++ vt.acqsig = SIGUSR2;
++ ioctl(G.fd_tty_s, VT_SETMODE, &vt);
++
++ /* Redirect all kernel messages to tty1 so that they don't get
++ * printed over our silent splash image. And clear it. */
++ buf[0] = TIOCL_SETKMSGREDIRECT;
++ buf[1] = 1;
++ ioctl(G.fd_tty_s, TIOCLINUX, buf);
++ full_write(G.fd_tty_s, "\e[H\e[2J" "\e[?17;0c", 7+8);
++ ioctl(G.fd_tty_s, KDSETMODE, KD_GRAPHICS);
++ } else {
++ G.fd_tty_s = STDOUT_FILENO;
++ }
++
+ fb_open(fb_device);
+
+ if (fifo_filename && bCursorOff) {
+ // hide cursor (BEFORE any fb ops)
+- full_write(STDOUT_FILENO, "\033[?25l", 6);
++ full_write(G.fd_tty_s, "\033[?25l", 6);
+ }
+
+ fb_drawimage();
+@@ -522,6 +572,7 @@ int fbsplash_main(int argc UNUSED_PARAM, char **argv)
+ if (!fifo_filename)
+ return EXIT_SUCCESS;
+
++ sig_block(SIGUSR1);
+ fp = xfopen_stdin(fifo_filename);
+ if (fp != stdin) {
+ // For named pipes, we want to support this:
+@@ -537,8 +588,9 @@ int fbsplash_main(int argc UNUSED_PARAM, char **argv)
+ // and become an additional writer :)
+ open(fifo_filename, O_WRONLY); // errors are ignored
+ }
+-
+ fb_drawprogressbar(0);
++ sig_unblock(SIGUSR1);
++
+ // Block on read, waiting for some input.
+ // Use of <stdio.h> style I/O allows to correctly
+ // handle a case when we have many buffered lines
+@@ -553,12 +605,29 @@ int fbsplash_main(int argc UNUSED_PARAM, char **argv)
+ #if DEBUG
+ DEBUG_MESSAGE(itoa(num));
+ #endif
+- fb_drawprogressbar(num);
++ sig_block(SIGUSR1);
++ if (!G.do_not_draw)
++ fb_drawprogressbar(num);
++ sig_unblock(SIGUSR1);
+ }
+ free(num_buf);
+ }
+
+- if (bCursorOff) // restore cursor
++ if (G.silent_tty) {
++ usleep(100*1000);
++
++ ioctl(G.fd_tty_s, VT_RELDISP, 1);
++ ioctl(G.fd_tty_s, KDSETMODE, KD_TEXT);
++ vt.mode = VT_AUTO;
++ vt.waitv = 0;
++ ioctl(G.fd_tty_s, VT_SETMODE, &vt);
++ close(G.fd_tty_s);
++
++ xioctl(fd_tty0, VT_GETSTATE, &vtstat);
++ if (vtstat.v_active == G.silent_tty)
++ console_make_active(fd_tty0, active_vt);
++ ioctl(fd_tty0, VT_DISALLOCATE, (void *)(ptrdiff_t)G.silent_tty);
++ } else if (bCursorOff) // restore cursor
+ full_write(STDOUT_FILENO, "\033[?25h", 6);
+
+ return EXIT_SUCCESS;
+--
+2.13.2
+
diff --git a/system/busybox/0006-fbsplash-support-image-and-bar-alignment-and-positio.patch b/system/busybox/0006-fbsplash-support-image-and-bar-alignment-and-positio.patch
new file mode 100644
index 000000000..65c423178
--- /dev/null
+++ b/system/busybox/0006-fbsplash-support-image-and-bar-alignment-and-positio.patch
@@ -0,0 +1,185 @@
+From 64e2d2e495f82ef7ccc952bfa4216d1ff8ab3481 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
+Date: Fri, 21 Nov 2014 16:06:34 +0200
+Subject: [PATCH 06/11] fbsplash: support image and bar alignment and
+ positioning
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Timo Teräs <timo.teras@iki.fi>
+---
+ miscutils/fbsplash.c | 91 +++++++++++++++++++++++++++++++++++++++++++---------
+ 1 file changed, 76 insertions(+), 15 deletions(-)
+
+diff --git a/miscutils/fbsplash.c b/miscutils/fbsplash.c
+index ec5947314..34bbf81f5 100644
+--- a/miscutils/fbsplash.c
++++ b/miscutils/fbsplash.c
+@@ -53,6 +53,7 @@
+ //usage: "\n -c Hide cursor"
+ //usage: "\n -d Framebuffer device (default /dev/fb0)"
+ //usage: "\n -i Config file (var=value):"
++//usage: "\n IMAGE_ALIGN"
+ //usage: "\n BAR_LEFT,BAR_TOP,BAR_WIDTH,BAR_HEIGHT"
+ //usage: "\n BAR_R,BAR_G,BAR_B"
+ //usage: "\n -f Control pipe (else exit after drawing image)"
+@@ -71,13 +72,38 @@
+ /* If you want logging messages on /tmp/fbsplash.log... */
+ #define DEBUG 0
+
++enum {
++ image_align,
++
++ image_posx,
++ image_posy,
++ bar_width,
++ bar_height,
++ bar_posx,
++ bar_posy,
++ bar_colr,
++ bar_colg,
++ bar_colb,
++
++ debug
++};
++
++#define nimage_align ns[image_align]
++#define nbar_width ns[bar_width]
++#define nbar_height ns[bar_height]
++#define nbar_posx ns[bar_posx]
++#define nbar_posy ns[bar_posy]
++#define nbar_colr ns[bar_colr]
++#define nbar_colg ns[bar_colg]
++#define nbar_colb ns[bar_colb]
++
+ struct globals {
+ #if DEBUG
+ bool bdebug_messages; // enable/disable logging
+ FILE *logfile_fd; // log file
+ #endif
+ unsigned char *addr; // pointer to framebuffer memory
+- unsigned ns[7]; // n-parameters
++ unsigned ns[debug+1]; // n-parameters
+ const char *image_filename;
+ int silent_tty, fd_tty_s;
+ bool do_not_draw;
+@@ -94,14 +120,6 @@ struct globals {
+ SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \
+ } while (0)
+
+-#define nbar_width ns[0] // progress bar width
+-#define nbar_height ns[1] // progress bar height
+-#define nbar_posx ns[2] // progress bar horizontal position
+-#define nbar_posy ns[3] // progress bar vertical position
+-#define nbar_colr ns[4] // progress bar color red component
+-#define nbar_colg ns[5] // progress bar color green component
+-#define nbar_colb ns[6] // progress bar color blue component
+-
+ #if DEBUG
+ #define DEBUG_MESSAGE(strMessage, args...) \
+ if (G.bdebug_messages) { \
+@@ -382,7 +400,7 @@ static void fb_drawimage(void)
+ FILE *theme_file;
+ char *read_ptr;
+ unsigned char *pixline;
+- unsigned i, j, width, height, line_size;
++ int i, j, width, height, line_size, xoffs, yoffs, xstart;
+
+ if (LONE_DASH(G.image_filename)) {
+ theme_file = stdin;
+@@ -432,18 +450,46 @@ static void fb_drawimage(void)
+ line_size = width*3;
+ pixline = xmalloc(line_size);
+
++#if 0
+ if (width > G.scr_var.xres)
+ width = G.scr_var.xres;
+ if (height > G.scr_var.yres)
+ height = G.scr_var.yres;
+- for (j = 0; j < height; j++) {
++#endif
++
++ xoffs = yoffs = 0;
++ switch (G.nimage_align % 3) {
++ case 1: xoffs = (G.scr_var.xres - width) / 2; break;
++ case 2: xoffs = G.scr_var.xres - width; break;
++ }
++ xstart = 0;
++ if (xoffs < 0) {
++ xstart = -xoffs;
++ width -= xstart;
++ xoffs = 0;
++ }
++ xoffs *= G.bytes_per_pixel;
++ if (width > G.scr_var.xres)
++ width = G.scr_var.xres;
++
++ switch (G.nimage_align / 3) {
++ case 1: yoffs = (G.scr_var.yres - height) / 2; break;
++ case 2: yoffs = G.scr_var.yres - height; break;
++ }
++
++ for (j = 0; j < height && yoffs < G.scr_var.yres; j++, yoffs++) {
+ unsigned char *pixel;
+ unsigned char *src;
+
+ if (fread(pixline, 1, line_size, theme_file) != line_size)
+ bb_error_msg_and_die("bad PPM file '%s'", G.image_filename);
++
++ if (yoffs < 0)
++ continue;
++
+ pixel = pixline;
+- src = G.addr + j * G.scr_fix.line_length;
++ src = G.addr + yoffs * G.scr_fix.line_length + xoffs;
++
+ for (i = 0; i < width; i++) {
+ unsigned thispix = fb_pixel_value(pixel[0], pixel[1], pixel[2]);
+ fb_write_pixel(src, thispix);
+@@ -462,9 +508,17 @@ static void fb_drawimage(void)
+ */
+ static void init(const char *cfg_filename)
+ {
++ static const char align_names[] ALIGN1 =
++ "LT\0" "CT\0" "RT\0"
++ "LM\0" "CM\0" "RM\0"
++ "LB\0" "CB\0" "RB\0";
+ static const char param_names[] ALIGN1 =
++ "IMAGE_ALIGN\0"
++
++ "IMAGE_X\0" "IMAGE_Y\0"
+ "BAR_WIDTH\0" "BAR_HEIGHT\0"
+ "BAR_LEFT\0" "BAR_TOP\0"
++
+ "BAR_R\0" "BAR_G\0" "BAR_B\0"
+ #if DEBUG
+ "DEBUG\0"
+@@ -474,14 +528,21 @@ static void init(const char *cfg_filename)
+ parser_t *parser = config_open2(cfg_filename, xfopen_stdin);
+ while (config_read(parser, token, 2, 2, "#=",
+ (PARSE_NORMAL | PARSE_MIN_DIE) & ~(PARSE_TRIM | PARSE_COLLAPSE))) {
+- unsigned val = xatoi_positive(token[1]);
++ unsigned val;
+ int i = index_in_strings(param_names, token[0]);
++
+ if (i < 0)
+ bb_error_msg_and_die("syntax error: %s", token[0]);
+- if (i >= 0 && i < 7)
++
++ if (i <= image_align)
++ val = index_in_strings(align_names, token[1]);
++ else
++ val = xatoi_positive(token[1]);
++
++ if (i < debug)
+ G.ns[i] = val;
+ #if DEBUG
+- if (i == 7) {
++ if (i == debug) {
+ G.bdebug_messages = val;
+ if (G.bdebug_messages)
+ G.logfile_fd = xfopen_for_write("/tmp/fbsplash.log");
+--
+2.13.2
+
diff --git a/system/busybox/0007-depmod-support-generating-kmod-binary-index-files.patch b/system/busybox/0007-depmod-support-generating-kmod-binary-index-files.patch
new file mode 100644
index 000000000..8b89902de
--- /dev/null
+++ b/system/busybox/0007-depmod-support-generating-kmod-binary-index-files.patch
@@ -0,0 +1,516 @@
+From ab4df89615fc2c5726b4ce55546e4dc098211a0b Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
+Date: Sun, 25 Oct 2015 22:21:41 +0200
+Subject: [PATCH 07/11] depmod: support generating kmod binary index files
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This allows to use busybox depmod, and run daemons
+using libkmod (or even kmod modprobe if needed).
+
+About +1500 bytes when enabled. This patch merges some
+depmod code paths, so when this is disabled it shrinks
+the code size a little bit.
+
+Signed-off-by: Timo Teräs <timo.teras@iki.fi>
+---
+ modutils/Config.src | 9 ++
+ modutils/depmod.c | 281 ++++++++++++++++++++++++++++++++++++++++++----------
+ modutils/modprobe.c | 15 ---
+ modutils/modutils.c | 31 ++++++
+ modutils/modutils.h | 16 +++
+ 5 files changed, 286 insertions(+), 66 deletions(-)
+
+diff --git a/modutils/Config.src b/modutils/Config.src
+index 9b76c83d2..9e3b9b71e 100644
+--- a/modutils/Config.src
++++ b/modutils/Config.src
+@@ -152,6 +152,15 @@ config FEATURE_MODUTILS_ALIAS
+
+ Say Y if unsure.
+
++config FEATURE_MODUTILS_BIN
++ bool "Support for the kmod .bin file format"
++ default n
++ depends on DEPMOD && !MODPROBE_SMALL
++ help
++ Generate kmod compatible binary index files for .dep, .alias,
++ .symbols and .builtin files. Allows mixing use of busybox
++ modutils and kmod (binaries and library).
++
+ config FEATURE_MODUTILS_SYMBOLS
+ bool "Support module.symbols file"
+ default y
+diff --git a/modutils/depmod.c b/modutils/depmod.c
+index b7965ebd2..73ba7d0f4 100644
+--- a/modutils/depmod.c
++++ b/modutils/depmod.c
+@@ -2,7 +2,7 @@
+ /*
+ * depmod - generate modules.dep
+ * Copyright (c) 2008 Bernhard Reutner-Fischer
+- * Copyrihgt (c) 2008 Timo Teras <timo.teras@iki.fi>
++ * Copyrihgt (c) 2008-2015 Timo Teras <timo.teras@iki.fi>
+ * Copyright (c) 2008 Vladimir Dronnikov
+ *
+ * Licensed under GPLv2 or later, see file LICENSE in this source tree.
+@@ -26,6 +26,24 @@
+ #include "modutils.h"
+ #include <sys/utsname.h> /* uname() */
+
++#define INDEX_MINCHAR 32
++#define INDEX_MAXCHAR 128
++
++typedef struct index_node {
++ char *prefix;
++ llist_t *values;
++ struct index_node *children[INDEX_MAXCHAR-INDEX_MINCHAR];
++} index_node;
++
++struct globals {
++ module_db db;
++ index_node *root_node;
++} FIX_ALIASING;
++#define G (*ptr_to_globals)
++#define INIT_G() do { \
++ SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \
++} while (0)
++
+ /*
+ * Theory of operation:
+ * - iterate over all modules and record their full path
+@@ -53,18 +71,12 @@ static int FAST_FUNC parse_module(const char *fname, struct stat *sb UNUSED_PARA
+
+ for (ptr = image; ptr < image + len - 10; ptr++) {
+ if (is_prefixed_with(ptr, "depends=")) {
+- char *u;
+-
+ ptr += 8;
+- for (u = ptr; *u; u++)
+- if (*u == '-')
+- *u = '_';
+- ptr += string_to_llist(ptr, &e->deps, ",");
++ string_to_llist(replace_underscores(ptr), &e->deps, ",");
+ } else if (ENABLE_FEATURE_MODUTILS_ALIAS
+ && is_prefixed_with(ptr, "alias=")
+ ) {
+- llist_add_to(&e->aliases, xstrdup(ptr + 6));
+- ptr += strlen(ptr);
++ llist_add_to(&e->aliases, replace_underscores(xstrdup(ptr + 6)));
+ } else if (ENABLE_FEATURE_MODUTILS_SYMBOLS
+ && is_prefixed_with(ptr, "__ksymtab_")
+ ) {
+@@ -74,9 +86,10 @@ static int FAST_FUNC parse_module(const char *fname, struct stat *sb UNUSED_PARA
+ ) {
+ continue;
+ }
+- llist_add_to(&e->symbols, xstrdup(ptr));
+- ptr += strlen(ptr);
+- }
++ llist_add_to(&e->symbols, xasprintf("symbol:%s", ptr));
++ } else
++ continue;
++ ptr += strlen(ptr);
+ }
+ free(image);
+
+@@ -108,12 +121,6 @@ static void order_dep_list(module_db *modules, module_entry *start, llist_t *add
+ }
+ }
+
+-static void xfreopen_write(const char *file, FILE *f)
+-{
+- if (freopen(file, "w", f) == NULL)
+- bb_perror_msg_and_die("can't open '%s'", file);
+-}
+-
+ //usage:#if !ENABLE_MODPROBE_SMALL
+ //usage:#define depmod_trivial_usage "[-n] [-b BASE] [VERSION] [MODFILES]..."
+ //usage:#define depmod_full_usage "\n\n"
+@@ -167,6 +174,169 @@ enum {
+ OPT_C = (1 << 9), /* -C,--config etc_modules_conf: ignored */
+ };
+
++/* Support for the mod binary index generation */
++
++static void index_init(const char *filename)
++{
++ if (ENABLE_FEATURE_MODUTILS_BIN) {
++ index_node *n;
++
++ n = xzalloc(sizeof(index_node));
++ n->prefix = xstrdup("");
++ G.root_node = n;
++ }
++
++ if (filename && !(option_mask32 & OPT_n)) {
++ if (freopen(filename, "w", stdout) == NULL)
++ bb_perror_msg_and_die("can't open '%s'", filename);
++ }
++}
++
++static void index_add(const char *key, char *value, const char *prefix)
++{
++ if (prefix && *prefix)
++ printf("%s%s %s\n", prefix, key, value);
++ else if (prefix)
++ printf("%s\n", value);
++
++ if (ENABLE_FEATURE_MODUTILS_BIN) {
++ index_node *cur = G.root_node, *n;
++ unsigned i = 0, j, ch;
++
++ while (1) {
++ /* Ensure node->prefix is a prefix of &str[i].
++ * If it is not already, then we must split node. */
++ for (j = 0; cur->prefix[j]; j++) {
++ ch = cur->prefix[j];
++ if (ch != key[i+j]) {
++ /* New child is copy of node with prefix[j+1..N] */
++ n = xzalloc(sizeof(index_node));
++ n->prefix = xstrdup(&cur->prefix[j+1]);
++ n->values = cur->values;
++ memcpy(n->children, cur->children, sizeof(n->children));
++
++ /* Parent has prefix[0..j], child at prefix[j] */
++ cur->prefix[j] = '\0';
++ cur->values = NULL;
++ memset(cur->children, 0, sizeof(cur->children));
++ cur->children[ch-INDEX_MINCHAR] = n;
++ break;
++ }
++ }
++ i += j;
++
++ ch = key[i];
++ if (ch == 0)
++ break;
++
++ if (ch < INDEX_MINCHAR || ch >= INDEX_MAXCHAR)
++ bb_error_msg_and_die("bad module name");
++
++ ch -= INDEX_MINCHAR;
++ if (!cur->children[ch]) {
++ n = xzalloc(sizeof(index_node));
++ cur->children[ch] = n;
++ n->prefix = xstrdup(&key[i+1]);
++ cur = n;
++ break;
++ }
++
++ /* Descend into child node and continue */
++ cur = cur->children[ch];
++ i++;
++ }
++
++ llist_add_to(&cur->values, value);
++ }
++}
++
++static uint32_t index_write_node(FILE *out, index_node *n, void (*freeit)(void *data))
++{
++ uint32_t child_offs[INDEX_MAXCHAR-INDEX_MINCHAR];
++ uint32_t offset;
++ uint8_t first = 255, last = 0;
++ unsigned i;
++
++ for (i = 0; i < INDEX_MAXCHAR-INDEX_MINCHAR; i++) {
++ child_offs[i] = 0;
++ if (!n->children[i])
++ continue;
++ child_offs[i] = index_write_node(out, n->children[i], freeit);
++ if (first > INDEX_MAXCHAR)
++ first = i;
++ last = i;
++ }
++
++ offset = ftell(out);
++
++ if (n->prefix[0]) {
++ fputs(n->prefix, out);
++ fputc('\0', out);
++ offset |= INDEX_NODE_PREFIX;
++ }
++
++ if (first < INDEX_MAXCHAR) {
++ fputc(first + INDEX_MINCHAR, out);
++ fputc(last + INDEX_MINCHAR, out);
++ fwrite(child_offs + first, sizeof(uint32_t), last - first + 1, out);
++ offset |= INDEX_NODE_CHILDS;
++ }
++
++ if (n->values) {
++ const llist_t *v;
++ unsigned int cnt;
++ uint32_t u;
++
++ n->values = llist_rev(n->values);
++ for (v = n->values, cnt = 0; v != NULL; v = v->link, cnt++);
++ u = htonl(cnt);
++ fwrite(&u, sizeof(u), 1, out);
++ for (v = n->values, cnt = 0; v != NULL; v = v->link, cnt++) {
++ u = htonl(cnt);
++ fwrite(&u, sizeof(u), 1, out);
++ fputs(v->data, out);
++ fputc('\0', out);
++ }
++ offset |= INDEX_NODE_VALUES;
++ }
++
++ llist_free(n->values, freeit);
++ free(n->prefix);
++ free(n);
++
++ return htonl(offset);
++}
++
++static void index_dump(const char *filename, int deps_file)
++{
++ if (ENABLE_FEATURE_MODUTILS_BIN) {
++ FILE *out;
++ uint32_t header[3] = {
++ htonl(INDEX_MAGIC),
++ htonl(INDEX_VERSION),
++ };
++
++ if (option_mask32 & OPT_n)
++ filename = "/dev/null";
++ else
++ filename = xasprintf("tmp.%s.bin", filename);
++
++ out = xfopen_for_write(filename);
++ fwrite(header, sizeof(uint32_t), 3, out);
++ header[2] = index_write_node(out, G.root_node, deps_file ? free : 0);
++ rewind(out);
++ G.root_node = NULL;
++ fwrite(header, sizeof(uint32_t), 3, out);
++ if (fclose(out)) {
++ remove(filename);
++ bb_error_msg_and_die(bb_msg_write_error);
++ }
++ /* .bin files are mmap'ed; not renaming it may crash
++ * long standing daemon using libkmod */
++ rename_or_warn(filename, filename + 4);
++ }
++}
++
+ int depmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
+ int depmod_main(int argc UNUSED_PARAM, char **argv)
+ {
+@@ -178,6 +348,8 @@ int depmod_main(int argc UNUSED_PARAM, char **argv)
+ unsigned i;
+ int tmp;
+
++ INIT_G();
++
+ getopt32(argv, "aAb:eF:nruqC:", &moddir_base, NULL, NULL);
+ argv += optind;
+
+@@ -210,53 +382,60 @@ int depmod_main(int argc UNUSED_PARAM, char **argv)
+ }
+
+ /* Generate dependency and alias files */
+- if (!(option_mask32 & OPT_n))
+- xfreopen_write(CONFIG_DEFAULT_DEPMOD_FILE, stdout);
+-
++ index_init(CONFIG_DEFAULT_DEPMOD_FILE);
+ moddb_foreach_module(&modules, m, i) {
+- printf("%s:", m->name);
+-
++ char *buf = xasprintf("%s:", m->name);
+ order_dep_list(&modules, m, m->deps);
++
+ while (m->dnext != m) {
+ dep = m->dnext;
+- printf(" %s", dep->name);
+-
++ buf = gather_options_str(buf, dep->name);
+ /* unlink current entry */
+ dep->dnext->dprev = dep->dprev;
+ dep->dprev->dnext = dep->dnext;
+ dep->dnext = dep->dprev = dep;
+ }
+- bb_putchar('\n');
++ index_add(m->modname, buf, "");
+ }
+-
+-#if ENABLE_FEATURE_MODUTILS_ALIAS
+- if (!(option_mask32 & OPT_n))
+- xfreopen_write("modules.alias", stdout);
+- moddb_foreach_module(&modules, m, i) {
+- while (m->aliases) {
+- /*
+- * Last word used to be a basename
+- * (filename with path and .ko.* stripped)
+- * at the time of module-init-tools 3.4.
+- * kmod v.12 uses module name, i.e., s/-/_/g.
+- */
+- printf("alias %s %s\n",
+- (char*)llist_pop(&m->aliases),
+- m->modname);
++ index_dump(CONFIG_DEFAULT_DEPMOD_FILE, 1);
++
++ if (ENABLE_FEATURE_MODUTILS_ALIAS) {
++ index_init("modules.alias");
++ moddb_foreach_module(&modules, m, i) {
++ while (m->aliases) {
++ /*
++ * Last word used to be a basename
++ * (filename with path and .ko.* stripped)
++ * at the time of module-init-tools 3.4.
++ * kmod v.12 uses module name, i.e., s/-/_/g.
++ */
++ index_add((char*)llist_pop(&m->aliases), m->modname, "alias ");
++ }
+ }
++ index_dump("modules.alias", 0);
+ }
+-#endif
+-#if ENABLE_FEATURE_MODUTILS_SYMBOLS
+- if (!(option_mask32 & OPT_n))
+- xfreopen_write("modules.symbols", stdout);
+- moddb_foreach_module(&modules, m, i) {
+- while (m->symbols) {
+- printf("alias symbol:%s %s\n",
+- (char*)llist_pop(&m->symbols),
+- m->modname);
++ if (ENABLE_FEATURE_MODUTILS_SYMBOLS) {
++ index_init("modules.symbols");
++ moddb_foreach_module(&modules, m, i) {
++ while (m->symbols) {
++ index_add((char*)llist_pop(&m->symbols), m->modname, "alias ");
++ }
++ }
++ index_dump("modules.symbols", 0);
++ }
++ if (ENABLE_FEATURE_MODUTILS_BIN) {
++ char line[PATH_MAX], modname[MODULE_NAME_LEN];
++ FILE *in;
++
++ index_init(NULL);
++ in = xfopen_for_read("modules.builtin");
++ while (fgets(line, sizeof(line), in) != NULL) {
++ filename2modname(line, modname);
++ index_add(modname, (char *) "", 0);
+ }
++ fclose(in);
++ index_dump("modules.builtin", 0);
+ }
+-#endif
+
+ if (ENABLE_FEATURE_CLEAN_UP)
+ moddb_free(&modules);
+diff --git a/modutils/modprobe.c b/modutils/modprobe.c
+index 51ede9204..d1fcc0b7f 100644
+--- a/modutils/modprobe.c
++++ b/modutils/modprobe.c
+@@ -192,21 +192,6 @@ struct globals {
+
+ static int read_config(const char *path);
+
+-static char *gather_options_str(char *opts, const char *append)
+-{
+- /* Speed-optimized. We call gather_options_str many times. */
+- if (append) {
+- if (opts == NULL) {
+- opts = xstrdup(append);
+- } else {
+- int optlen = strlen(opts);
+- opts = xrealloc(opts, optlen + strlen(append) + 2);
+- sprintf(opts + optlen, " %s", append);
+- }
+- }
+- return opts;
+-}
+-
+ static struct module_entry *get_or_add_modentry(const char *module)
+ {
+ return moddb_get_or_create(&G.db, module);
+diff --git a/modutils/modutils.c b/modutils/modutils.c
+index 6f7cd9721..257089af4 100644
+--- a/modutils/modutils.c
++++ b/modutils/modutils.c
+@@ -66,6 +66,21 @@ void FAST_FUNC moddb_free(module_db *db)
+ }
+ }
+
++char * FAST_FUNC gather_options_str(char *opts, const char *append)
++{
++ /* Speed-optimized. We call gather_options_str many times. */
++ if (append) {
++ if (opts == NULL) {
++ opts = xstrdup(append);
++ } else {
++ int optlen = strlen(opts);
++ opts = xrealloc(opts, optlen + strlen(append) + 2);
++ sprintf(opts + optlen, " %s", append);
++ }
++ }
++ return opts;
++}
++
+ void FAST_FUNC replace(char *s, char what, char with)
+ {
+ while (*s) {
+@@ -75,6 +90,22 @@ void FAST_FUNC replace(char *s, char what, char with)
+ }
+ }
+
++char* FAST_FUNC replace_underscores(char *s)
++{
++ int i;
++ for (i = 0; s[i]; i++) {
++ switch (s[i]) {
++ case '-':
++ s[i] = '_';
++ break;
++ case '[':
++ i += strcspn(&s[i], "]");
++ break;
++ }
++ }
++ return s;
++}
++
+ int FAST_FUNC string_to_llist(char *string, llist_t **llist, const char *delim)
+ {
+ char *tok;
+diff --git a/modutils/modutils.h b/modutils/modutils.h
+index 4a702e97c..73e816028 100644
+--- a/modutils/modutils.h
++++ b/modutils/modutils.h
+@@ -18,6 +18,20 @@ PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
+ #define MODULE_NAME_LEN 256
+ #define MODULE_HASH_SIZE 256
+
++/* .bin index format definitions */
++#define INDEX_MAGIC 0xB007F457
++#define INDEX_VERSION_MAJOR 0x0002
++#define INDEX_VERSION_MINOR 0x0001
++#define INDEX_VERSION ((INDEX_VERSION_MAJOR<<16)|INDEX_VERSION_MINOR)
++
++enum node_offset {
++ INDEX_NODE_FLAGS = 0xF0000000, /* Flags in high nibble */
++ INDEX_NODE_PREFIX = 0x80000000,
++ INDEX_NODE_VALUES = 0x40000000,
++ INDEX_NODE_CHILDS = 0x20000000,
++ INDEX_NODE_MASK = 0x0FFFFFFF, /* Offset value */
++};
++
+ typedef struct module_entry {
+ struct module_entry *next;
+ char *name, *modname;
+@@ -47,7 +61,9 @@ module_entry *moddb_get(module_db *db, const char *s) FAST_FUNC;
+ module_entry *moddb_get_or_create(module_db *db, const char *s) FAST_FUNC;
+ void moddb_free(module_db *db) FAST_FUNC;
+
++char *gather_options_str(char *opts, const char *append) FAST_FUNC;
+ void replace(char *s, char what, char with) FAST_FUNC;
++char *replace_underscores(char *s) FAST_FUNC;
+ int string_to_llist(char *string, llist_t **llist, const char *delim) FAST_FUNC;
+ char *filename2modname(const char *filename, char *modname) FAST_FUNC;
+ #if ENABLE_FEATURE_CMDLINE_MODULE_OPTIONS
+--
+2.13.2
+
diff --git a/system/busybox/0008-diff-add-support-for-no-dereference.patch b/system/busybox/0008-diff-add-support-for-no-dereference.patch
new file mode 100644
index 000000000..95063a863
--- /dev/null
+++ b/system/busybox/0008-diff-add-support-for-no-dereference.patch
@@ -0,0 +1,63 @@
+From d70be9891718ffb94ea9946cc3540b1b62eced77 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Fri, 25 Jul 2014 15:28:33 +0200
+Subject: [PATCH 08/11] diff: add support for --no-dereference
+
+Add flag for not following symlinks when recursing
+
+function old new delta
+.rodata 7934 7967 +33
+diff_longopts 253 270 +17
+packed_usage 1704 1720 +16
+diff_main 1665 1662 -3
+------------------------------------------------------------------------------
+(add/remove: 0/0 grow/shrink: 3/1 up/down: 66/-3) Total: 63 bytes
+
+Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
+---
+ editors/diff.c | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/editors/diff.c b/editors/diff.c
+index 7687518f3..f07cafb19 100644
+--- a/editors/diff.c
++++ b/editors/diff.c
+@@ -115,6 +115,9 @@
+ //usage: "\n -N Treat absent files as empty"
+ //usage: "\n -q Output only whether files differ"
+ //usage: "\n -r Recurse"
++//usage: IF_LONG_OPTS(
++//usage: "\n --no-dereference Don't follow symlinks"
++//usage: )
+ //usage: "\n -S Start with FILE when comparing directories"
+ //usage: "\n -T Make tabs line up by prefixing a tab when necessary"
+ //usage: "\n -s Report when two files are the same"
+@@ -156,6 +159,7 @@ enum { /* Commandline flags */
+ FLAG_p, /* not implemented */
+ FLAG_B,
+ FLAG_E, /* not implemented */
++ FLAG_no_deref,
+ };
+ #define FLAG(x) (1 << FLAG_##x)
+
+@@ -869,7 +873,8 @@ static void diffdir(char *p[2], const char *s_start)
+ * Using list.len to specify its length,
+ * add_to_dirlist will remove it. */
+ list[i].len = strlen(p[i]);
+- recursive_action(p[i], ACTION_RECURSE | ACTION_FOLLOWLINKS,
++ recursive_action(p[i], ACTION_RECURSE |
++ ((option_mask32 & FLAG(no_deref)) ? 0 : ACTION_FOLLOWLINKS),
+ add_to_dirlist, skip_dir, &list[i], 0);
+ /* Sort dl alphabetically.
+ * GNU diff does this ignoring any number of trailing dots.
+@@ -966,6 +971,7 @@ static const char diff_longopts[] ALIGN1 =
+ "report-identical-files\0" No_argument "s"
+ "starting-file\0" Required_argument "S"
+ "minimal\0" No_argument "d"
++ "no-dereference\0" No_argument "\xff"
+ ;
+ #endif
+
+--
+2.13.2
+
diff --git a/system/busybox/0009-sysklogd-add-Z-option-to-adjust-message-timezones.patch b/system/busybox/0009-sysklogd-add-Z-option-to-adjust-message-timezones.patch
new file mode 100644
index 000000000..2624675c4
--- /dev/null
+++ b/system/busybox/0009-sysklogd-add-Z-option-to-adjust-message-timezones.patch
@@ -0,0 +1,104 @@
+From 1cb2e911c47f1b798ee610deabbea21ba6fb6961 Mon Sep 17 00:00:00 2001
+From: Shiz <hi@shiz.me>
+Date: Mon, 8 May 2017 23:09:13 +0200
+Subject: [PATCH 09/11] sysklogd: add -Z option to adjust message timezones
+
+Some syslog() implementations like musl's[1] always send timestamps in UTC.
+This change adds a new option to syslogd, -Z, to assume incoming timestamps
+are always UTC and adjust them to the local timezone (of the syslogd) before
+logging.
+
+[1]: http://www.openwall.com/lists/musl/2014/01/29/1
+
+Signed-off-by: Shiz <hi@shiz.me>
+---
+ sysklogd/syslogd.c | 23 +++++++++++++++++++----
+ 1 file changed, 19 insertions(+), 4 deletions(-)
+
+diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
+index d64ff278f..159336ed7 100644
+--- a/sysklogd/syslogd.c
++++ b/sysklogd/syslogd.c
+@@ -122,6 +122,7 @@
+ //usage: "(this version of syslogd ignores /etc/syslog.conf)\n"
+ //usage: )
+ //usage: "\n -n Run in foreground"
++//usage: "\n -Z Adjust incoming UTC times to local time"
+ //usage: IF_FEATURE_REMOTE_LOG(
+ //usage: "\n -R HOST[:PORT] Log to HOST:PORT (default PORT:514)"
+ //usage: "\n -L Log locally and via network (default is network only if -R)"
+@@ -233,6 +234,8 @@ typedef struct logRule_t {
+ /*int markInterval;*/ \
+ /* level of messages to be logged */ \
+ int logLevel; \
++ /* whether to adjust message timezone */\
++ int adjustTimezone; \
+ IF_FEATURE_ROTATE_LOGFILE( \
+ /* max size of file before rotation */ \
+ unsigned logFileSize; \
+@@ -316,6 +319,7 @@ enum {
+ OPTBIT_outfile, // -O
+ OPTBIT_loglevel, // -l
+ OPTBIT_small, // -S
++ OPTBIT_adjusttz, // -Z
+ IF_FEATURE_ROTATE_LOGFILE(OPTBIT_filesize ,) // -s
+ IF_FEATURE_ROTATE_LOGFILE(OPTBIT_rotatecnt ,) // -b
+ IF_FEATURE_REMOTE_LOG( OPTBIT_remotelog ,) // -R
+@@ -330,6 +334,7 @@ enum {
+ OPT_outfile = 1 << OPTBIT_outfile ,
+ OPT_loglevel = 1 << OPTBIT_loglevel,
+ OPT_small = 1 << OPTBIT_small ,
++ OPT_adjusttz = 1 << OPTBIT_adjusttz,
+ OPT_filesize = IF_FEATURE_ROTATE_LOGFILE((1 << OPTBIT_filesize )) + 0,
+ OPT_rotatecnt = IF_FEATURE_ROTATE_LOGFILE((1 << OPTBIT_rotatecnt )) + 0,
+ OPT_remotelog = IF_FEATURE_REMOTE_LOG( (1 << OPTBIT_remotelog )) + 0,
+@@ -339,7 +344,7 @@ enum {
+ OPT_cfg = IF_FEATURE_SYSLOGD_CFG( (1 << OPTBIT_cfg )) + 0,
+ OPT_kmsg = IF_FEATURE_KMSG_SYSLOG( (1 << OPTBIT_kmsg )) + 0,
+ };
+-#define OPTION_STR "m:nO:l:S" \
++#define OPTION_STR "m:nO:l:SZ" \
+ IF_FEATURE_ROTATE_LOGFILE("s:" ) \
+ IF_FEATURE_ROTATE_LOGFILE("b:" ) \
+ IF_FEATURE_REMOTE_LOG( "R:*") \
+@@ -815,17 +820,23 @@ static void timestamp_and_log(int pri, char *msg, int len)
+ {
+ char *timestamp;
+ time_t now;
++ struct tm nowtm = { .tm_isdst = 0 };
+
+ /* Jan 18 00:11:22 msg... */
+ /* 01234567890123456 */
+ if (len < 16 || msg[3] != ' ' || msg[6] != ' '
+ || msg[9] != ':' || msg[12] != ':' || msg[15] != ' '
+ ) {
+- time(&now);
++ now = time(NULL);
+ timestamp = ctime(&now) + 4; /* skip day of week */
+ } else {
+- now = 0;
+- timestamp = msg;
++ if (G.adjustTimezone && strptime(msg, "%b %e %T", &nowtm)) {
++ now = mktime(&nowtm) - timezone;
++ timestamp = ctime(&now) + 4; /* skip day of week */
++ } else {
++ now = 0;
++ timestamp = msg;
++ }
+ msg += 16;
+ }
+ timestamp[15] = '\0';
+@@ -1130,6 +1141,10 @@ int syslogd_main(int argc UNUSED_PARAM, char **argv)
+ if (opts & OPT_loglevel) // -l
+ G.logLevel = xatou_range(opt_l, 1, 8);
+ //if (opts & OPT_small) // -S
++ if (opts & OPT_adjusttz) { // -Z
++ G.adjustTimezone = 1;
++ tzset();
++ }
+ #if ENABLE_FEATURE_ROTATE_LOGFILE
+ if (opts & OPT_filesize) // -s
+ G.logFileSize = xatou_range(opt_s, 0, INT_MAX/1024) * 1024;
+--
+2.13.2
+
diff --git a/system/busybox/0010-udhcpc-Don-t-background-if-n-is-given.patch b/system/busybox/0010-udhcpc-Don-t-background-if-n-is-given.patch
new file mode 100644
index 000000000..75fe62dfd
--- /dev/null
+++ b/system/busybox/0010-udhcpc-Don-t-background-if-n-is-given.patch
@@ -0,0 +1,45 @@
+From a663349a9ae6d62bfad1243a8781fb254065b480 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Thu, 6 Jul 2017 13:39:15 +0200
+Subject: [PATCH 10/11] udhcpc: Don't background if -n is given
+
+we need add -b to our udhcpc options to prevent boot forever if there are no
+dhcp server. We also need a way for users to disable this behavior by making
+it possible to set -n option at runtime.
+---
+ networking/udhcp/dhcpc.c | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
+index 43aac1b85..bf53dd559 100644
+--- a/networking/udhcp/dhcpc.c
++++ b/networking/udhcp/dhcpc.c
+@@ -1504,19 +1504,19 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
+ }
+ leasefail:
+ udhcp_run_script(NULL, "leasefail");
++ if (opt & OPT_n) { /* abort if no lease */
++ bb_error_msg("no lease, failing");
++ retval = 1;
++ goto ret;
++ }
+ #if BB_MMU /* -b is not supported on NOMMU */
+ if (opt & OPT_b) { /* background if no lease */
+ bb_error_msg("no lease, forking to background");
+ client_background();
+ /* do not background again! */
+ opt = ((opt & ~OPT_b) | OPT_f);
+- } else
+-#endif
+- if (opt & OPT_n) { /* abort if no lease */
+- bb_error_msg("no lease, failing");
+- retval = 1;
+- goto ret;
+ }
++#endif
+ /* wait before trying again */
+ timeout = tryagain_timeout;
+ packet_num = 0;
+--
+2.13.2
+
diff --git a/system/busybox/0011-testsuite-fix-cpio-tests.patch b/system/busybox/0011-testsuite-fix-cpio-tests.patch
new file mode 100644
index 000000000..a6eb803de
--- /dev/null
+++ b/system/busybox/0011-testsuite-fix-cpio-tests.patch
@@ -0,0 +1,82 @@
+From 9a522cf388e321b47f9462bbbd7726323095f8db Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Thu, 6 Jul 2017 13:41:32 +0200
+Subject: [PATCH 11/11] testsuite: fix cpio tests
+
+The cpio tests don't search for the right output line correctly,
+using a hardcoded tail offset. Instead, grep for the file entry
+just added.
+
+The reverse-hunk patch tests seem to get the output order wrong,
+and the tests pass when this is corrected.
+---
+ testsuite/cpio.tests | 6 +++---
+ testsuite/patch.tests | 4 ++--
+ 2 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/testsuite/cpio.tests b/testsuite/cpio.tests
+index 88ec086b6..40f72c363 100755
+--- a/testsuite/cpio.tests
++++ b/testsuite/cpio.tests
+@@ -129,7 +129,7 @@ SKIP=
+
+ optional FEATURE_CPIO_O
+ testing "cpio uses by default uid/gid" \
+-"echo $0 | cpio -o -H newc | cpio -tv 2>&1 | tail -n +2 | awk ' { print \$2 } '; echo \$?" \
++"echo $0 | cpio -o -H newc | cpio -tv 2>&1 | grep -F $(basename $0) | awk ' { print \$2 } '; echo \$?" \
+ "\
+ $user/$group
+ 0
+@@ -138,7 +138,7 @@ SKIP=
+
+ optional FEATURE_CPIO_O
+ testing "cpio -R with create" \
+-"echo $0 | cpio -o -H newc -R 1234:5678 | cpio -tv 2>&1 | tail -n +2 | awk ' { print \$2 } '; echo \$?" \
++"echo $0 | cpio -o -H newc -R 1234:5678 | cpio -tv 2>&1 | grep -F $(basename $0) | awk ' { print \$2 } '; echo \$?" \
+ "\
+ 1234/5678
+ 0
+@@ -147,7 +147,7 @@ SKIP=
+
+ optional FEATURE_CPIO_O
+ testing "cpio -R with extract" \
+-"echo $0 | cpio -o -H newc | cpio -tv -R 8765:4321 2>&1 | tail -n +2 | awk ' { print \$2 } '; echo \$?" \
++"echo $0 | cpio -o -H newc | cpio -tv -R 8765:4321 2>&1 | grep -F $(basename $0) | awk ' { print \$2 } '; echo \$?" \
+ "\
+ 8765/4321
+ 0
+diff --git a/testsuite/patch.tests b/testsuite/patch.tests
+index 39205242c..1d48e90be 100755
+--- a/testsuite/patch.tests
++++ b/testsuite/patch.tests
+@@ -75,12 +75,12 @@ zxc
+ testing "patch detects already applied hunk" \
+ 'patch 2>&1; echo $?; cat input' \
+ "\
++patching file input
+ Possibly reversed hunk 1 at 4
+ Hunk 1 FAILED 1/1.
+ abc
+ +def
+ 123
+-patching file input
+ 1
+ abc
+ def
+@@ -103,12 +103,12 @@ def
+ testing "patch detects already applied hunk at the EOF" \
+ 'patch 2>&1; echo $?; cat input' \
+ "\
++patching file input
+ Possibly reversed hunk 1 at 4
+ Hunk 1 FAILED 1/1.
+ abc
+ 123
+ +456
+-patching file input
+ 1
+ abc
+ 123
+--
+2.13.2
+
diff --git a/system/busybox/0012-microcom-segfault.patch b/system/busybox/0012-microcom-segfault.patch
new file mode 100644
index 000000000..4789079b3
--- /dev/null
+++ b/system/busybox/0012-microcom-segfault.patch
@@ -0,0 +1,31 @@
+From fd8a0116a29ea4014fac7fbdba2636fc7b51ffc2 Mon Sep 17 00:00:00 2001
+From: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
+Date: Wed, 2 Aug 2017 23:36:08 +0200
+Subject: [PATCH] miscutils/microcom: Fixed segfault
+
+microcom did not check if required parameter TTY is present. Thus,
+bb_basename() was called with a NULL pointer if TTY was missing.
+This commit adds the missing check.
+---
+ miscutils/microcom.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/miscutils/microcom.c b/miscutils/microcom.c
+index 14b9f3baf..38f6425c1 100644
+--- a/miscutils/microcom.c
++++ b/miscutils/microcom.c
+@@ -78,6 +78,11 @@ int microcom_main(int argc UNUSED_PARAM, char **argv)
+ // argc -= optind;
+ argv += optind;
+
++ if (*argv == NULL){
++ bb_show_usage();
++ return EXIT_FAILURE;
++ }
++
+ // try to create lock file in /var/lock
+ device_lock_file = (char *)bb_basename(argv[0]);
+ device_lock_file = xasprintf("/var/lock/LCK..%s", device_lock_file);
+--
+2.13.3
+
diff --git a/system/busybox/APKBUILD b/system/busybox/APKBUILD
new file mode 100644
index 000000000..0c09b1126
--- /dev/null
+++ b/system/busybox/APKBUILD
@@ -0,0 +1,202 @@
+# Contributor: Łukasz Jendrysik <scadu@yandex.com>
+# Contributor: Oliver Smith <ollieparanoid@bitmessage.ch>
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=busybox
+pkgver=1.27.2
+pkgrel=4
+pkgdesc="Size optimized toolbox of many common UNIX utilities"
+url=http://busybox.net
+arch="all"
+license="GPL2"
+makedepends_build=""
+makedepends_host="linux-headers"
+makedepends="$makedepends_build $makedepends_host"
+checkdepends="zip"
+provides="/bin/sh /sbin/init"
+install="$pkgname.post-install $pkgname.post-upgrade
+ $pkgname-extras.post-install $pkgname-extras.pre-deinstall"
+subpackages="$pkgname-static $pkgname-suid $pkgname-extras $pkgname-binsh"
+options="suid !check"
+triggers="busybox.trigger=/bin:/usr/bin:/sbin:/usr/sbin:/lib/modules/*"
+source="http://busybox.net/downloads/$pkgname-$pkgver.tar.bz2
+ 0001-ash-add-support-for-command_not_found_handle-hook-fu.patch
+
+ 0001-ash-exec-busybox.static.patch
+ 0002-app-location-for-cpio-vi-and-lspci.patch
+ 0003-udhcpc-set-default-discover-retries-to-5.patch
+ 0004-ping-make-ping-work-without-root-privileges.patch
+ 0005-fbsplash-support-console-switching.patch
+ 0006-fbsplash-support-image-and-bar-alignment-and-positio.patch
+ 0007-depmod-support-generating-kmod-binary-index-files.patch
+ 0008-diff-add-support-for-no-dereference.patch
+ 0009-sysklogd-add-Z-option-to-adjust-message-timezones.patch
+ 0010-udhcpc-Don-t-background-if-n-is-given.patch
+ 0011-testsuite-fix-cpio-tests.patch
+ 0012-microcom-segfault.patch
+
+ top-buffer-overflow.patch
+
+ acpid.logrotate
+ busyboxconfig
+ busyboxconfig-extras
+ bbsuid.c
+ dad.if-up
+ nologin.c
+ "
+builddir="$srcdir"/$pkgname-$pkgver
+
+_staticdir="$srcdir"/build-static
+_dyndir="$srcdir"/build-dynamic
+_dyndir_extras="$srcdir"/build-dynamic-extras
+_config="$srcdir"/busyboxconfig
+_config_extras="$srcdir"/busyboxconfig-extras
+
+prepare() {
+ default_prepare
+
+ cd "$builddir"
+ mkdir -p "$_staticdir" "$_dyndir" "$_dyndir_extras"
+ cp "$srcdir"/nologin.c loginutils/
+}
+
+build() {
+ # build bbsuid
+ msg "Building bbsuid"
+ ${CC:-${CROSS_COMPILE}gcc} ${CPPFLAGS} ${CFLAGS} \
+ ${LDFLAGS} "$srcdir"/bbsuid.c -o "$_dyndir"/bbsuid
+
+ # build dynamic
+ cd "$_dyndir"
+ msg "Building dynamic busybox"
+ cp "$_config" .config
+ [ "$CLIBC" = musl ] && sed -i \
+ -e "s/CONFIG_EXTRA_COMPAT=y/CONFIG_EXTRA_COMPAT=n/" \
+ .config
+ make -C "$builddir" O="$PWD" silentoldconfig
+ make
+
+ # build dynamic (extras)
+ cd "$_dyndir_extras"
+ msg "Building dynamic busybox-extras"
+ cp "$_config_extras" .config
+ [ "$CLIBC" = musl ] && sed -i \
+ -e "s/CONFIG_EXTRA_COMPAT=y/CONFIG_EXTRA_COMPAT=n/" \
+ .config
+ make -C "$builddir" O="$PWD" silentoldconfig
+ make
+
+ # build static
+ cd "$_staticdir"
+ msg "Building static busybox"
+ sed -e "s/.*CONFIG_PIE.*/\# CONFIG_PIE is not set/" \
+ -e "s/.*CONFIG_STATIC.*/CONFIG_STATIC=y/" \
+ "$_config" > .config
+ # musl does not support GNU regex
+ [ "$CLIBC" = musl ] && sed -i \
+ -e "s/CONFIG_EXTRA_COMPAT=y/CONFIG_EXTRA_COMPAT=n/" \
+ .config
+ make -C "$builddir" O="$PWD" silentoldconfig
+ make
+ mv busybox busybox.static
+}
+
+check() {
+ cd "$_dyndir"
+ SKIP_KNOWN_BUGS=1 make -C "$builddir" O="$PWD" V=1 check
+
+ cd "$_dyndir_extras"
+ SKIP_KNOWN_BUGS=1 make -C "$builddir" O="$PWD" V=1 check
+}
+
+package() {
+ cd "$_dyndir"
+ mkdir -p "$pkgdir"/usr/sbin "$pkgdir"/usr/bin "$pkgdir"/tmp \
+ "$pkgdir"/var/cache/misc "$pkgdir"/bin "$pkgdir"/sbin
+ chmod 1777 "$pkgdir"/tmp
+ install -m755 busybox "$pkgdir"/bin/busybox || return 1
+ # we need /bin/sh to be able to execute post-install
+ ln -s /bin/busybox "$pkgdir"/bin/sh
+
+ #ifupdown needs those dirs to be present
+ mkdir -p \
+ "$pkgdir"/etc/network/if-down.d \
+ "$pkgdir"/etc/network/if-post-down.d \
+ "$pkgdir"/etc/network/if-post-up.d \
+ "$pkgdir"/etc/network/if-pre-down.d \
+ "$pkgdir"/etc/network/if-pre-up.d \
+ "$pkgdir"/etc/network/if-up.d
+ install -m775 "$srcdir"/dad.if-up "$pkgdir"/etc/network/if-up.d/dad
+
+ install -Dm644 "$srcdir"/acpid.logrotate \
+ "$pkgdir/etc/logrotate.d/acpid"
+
+ mkdir -p "$pkgdir"/var/lib/udhcpd
+ install -Dm644 "$builddir"/examples/udhcp/udhcpd.conf \
+ "$pkgdir"/etc/udhcpd.conf
+ cat >"$pkgdir"/etc/securetty <<EOF
+console
+tty1
+tty2
+tty3
+tty4
+tty5
+tty6
+tty7
+tty8
+tty9
+tty10
+tty11
+EOF
+}
+
+extras() {
+ pkgdesc="Additional binaries of Busybox"
+ depends="${pkgname}"
+ install -Dm755 "$_dyndir_extras"/busybox "$subpkgdir"/bin/busybox-extras
+}
+
+suid() {
+ pkgdesc="suid binaries of Busybox"
+ depends="${pkgname}"
+
+ cd "$_dyndir"
+ mkdir -p "$subpkgdir"/bin
+ install -m4111 bbsuid "$subpkgdir"/bin/bbsuid
+}
+
+binsh() {
+ pkgdesc="Provide /bin/sh with BusyBox ash"
+ depends="${pkgname}"
+
+ mkdir -p "$subpkgdir"/bin
+ mv "$pkgdir"/bin/sh "$subpkgdir"/bin
+}
+
+static() {
+ pkgdesc="Statically linked Busybox"
+ mkdir -p "$subpkgdir"/bin
+ install -m755 "$_staticdir"/busybox.static \
+ "$subpkgdir"/bin/busybox.static
+}
+
+sha512sums="d99e86b652562ebe1a5d50e1ba3877a1d1612997c17cb8d8e4212da181211a9b741a881cb051f14cb3ee8aea40226cf2cde80a076baed265d3bc0a4e96a5031c busybox-1.27.2.tar.bz2
+dc08288c8e9e29d36be7174d58f3bee2d0508465977fb40d39807aa0b03149f7814f8cfed113d0a7589ef49890beb1805ef00f0d37b563447fe875e3cff08d1c 0001-ash-add-support-for-command_not_found_handle-hook-fu.patch
+1930775839354a63c30970f0d52d00cfd3a8f6b9f48d6de45ea7d2478d080bde7193c1c2cce026dc7337d9ecf0b65f5ff1dd4351c1eb195e6f0c0c5126f10511 0001-ash-exec-busybox.static.patch
+a756aa89c4602cd091df0052e2e3d7b45a359fbfe953b70aa3029e3eeb8e5d1772cbf1525bb62df6ce6547f1e5605617195ddae336e1ffe41f5c58d524af6ba6 0002-app-location-for-cpio-vi-and-lspci.patch
+fc17ce9b12726e3449518692bf0d4906c36f091534706b5b91c910866bd8cd50d8f7d4b449d54eeed24ee656012a6ef04612bf092874e4b83b0723f852fdce0e 0003-udhcpc-set-default-discover-retries-to-5.patch
+dc0b660b60ef3028a4cc86f712e7f6d08ad7c00d27056f9978a2a103434f45edc7385d2c48eca5ee83efab8fc81735674bf1c40e78fb07a1b5d07ca9da37811a 0004-ping-make-ping-work-without-root-privileges.patch
+63838512679586eb6d83e7b7d3b1e318bb693b91dfb9675a48480e6623e03472b1aa7f86fb7e2ab9e8d6db7a9609b2bcf1c3c1de64fc7d73b65b4794cab87cbf 0005-fbsplash-support-console-switching.patch
+1afe261da507ca13869923033a4adbb3c22e512136cc4b771a2d14d0c25d8de6514cec1dd0363b0684410f0e6a274c3250c1ca8a8a839111f3ed16f800b1d403 0006-fbsplash-support-image-and-bar-alignment-and-positio.patch
+16804d38000bf4395ed2657c19ddf0a1414214db8d2e43541034d5a6db29f74c53c6d8fd28c4c865c7e87fa4a9b914d414e5a00430a261aeaa69ec86bf865780 0007-depmod-support-generating-kmod-binary-index-files.patch
+baac796f8aa96fbeab19f96eea7787ace5737b182f49e02f1b1e911d0a927ae14f3c334daad4241858617dc79607541b9ce66b367d0379b2cb32f67a1e9efc5b 0008-diff-add-support-for-no-dereference.patch
+d1c375184f806f7550bac5c82ab5471bdb8085d845172c973724b22af05ab3759b3ce982e088b4c45815ade56b9adfb7a677d0c180e077545ac7ec003c8aa7c4 0009-sysklogd-add-Z-option-to-adjust-message-timezones.patch
+9b5143d0be615b1604d82007628d59a62721f1e61a63cca7a4ffa5e60fa8da102bfc21fa20cc35c2f5a0a24bc8013598f8eff5888f9d0f3bcfa796343b5f5a91 0010-udhcpc-Don-t-background-if-n-is-given.patch
+f4e00eb13fda752df13f300a7ed9b1320ca9f573c4309247f292c8710464d7be8740148f42e4aff16312335eadabce5a629dce4af58334b9199faf2fd658e4f9 0011-testsuite-fix-cpio-tests.patch
+a09a64b3bce8048c58a68dcd2dd9e63c911009c06195d6bb4e5aecfb5700e479c25b34635c60899127975fae32275ad51846ee75f840d612e00668ce9aba8322 0012-microcom-segfault.patch
+524e858b52cb31fb8d24e8c7f18606fff349aeab6a14da9cca3902641f6127980daed73c53586c6e8b41eecda06cdb29c40ff1dde2dc82a318c2649680458921 top-buffer-overflow.patch
+a9b1403c844c51934637215307dd9e2adb9458921047acff0d86dcf229b6e0027f4b2c6cdaa25a58407aad9d098fb5685d58eb5ff8d2aa3de4912cdea21fe54c acpid.logrotate
+02102f0764ffbec86e97ccab99b3a1e55ffa5b25aa2cdc1fe270d5b575610bdb50568574c7cbd05aba91b13151f84f536b44320c180051cbd77cf258e4fc89a4 busyboxconfig
+7759d1611ce72f7aa9e4afbd48f410806b3bd59701fe8a570675898c504c0e15f85bacbc1578f87345197844ee6175117d348acc4fe29a742b7ac96b84fe7386 busyboxconfig-extras
+e84087a453f8c9814951c9ad496cce19f8280b80a8ab6a1c8e21385f1facb17e987adc8d1d72c7cb463c04eb0cadd2bd6fb9b6f6c0067ddd21eeacf91ca42f32 bbsuid.c
+a1127c8a384294135e11500fde7ead33b73d24b11c21911b08447a4c4ef71d7a9965d6466f60f2da64e3b877213b0a3e924a5add3c5333ee3ecde8c2a91c5e02 dad.if-up
+4e7c291a70e879b74c0fc07c54a73ef50537d8be68fee6b2d409425c07afd2d67f9b6afcd8c33a7971014913cc5de85e45079681c9e77200c6cc2f34acfba6d2 nologin.c"
diff --git a/system/busybox/acpid.logrotate b/system/busybox/acpid.logrotate
new file mode 100644
index 000000000..a37763540
--- /dev/null
+++ b/system/busybox/acpid.logrotate
@@ -0,0 +1,8 @@
+/var/log/acpid.log {
+ missingok
+ notifempty
+ sharedscripts
+ postrotate
+ /etc/init.d/acpid --ifstarted restart || true
+ endscript
+}
diff --git a/system/busybox/bbsuid.c b/system/busybox/bbsuid.c
new file mode 100644
index 000000000..8be2671b1
--- /dev/null
+++ b/system/busybox/bbsuid.c
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2008 Natanael Copa <natanael.copa@gmail.com>
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation. See http://www.gnu.org/ for details.
+ *
+ */
+
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include <libgen.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#define BBSUID_PATH "/bin/bbsuid"
+
+const static char * applets[] = {
+ "/bin/mount",
+ "/bin/umount",
+ "/bin/su",
+ "/usr/bin/crontab",
+ "/usr/bin/passwd",
+ "/usr/bin/traceroute",
+ "/usr/bin/traceroute6",
+ "/usr/bin/vlock",
+ NULL
+};
+
+
+static const char *applet_from_path(const char *str)
+{
+ const char *p = strrchr(str, '/');
+ if (p == NULL)
+ p = str;
+ else
+ p++;
+ return p;
+}
+
+static int is_valid_applet(const char *str)
+{
+ int i;
+ for (i = 0; applets[i] != NULL; i++) {
+ const char *a = applet_from_path(applets[i]);
+ if (strcmp(applet_from_path(str), a) == 0)
+ return 1;
+ }
+ return 0;
+}
+
+int exec_busybox(const char *app, int argc, char **argv)
+{
+ char **newargv = malloc((argc + 2) * sizeof(char *));
+ int i;
+ newargv[0] = "/bin/busybox";
+ newargv[1] = (char *)app;
+ for (i = 1; i < argc; i++)
+ newargv[i+1] = argv[i];
+ newargv[argc+1] = NULL;
+ execv(newargv[0], newargv);
+ perror(newargv[0]);
+ free(newargv);
+ return 1;
+}
+
+static int install_links(void)
+{
+ int i, r = 0;
+ /* we don't want others than root to install the symlinks */
+ if (getuid() != 0)
+ errx(1, "Only root can install symlinks");
+
+ for (i = 0; applets[i] != NULL; i++) {
+ const char *a = applets[i];
+ struct stat st;
+ if (lstat(a, &st) == 0 && S_ISLNK(st.st_mode))
+ unlink(a);
+ if (symlink(BBSUID_PATH, a) < 0)
+ r++;
+ }
+
+ return r;
+}
+
+int main(int argc, char **argv)
+{
+ const char *app = applet_from_path(argv[0]);
+
+ if (strcmp(app, "bbsuid") == 0) {
+ if (argc == 2 && strcmp(argv[1], "--install") == 0)
+ return install_links();
+ errx(1, "Use --install to install symlinks");
+ }
+
+ if (is_valid_applet(app))
+ return exec_busybox(app, argc, argv);
+
+ errx(1, "%s is not a valid applet", app);
+ return 1;
+}
+
diff --git a/system/busybox/busybox-extras.post-install b/system/busybox/busybox-extras.post-install
new file mode 100644
index 000000000..a0327a691
--- /dev/null
+++ b/system/busybox/busybox-extras.post-install
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Create all symlinks
+exec /bin/busybox-extras --install -s
diff --git a/system/busybox/busybox-extras.pre-deinstall b/system/busybox/busybox-extras.pre-deinstall
new file mode 100644
index 000000000..15461302c
--- /dev/null
+++ b/system/busybox/busybox-extras.pre-deinstall
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# Remove all symlinks to busybox-extras
+cd /
+for link in $(busybox-extras --list --full); do
+ if [ -L "$link" ] && [ "$(readlink $link)" = "/bin/busybox-extras" ]; then
+ rm "$link"
+ fi
+done
diff --git a/system/busybox/busybox.post-install b/system/busybox/busybox.post-install
new file mode 100644
index 000000000..a986b2f76
--- /dev/null
+++ b/system/busybox/busybox.post-install
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# We need the symlinks early
+exec /bin/busybox --install -s
diff --git a/system/busybox/busybox.post-upgrade b/system/busybox/busybox.post-upgrade
new file mode 100644
index 000000000..291ed7a6d
--- /dev/null
+++ b/system/busybox/busybox.post-upgrade
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+# remove links that has been relocated
+for link in /bin/install /bin/ip /bin/vi /usr/bin/lspci; do
+ if [ -L "$link" ] && [ "$(readlink $link)" = "/bin/busybox" ]; then
+ rm "$link"
+ fi
+done
+for link in /bin/ping /bin/ping6; do
+ if [ -L "$link" ] && [ "$(readlink $link)" = "/bin/bbsuid" ]; then
+ rm "$link"
+ fi
+done
+
+# remove links of programs moved to busybox-extras
+for link in /usr/bin/telnet /usr/sbin/httpd /usr/bin/ftpget /usr/bin/ftpput \
+ /usr/sbin/ftpd /usr/bin/tftp /usr/sbin/fakeidentd /usr/sbin/dnsd \
+ /usr/sbin/inetd /usr/sbin/udhcpd; do
+ if [ -L "$link" ] && [ "$(readlink $link)" = "/bin/busybox" ]; then
+ rm "$link"
+ echo "NOTE: $link has been moved to the package 'busybox-extras'"
+ fi
+done
+
+# We need the symlinks early
+exec /bin/busybox --install -s
diff --git a/system/busybox/busybox.trigger b/system/busybox/busybox.trigger
new file mode 100644
index 000000000..e531a45b8
--- /dev/null
+++ b/system/busybox/busybox.trigger
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+do_bb_install=
+
+for i in "$@"; do
+ case "$i" in
+ /lib/modules/*)
+ if [ -d "$i" ]; then
+ /bin/busybox depmod ${i#/lib/modules/}
+ fi
+ ;;
+ *) do_bb_install=yes;;
+ esac
+done
+
+if [ -n "$do_bb_install" ]; then
+ [ -e /bin/bbsuid ] && /bin/bbsuid --install
+ [ -e /bin/busybox-extras ] && /bin/busybox-extras --install -s
+ /bin/busybox --install -s
+fi
diff --git a/system/busybox/busyboxconfig b/system/busybox/busyboxconfig
new file mode 100644
index 000000000..979646071
--- /dev/null
+++ b/system/busybox/busyboxconfig
@@ -0,0 +1,1138 @@
+#
+# Automatically generated make config: don't edit
+# Busybox version: 1.27.2
+# Fri Oct 27 21:22:08 2017
+#
+CONFIG_HAVE_DOT_CONFIG=y
+
+#
+# Busybox Settings
+#
+CONFIG_DESKTOP=y
+# CONFIG_EXTRA_COMPAT is not set
+# CONFIG_FEDORA_COMPAT is not set
+# CONFIG_INCLUDE_SUSv2 is not set
+# CONFIG_USE_PORTABLE_CODE is not set
+CONFIG_SHOW_USAGE=y
+CONFIG_FEATURE_VERBOSE_USAGE=y
+CONFIG_FEATURE_COMPRESS_USAGE=y
+CONFIG_BUSYBOX=y
+CONFIG_FEATURE_INSTALLER=y
+# CONFIG_INSTALL_NO_USR is not set
+# CONFIG_PAM is not set
+CONFIG_LONG_OPTS=y
+CONFIG_FEATURE_DEVPTS=y
+# CONFIG_FEATURE_CLEAN_UP is not set
+# CONFIG_FEATURE_UTMP is not set
+# CONFIG_FEATURE_WTMP is not set
+CONFIG_FEATURE_PIDFILE=y
+CONFIG_PID_FILE_PATH="/var/run"
+CONFIG_FEATURE_SUID=y
+# CONFIG_FEATURE_SUID_CONFIG is not set
+# CONFIG_FEATURE_SUID_CONFIG_QUIET is not set
+# CONFIG_SELINUX is not set
+# CONFIG_FEATURE_PREFER_APPLETS is not set
+CONFIG_BUSYBOX_EXEC_PATH="/bin/busybox"
+CONFIG_FEATURE_SYSLOG=y
+# CONFIG_FEATURE_HAVE_RPC is not set
+CONFIG_PLATFORM_LINUX=y
+
+#
+# Build Options
+#
+# CONFIG_STATIC is not set
+CONFIG_PIE=y
+# CONFIG_NOMMU is not set
+# CONFIG_BUILD_LIBBUSYBOX is not set
+# CONFIG_FEATURE_INDIVIDUAL is not set
+# CONFIG_FEATURE_SHARED_BUSYBOX is not set
+CONFIG_LFS=y
+CONFIG_CROSS_COMPILER_PREFIX=""
+CONFIG_SYSROOT=""
+CONFIG_EXTRA_CFLAGS=""
+CONFIG_EXTRA_LDFLAGS=""
+CONFIG_EXTRA_LDLIBS=""
+
+#
+# Installation Options ("make install" behavior)
+#
+# CONFIG_INSTALL_APPLET_SYMLINKS is not set
+# CONFIG_INSTALL_APPLET_HARDLINKS is not set
+# CONFIG_INSTALL_APPLET_SCRIPT_WRAPPERS is not set
+CONFIG_INSTALL_APPLET_DONT=y
+# CONFIG_INSTALL_SH_APPLET_SYMLINK is not set
+# CONFIG_INSTALL_SH_APPLET_HARDLINK is not set
+# CONFIG_INSTALL_SH_APPLET_SCRIPT_WRAPPER is not set
+CONFIG_PREFIX="/home/ncopa/aports/main/busybox/pkg/busybox"
+
+#
+# Debugging Options
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PESSIMIZE is not set
+# CONFIG_DEBUG_SANITIZE is not set
+# CONFIG_UNIT_TEST is not set
+# CONFIG_WERROR is not set
+CONFIG_NO_DEBUG_LIB=y
+# CONFIG_DMALLOC is not set
+# CONFIG_EFENCE is not set
+
+#
+# Busybox Library Tuning
+#
+# CONFIG_FEATURE_USE_BSS_TAIL is not set
+CONFIG_FEATURE_RTMINMAX=y
+CONFIG_FEATURE_BUFFERS_USE_MALLOC=y
+# CONFIG_FEATURE_BUFFERS_GO_ON_STACK is not set
+# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set
+CONFIG_PASSWORD_MINLEN=6
+CONFIG_MD5_SMALL=0
+CONFIG_SHA3_SMALL=0
+CONFIG_FEATURE_FAST_TOP=y
+# CONFIG_FEATURE_ETC_NETWORKS is not set
+CONFIG_FEATURE_EDITING=y
+CONFIG_FEATURE_EDITING_MAX_LEN=1024
+CONFIG_FEATURE_EDITING_VI=y
+CONFIG_FEATURE_EDITING_HISTORY=8192
+CONFIG_FEATURE_EDITING_SAVEHISTORY=y
+# CONFIG_FEATURE_EDITING_SAVE_ON_EXIT is not set
+CONFIG_FEATURE_REVERSE_SEARCH=y
+CONFIG_FEATURE_TAB_COMPLETION=y
+CONFIG_FEATURE_USERNAME_COMPLETION=y
+CONFIG_FEATURE_EDITING_FANCY_PROMPT=y
+CONFIG_FEATURE_EDITING_ASK_TERMINAL=y
+CONFIG_LOCALE_SUPPORT=y
+CONFIG_UNICODE_SUPPORT=y
+CONFIG_UNICODE_USING_LOCALE=y
+# CONFIG_FEATURE_CHECK_UNICODE_IN_ENV is not set
+CONFIG_SUBST_WCHAR=63
+CONFIG_LAST_SUPPORTED_WCHAR=1114111
+CONFIG_UNICODE_COMBINING_WCHARS=y
+CONFIG_UNICODE_WIDE_WCHARS=y
+# CONFIG_UNICODE_BIDI_SUPPORT is not set
+# CONFIG_UNICODE_NEUTRAL_TABLE is not set
+CONFIG_UNICODE_PRESERVE_BROKEN=y
+CONFIG_FEATURE_NON_POSIX_CP=y
+# CONFIG_FEATURE_VERBOSE_CP_MESSAGE is not set
+CONFIG_FEATURE_USE_SENDFILE=y
+CONFIG_FEATURE_COPYBUF_KB=16
+CONFIG_FEATURE_SKIP_ROOTFS=y
+CONFIG_MONOTONIC_SYSCALL=y
+# CONFIG_IOCTL_HEX2STR_ERROR is not set
+CONFIG_FEATURE_HWIB=y
+
+#
+# Applets
+#
+
+#
+# Archival Utilities
+#
+CONFIG_FEATURE_SEAMLESS_XZ=y
+CONFIG_FEATURE_SEAMLESS_LZMA=y
+CONFIG_FEATURE_SEAMLESS_BZ2=y
+CONFIG_FEATURE_SEAMLESS_GZ=y
+CONFIG_FEATURE_SEAMLESS_Z=y
+# CONFIG_AR is not set
+# CONFIG_FEATURE_AR_LONG_FILENAMES is not set
+# CONFIG_FEATURE_AR_CREATE is not set
+# CONFIG_UNCOMPRESS is not set
+CONFIG_GUNZIP=y
+CONFIG_ZCAT=y
+CONFIG_FEATURE_GUNZIP_LONG_OPTIONS=y
+CONFIG_BUNZIP2=y
+CONFIG_BZCAT=y
+CONFIG_UNLZMA=y
+CONFIG_LZCAT=y
+CONFIG_LZMA=y
+CONFIG_FEATURE_LZMA_FAST=y
+CONFIG_UNXZ=y
+CONFIG_XZCAT=y
+# CONFIG_XZ is not set
+CONFIG_BZIP2=y
+CONFIG_FEATURE_BZIP2_DECOMPRESS=y
+CONFIG_CPIO=y
+CONFIG_FEATURE_CPIO_O=y
+CONFIG_FEATURE_CPIO_P=y
+# CONFIG_DPKG is not set
+# CONFIG_DPKG_DEB is not set
+CONFIG_GZIP=y
+# CONFIG_FEATURE_GZIP_LONG_OPTIONS is not set
+CONFIG_GZIP_FAST=2
+CONFIG_FEATURE_GZIP_LEVELS=y
+CONFIG_FEATURE_GZIP_DECOMPRESS=y
+CONFIG_LZOP=y
+CONFIG_UNLZOP=y
+CONFIG_LZOPCAT=y
+# CONFIG_LZOP_COMPR_HIGH is not set
+# CONFIG_RPM is not set
+# CONFIG_RPM2CPIO is not set
+CONFIG_TAR=y
+CONFIG_FEATURE_TAR_LONG_OPTIONS=y
+CONFIG_FEATURE_TAR_CREATE=y
+CONFIG_FEATURE_TAR_AUTODETECT=y
+CONFIG_FEATURE_TAR_FROM=y
+CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY=y
+CONFIG_FEATURE_TAR_OLDSUN_COMPATIBILITY=y
+CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y
+# CONFIG_FEATURE_TAR_TO_COMMAND is not set
+CONFIG_FEATURE_TAR_UNAME_GNAME=y
+CONFIG_FEATURE_TAR_NOPRESERVE_TIME=y
+# CONFIG_FEATURE_TAR_SELINUX is not set
+CONFIG_UNZIP=y
+CONFIG_FEATURE_UNZIP_CDF=y
+CONFIG_FEATURE_UNZIP_BZIP2=y
+CONFIG_FEATURE_UNZIP_LZMA=y
+CONFIG_FEATURE_UNZIP_XZ=y
+
+#
+# Coreutils
+#
+CONFIG_BASENAME=y
+CONFIG_CAT=y
+CONFIG_FEATURE_CATV=y
+CONFIG_CHGRP=y
+CONFIG_CHMOD=y
+CONFIG_CHOWN=y
+CONFIG_FEATURE_CHOWN_LONG_OPTIONS=y
+CONFIG_CHROOT=y
+CONFIG_CKSUM=y
+CONFIG_COMM=y
+CONFIG_CP=y
+CONFIG_FEATURE_CP_LONG_OPTIONS=y
+CONFIG_CUT=y
+CONFIG_DATE=y
+CONFIG_FEATURE_DATE_ISOFMT=y
+# CONFIG_FEATURE_DATE_NANO is not set
+CONFIG_FEATURE_DATE_COMPAT=y
+CONFIG_DD=y
+CONFIG_FEATURE_DD_SIGNAL_HANDLING=y
+# CONFIG_FEATURE_DD_THIRD_STATUS_LINE is not set
+CONFIG_FEATURE_DD_IBS_OBS=y
+CONFIG_FEATURE_DD_STATUS=y
+CONFIG_DF=y
+CONFIG_FEATURE_DF_FANCY=y
+CONFIG_DIRNAME=y
+CONFIG_DOS2UNIX=y
+CONFIG_UNIX2DOS=y
+CONFIG_DU=y
+CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K=y
+CONFIG_ECHO=y
+CONFIG_FEATURE_FANCY_ECHO=y
+CONFIG_ENV=y
+# CONFIG_FEATURE_ENV_LONG_OPTIONS is not set
+CONFIG_EXPAND=y
+# CONFIG_FEATURE_EXPAND_LONG_OPTIONS is not set
+CONFIG_UNEXPAND=y
+# CONFIG_FEATURE_UNEXPAND_LONG_OPTIONS is not set
+CONFIG_EXPR=y
+CONFIG_EXPR_MATH_SUPPORT_64=y
+CONFIG_FACTOR=y
+CONFIG_FALSE=y
+CONFIG_FOLD=y
+CONFIG_FSYNC=y
+CONFIG_HEAD=y
+CONFIG_FEATURE_FANCY_HEAD=y
+CONFIG_HOSTID=y
+CONFIG_ID=y
+CONFIG_GROUPS=y
+CONFIG_INSTALL=y
+# CONFIG_FEATURE_INSTALL_LONG_OPTIONS is not set
+CONFIG_LINK=y
+CONFIG_LN=y
+# CONFIG_LOGNAME is not set
+CONFIG_LS=y
+CONFIG_FEATURE_LS_FILETYPES=y
+CONFIG_FEATURE_LS_FOLLOWLINKS=y
+CONFIG_FEATURE_LS_RECURSIVE=y
+CONFIG_FEATURE_LS_WIDTH=y
+CONFIG_FEATURE_LS_SORTFILES=y
+CONFIG_FEATURE_LS_TIMESTAMPS=y
+CONFIG_FEATURE_LS_USERNAME=y
+CONFIG_FEATURE_LS_COLOR=y
+CONFIG_FEATURE_LS_COLOR_IS_DEFAULT=y
+CONFIG_MD5SUM=y
+CONFIG_SHA1SUM=y
+CONFIG_SHA256SUM=y
+CONFIG_SHA512SUM=y
+CONFIG_SHA3SUM=y
+
+#
+# Common options for md5sum, sha1sum, sha256sum, sha512sum, sha3sum
+#
+CONFIG_FEATURE_MD5_SHA1_SUM_CHECK=y
+CONFIG_MKDIR=y
+# CONFIG_FEATURE_MKDIR_LONG_OPTIONS is not set
+CONFIG_MKFIFO=y
+CONFIG_MKNOD=y
+CONFIG_MKTEMP=y
+CONFIG_MV=y
+# CONFIG_FEATURE_MV_LONG_OPTIONS is not set
+CONFIG_NICE=y
+CONFIG_NL=y
+CONFIG_NOHUP=y
+CONFIG_NPROC=y
+CONFIG_OD=y
+CONFIG_PASTE=y
+CONFIG_PRINTENV=y
+CONFIG_PRINTF=y
+CONFIG_PWD=y
+CONFIG_READLINK=y
+CONFIG_FEATURE_READLINK_FOLLOW=y
+CONFIG_REALPATH=y
+CONFIG_RM=y
+CONFIG_RMDIR=y
+# CONFIG_FEATURE_RMDIR_LONG_OPTIONS is not set
+CONFIG_SEQ=y
+CONFIG_SHRED=y
+CONFIG_SHUF=y
+CONFIG_SLEEP=y
+CONFIG_FEATURE_FANCY_SLEEP=y
+CONFIG_FEATURE_FLOAT_SLEEP=y
+CONFIG_SORT=y
+CONFIG_FEATURE_SORT_BIG=y
+CONFIG_SPLIT=y
+# CONFIG_FEATURE_SPLIT_FANCY is not set
+CONFIG_STAT=y
+CONFIG_FEATURE_STAT_FORMAT=y
+CONFIG_FEATURE_STAT_FILESYSTEM=y
+CONFIG_STTY=y
+CONFIG_SUM=y
+CONFIG_SYNC=y
+CONFIG_FEATURE_SYNC_FANCY=y
+CONFIG_TAC=y
+CONFIG_TAIL=y
+CONFIG_FEATURE_FANCY_TAIL=y
+CONFIG_TEE=y
+CONFIG_FEATURE_TEE_USE_BLOCK_IO=y
+CONFIG_TEST=y
+CONFIG_TEST1=y
+CONFIG_TEST2=y
+CONFIG_FEATURE_TEST_64=y
+CONFIG_TIMEOUT=y
+CONFIG_TOUCH=y
+CONFIG_FEATURE_TOUCH_NODEREF=y
+CONFIG_FEATURE_TOUCH_SUSV3=y
+CONFIG_TR=y
+CONFIG_FEATURE_TR_CLASSES=y
+CONFIG_FEATURE_TR_EQUIV=y
+CONFIG_TRUE=y
+CONFIG_TRUNCATE=y
+CONFIG_TTY=y
+CONFIG_UNAME=y
+CONFIG_UNAME_OSNAME="Linux"
+CONFIG_UNIQ=y
+CONFIG_UNLINK=y
+CONFIG_USLEEP=y
+CONFIG_UUDECODE=y
+CONFIG_BASE64=y
+CONFIG_UUENCODE=y
+CONFIG_WC=y
+# CONFIG_FEATURE_WC_LARGE is not set
+# CONFIG_WHO is not set
+# CONFIG_W is not set
+# CONFIG_USERS is not set
+CONFIG_WHOAMI=y
+CONFIG_YES=y
+
+#
+# Common options
+#
+CONFIG_FEATURE_VERBOSE=y
+
+#
+# Common options for cp and mv
+#
+CONFIG_FEATURE_PRESERVE_HARDLINKS=y
+
+#
+# Common options for df, du, ls
+#
+CONFIG_FEATURE_HUMAN_READABLE=y
+
+#
+# Console Utilities
+#
+CONFIG_CHVT=y
+CONFIG_CLEAR=y
+CONFIG_DEALLOCVT=y
+CONFIG_DUMPKMAP=y
+# CONFIG_FGCONSOLE is not set
+CONFIG_KBD_MODE=y
+CONFIG_LOADFONT=y
+CONFIG_SETFONT=y
+CONFIG_FEATURE_SETFONT_TEXTUAL_MAP=y
+CONFIG_DEFAULT_SETFONT_DIR="/usr/share"
+
+#
+# Common options for loadfont and setfont
+#
+CONFIG_FEATURE_LOADFONT_PSF2=y
+CONFIG_FEATURE_LOADFONT_RAW=y
+CONFIG_LOADKMAP=y
+CONFIG_OPENVT=y
+CONFIG_RESET=y
+CONFIG_RESIZE=y
+CONFIG_FEATURE_RESIZE_PRINT=y
+CONFIG_SETCONSOLE=y
+# CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS is not set
+CONFIG_SETKEYCODES=y
+CONFIG_SETLOGCONS=y
+CONFIG_SHOWKEY=y
+
+#
+# Debian Utilities
+#
+CONFIG_PIPE_PROGRESS=y
+CONFIG_RUN_PARTS=y
+CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS=y
+# CONFIG_FEATURE_RUN_PARTS_FANCY is not set
+# CONFIG_START_STOP_DAEMON is not set
+# CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS is not set
+# CONFIG_FEATURE_START_STOP_DAEMON_FANCY is not set
+CONFIG_WHICH=y
+
+#
+# Editors
+#
+CONFIG_AWK=y
+CONFIG_FEATURE_AWK_LIBM=y
+CONFIG_FEATURE_AWK_GNU_EXTENSIONS=y
+CONFIG_CMP=y
+CONFIG_DIFF=y
+CONFIG_FEATURE_DIFF_LONG_OPTIONS=y
+CONFIG_FEATURE_DIFF_DIR=y
+CONFIG_ED=y
+CONFIG_PATCH=y
+CONFIG_SED=y
+CONFIG_VI=y
+CONFIG_FEATURE_VI_MAX_LEN=1024
+CONFIG_FEATURE_VI_8BIT=y
+CONFIG_FEATURE_VI_COLON=y
+CONFIG_FEATURE_VI_YANKMARK=y
+CONFIG_FEATURE_VI_SEARCH=y
+# CONFIG_FEATURE_VI_REGEX_SEARCH is not set
+CONFIG_FEATURE_VI_USE_SIGNALS=y
+CONFIG_FEATURE_VI_DOT_CMD=y
+CONFIG_FEATURE_VI_READONLY=y
+CONFIG_FEATURE_VI_SETOPTS=y
+CONFIG_FEATURE_VI_SET=y
+CONFIG_FEATURE_VI_WIN_RESIZE=y
+CONFIG_FEATURE_VI_ASK_TERMINAL=y
+CONFIG_FEATURE_VI_UNDO=y
+CONFIG_FEATURE_VI_UNDO_QUEUE=y
+CONFIG_FEATURE_VI_UNDO_QUEUE_MAX=256
+CONFIG_FEATURE_ALLOW_EXEC=y
+
+#
+# Finding Utilities
+#
+CONFIG_FIND=y
+CONFIG_FEATURE_FIND_PRINT0=y
+CONFIG_FEATURE_FIND_MTIME=y
+CONFIG_FEATURE_FIND_MMIN=y
+CONFIG_FEATURE_FIND_PERM=y
+CONFIG_FEATURE_FIND_TYPE=y
+CONFIG_FEATURE_FIND_XDEV=y
+CONFIG_FEATURE_FIND_MAXDEPTH=y
+CONFIG_FEATURE_FIND_NEWER=y
+CONFIG_FEATURE_FIND_INUM=y
+CONFIG_FEATURE_FIND_EXEC=y
+CONFIG_FEATURE_FIND_EXEC_PLUS=y
+CONFIG_FEATURE_FIND_USER=y
+CONFIG_FEATURE_FIND_GROUP=y
+CONFIG_FEATURE_FIND_NOT=y
+CONFIG_FEATURE_FIND_DEPTH=y
+CONFIG_FEATURE_FIND_PAREN=y
+CONFIG_FEATURE_FIND_SIZE=y
+CONFIG_FEATURE_FIND_PRUNE=y
+CONFIG_FEATURE_FIND_DELETE=y
+CONFIG_FEATURE_FIND_PATH=y
+CONFIG_FEATURE_FIND_REGEX=y
+# CONFIG_FEATURE_FIND_CONTEXT is not set
+CONFIG_FEATURE_FIND_LINKS=y
+CONFIG_GREP=y
+CONFIG_EGREP=y
+CONFIG_FGREP=y
+CONFIG_FEATURE_GREP_CONTEXT=y
+CONFIG_XARGS=y
+CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION=y
+CONFIG_FEATURE_XARGS_SUPPORT_QUOTES=y
+CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT=y
+CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y
+CONFIG_FEATURE_XARGS_SUPPORT_REPL_STR=y
+
+#
+# Init Utilities
+#
+# CONFIG_BOOTCHARTD is not set
+# CONFIG_FEATURE_BOOTCHARTD_BLOATED_HEADER is not set
+# CONFIG_FEATURE_BOOTCHARTD_CONFIG_FILE is not set
+CONFIG_HALT=y
+CONFIG_POWEROFF=y
+CONFIG_REBOOT=y
+# CONFIG_FEATURE_CALL_TELINIT is not set
+CONFIG_TELINIT_PATH=""
+CONFIG_INIT=y
+# CONFIG_LINUXRC is not set
+CONFIG_FEATURE_USE_INITTAB=y
+CONFIG_FEATURE_KILL_REMOVED=y
+CONFIG_FEATURE_KILL_DELAY=0
+CONFIG_FEATURE_INIT_SCTTY=y
+CONFIG_FEATURE_INIT_SYSLOG=y
+CONFIG_FEATURE_INIT_QUIET=y
+# CONFIG_FEATURE_INIT_COREDUMPS is not set
+CONFIG_INIT_TERMINAL_TYPE="linux"
+# CONFIG_FEATURE_INIT_MODIFY_CMDLINE is not set
+
+#
+# Login/Password Management Utilities
+#
+CONFIG_FEATURE_SHADOWPASSWDS=y
+# CONFIG_USE_BB_PWD_GRP is not set
+# CONFIG_USE_BB_SHADOW is not set
+# CONFIG_USE_BB_CRYPT is not set
+# CONFIG_USE_BB_CRYPT_SHA is not set
+CONFIG_ADD_SHELL=y
+CONFIG_REMOVE_SHELL=y
+CONFIG_ADDGROUP=y
+# CONFIG_FEATURE_ADDGROUP_LONG_OPTIONS is not set
+CONFIG_FEATURE_ADDUSER_TO_GROUP=y
+CONFIG_ADDUSER=y
+# CONFIG_FEATURE_ADDUSER_LONG_OPTIONS is not set
+CONFIG_FEATURE_CHECK_NAMES=y
+CONFIG_LAST_ID=256000
+CONFIG_FIRST_SYSTEM_ID=100
+CONFIG_LAST_SYSTEM_ID=999
+CONFIG_CHPASSWD=y
+CONFIG_FEATURE_DEFAULT_PASSWD_ALGO="sha512"
+CONFIG_CRYPTPW=y
+CONFIG_MKPASSWD=y
+CONFIG_DELUSER=y
+CONFIG_DELGROUP=y
+CONFIG_FEATURE_DEL_USER_FROM_GROUP=y
+CONFIG_GETTY=y
+CONFIG_LOGIN=y
+CONFIG_LOGIN_SESSION_AS_CHILD=y
+CONFIG_LOGIN_SCRIPTS=y
+CONFIG_FEATURE_NOLOGIN=y
+CONFIG_FEATURE_SECURETTY=y
+CONFIG_NOLOGIN=y
+CONFIG_PASSWD=y
+CONFIG_FEATURE_PASSWD_WEAK_CHECK=y
+CONFIG_SU=y
+CONFIG_FEATURE_SU_SYSLOG=y
+CONFIG_FEATURE_SU_CHECKS_SHELLS=y
+CONFIG_FEATURE_SU_BLANK_PW_NEEDS_SECURE_TTY=y
+# CONFIG_SULOGIN is not set
+CONFIG_VLOCK=y
+
+#
+# Linux Ext2 FS Progs
+#
+# CONFIG_CHATTR is not set
+CONFIG_FSCK=y
+# CONFIG_LSATTR is not set
+# CONFIG_TUNE2FS is not set
+
+#
+# Linux Module Utilities
+#
+# CONFIG_MODPROBE_SMALL is not set
+CONFIG_DEPMOD=y
+CONFIG_INSMOD=y
+CONFIG_LSMOD=y
+CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT=y
+CONFIG_MODINFO=y
+CONFIG_MODPROBE=y
+CONFIG_FEATURE_MODPROBE_BLACKLIST=y
+CONFIG_RMMOD=y
+
+#
+# Options common to multiple modutils
+#
+CONFIG_FEATURE_CMDLINE_MODULE_OPTIONS=y
+# CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED is not set
+# CONFIG_FEATURE_2_4_MODULES is not set
+# CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set
+# CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set
+# CONFIG_FEATURE_INSMOD_LOADINKMEM is not set
+# CONFIG_FEATURE_INSMOD_LOAD_MAP is not set
+# CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL is not set
+CONFIG_FEATURE_CHECK_TAINTED_MODULE=y
+# CONFIG_FEATURE_INSMOD_TRY_MMAP is not set
+CONFIG_FEATURE_MODUTILS_ALIAS=y
+CONFIG_FEATURE_MODUTILS_BIN=y
+CONFIG_FEATURE_MODUTILS_SYMBOLS=y
+CONFIG_DEFAULT_MODULES_DIR="/lib/modules"
+CONFIG_DEFAULT_DEPMOD_FILE="modules.dep"
+
+#
+# Linux System Utilities
+#
+CONFIG_ACPID=y
+CONFIG_FEATURE_ACPID_COMPAT=y
+CONFIG_BLKDISCARD=y
+CONFIG_BLKID=y
+CONFIG_FEATURE_BLKID_TYPE=y
+CONFIG_BLOCKDEV=y
+CONFIG_CAL=y
+# CONFIG_CHRT is not set
+CONFIG_DMESG=y
+CONFIG_FEATURE_DMESG_PRETTY=y
+CONFIG_EJECT=y
+CONFIG_FEATURE_EJECT_SCSI=y
+CONFIG_FALLOCATE=y
+CONFIG_FATATTR=y
+CONFIG_FBSET=y
+CONFIG_FEATURE_FBSET_FANCY=y
+CONFIG_FEATURE_FBSET_READMODE=y
+CONFIG_FDFORMAT=y
+CONFIG_FDISK=y
+# CONFIG_FDISK_SUPPORT_LARGE_DISKS is not set
+CONFIG_FEATURE_FDISK_WRITABLE=y
+CONFIG_FEATURE_AIX_LABEL=y
+CONFIG_FEATURE_SGI_LABEL=y
+CONFIG_FEATURE_SUN_LABEL=y
+CONFIG_FEATURE_OSF_LABEL=y
+CONFIG_FEATURE_GPT_LABEL=y
+CONFIG_FEATURE_FDISK_ADVANCED=y
+CONFIG_FINDFS=y
+CONFIG_FLOCK=y
+CONFIG_FDFLUSH=y
+# CONFIG_FREERAMDISK is not set
+# CONFIG_FSCK_MINIX is not set
+# CONFIG_FSFREEZE is not set
+CONFIG_FSTRIM=y
+CONFIG_GETOPT=y
+CONFIG_FEATURE_GETOPT_LONG=y
+CONFIG_HEXDUMP=y
+CONFIG_FEATURE_HEXDUMP_REVERSE=y
+CONFIG_HD=y
+CONFIG_XXD=y
+CONFIG_HWCLOCK=y
+CONFIG_FEATURE_HWCLOCK_LONG_OPTIONS=y
+CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS=y
+CONFIG_IONICE=y
+CONFIG_IPCRM=y
+CONFIG_IPCS=y
+# CONFIG_LAST is not set
+# CONFIG_FEATURE_LAST_FANCY is not set
+CONFIG_LOSETUP=y
+CONFIG_LSPCI=y
+CONFIG_LSUSB=y
+CONFIG_MDEV=y
+CONFIG_FEATURE_MDEV_CONF=y
+CONFIG_FEATURE_MDEV_RENAME=y
+CONFIG_FEATURE_MDEV_RENAME_REGEXP=y
+CONFIG_FEATURE_MDEV_EXEC=y
+CONFIG_FEATURE_MDEV_LOAD_FIRMWARE=y
+CONFIG_MESG=y
+CONFIG_FEATURE_MESG_ENABLE_ONLY_GROUP=y
+# CONFIG_MKE2FS is not set
+# CONFIG_MKFS_EXT2 is not set
+# CONFIG_MKFS_MINIX is not set
+# CONFIG_FEATURE_MINIX2 is not set
+# CONFIG_MKFS_REISER is not set
+CONFIG_MKDOSFS=y
+CONFIG_MKFS_VFAT=y
+CONFIG_MKSWAP=y
+CONFIG_FEATURE_MKSWAP_UUID=y
+CONFIG_MORE=y
+CONFIG_MOUNT=y
+CONFIG_FEATURE_MOUNT_FAKE=y
+CONFIG_FEATURE_MOUNT_VERBOSE=y
+CONFIG_FEATURE_MOUNT_HELPERS=y
+CONFIG_FEATURE_MOUNT_LABEL=y
+# CONFIG_FEATURE_MOUNT_NFS is not set
+CONFIG_FEATURE_MOUNT_CIFS=y
+CONFIG_FEATURE_MOUNT_FLAGS=y
+CONFIG_FEATURE_MOUNT_FSTAB=y
+# CONFIG_FEATURE_MOUNT_OTHERTAB is not set
+CONFIG_MOUNTPOINT=y
+CONFIG_NSENTER=y
+CONFIG_FEATURE_NSENTER_LONG_OPTS=y
+# CONFIG_PIVOT_ROOT is not set
+CONFIG_RDATE=y
+CONFIG_RDEV=y
+CONFIG_READPROFILE=y
+CONFIG_RENICE=y
+CONFIG_REV=y
+# CONFIG_RTCWAKE is not set
+# CONFIG_SCRIPT is not set
+# CONFIG_SCRIPTREPLAY is not set
+# CONFIG_SETARCH is not set
+CONFIG_LINUX32=y
+CONFIG_LINUX64=y
+CONFIG_SETPRIV=y
+CONFIG_SETSID=y
+CONFIG_SWAPON=y
+CONFIG_FEATURE_SWAPON_DISCARD=y
+CONFIG_FEATURE_SWAPON_PRI=y
+CONFIG_SWAPOFF=y
+CONFIG_SWITCH_ROOT=y
+# CONFIG_TASKSET is not set
+# CONFIG_FEATURE_TASKSET_FANCY is not set
+# CONFIG_UEVENT is not set
+CONFIG_UMOUNT=y
+CONFIG_FEATURE_UMOUNT_ALL=y
+CONFIG_UNSHARE=y
+# CONFIG_WALL is not set
+
+#
+# Common options for mount/umount
+#
+CONFIG_FEATURE_MOUNT_LOOP=y
+CONFIG_FEATURE_MOUNT_LOOP_CREATE=y
+# CONFIG_FEATURE_MTAB_SUPPORT is not set
+CONFIG_VOLUMEID=y
+
+#
+# Filesystem/Volume identification
+#
+CONFIG_FEATURE_VOLUMEID_BCACHE=y
+CONFIG_FEATURE_VOLUMEID_BTRFS=y
+CONFIG_FEATURE_VOLUMEID_CRAMFS=y
+CONFIG_FEATURE_VOLUMEID_EXFAT=y
+CONFIG_FEATURE_VOLUMEID_EXT=y
+CONFIG_FEATURE_VOLUMEID_F2FS=y
+CONFIG_FEATURE_VOLUMEID_FAT=y
+# CONFIG_FEATURE_VOLUMEID_HFS is not set
+CONFIG_FEATURE_VOLUMEID_ISO9660=y
+CONFIG_FEATURE_VOLUMEID_JFS=y
+CONFIG_FEATURE_VOLUMEID_LINUXRAID=y
+CONFIG_FEATURE_VOLUMEID_LINUXSWAP=y
+CONFIG_FEATURE_VOLUMEID_LUKS=y
+CONFIG_FEATURE_VOLUMEID_NILFS=y
+CONFIG_FEATURE_VOLUMEID_NTFS=y
+CONFIG_FEATURE_VOLUMEID_OCFS2=y
+CONFIG_FEATURE_VOLUMEID_REISERFS=y
+# CONFIG_FEATURE_VOLUMEID_ROMFS is not set
+CONFIG_FEATURE_VOLUMEID_SQUASHFS=y
+# CONFIG_FEATURE_VOLUMEID_SYSV is not set
+CONFIG_FEATURE_VOLUMEID_UBIFS=y
+CONFIG_FEATURE_VOLUMEID_UDF=y
+CONFIG_FEATURE_VOLUMEID_XFS=y
+
+#
+# Miscellaneous Utilities
+#
+CONFIG_ADJTIMEX=y
+CONFIG_BBCONFIG=y
+CONFIG_FEATURE_COMPRESS_BBCONFIG=y
+CONFIG_BEEP=y
+CONFIG_FEATURE_BEEP_FREQ=440
+CONFIG_FEATURE_BEEP_LENGTH_MS=30
+# CONFIG_CHAT is not set
+# CONFIG_FEATURE_CHAT_NOFAIL is not set
+# CONFIG_FEATURE_CHAT_TTY_HIFI is not set
+# CONFIG_FEATURE_CHAT_IMPLICIT_CR is not set
+# CONFIG_FEATURE_CHAT_SWALLOW_OPTS is not set
+# CONFIG_FEATURE_CHAT_SEND_ESCAPES is not set
+# CONFIG_FEATURE_CHAT_VAR_ABORT_LEN is not set
+# CONFIG_FEATURE_CHAT_CLR_ABORT is not set
+CONFIG_CONSPY=y
+CONFIG_CROND=y
+CONFIG_FEATURE_CROND_D=y
+CONFIG_FEATURE_CROND_CALL_SENDMAIL=y
+CONFIG_FEATURE_CROND_DIR="/var/spool/cron"
+CONFIG_CRONTAB=y
+CONFIG_DC=y
+CONFIG_FEATURE_DC_LIBM=y
+# CONFIG_DEVFSD is not set
+# CONFIG_DEVFSD_MODLOAD is not set
+# CONFIG_DEVFSD_FG_NP is not set
+# CONFIG_DEVFSD_VERBOSE is not set
+# CONFIG_FEATURE_DEVFS is not set
+# CONFIG_DEVMEM is not set
+CONFIG_FBSPLASH=y
+# CONFIG_FLASH_ERASEALL is not set
+# CONFIG_FLASH_LOCK is not set
+# CONFIG_FLASH_UNLOCK is not set
+# CONFIG_FLASHCP is not set
+CONFIG_HDPARM=y
+# CONFIG_FEATURE_HDPARM_GET_IDENTITY is not set
+# CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF is not set
+# CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF is not set
+# CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET is not set
+# CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF is not set
+# CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA is not set
+# CONFIG_I2CGET is not set
+# CONFIG_I2CSET is not set
+# CONFIG_I2CDUMP is not set
+# CONFIG_I2CDETECT is not set
+CONFIG_INOTIFYD=y
+CONFIG_LESS=y
+CONFIG_FEATURE_LESS_MAXLINES=9999999
+CONFIG_FEATURE_LESS_BRACKETS=y
+CONFIG_FEATURE_LESS_FLAGS=y
+CONFIG_FEATURE_LESS_TRUNCATE=y
+CONFIG_FEATURE_LESS_MARKS=y
+CONFIG_FEATURE_LESS_REGEXP=y
+CONFIG_FEATURE_LESS_WINCH=y
+CONFIG_FEATURE_LESS_ASK_TERMINAL=y
+CONFIG_FEATURE_LESS_DASHCMD=y
+CONFIG_FEATURE_LESS_LINENUMS=y
+# CONFIG_LSSCSI is not set
+# CONFIG_MAKEDEVS is not set
+# CONFIG_FEATURE_MAKEDEVS_LEAF is not set
+# CONFIG_FEATURE_MAKEDEVS_TABLE is not set
+# CONFIG_MAN is not set
+CONFIG_MICROCOM=y
+# CONFIG_MT is not set
+CONFIG_NANDWRITE=y
+CONFIG_NANDDUMP=y
+CONFIG_PARTPROBE=y
+CONFIG_RAIDAUTORUN=y
+CONFIG_READAHEAD=y
+CONFIG_RFKILL=y
+# CONFIG_RUNLEVEL is not set
+# CONFIG_RX is not set
+CONFIG_SETSERIAL=y
+CONFIG_STRINGS=y
+CONFIG_TIME=y
+CONFIG_TTYSIZE=y
+# CONFIG_UBIATTACH is not set
+# CONFIG_UBIDETACH is not set
+# CONFIG_UBIMKVOL is not set
+# CONFIG_UBIRMVOL is not set
+# CONFIG_UBIRSVOL is not set
+# CONFIG_UBIUPDATEVOL is not set
+# CONFIG_UBIRENAME is not set
+CONFIG_VOLNAME=y
+CONFIG_WATCHDOG=y
+
+#
+# Networking Utilities
+#
+CONFIG_FEATURE_IPV6=y
+CONFIG_FEATURE_UNIX_LOCAL=y
+CONFIG_FEATURE_PREFER_IPV4_ADDRESS=y
+CONFIG_VERBOSE_RESOLUTION_ERRORS=y
+CONFIG_ARP=y
+CONFIG_ARPING=y
+CONFIG_BRCTL=y
+CONFIG_FEATURE_BRCTL_FANCY=y
+CONFIG_FEATURE_BRCTL_SHOW=y
+# CONFIG_DNSD is not set
+CONFIG_ETHER_WAKE=y
+# CONFIG_FTPD is not set
+# CONFIG_FEATURE_FTPD_WRITE is not set
+# CONFIG_FEATURE_FTPD_ACCEPT_BROKEN_LIST is not set
+# CONFIG_FEATURE_FTPD_AUTHENTICATION is not set
+# CONFIG_FTPGET is not set
+# CONFIG_FTPPUT is not set
+# CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS is not set
+CONFIG_HOSTNAME=y
+CONFIG_DNSDOMAINNAME=y
+# CONFIG_HTTPD is not set
+# CONFIG_FEATURE_HTTPD_RANGES is not set
+# CONFIG_FEATURE_HTTPD_SETUID is not set
+# CONFIG_FEATURE_HTTPD_BASIC_AUTH is not set
+# CONFIG_FEATURE_HTTPD_AUTH_MD5 is not set
+# CONFIG_FEATURE_HTTPD_CGI is not set
+# CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR is not set
+# CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV is not set
+# CONFIG_FEATURE_HTTPD_ENCODE_URL_STR is not set
+# CONFIG_FEATURE_HTTPD_ERROR_PAGES is not set
+# CONFIG_FEATURE_HTTPD_PROXY is not set
+# CONFIG_FEATURE_HTTPD_GZIP is not set
+CONFIG_IFCONFIG=y
+CONFIG_FEATURE_IFCONFIG_STATUS=y
+CONFIG_FEATURE_IFCONFIG_SLIP=y
+CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ=y
+CONFIG_FEATURE_IFCONFIG_HW=y
+CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS=y
+CONFIG_IFENSLAVE=y
+# CONFIG_IFPLUGD is not set
+CONFIG_IFUP=y
+CONFIG_IFDOWN=y
+CONFIG_IFUPDOWN_IFSTATE_PATH="/var/run/ifstate"
+CONFIG_FEATURE_IFUPDOWN_IP=y
+CONFIG_FEATURE_IFUPDOWN_IPV4=y
+CONFIG_FEATURE_IFUPDOWN_IPV6=y
+# CONFIG_FEATURE_IFUPDOWN_MAPPING is not set
+CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP=y
+# CONFIG_INETD is not set
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO is not set
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD is not set
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_TIME is not set
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME is not set
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN is not set
+# CONFIG_FEATURE_INETD_RPC is not set
+CONFIG_IP=y
+CONFIG_IPADDR=y
+CONFIG_IPLINK=y
+CONFIG_IPROUTE=y
+CONFIG_IPTUNNEL=y
+CONFIG_IPRULE=y
+CONFIG_IPNEIGH=y
+CONFIG_FEATURE_IP_ADDRESS=y
+CONFIG_FEATURE_IP_LINK=y
+CONFIG_FEATURE_IP_ROUTE=y
+CONFIG_FEATURE_IP_ROUTE_DIR="/etc/iproute2"
+CONFIG_FEATURE_IP_TUNNEL=y
+CONFIG_FEATURE_IP_RULE=y
+CONFIG_FEATURE_IP_NEIGH=y
+CONFIG_FEATURE_IP_RARE_PROTOCOLS=y
+CONFIG_IPCALC=y
+# CONFIG_FEATURE_IPCALC_LONG_OPTIONS is not set
+CONFIG_FEATURE_IPCALC_FANCY=y
+# CONFIG_FAKEIDENTD is not set
+CONFIG_NAMEIF=y
+CONFIG_FEATURE_NAMEIF_EXTENDED=y
+CONFIG_NBDCLIENT=y
+CONFIG_NC=y
+CONFIG_NC_SERVER=y
+CONFIG_NC_EXTRA=y
+CONFIG_NC_110_COMPAT=y
+CONFIG_NETSTAT=y
+CONFIG_FEATURE_NETSTAT_WIDE=y
+CONFIG_FEATURE_NETSTAT_PRG=y
+CONFIG_NSLOOKUP=y
+CONFIG_NTPD=y
+CONFIG_FEATURE_NTPD_SERVER=y
+CONFIG_FEATURE_NTPD_CONF=y
+CONFIG_PING=y
+CONFIG_PING6=y
+CONFIG_FEATURE_FANCY_PING=y
+CONFIG_PSCAN=y
+CONFIG_ROUTE=y
+CONFIG_SLATTACH=y
+CONFIG_SSL_CLIENT=y
+# CONFIG_TCPSVD is not set
+# CONFIG_UDPSVD is not set
+# CONFIG_TELNET is not set
+# CONFIG_FEATURE_TELNET_TTYPE is not set
+# CONFIG_FEATURE_TELNET_AUTOLOGIN is not set
+# CONFIG_FEATURE_TELNET_WIDTH is not set
+# CONFIG_TELNETD is not set
+# CONFIG_FEATURE_TELNETD_STANDALONE is not set
+# CONFIG_FEATURE_TELNETD_INETD_WAIT is not set
+# CONFIG_TFTP is not set
+# CONFIG_TFTPD is not set
+# CONFIG_FEATURE_TFTP_GET is not set
+# CONFIG_FEATURE_TFTP_PUT is not set
+# CONFIG_FEATURE_TFTP_BLOCKSIZE is not set
+# CONFIG_FEATURE_TFTP_PROGRESS_BAR is not set
+# CONFIG_TFTP_DEBUG is not set
+CONFIG_TLS=y
+CONFIG_TRACEROUTE=y
+CONFIG_TRACEROUTE6=y
+CONFIG_FEATURE_TRACEROUTE_VERBOSE=y
+CONFIG_FEATURE_TRACEROUTE_USE_ICMP=y
+CONFIG_TUNCTL=y
+CONFIG_FEATURE_TUNCTL_UG=y
+CONFIG_VCONFIG=y
+CONFIG_WGET=y
+CONFIG_FEATURE_WGET_LONG_OPTIONS=y
+CONFIG_FEATURE_WGET_STATUSBAR=y
+CONFIG_FEATURE_WGET_AUTHENTICATION=y
+CONFIG_FEATURE_WGET_TIMEOUT=y
+CONFIG_FEATURE_WGET_HTTPS=y
+CONFIG_FEATURE_WGET_OPENSSL=y
+CONFIG_WHOIS=y
+# CONFIG_ZCIP is not set
+CONFIG_UDHCPC6=y
+CONFIG_FEATURE_UDHCPC6_RFC3646=y
+CONFIG_FEATURE_UDHCPC6_RFC4704=y
+CONFIG_FEATURE_UDHCPC6_RFC4833=y
+# CONFIG_UDHCPD is not set
+# CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY is not set
+# CONFIG_FEATURE_UDHCPD_BASE_IP_ON_MAC is not set
+CONFIG_DHCPD_LEASES_FILE=""
+CONFIG_DUMPLEASES=y
+# CONFIG_DHCPRELAY is not set
+CONFIG_UDHCPC=y
+CONFIG_FEATURE_UDHCPC_ARPING=y
+CONFIG_FEATURE_UDHCPC_SANITIZEOPT=y
+CONFIG_UDHCPC_DEFAULT_SCRIPT="/usr/share/udhcpc/default.script"
+# CONFIG_FEATURE_UDHCP_PORT is not set
+CONFIG_UDHCP_DEBUG=0
+CONFIG_FEATURE_UDHCP_RFC3397=y
+CONFIG_FEATURE_UDHCP_8021Q=y
+CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=80
+CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="-b"
+
+#
+# Print Utilities
+#
+# CONFIG_LPD is not set
+# CONFIG_LPR is not set
+# CONFIG_LPQ is not set
+
+#
+# Mail Utilities
+#
+CONFIG_MAKEMIME=y
+# CONFIG_POPMAILDIR is not set
+# CONFIG_FEATURE_POPMAILDIR_DELIVERY is not set
+CONFIG_REFORMIME=y
+CONFIG_FEATURE_REFORMIME_COMPAT=y
+CONFIG_SENDMAIL=y
+CONFIG_FEATURE_MIME_CHARSET="us-ascii"
+
+#
+# Process Utilities
+#
+CONFIG_FREE=y
+CONFIG_FUSER=y
+CONFIG_IOSTAT=y
+CONFIG_KILL=y
+CONFIG_KILLALL=y
+CONFIG_KILLALL5=y
+CONFIG_LSOF=y
+CONFIG_MPSTAT=y
+CONFIG_NMETER=y
+CONFIG_PGREP=y
+CONFIG_PKILL=y
+CONFIG_PIDOF=y
+CONFIG_FEATURE_PIDOF_SINGLE=y
+CONFIG_FEATURE_PIDOF_OMIT=y
+CONFIG_PMAP=y
+CONFIG_POWERTOP=y
+CONFIG_FEATURE_POWERTOP_INTERACTIVE=y
+CONFIG_PS=y
+# CONFIG_FEATURE_PS_WIDE is not set
+# CONFIG_FEATURE_PS_LONG is not set
+CONFIG_FEATURE_PS_TIME=y
+# CONFIG_FEATURE_PS_UNUSUAL_SYSTEMS is not set
+CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS=y
+CONFIG_PSTREE=y
+CONFIG_PWDX=y
+CONFIG_SMEMCAP=y
+CONFIG_BB_SYSCTL=y
+CONFIG_TOP=y
+CONFIG_FEATURE_TOP_INTERACTIVE=y
+CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE=y
+CONFIG_FEATURE_TOP_CPU_GLOBAL_PERCENTS=y
+CONFIG_FEATURE_TOP_SMP_CPU=y
+# CONFIG_FEATURE_TOP_DECIMALS is not set
+CONFIG_FEATURE_TOP_SMP_PROCESS=y
+CONFIG_FEATURE_TOPMEM=y
+CONFIG_UPTIME=y
+# CONFIG_FEATURE_UPTIME_UTMP_SUPPORT is not set
+CONFIG_WATCH=y
+# CONFIG_FEATURE_SHOW_THREADS is not set
+
+#
+# Runit Utilities
+#
+# CONFIG_CHPST is not set
+# CONFIG_SETUIDGID is not set
+# CONFIG_ENVUIDGID is not set
+# CONFIG_ENVDIR is not set
+# CONFIG_SOFTLIMIT is not set
+# CONFIG_RUNSV is not set
+# CONFIG_RUNSVDIR is not set
+# CONFIG_FEATURE_RUNSVDIR_LOG is not set
+# CONFIG_SV is not set
+CONFIG_SV_DEFAULT_SERVICE_DIR=""
+# CONFIG_SVC is not set
+# CONFIG_SVLOGD is not set
+# CONFIG_CHCON is not set
+# CONFIG_FEATURE_CHCON_LONG_OPTIONS is not set
+# CONFIG_GETENFORCE is not set
+# CONFIG_GETSEBOOL is not set
+# CONFIG_LOAD_POLICY is not set
+# CONFIG_MATCHPATHCON is not set
+# CONFIG_RUNCON is not set
+# CONFIG_FEATURE_RUNCON_LONG_OPTIONS is not set
+# CONFIG_SELINUXENABLED is not set
+# CONFIG_SESTATUS is not set
+# CONFIG_SETENFORCE is not set
+# CONFIG_SETFILES is not set
+# CONFIG_FEATURE_SETFILES_CHECK_OPTION is not set
+# CONFIG_RESTORECON is not set
+# CONFIG_SETSEBOOL is not set
+
+#
+# Shells
+#
+CONFIG_SH_IS_ASH=y
+# CONFIG_SH_IS_HUSH is not set
+# CONFIG_SH_IS_NONE is not set
+# CONFIG_BASH_IS_ASH is not set
+# CONFIG_BASH_IS_HUSH is not set
+CONFIG_BASH_IS_NONE=y
+CONFIG_ASH=y
+CONFIG_ASH_OPTIMIZE_FOR_SIZE=y
+CONFIG_ASH_INTERNAL_GLOB=y
+CONFIG_ASH_BASH_COMPAT=y
+CONFIG_ASH_JOB_CONTROL=y
+CONFIG_ASH_ALIAS=y
+CONFIG_ASH_RANDOM_SUPPORT=y
+CONFIG_ASH_EXPAND_PRMT=y
+CONFIG_ASH_IDLE_TIMEOUT=y
+CONFIG_ASH_MAIL=y
+CONFIG_ASH_ECHO=y
+CONFIG_ASH_PRINTF=y
+CONFIG_ASH_TEST=y
+CONFIG_ASH_HELP=y
+CONFIG_ASH_GETOPTS=y
+CONFIG_ASH_CMDCMD=y
+CONFIG_ASH_COMMAND_NOT_FOUND_HOOK=y
+# CONFIG_CTTYHACK is not set
+# CONFIG_HUSH is not set
+# CONFIG_HUSH_BASH_COMPAT is not set
+# CONFIG_HUSH_BRACE_EXPANSION is not set
+# CONFIG_HUSH_INTERACTIVE is not set
+# CONFIG_HUSH_SAVEHISTORY is not set
+# CONFIG_HUSH_JOB is not set
+# CONFIG_HUSH_TICK is not set
+# CONFIG_HUSH_IF is not set
+# CONFIG_HUSH_LOOPS is not set
+# CONFIG_HUSH_CASE is not set
+# CONFIG_HUSH_FUNCTIONS is not set
+# CONFIG_HUSH_LOCAL is not set
+# CONFIG_HUSH_RANDOM_SUPPORT is not set
+# CONFIG_HUSH_MODE_X is not set
+# CONFIG_HUSH_ECHO is not set
+# CONFIG_HUSH_PRINTF is not set
+# CONFIG_HUSH_TEST is not set
+# CONFIG_HUSH_HELP is not set
+# CONFIG_HUSH_EXPORT is not set
+# CONFIG_HUSH_EXPORT_N is not set
+# CONFIG_HUSH_KILL is not set
+# CONFIG_HUSH_WAIT is not set
+# CONFIG_HUSH_TRAP is not set
+# CONFIG_HUSH_TYPE is not set
+# CONFIG_HUSH_READ is not set
+# CONFIG_HUSH_SET is not set
+# CONFIG_HUSH_UNSET is not set
+# CONFIG_HUSH_ULIMIT is not set
+# CONFIG_HUSH_UMASK is not set
+# CONFIG_HUSH_MEMLEAK is not set
+# CONFIG_MSH is not set
+
+#
+# Options common to all shells
+#
+CONFIG_FEATURE_SH_MATH=y
+CONFIG_FEATURE_SH_MATH_64=y
+CONFIG_FEATURE_SH_EXTRA_QUIET=y
+# CONFIG_FEATURE_SH_STANDALONE is not set
+# CONFIG_FEATURE_SH_NOFORK is not set
+CONFIG_FEATURE_SH_HISTFILESIZE=y
+
+#
+# System Logging Utilities
+#
+CONFIG_KLOGD=y
+
+#
+# klogd should not be used together with syslog to kernel printk buffer
+#
+CONFIG_FEATURE_KLOGD_KLOGCTL=y
+CONFIG_LOGGER=y
+CONFIG_LOGREAD=y
+CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING=y
+CONFIG_SYSLOGD=y
+CONFIG_FEATURE_ROTATE_LOGFILE=y
+CONFIG_FEATURE_REMOTE_LOG=y
+CONFIG_FEATURE_SYSLOGD_DUP=y
+CONFIG_FEATURE_SYSLOGD_CFG=y
+CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=256
+CONFIG_FEATURE_IPC_SYSLOG=y
+CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=16
+CONFIG_FEATURE_KMSG_SYSLOG=y
diff --git a/system/busybox/busyboxconfig-extras b/system/busybox/busyboxconfig-extras
new file mode 100644
index 000000000..c460d0144
--- /dev/null
+++ b/system/busybox/busyboxconfig-extras
@@ -0,0 +1,1114 @@
+#
+# Automatically generated make config: don't edit
+# Busybox version: 1.27.2
+# Fri Oct 27 21:23:19 2017
+#
+CONFIG_HAVE_DOT_CONFIG=y
+
+#
+# Busybox Settings
+#
+# CONFIG_DESKTOP is not set
+# CONFIG_EXTRA_COMPAT is not set
+# CONFIG_FEDORA_COMPAT is not set
+# CONFIG_INCLUDE_SUSv2 is not set
+# CONFIG_USE_PORTABLE_CODE is not set
+CONFIG_SHOW_USAGE=y
+CONFIG_FEATURE_VERBOSE_USAGE=y
+CONFIG_FEATURE_COMPRESS_USAGE=y
+CONFIG_BUSYBOX=y
+CONFIG_FEATURE_INSTALLER=y
+# CONFIG_INSTALL_NO_USR is not set
+# CONFIG_PAM is not set
+# CONFIG_LONG_OPTS is not set
+CONFIG_FEATURE_DEVPTS=y
+# CONFIG_FEATURE_CLEAN_UP is not set
+# CONFIG_FEATURE_UTMP is not set
+# CONFIG_FEATURE_WTMP is not set
+# CONFIG_FEATURE_PIDFILE is not set
+CONFIG_PID_FILE_PATH=""
+# CONFIG_FEATURE_SUID is not set
+# CONFIG_FEATURE_SUID_CONFIG is not set
+# CONFIG_FEATURE_SUID_CONFIG_QUIET is not set
+# CONFIG_SELINUX is not set
+# CONFIG_FEATURE_PREFER_APPLETS is not set
+CONFIG_BUSYBOX_EXEC_PATH="/proc/self/exe"
+CONFIG_FEATURE_SYSLOG=y
+# CONFIG_FEATURE_HAVE_RPC is not set
+CONFIG_PLATFORM_LINUX=y
+
+#
+# Build Options
+#
+# CONFIG_STATIC is not set
+CONFIG_PIE=y
+# CONFIG_NOMMU is not set
+# CONFIG_BUILD_LIBBUSYBOX is not set
+# CONFIG_FEATURE_INDIVIDUAL is not set
+# CONFIG_FEATURE_SHARED_BUSYBOX is not set
+CONFIG_LFS=y
+CONFIG_CROSS_COMPILER_PREFIX=""
+CONFIG_SYSROOT=""
+CONFIG_EXTRA_CFLAGS=""
+CONFIG_EXTRA_LDFLAGS=""
+CONFIG_EXTRA_LDLIBS=""
+
+#
+# Installation Options ("make install" behavior)
+#
+CONFIG_INSTALL_APPLET_SYMLINKS=y
+# CONFIG_INSTALL_APPLET_HARDLINKS is not set
+# CONFIG_INSTALL_APPLET_SCRIPT_WRAPPERS is not set
+# CONFIG_INSTALL_APPLET_DONT is not set
+# CONFIG_INSTALL_SH_APPLET_SYMLINK is not set
+# CONFIG_INSTALL_SH_APPLET_HARDLINK is not set
+# CONFIG_INSTALL_SH_APPLET_SCRIPT_WRAPPER is not set
+CONFIG_PREFIX="./_install"
+
+#
+# Debugging Options
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PESSIMIZE is not set
+# CONFIG_DEBUG_SANITIZE is not set
+# CONFIG_UNIT_TEST is not set
+# CONFIG_WERROR is not set
+CONFIG_NO_DEBUG_LIB=y
+# CONFIG_DMALLOC is not set
+# CONFIG_EFENCE is not set
+
+#
+# Busybox Library Tuning
+#
+# CONFIG_FEATURE_USE_BSS_TAIL is not set
+# CONFIG_FEATURE_RTMINMAX is not set
+CONFIG_FEATURE_BUFFERS_USE_MALLOC=y
+# CONFIG_FEATURE_BUFFERS_GO_ON_STACK is not set
+# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set
+CONFIG_PASSWORD_MINLEN=6
+CONFIG_MD5_SMALL=1
+CONFIG_SHA3_SMALL=1
+# CONFIG_FEATURE_FAST_TOP is not set
+# CONFIG_FEATURE_ETC_NETWORKS is not set
+# CONFIG_FEATURE_EDITING is not set
+CONFIG_FEATURE_EDITING_MAX_LEN=0
+# CONFIG_FEATURE_EDITING_VI is not set
+CONFIG_FEATURE_EDITING_HISTORY=0
+# CONFIG_FEATURE_EDITING_SAVEHISTORY is not set
+# CONFIG_FEATURE_EDITING_SAVE_ON_EXIT is not set
+# CONFIG_FEATURE_REVERSE_SEARCH is not set
+# CONFIG_FEATURE_TAB_COMPLETION is not set
+# CONFIG_FEATURE_USERNAME_COMPLETION is not set
+# CONFIG_FEATURE_EDITING_FANCY_PROMPT is not set
+# CONFIG_FEATURE_EDITING_ASK_TERMINAL is not set
+# CONFIG_LOCALE_SUPPORT is not set
+# CONFIG_UNICODE_SUPPORT is not set
+# CONFIG_UNICODE_USING_LOCALE is not set
+# CONFIG_FEATURE_CHECK_UNICODE_IN_ENV is not set
+CONFIG_SUBST_WCHAR=0
+CONFIG_LAST_SUPPORTED_WCHAR=0
+# CONFIG_UNICODE_COMBINING_WCHARS is not set
+# CONFIG_UNICODE_WIDE_WCHARS is not set
+# CONFIG_UNICODE_BIDI_SUPPORT is not set
+# CONFIG_UNICODE_NEUTRAL_TABLE is not set
+# CONFIG_UNICODE_PRESERVE_BROKEN is not set
+# CONFIG_FEATURE_NON_POSIX_CP is not set
+# CONFIG_FEATURE_VERBOSE_CP_MESSAGE is not set
+# CONFIG_FEATURE_USE_SENDFILE is not set
+CONFIG_FEATURE_COPYBUF_KB=4
+# CONFIG_FEATURE_SKIP_ROOTFS is not set
+# CONFIG_MONOTONIC_SYSCALL is not set
+# CONFIG_IOCTL_HEX2STR_ERROR is not set
+# CONFIG_FEATURE_HWIB is not set
+
+#
+# Applets
+#
+
+#
+# Archival Utilities
+#
+# CONFIG_FEATURE_SEAMLESS_XZ is not set
+# CONFIG_FEATURE_SEAMLESS_LZMA is not set
+# CONFIG_FEATURE_SEAMLESS_BZ2 is not set
+CONFIG_FEATURE_SEAMLESS_GZ=y
+# CONFIG_FEATURE_SEAMLESS_Z is not set
+# CONFIG_AR is not set
+# CONFIG_FEATURE_AR_LONG_FILENAMES is not set
+# CONFIG_FEATURE_AR_CREATE is not set
+# CONFIG_UNCOMPRESS is not set
+# CONFIG_GUNZIP is not set
+# CONFIG_ZCAT is not set
+# CONFIG_FEATURE_GUNZIP_LONG_OPTIONS is not set
+# CONFIG_BUNZIP2 is not set
+# CONFIG_BZCAT is not set
+# CONFIG_UNLZMA is not set
+# CONFIG_LZCAT is not set
+# CONFIG_LZMA is not set
+# CONFIG_FEATURE_LZMA_FAST is not set
+# CONFIG_UNXZ is not set
+# CONFIG_XZCAT is not set
+# CONFIG_XZ is not set
+# CONFIG_BZIP2 is not set
+# CONFIG_FEATURE_BZIP2_DECOMPRESS is not set
+# CONFIG_CPIO is not set
+# CONFIG_FEATURE_CPIO_O is not set
+# CONFIG_FEATURE_CPIO_P is not set
+# CONFIG_DPKG is not set
+# CONFIG_DPKG_DEB is not set
+# CONFIG_GZIP is not set
+# CONFIG_FEATURE_GZIP_LONG_OPTIONS is not set
+CONFIG_GZIP_FAST=0
+# CONFIG_FEATURE_GZIP_LEVELS is not set
+# CONFIG_FEATURE_GZIP_DECOMPRESS is not set
+# CONFIG_LZOP is not set
+# CONFIG_UNLZOP is not set
+# CONFIG_LZOPCAT is not set
+# CONFIG_LZOP_COMPR_HIGH is not set
+# CONFIG_RPM is not set
+# CONFIG_RPM2CPIO is not set
+# CONFIG_TAR is not set
+# CONFIG_FEATURE_TAR_LONG_OPTIONS is not set
+# CONFIG_FEATURE_TAR_CREATE is not set
+# CONFIG_FEATURE_TAR_AUTODETECT is not set
+# CONFIG_FEATURE_TAR_FROM is not set
+# CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY is not set
+# CONFIG_FEATURE_TAR_OLDSUN_COMPATIBILITY is not set
+# CONFIG_FEATURE_TAR_GNU_EXTENSIONS is not set
+# CONFIG_FEATURE_TAR_TO_COMMAND is not set
+# CONFIG_FEATURE_TAR_UNAME_GNAME is not set
+# CONFIG_FEATURE_TAR_NOPRESERVE_TIME is not set
+# CONFIG_FEATURE_TAR_SELINUX is not set
+# CONFIG_UNZIP is not set
+# CONFIG_FEATURE_UNZIP_CDF is not set
+# CONFIG_FEATURE_UNZIP_BZIP2 is not set
+# CONFIG_FEATURE_UNZIP_LZMA is not set
+# CONFIG_FEATURE_UNZIP_XZ is not set
+
+#
+# Coreutils
+#
+# CONFIG_BASENAME is not set
+# CONFIG_CAT is not set
+# CONFIG_FEATURE_CATV is not set
+# CONFIG_CHGRP is not set
+# CONFIG_CHMOD is not set
+# CONFIG_CHOWN is not set
+# CONFIG_FEATURE_CHOWN_LONG_OPTIONS is not set
+# CONFIG_CHROOT is not set
+# CONFIG_CKSUM is not set
+# CONFIG_COMM is not set
+# CONFIG_CP is not set
+# CONFIG_FEATURE_CP_LONG_OPTIONS is not set
+# CONFIG_CUT is not set
+# CONFIG_DATE is not set
+# CONFIG_FEATURE_DATE_ISOFMT is not set
+# CONFIG_FEATURE_DATE_NANO is not set
+# CONFIG_FEATURE_DATE_COMPAT is not set
+# CONFIG_DD is not set
+# CONFIG_FEATURE_DD_SIGNAL_HANDLING is not set
+# CONFIG_FEATURE_DD_THIRD_STATUS_LINE is not set
+# CONFIG_FEATURE_DD_IBS_OBS is not set
+# CONFIG_FEATURE_DD_STATUS is not set
+# CONFIG_DF is not set
+# CONFIG_FEATURE_DF_FANCY is not set
+# CONFIG_DIRNAME is not set
+# CONFIG_DOS2UNIX is not set
+# CONFIG_UNIX2DOS is not set
+# CONFIG_DU is not set
+# CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K is not set
+# CONFIG_ECHO is not set
+# CONFIG_FEATURE_FANCY_ECHO is not set
+# CONFIG_ENV is not set
+# CONFIG_FEATURE_ENV_LONG_OPTIONS is not set
+# CONFIG_EXPAND is not set
+# CONFIG_FEATURE_EXPAND_LONG_OPTIONS is not set
+# CONFIG_UNEXPAND is not set
+# CONFIG_FEATURE_UNEXPAND_LONG_OPTIONS is not set
+# CONFIG_EXPR is not set
+# CONFIG_EXPR_MATH_SUPPORT_64 is not set
+# CONFIG_FACTOR is not set
+# CONFIG_FALSE is not set
+# CONFIG_FOLD is not set
+# CONFIG_FSYNC is not set
+# CONFIG_HEAD is not set
+# CONFIG_FEATURE_FANCY_HEAD is not set
+# CONFIG_HOSTID is not set
+# CONFIG_ID is not set
+# CONFIG_GROUPS is not set
+# CONFIG_INSTALL is not set
+# CONFIG_FEATURE_INSTALL_LONG_OPTIONS is not set
+# CONFIG_LINK is not set
+# CONFIG_LN is not set
+# CONFIG_LOGNAME is not set
+# CONFIG_LS is not set
+# CONFIG_FEATURE_LS_FILETYPES is not set
+# CONFIG_FEATURE_LS_FOLLOWLINKS is not set
+# CONFIG_FEATURE_LS_RECURSIVE is not set
+# CONFIG_FEATURE_LS_WIDTH is not set
+# CONFIG_FEATURE_LS_SORTFILES is not set
+# CONFIG_FEATURE_LS_TIMESTAMPS is not set
+# CONFIG_FEATURE_LS_USERNAME is not set
+# CONFIG_FEATURE_LS_COLOR is not set
+# CONFIG_FEATURE_LS_COLOR_IS_DEFAULT is not set
+# CONFIG_MD5SUM is not set
+# CONFIG_SHA1SUM is not set
+# CONFIG_SHA256SUM is not set
+# CONFIG_SHA512SUM is not set
+# CONFIG_SHA3SUM is not set
+# CONFIG_FEATURE_MD5_SHA1_SUM_CHECK is not set
+# CONFIG_MKDIR is not set
+# CONFIG_FEATURE_MKDIR_LONG_OPTIONS is not set
+# CONFIG_MKFIFO is not set
+# CONFIG_MKNOD is not set
+# CONFIG_MKTEMP is not set
+# CONFIG_MV is not set
+# CONFIG_FEATURE_MV_LONG_OPTIONS is not set
+# CONFIG_NICE is not set
+# CONFIG_NL is not set
+# CONFIG_NOHUP is not set
+# CONFIG_NPROC is not set
+# CONFIG_OD is not set
+# CONFIG_PASTE is not set
+# CONFIG_PRINTENV is not set
+# CONFIG_PRINTF is not set
+# CONFIG_PWD is not set
+# CONFIG_READLINK is not set
+# CONFIG_FEATURE_READLINK_FOLLOW is not set
+# CONFIG_REALPATH is not set
+# CONFIG_RM is not set
+# CONFIG_RMDIR is not set
+# CONFIG_FEATURE_RMDIR_LONG_OPTIONS is not set
+# CONFIG_SEQ is not set
+# CONFIG_SHRED is not set
+# CONFIG_SHUF is not set
+# CONFIG_SLEEP is not set
+# CONFIG_FEATURE_FANCY_SLEEP is not set
+# CONFIG_FEATURE_FLOAT_SLEEP is not set
+# CONFIG_SORT is not set
+# CONFIG_FEATURE_SORT_BIG is not set
+# CONFIG_SPLIT is not set
+# CONFIG_FEATURE_SPLIT_FANCY is not set
+# CONFIG_STAT is not set
+# CONFIG_FEATURE_STAT_FORMAT is not set
+# CONFIG_FEATURE_STAT_FILESYSTEM is not set
+# CONFIG_STTY is not set
+# CONFIG_SUM is not set
+# CONFIG_SYNC is not set
+# CONFIG_FEATURE_SYNC_FANCY is not set
+# CONFIG_TAC is not set
+# CONFIG_TAIL is not set
+# CONFIG_FEATURE_FANCY_TAIL is not set
+# CONFIG_TEE is not set
+# CONFIG_FEATURE_TEE_USE_BLOCK_IO is not set
+# CONFIG_TEST is not set
+# CONFIG_TEST1 is not set
+# CONFIG_TEST2 is not set
+# CONFIG_FEATURE_TEST_64 is not set
+# CONFIG_TIMEOUT is not set
+# CONFIG_TOUCH is not set
+# CONFIG_FEATURE_TOUCH_NODEREF is not set
+# CONFIG_FEATURE_TOUCH_SUSV3 is not set
+# CONFIG_TR is not set
+# CONFIG_FEATURE_TR_CLASSES is not set
+# CONFIG_FEATURE_TR_EQUIV is not set
+# CONFIG_TRUE is not set
+# CONFIG_TRUNCATE is not set
+# CONFIG_TTY is not set
+# CONFIG_UNAME is not set
+CONFIG_UNAME_OSNAME=""
+# CONFIG_UNIQ is not set
+# CONFIG_UNLINK is not set
+# CONFIG_USLEEP is not set
+# CONFIG_UUDECODE is not set
+# CONFIG_BASE64 is not set
+# CONFIG_UUENCODE is not set
+# CONFIG_WC is not set
+# CONFIG_FEATURE_WC_LARGE is not set
+# CONFIG_WHO is not set
+# CONFIG_W is not set
+# CONFIG_USERS is not set
+# CONFIG_WHOAMI is not set
+# CONFIG_YES is not set
+
+#
+# Common options
+#
+# CONFIG_FEATURE_VERBOSE is not set
+# CONFIG_FEATURE_PRESERVE_HARDLINKS is not set
+# CONFIG_FEATURE_HUMAN_READABLE is not set
+
+#
+# Console Utilities
+#
+# CONFIG_CHVT is not set
+# CONFIG_CLEAR is not set
+# CONFIG_DEALLOCVT is not set
+# CONFIG_DUMPKMAP is not set
+# CONFIG_FGCONSOLE is not set
+# CONFIG_KBD_MODE is not set
+# CONFIG_LOADFONT is not set
+# CONFIG_SETFONT is not set
+# CONFIG_FEATURE_SETFONT_TEXTUAL_MAP is not set
+CONFIG_DEFAULT_SETFONT_DIR=""
+# CONFIG_FEATURE_LOADFONT_PSF2 is not set
+# CONFIG_FEATURE_LOADFONT_RAW is not set
+# CONFIG_LOADKMAP is not set
+# CONFIG_OPENVT is not set
+# CONFIG_RESET is not set
+# CONFIG_RESIZE is not set
+# CONFIG_FEATURE_RESIZE_PRINT is not set
+# CONFIG_SETCONSOLE is not set
+# CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS is not set
+# CONFIG_SETKEYCODES is not set
+# CONFIG_SETLOGCONS is not set
+# CONFIG_SHOWKEY is not set
+
+#
+# Debian Utilities
+#
+# CONFIG_PIPE_PROGRESS is not set
+# CONFIG_RUN_PARTS is not set
+# CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS is not set
+# CONFIG_FEATURE_RUN_PARTS_FANCY is not set
+# CONFIG_START_STOP_DAEMON is not set
+# CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS is not set
+# CONFIG_FEATURE_START_STOP_DAEMON_FANCY is not set
+# CONFIG_WHICH is not set
+
+#
+# Editors
+#
+# CONFIG_AWK is not set
+# CONFIG_FEATURE_AWK_LIBM is not set
+# CONFIG_FEATURE_AWK_GNU_EXTENSIONS is not set
+# CONFIG_CMP is not set
+# CONFIG_DIFF is not set
+# CONFIG_FEATURE_DIFF_LONG_OPTIONS is not set
+# CONFIG_FEATURE_DIFF_DIR is not set
+# CONFIG_ED is not set
+# CONFIG_PATCH is not set
+# CONFIG_SED is not set
+# CONFIG_VI is not set
+CONFIG_FEATURE_VI_MAX_LEN=0
+# CONFIG_FEATURE_VI_8BIT is not set
+# CONFIG_FEATURE_VI_COLON is not set
+# CONFIG_FEATURE_VI_YANKMARK is not set
+# CONFIG_FEATURE_VI_SEARCH is not set
+# CONFIG_FEATURE_VI_REGEX_SEARCH is not set
+# CONFIG_FEATURE_VI_USE_SIGNALS is not set
+# CONFIG_FEATURE_VI_DOT_CMD is not set
+# CONFIG_FEATURE_VI_READONLY is not set
+# CONFIG_FEATURE_VI_SETOPTS is not set
+# CONFIG_FEATURE_VI_SET is not set
+# CONFIG_FEATURE_VI_WIN_RESIZE is not set
+# CONFIG_FEATURE_VI_ASK_TERMINAL is not set
+# CONFIG_FEATURE_VI_UNDO is not set
+# CONFIG_FEATURE_VI_UNDO_QUEUE is not set
+CONFIG_FEATURE_VI_UNDO_QUEUE_MAX=0
+# CONFIG_FEATURE_ALLOW_EXEC is not set
+
+#
+# Finding Utilities
+#
+# CONFIG_FIND is not set
+# CONFIG_FEATURE_FIND_PRINT0 is not set
+# CONFIG_FEATURE_FIND_MTIME is not set
+# CONFIG_FEATURE_FIND_MMIN is not set
+# CONFIG_FEATURE_FIND_PERM is not set
+# CONFIG_FEATURE_FIND_TYPE is not set
+# CONFIG_FEATURE_FIND_XDEV is not set
+# CONFIG_FEATURE_FIND_MAXDEPTH is not set
+# CONFIG_FEATURE_FIND_NEWER is not set
+# CONFIG_FEATURE_FIND_INUM is not set
+# CONFIG_FEATURE_FIND_EXEC is not set
+# CONFIG_FEATURE_FIND_EXEC_PLUS is not set
+# CONFIG_FEATURE_FIND_USER is not set
+# CONFIG_FEATURE_FIND_GROUP is not set
+# CONFIG_FEATURE_FIND_NOT is not set
+# CONFIG_FEATURE_FIND_DEPTH is not set
+# CONFIG_FEATURE_FIND_PAREN is not set
+# CONFIG_FEATURE_FIND_SIZE is not set
+# CONFIG_FEATURE_FIND_PRUNE is not set
+# CONFIG_FEATURE_FIND_DELETE is not set
+# CONFIG_FEATURE_FIND_PATH is not set
+# CONFIG_FEATURE_FIND_REGEX is not set
+# CONFIG_FEATURE_FIND_CONTEXT is not set
+# CONFIG_FEATURE_FIND_LINKS is not set
+# CONFIG_GREP is not set
+# CONFIG_EGREP is not set
+# CONFIG_FGREP is not set
+# CONFIG_FEATURE_GREP_CONTEXT is not set
+# CONFIG_XARGS is not set
+# CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION is not set
+# CONFIG_FEATURE_XARGS_SUPPORT_QUOTES is not set
+# CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT is not set
+# CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM is not set
+# CONFIG_FEATURE_XARGS_SUPPORT_REPL_STR is not set
+
+#
+# Init Utilities
+#
+# CONFIG_BOOTCHARTD is not set
+# CONFIG_FEATURE_BOOTCHARTD_BLOATED_HEADER is not set
+# CONFIG_FEATURE_BOOTCHARTD_CONFIG_FILE is not set
+# CONFIG_HALT is not set
+# CONFIG_POWEROFF is not set
+# CONFIG_REBOOT is not set
+# CONFIG_FEATURE_CALL_TELINIT is not set
+CONFIG_TELINIT_PATH=""
+# CONFIG_INIT is not set
+# CONFIG_LINUXRC is not set
+# CONFIG_FEATURE_USE_INITTAB is not set
+# CONFIG_FEATURE_KILL_REMOVED is not set
+CONFIG_FEATURE_KILL_DELAY=0
+# CONFIG_FEATURE_INIT_SCTTY is not set
+# CONFIG_FEATURE_INIT_SYSLOG is not set
+# CONFIG_FEATURE_INIT_QUIET is not set
+# CONFIG_FEATURE_INIT_COREDUMPS is not set
+CONFIG_INIT_TERMINAL_TYPE=""
+# CONFIG_FEATURE_INIT_MODIFY_CMDLINE is not set
+
+#
+# Login/Password Management Utilities
+#
+# CONFIG_FEATURE_SHADOWPASSWDS is not set
+# CONFIG_USE_BB_PWD_GRP is not set
+# CONFIG_USE_BB_SHADOW is not set
+# CONFIG_USE_BB_CRYPT is not set
+# CONFIG_USE_BB_CRYPT_SHA is not set
+# CONFIG_ADD_SHELL is not set
+# CONFIG_REMOVE_SHELL is not set
+# CONFIG_ADDGROUP is not set
+# CONFIG_FEATURE_ADDGROUP_LONG_OPTIONS is not set
+# CONFIG_FEATURE_ADDUSER_TO_GROUP is not set
+# CONFIG_ADDUSER is not set
+# CONFIG_FEATURE_ADDUSER_LONG_OPTIONS is not set
+# CONFIG_FEATURE_CHECK_NAMES is not set
+CONFIG_LAST_ID=0
+CONFIG_FIRST_SYSTEM_ID=0
+CONFIG_LAST_SYSTEM_ID=0
+# CONFIG_CHPASSWD is not set
+CONFIG_FEATURE_DEFAULT_PASSWD_ALGO=""
+# CONFIG_CRYPTPW is not set
+# CONFIG_MKPASSWD is not set
+# CONFIG_DELUSER is not set
+# CONFIG_DELGROUP is not set
+# CONFIG_FEATURE_DEL_USER_FROM_GROUP is not set
+# CONFIG_GETTY is not set
+# CONFIG_LOGIN is not set
+# CONFIG_LOGIN_SESSION_AS_CHILD is not set
+# CONFIG_LOGIN_SCRIPTS is not set
+# CONFIG_FEATURE_NOLOGIN is not set
+# CONFIG_FEATURE_SECURETTY is not set
+# CONFIG_NOLOGIN is not set
+# CONFIG_PASSWD is not set
+# CONFIG_FEATURE_PASSWD_WEAK_CHECK is not set
+# CONFIG_SU is not set
+# CONFIG_FEATURE_SU_SYSLOG is not set
+# CONFIG_FEATURE_SU_CHECKS_SHELLS is not set
+# CONFIG_FEATURE_SU_BLANK_PW_NEEDS_SECURE_TTY is not set
+# CONFIG_SULOGIN is not set
+# CONFIG_VLOCK is not set
+
+#
+# Linux Ext2 FS Progs
+#
+# CONFIG_CHATTR is not set
+# CONFIG_FSCK is not set
+# CONFIG_LSATTR is not set
+# CONFIG_TUNE2FS is not set
+
+#
+# Linux Module Utilities
+#
+# CONFIG_MODPROBE_SMALL is not set
+# CONFIG_DEPMOD is not set
+# CONFIG_INSMOD is not set
+# CONFIG_LSMOD is not set
+# CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT is not set
+# CONFIG_MODINFO is not set
+# CONFIG_MODPROBE is not set
+# CONFIG_FEATURE_MODPROBE_BLACKLIST is not set
+# CONFIG_RMMOD is not set
+
+#
+# Options common to multiple modutils
+#
+# CONFIG_FEATURE_CMDLINE_MODULE_OPTIONS is not set
+# CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED is not set
+# CONFIG_FEATURE_2_4_MODULES is not set
+# CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set
+# CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set
+# CONFIG_FEATURE_INSMOD_LOADINKMEM is not set
+# CONFIG_FEATURE_INSMOD_LOAD_MAP is not set
+# CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL is not set
+# CONFIG_FEATURE_CHECK_TAINTED_MODULE is not set
+# CONFIG_FEATURE_INSMOD_TRY_MMAP is not set
+# CONFIG_FEATURE_MODUTILS_ALIAS is not set
+# CONFIG_FEATURE_MODUTILS_BIN is not set
+# CONFIG_FEATURE_MODUTILS_SYMBOLS is not set
+CONFIG_DEFAULT_MODULES_DIR=""
+CONFIG_DEFAULT_DEPMOD_FILE=""
+
+#
+# Linux System Utilities
+#
+# CONFIG_ACPID is not set
+# CONFIG_FEATURE_ACPID_COMPAT is not set
+# CONFIG_BLKDISCARD is not set
+# CONFIG_BLKID is not set
+# CONFIG_FEATURE_BLKID_TYPE is not set
+# CONFIG_BLOCKDEV is not set
+# CONFIG_CAL is not set
+# CONFIG_CHRT is not set
+# CONFIG_DMESG is not set
+# CONFIG_FEATURE_DMESG_PRETTY is not set
+# CONFIG_EJECT is not set
+# CONFIG_FEATURE_EJECT_SCSI is not set
+# CONFIG_FALLOCATE is not set
+# CONFIG_FATATTR is not set
+# CONFIG_FBSET is not set
+# CONFIG_FEATURE_FBSET_FANCY is not set
+# CONFIG_FEATURE_FBSET_READMODE is not set
+# CONFIG_FDFORMAT is not set
+# CONFIG_FDISK is not set
+# CONFIG_FDISK_SUPPORT_LARGE_DISKS is not set
+# CONFIG_FEATURE_FDISK_WRITABLE is not set
+# CONFIG_FEATURE_AIX_LABEL is not set
+# CONFIG_FEATURE_SGI_LABEL is not set
+# CONFIG_FEATURE_SUN_LABEL is not set
+# CONFIG_FEATURE_OSF_LABEL is not set
+# CONFIG_FEATURE_GPT_LABEL is not set
+# CONFIG_FEATURE_FDISK_ADVANCED is not set
+# CONFIG_FINDFS is not set
+# CONFIG_FLOCK is not set
+# CONFIG_FDFLUSH is not set
+# CONFIG_FREERAMDISK is not set
+# CONFIG_FSCK_MINIX is not set
+# CONFIG_FSFREEZE is not set
+# CONFIG_FSTRIM is not set
+# CONFIG_GETOPT is not set
+# CONFIG_FEATURE_GETOPT_LONG is not set
+# CONFIG_HEXDUMP is not set
+# CONFIG_FEATURE_HEXDUMP_REVERSE is not set
+# CONFIG_HD is not set
+# CONFIG_XXD is not set
+# CONFIG_HWCLOCK is not set
+# CONFIG_FEATURE_HWCLOCK_LONG_OPTIONS is not set
+# CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS is not set
+# CONFIG_IONICE is not set
+# CONFIG_IPCRM is not set
+# CONFIG_IPCS is not set
+# CONFIG_LAST is not set
+# CONFIG_FEATURE_LAST_FANCY is not set
+# CONFIG_LOSETUP is not set
+# CONFIG_LSPCI is not set
+# CONFIG_LSUSB is not set
+# CONFIG_MDEV is not set
+# CONFIG_FEATURE_MDEV_CONF is not set
+# CONFIG_FEATURE_MDEV_RENAME is not set
+# CONFIG_FEATURE_MDEV_RENAME_REGEXP is not set
+# CONFIG_FEATURE_MDEV_EXEC is not set
+# CONFIG_FEATURE_MDEV_LOAD_FIRMWARE is not set
+# CONFIG_MESG is not set
+# CONFIG_FEATURE_MESG_ENABLE_ONLY_GROUP is not set
+# CONFIG_MKE2FS is not set
+# CONFIG_MKFS_EXT2 is not set
+# CONFIG_MKFS_MINIX is not set
+# CONFIG_FEATURE_MINIX2 is not set
+# CONFIG_MKFS_REISER is not set
+# CONFIG_MKDOSFS is not set
+# CONFIG_MKFS_VFAT is not set
+# CONFIG_MKSWAP is not set
+# CONFIG_FEATURE_MKSWAP_UUID is not set
+# CONFIG_MORE is not set
+# CONFIG_MOUNT is not set
+# CONFIG_FEATURE_MOUNT_FAKE is not set
+# CONFIG_FEATURE_MOUNT_VERBOSE is not set
+# CONFIG_FEATURE_MOUNT_HELPERS is not set
+# CONFIG_FEATURE_MOUNT_LABEL is not set
+# CONFIG_FEATURE_MOUNT_NFS is not set
+# CONFIG_FEATURE_MOUNT_CIFS is not set
+# CONFIG_FEATURE_MOUNT_FLAGS is not set
+# CONFIG_FEATURE_MOUNT_FSTAB is not set
+# CONFIG_FEATURE_MOUNT_OTHERTAB is not set
+# CONFIG_MOUNTPOINT is not set
+# CONFIG_NSENTER is not set
+# CONFIG_FEATURE_NSENTER_LONG_OPTS is not set
+# CONFIG_PIVOT_ROOT is not set
+# CONFIG_RDATE is not set
+# CONFIG_RDEV is not set
+# CONFIG_READPROFILE is not set
+# CONFIG_RENICE is not set
+# CONFIG_REV is not set
+# CONFIG_RTCWAKE is not set
+# CONFIG_SCRIPT is not set
+# CONFIG_SCRIPTREPLAY is not set
+# CONFIG_SETARCH is not set
+# CONFIG_LINUX32 is not set
+# CONFIG_LINUX64 is not set
+# CONFIG_SETPRIV is not set
+# CONFIG_SETSID is not set
+# CONFIG_SWAPON is not set
+# CONFIG_FEATURE_SWAPON_DISCARD is not set
+# CONFIG_FEATURE_SWAPON_PRI is not set
+# CONFIG_SWAPOFF is not set
+# CONFIG_SWITCH_ROOT is not set
+# CONFIG_TASKSET is not set
+# CONFIG_FEATURE_TASKSET_FANCY is not set
+# CONFIG_UEVENT is not set
+# CONFIG_UMOUNT is not set
+# CONFIG_FEATURE_UMOUNT_ALL is not set
+# CONFIG_UNSHARE is not set
+# CONFIG_WALL is not set
+# CONFIG_FEATURE_MOUNT_LOOP is not set
+# CONFIG_FEATURE_MOUNT_LOOP_CREATE is not set
+# CONFIG_FEATURE_MTAB_SUPPORT is not set
+# CONFIG_VOLUMEID is not set
+# CONFIG_FEATURE_VOLUMEID_BCACHE is not set
+# CONFIG_FEATURE_VOLUMEID_BTRFS is not set
+# CONFIG_FEATURE_VOLUMEID_CRAMFS is not set
+# CONFIG_FEATURE_VOLUMEID_EXFAT is not set
+# CONFIG_FEATURE_VOLUMEID_EXT is not set
+# CONFIG_FEATURE_VOLUMEID_F2FS is not set
+# CONFIG_FEATURE_VOLUMEID_FAT is not set
+# CONFIG_FEATURE_VOLUMEID_HFS is not set
+# CONFIG_FEATURE_VOLUMEID_ISO9660 is not set
+# CONFIG_FEATURE_VOLUMEID_JFS is not set
+# CONFIG_FEATURE_VOLUMEID_LINUXRAID is not set
+# CONFIG_FEATURE_VOLUMEID_LINUXSWAP is not set
+# CONFIG_FEATURE_VOLUMEID_LUKS is not set
+# CONFIG_FEATURE_VOLUMEID_NILFS is not set
+# CONFIG_FEATURE_VOLUMEID_NTFS is not set
+# CONFIG_FEATURE_VOLUMEID_OCFS2 is not set
+# CONFIG_FEATURE_VOLUMEID_REISERFS is not set
+# CONFIG_FEATURE_VOLUMEID_ROMFS is not set
+# CONFIG_FEATURE_VOLUMEID_SQUASHFS is not set
+# CONFIG_FEATURE_VOLUMEID_SYSV is not set
+# CONFIG_FEATURE_VOLUMEID_UBIFS is not set
+# CONFIG_FEATURE_VOLUMEID_UDF is not set
+# CONFIG_FEATURE_VOLUMEID_XFS is not set
+
+#
+# Miscellaneous Utilities
+#
+# CONFIG_ADJTIMEX is not set
+# CONFIG_BBCONFIG is not set
+# CONFIG_FEATURE_COMPRESS_BBCONFIG is not set
+# CONFIG_BEEP is not set
+CONFIG_FEATURE_BEEP_FREQ=0
+CONFIG_FEATURE_BEEP_LENGTH_MS=0
+# CONFIG_CHAT is not set
+# CONFIG_FEATURE_CHAT_NOFAIL is not set
+# CONFIG_FEATURE_CHAT_TTY_HIFI is not set
+# CONFIG_FEATURE_CHAT_IMPLICIT_CR is not set
+# CONFIG_FEATURE_CHAT_SWALLOW_OPTS is not set
+# CONFIG_FEATURE_CHAT_SEND_ESCAPES is not set
+# CONFIG_FEATURE_CHAT_VAR_ABORT_LEN is not set
+# CONFIG_FEATURE_CHAT_CLR_ABORT is not set
+# CONFIG_CONSPY is not set
+# CONFIG_CROND is not set
+# CONFIG_FEATURE_CROND_D is not set
+# CONFIG_FEATURE_CROND_CALL_SENDMAIL is not set
+CONFIG_FEATURE_CROND_DIR=""
+# CONFIG_CRONTAB is not set
+# CONFIG_DC is not set
+# CONFIG_FEATURE_DC_LIBM is not set
+# CONFIG_DEVFSD is not set
+# CONFIG_DEVFSD_MODLOAD is not set
+# CONFIG_DEVFSD_FG_NP is not set
+# CONFIG_DEVFSD_VERBOSE is not set
+# CONFIG_FEATURE_DEVFS is not set
+# CONFIG_DEVMEM is not set
+# CONFIG_FBSPLASH is not set
+# CONFIG_FLASH_ERASEALL is not set
+# CONFIG_FLASH_LOCK is not set
+# CONFIG_FLASH_UNLOCK is not set
+# CONFIG_FLASHCP is not set
+# CONFIG_HDPARM is not set
+# CONFIG_FEATURE_HDPARM_GET_IDENTITY is not set
+# CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF is not set
+# CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF is not set
+# CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET is not set
+# CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF is not set
+# CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA is not set
+# CONFIG_I2CGET is not set
+# CONFIG_I2CSET is not set
+# CONFIG_I2CDUMP is not set
+# CONFIG_I2CDETECT is not set
+# CONFIG_INOTIFYD is not set
+# CONFIG_LESS is not set
+CONFIG_FEATURE_LESS_MAXLINES=0
+# CONFIG_FEATURE_LESS_BRACKETS is not set
+# CONFIG_FEATURE_LESS_FLAGS is not set
+# CONFIG_FEATURE_LESS_TRUNCATE is not set
+# CONFIG_FEATURE_LESS_MARKS is not set
+# CONFIG_FEATURE_LESS_REGEXP is not set
+# CONFIG_FEATURE_LESS_WINCH is not set
+# CONFIG_FEATURE_LESS_ASK_TERMINAL is not set
+# CONFIG_FEATURE_LESS_DASHCMD is not set
+# CONFIG_FEATURE_LESS_LINENUMS is not set
+# CONFIG_LSSCSI is not set
+# CONFIG_MAKEDEVS is not set
+# CONFIG_FEATURE_MAKEDEVS_LEAF is not set
+# CONFIG_FEATURE_MAKEDEVS_TABLE is not set
+# CONFIG_MAN is not set
+# CONFIG_MICROCOM is not set
+# CONFIG_MT is not set
+# CONFIG_NANDWRITE is not set
+# CONFIG_NANDDUMP is not set
+# CONFIG_PARTPROBE is not set
+# CONFIG_RAIDAUTORUN is not set
+CONFIG_READAHEAD=y
+# CONFIG_RFKILL is not set
+# CONFIG_RUNLEVEL is not set
+# CONFIG_RX is not set
+# CONFIG_SETSERIAL is not set
+# CONFIG_STRINGS is not set
+# CONFIG_TIME is not set
+# CONFIG_TTYSIZE is not set
+# CONFIG_UBIATTACH is not set
+# CONFIG_UBIDETACH is not set
+# CONFIG_UBIMKVOL is not set
+# CONFIG_UBIRMVOL is not set
+# CONFIG_UBIRSVOL is not set
+# CONFIG_UBIUPDATEVOL is not set
+# CONFIG_UBIRENAME is not set
+# CONFIG_VOLNAME is not set
+# CONFIG_WATCHDOG is not set
+
+#
+# Networking Utilities
+#
+# CONFIG_FEATURE_IPV6 is not set
+# CONFIG_FEATURE_UNIX_LOCAL is not set
+# CONFIG_FEATURE_PREFER_IPV4_ADDRESS is not set
+# CONFIG_VERBOSE_RESOLUTION_ERRORS is not set
+# CONFIG_ARP is not set
+# CONFIG_ARPING is not set
+# CONFIG_BRCTL is not set
+# CONFIG_FEATURE_BRCTL_FANCY is not set
+# CONFIG_FEATURE_BRCTL_SHOW is not set
+CONFIG_DNSD=y
+# CONFIG_ETHER_WAKE is not set
+CONFIG_FTPD=y
+CONFIG_FEATURE_FTPD_WRITE=y
+CONFIG_FEATURE_FTPD_ACCEPT_BROKEN_LIST=y
+CONFIG_FEATURE_FTPD_AUTHENTICATION=y
+CONFIG_FTPGET=y
+CONFIG_FTPPUT=y
+# CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS is not set
+# CONFIG_HOSTNAME is not set
+# CONFIG_DNSDOMAINNAME is not set
+CONFIG_HTTPD=y
+CONFIG_FEATURE_HTTPD_RANGES=y
+CONFIG_FEATURE_HTTPD_SETUID=y
+CONFIG_FEATURE_HTTPD_BASIC_AUTH=y
+CONFIG_FEATURE_HTTPD_AUTH_MD5=y
+CONFIG_FEATURE_HTTPD_CGI=y
+CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR=y
+CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV=y
+CONFIG_FEATURE_HTTPD_ENCODE_URL_STR=y
+CONFIG_FEATURE_HTTPD_ERROR_PAGES=y
+CONFIG_FEATURE_HTTPD_PROXY=y
+CONFIG_FEATURE_HTTPD_GZIP=y
+# CONFIG_IFCONFIG is not set
+# CONFIG_FEATURE_IFCONFIG_STATUS is not set
+# CONFIG_FEATURE_IFCONFIG_SLIP is not set
+# CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ is not set
+# CONFIG_FEATURE_IFCONFIG_HW is not set
+# CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS is not set
+# CONFIG_IFENSLAVE is not set
+# CONFIG_IFPLUGD is not set
+# CONFIG_IFUP is not set
+# CONFIG_IFDOWN is not set
+CONFIG_IFUPDOWN_IFSTATE_PATH=""
+# CONFIG_FEATURE_IFUPDOWN_IP is not set
+# CONFIG_FEATURE_IFUPDOWN_IPV4 is not set
+# CONFIG_FEATURE_IFUPDOWN_IPV6 is not set
+# CONFIG_FEATURE_IFUPDOWN_MAPPING is not set
+# CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP is not set
+CONFIG_INETD=y
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO is not set
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD is not set
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_TIME is not set
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME is not set
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN is not set
+# CONFIG_FEATURE_INETD_RPC is not set
+# CONFIG_IP is not set
+# CONFIG_IPADDR is not set
+# CONFIG_IPLINK is not set
+# CONFIG_IPROUTE is not set
+# CONFIG_IPTUNNEL is not set
+# CONFIG_IPRULE is not set
+# CONFIG_IPNEIGH is not set
+# CONFIG_FEATURE_IP_ADDRESS is not set
+# CONFIG_FEATURE_IP_LINK is not set
+# CONFIG_FEATURE_IP_ROUTE is not set
+CONFIG_FEATURE_IP_ROUTE_DIR=""
+# CONFIG_FEATURE_IP_TUNNEL is not set
+# CONFIG_FEATURE_IP_RULE is not set
+# CONFIG_FEATURE_IP_NEIGH is not set
+# CONFIG_FEATURE_IP_RARE_PROTOCOLS is not set
+# CONFIG_IPCALC is not set
+# CONFIG_FEATURE_IPCALC_LONG_OPTIONS is not set
+# CONFIG_FEATURE_IPCALC_FANCY is not set
+CONFIG_FAKEIDENTD=y
+# CONFIG_NAMEIF is not set
+# CONFIG_FEATURE_NAMEIF_EXTENDED is not set
+# CONFIG_NBDCLIENT is not set
+# CONFIG_NC is not set
+# CONFIG_NC_SERVER is not set
+# CONFIG_NC_EXTRA is not set
+# CONFIG_NC_110_COMPAT is not set
+# CONFIG_NETSTAT is not set
+# CONFIG_FEATURE_NETSTAT_WIDE is not set
+# CONFIG_FEATURE_NETSTAT_PRG is not set
+# CONFIG_NSLOOKUP is not set
+# CONFIG_NTPD is not set
+# CONFIG_FEATURE_NTPD_SERVER is not set
+# CONFIG_FEATURE_NTPD_CONF is not set
+# CONFIG_PING is not set
+# CONFIG_PING6 is not set
+# CONFIG_FEATURE_FANCY_PING is not set
+# CONFIG_PSCAN is not set
+# CONFIG_ROUTE is not set
+# CONFIG_SLATTACH is not set
+# CONFIG_SSL_CLIENT is not set
+# CONFIG_TCPSVD is not set
+# CONFIG_UDPSVD is not set
+CONFIG_TELNET=y
+CONFIG_FEATURE_TELNET_TTYPE=y
+CONFIG_FEATURE_TELNET_AUTOLOGIN=y
+CONFIG_FEATURE_TELNET_WIDTH=y
+CONFIG_TELNETD=y
+CONFIG_FEATURE_TELNETD_STANDALONE=y
+CONFIG_FEATURE_TELNETD_INETD_WAIT=y
+CONFIG_TFTP=y
+CONFIG_TFTPD=y
+
+#
+# Common options for tftp/tftpd
+#
+CONFIG_FEATURE_TFTP_GET=y
+CONFIG_FEATURE_TFTP_PUT=y
+CONFIG_FEATURE_TFTP_BLOCKSIZE=y
+CONFIG_FEATURE_TFTP_PROGRESS_BAR=y
+# CONFIG_TFTP_DEBUG is not set
+# CONFIG_TLS is not set
+# CONFIG_TRACEROUTE is not set
+# CONFIG_TRACEROUTE6 is not set
+# CONFIG_FEATURE_TRACEROUTE_VERBOSE is not set
+# CONFIG_FEATURE_TRACEROUTE_USE_ICMP is not set
+# CONFIG_TUNCTL is not set
+# CONFIG_FEATURE_TUNCTL_UG is not set
+# CONFIG_VCONFIG is not set
+# CONFIG_WGET is not set
+# CONFIG_FEATURE_WGET_LONG_OPTIONS is not set
+# CONFIG_FEATURE_WGET_STATUSBAR is not set
+# CONFIG_FEATURE_WGET_AUTHENTICATION is not set
+# CONFIG_FEATURE_WGET_TIMEOUT is not set
+# CONFIG_FEATURE_WGET_HTTPS is not set
+# CONFIG_FEATURE_WGET_OPENSSL is not set
+# CONFIG_WHOIS is not set
+# CONFIG_ZCIP is not set
+# CONFIG_UDHCPC6 is not set
+# CONFIG_FEATURE_UDHCPC6_RFC3646 is not set
+# CONFIG_FEATURE_UDHCPC6_RFC4704 is not set
+# CONFIG_FEATURE_UDHCPC6_RFC4833 is not set
+CONFIG_UDHCPD=y
+CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY=y
+CONFIG_FEATURE_UDHCPD_BASE_IP_ON_MAC=y
+CONFIG_DHCPD_LEASES_FILE="/var/lib/udhcpd/udhcpd.leases"
+# CONFIG_DUMPLEASES is not set
+# CONFIG_DHCPRELAY is not set
+# CONFIG_UDHCPC is not set
+# CONFIG_FEATURE_UDHCPC_ARPING is not set
+# CONFIG_FEATURE_UDHCPC_SANITIZEOPT is not set
+CONFIG_UDHCPC_DEFAULT_SCRIPT=""
+# CONFIG_FEATURE_UDHCP_PORT is not set
+CONFIG_UDHCP_DEBUG=0
+CONFIG_FEATURE_UDHCP_RFC3397=y
+CONFIG_FEATURE_UDHCP_8021Q=y
+CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=80
+CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS=""
+
+#
+# Print Utilities
+#
+# CONFIG_LPD is not set
+# CONFIG_LPR is not set
+# CONFIG_LPQ is not set
+
+#
+# Mail Utilities
+#
+# CONFIG_MAKEMIME is not set
+# CONFIG_POPMAILDIR is not set
+# CONFIG_FEATURE_POPMAILDIR_DELIVERY is not set
+# CONFIG_REFORMIME is not set
+# CONFIG_FEATURE_REFORMIME_COMPAT is not set
+# CONFIG_SENDMAIL is not set
+CONFIG_FEATURE_MIME_CHARSET=""
+
+#
+# Process Utilities
+#
+# CONFIG_FREE is not set
+# CONFIG_FUSER is not set
+# CONFIG_IOSTAT is not set
+# CONFIG_KILL is not set
+# CONFIG_KILLALL is not set
+# CONFIG_KILLALL5 is not set
+# CONFIG_LSOF is not set
+# CONFIG_MPSTAT is not set
+# CONFIG_NMETER is not set
+# CONFIG_PGREP is not set
+# CONFIG_PKILL is not set
+# CONFIG_PIDOF is not set
+# CONFIG_FEATURE_PIDOF_SINGLE is not set
+# CONFIG_FEATURE_PIDOF_OMIT is not set
+# CONFIG_PMAP is not set
+# CONFIG_POWERTOP is not set
+# CONFIG_FEATURE_POWERTOP_INTERACTIVE is not set
+# CONFIG_PS is not set
+# CONFIG_FEATURE_PS_WIDE is not set
+# CONFIG_FEATURE_PS_LONG is not set
+# CONFIG_FEATURE_PS_TIME is not set
+# CONFIG_FEATURE_PS_UNUSUAL_SYSTEMS is not set
+# CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS is not set
+# CONFIG_PSTREE is not set
+# CONFIG_PWDX is not set
+# CONFIG_SMEMCAP is not set
+# CONFIG_BB_SYSCTL is not set
+# CONFIG_TOP is not set
+# CONFIG_FEATURE_TOP_INTERACTIVE is not set
+# CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE is not set
+# CONFIG_FEATURE_TOP_CPU_GLOBAL_PERCENTS is not set
+# CONFIG_FEATURE_TOP_SMP_CPU is not set
+# CONFIG_FEATURE_TOP_DECIMALS is not set
+# CONFIG_FEATURE_TOP_SMP_PROCESS is not set
+# CONFIG_FEATURE_TOPMEM is not set
+# CONFIG_UPTIME is not set
+# CONFIG_FEATURE_UPTIME_UTMP_SUPPORT is not set
+# CONFIG_WATCH is not set
+# CONFIG_FEATURE_SHOW_THREADS is not set
+
+#
+# Runit Utilities
+#
+# CONFIG_CHPST is not set
+# CONFIG_SETUIDGID is not set
+# CONFIG_ENVUIDGID is not set
+# CONFIG_ENVDIR is not set
+# CONFIG_SOFTLIMIT is not set
+# CONFIG_RUNSV is not set
+# CONFIG_RUNSVDIR is not set
+# CONFIG_FEATURE_RUNSVDIR_LOG is not set
+# CONFIG_SV is not set
+CONFIG_SV_DEFAULT_SERVICE_DIR=""
+# CONFIG_SVC is not set
+# CONFIG_SVLOGD is not set
+# CONFIG_CHCON is not set
+# CONFIG_FEATURE_CHCON_LONG_OPTIONS is not set
+# CONFIG_GETENFORCE is not set
+# CONFIG_GETSEBOOL is not set
+# CONFIG_LOAD_POLICY is not set
+# CONFIG_MATCHPATHCON is not set
+# CONFIG_RUNCON is not set
+# CONFIG_FEATURE_RUNCON_LONG_OPTIONS is not set
+# CONFIG_SELINUXENABLED is not set
+# CONFIG_SESTATUS is not set
+# CONFIG_SETENFORCE is not set
+# CONFIG_SETFILES is not set
+# CONFIG_FEATURE_SETFILES_CHECK_OPTION is not set
+# CONFIG_RESTORECON is not set
+# CONFIG_SETSEBOOL is not set
+
+#
+# Shells
+#
+# CONFIG_SH_IS_ASH is not set
+# CONFIG_SH_IS_HUSH is not set
+CONFIG_SH_IS_NONE=y
+# CONFIG_BASH_IS_ASH is not set
+# CONFIG_BASH_IS_HUSH is not set
+CONFIG_BASH_IS_NONE=y
+# CONFIG_ASH is not set
+# CONFIG_ASH_OPTIMIZE_FOR_SIZE is not set
+# CONFIG_ASH_INTERNAL_GLOB is not set
+# CONFIG_ASH_BASH_COMPAT is not set
+# CONFIG_ASH_JOB_CONTROL is not set
+# CONFIG_ASH_ALIAS is not set
+# CONFIG_ASH_RANDOM_SUPPORT is not set
+# CONFIG_ASH_EXPAND_PRMT is not set
+# CONFIG_ASH_IDLE_TIMEOUT is not set
+# CONFIG_ASH_MAIL is not set
+# CONFIG_ASH_ECHO is not set
+# CONFIG_ASH_PRINTF is not set
+# CONFIG_ASH_TEST is not set
+# CONFIG_ASH_HELP is not set
+# CONFIG_ASH_GETOPTS is not set
+# CONFIG_ASH_CMDCMD is not set
+# CONFIG_ASH_COMMAND_NOT_FOUND_HOOK is not set
+# CONFIG_CTTYHACK is not set
+# CONFIG_HUSH is not set
+# CONFIG_HUSH_BASH_COMPAT is not set
+# CONFIG_HUSH_BRACE_EXPANSION is not set
+# CONFIG_HUSH_INTERACTIVE is not set
+# CONFIG_HUSH_SAVEHISTORY is not set
+# CONFIG_HUSH_JOB is not set
+# CONFIG_HUSH_TICK is not set
+# CONFIG_HUSH_IF is not set
+# CONFIG_HUSH_LOOPS is not set
+# CONFIG_HUSH_CASE is not set
+# CONFIG_HUSH_FUNCTIONS is not set
+# CONFIG_HUSH_LOCAL is not set
+# CONFIG_HUSH_RANDOM_SUPPORT is not set
+# CONFIG_HUSH_MODE_X is not set
+# CONFIG_HUSH_ECHO is not set
+# CONFIG_HUSH_PRINTF is not set
+# CONFIG_HUSH_TEST is not set
+# CONFIG_HUSH_HELP is not set
+# CONFIG_HUSH_EXPORT is not set
+# CONFIG_HUSH_EXPORT_N is not set
+# CONFIG_HUSH_KILL is not set
+# CONFIG_HUSH_WAIT is not set
+# CONFIG_HUSH_TRAP is not set
+# CONFIG_HUSH_TYPE is not set
+# CONFIG_HUSH_READ is not set
+# CONFIG_HUSH_SET is not set
+# CONFIG_HUSH_UNSET is not set
+# CONFIG_HUSH_ULIMIT is not set
+# CONFIG_HUSH_UMASK is not set
+# CONFIG_HUSH_MEMLEAK is not set
+# CONFIG_MSH is not set
+
+#
+# Options common to all shells
+#
+# CONFIG_FEATURE_SH_MATH is not set
+# CONFIG_FEATURE_SH_MATH_64 is not set
+# CONFIG_FEATURE_SH_EXTRA_QUIET is not set
+# CONFIG_FEATURE_SH_STANDALONE is not set
+# CONFIG_FEATURE_SH_NOFORK is not set
+# CONFIG_FEATURE_SH_HISTFILESIZE is not set
+
+#
+# System Logging Utilities
+#
+# CONFIG_KLOGD is not set
+# CONFIG_FEATURE_KLOGD_KLOGCTL is not set
+# CONFIG_LOGGER is not set
+# CONFIG_LOGREAD is not set
+# CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING is not set
+# CONFIG_SYSLOGD is not set
+# CONFIG_FEATURE_ROTATE_LOGFILE is not set
+# CONFIG_FEATURE_REMOTE_LOG is not set
+# CONFIG_FEATURE_SYSLOGD_DUP is not set
+# CONFIG_FEATURE_SYSLOGD_CFG is not set
+CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=0
+# CONFIG_FEATURE_IPC_SYSLOG is not set
+CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=0
+# CONFIG_FEATURE_KMSG_SYSLOG is not set
diff --git a/system/busybox/dad.if-up b/system/busybox/dad.if-up
new file mode 100644
index 000000000..e76bb60bf
--- /dev/null
+++ b/system/busybox/dad.if-up
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+# Block ifup until DAD completion
+# Copyright (c) 2016 Kaarle Ritvanen
+
+while ip address show dev $IFACE | grep -q " tentative "; do
+ sleep 0.2
+done
diff --git a/system/busybox/nologin.c b/system/busybox/nologin.c
new file mode 100644
index 000000000..e0a4c56c7
--- /dev/null
+++ b/system/busybox/nologin.c
@@ -0,0 +1,38 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * nologin implementation for busybox
+ *
+ * Licensed under GPLv2 or later, see file LICENSE in this source tree.
+ */
+
+//config:config NOLOGIN
+//config: bool "nologin"
+//config: default n
+//config: help
+//config: nologin is a tool that is supposed to be the shell for user accounts
+//config: that are not supposed to login.
+
+//applet:IF_NOLOGIN(APPLET(nologin, BB_DIR_SBIN, BB_SUID_DROP))
+//kbuild:lib-$(CONFIG_NOLOGIN) += nologin.o
+
+//usage:#define nologin_trivial_usage
+//usage: ""
+//usage:#define nologin_full_usage "\n\n"
+//usage: "politely refuse a login\n"
+
+#include "libbb.h"
+#include <syslog.h>
+
+#define _NOLOGIN_TXT "/etc/nologin.txt"
+
+int nologin_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
+int nologin_main(int argc UNUSED_PARAM, char **argv)
+{
+ int fd;
+ fd = open(_NOLOGIN_TXT, O_RDONLY);
+ if (bb_copyfd_eof(fd, STDOUT_FILENO) == -1)
+ bb_error_msg_and_die("this account is not available");
+ close(fd);
+ return 1;
+}
+
diff --git a/system/busybox/top-buffer-overflow.patch b/system/busybox/top-buffer-overflow.patch
new file mode 100644
index 000000000..14b23c648
--- /dev/null
+++ b/system/busybox/top-buffer-overflow.patch
@@ -0,0 +1,20 @@
+--- busybox-1.27.0.orig/procps/top.c
++++ busybox-1.27.0/procps/top.c
+@@ -694,10 +694,14 @@
+ CALC_STAT(pcpu, (s->pcpu*pcpu_scale + pcpu_half) >> pcpu_shift);
+ #endif
+
+- if (s->vsz >= 100000)
+- sprintf(vsz_str_buf, "%6ldm", s->vsz/1024);
++ if ((s->vsz / (1024 * 1024)) >= 100000)
++ snprintf(vsz_str_buf, sizeof(vsz_str_buf), "%6ldt", s->vsz/(1024 * 1024 * 1024));
++ else if ((s->vsz / 1024) >= 100000)
++ snprintf(vsz_str_buf, sizeof(vsz_str_buf), "%6ldg", s->vsz/(1024 * 1024));
++ else if (s->vsz >= 100000)
++ snprintf(vsz_str_buf, sizeof(vsz_str_buf), "%6ldm", s->vsz/1024);
+ else
+- sprintf(vsz_str_buf, "%7lu", s->vsz);
++ snprintf(vsz_str_buf, sizeof(vsz_str_buf), "%7lu", s->vsz);
+ /* PID PPID USER STAT VSZ %VSZ [%CPU] COMMAND */
+ col = snprintf(line_buf, scr_width,
+ "\n" "%5u%6u %-8.8s %s%s" FMT
diff --git a/system/c-ares/APKBUILD b/system/c-ares/APKBUILD
new file mode 100644
index 000000000..98fbe2eb1
--- /dev/null
+++ b/system/c-ares/APKBUILD
@@ -0,0 +1,46 @@
+# Contributor: Carlo Landmeter <clandmeter@gmail.com>
+# Maintainer: Carlo Landmeter <clandmeter@gmail.com>
+pkgname=c-ares
+pkgver=1.13.0
+pkgrel=0
+pkgdesc="An asynchronously DNS/names resolver library"
+url="http://c-ares.haxx.se/"
+arch="all"
+license="MIT"
+depends=""
+makedepends=""
+subpackages="$pkgname-doc $pkgname-dev"
+options="!checkroot"
+source="http://c-ares.haxx.se/download/$pkgname-$pkgver.tar.gz"
+
+_builddir="$srcdir"/$pkgname-$pkgver
+
+build() {
+ cd "$_builddir"
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --enable-shared
+ make
+}
+
+check() {
+ cd "$_builddir"
+
+ # This is only needed for < 1.14.0, where the .sh file was not
+ # distributed properly - see https://da.gd/carestest
+ echo "#!/bin/true" > test/fuzzcheck.sh
+ chmod a+x test/fuzzcheck.sh
+
+ make -C test check
+}
+
+package() {
+ cd "$_builddir"
+ make -j1 DESTDIR="$pkgdir" install
+}
+
+sha512sums="4a7942e754673f5b8d55a7471e31b0f390e8324b14c12077580c956147fad4d165c7fe8a3190199b1add95c710ceeb1a7957706d4f0d6299d39c5dddc719bd9d c-ares-1.13.0.tar.gz"
diff --git a/system/ca-certificates/APKBUILD b/system/ca-certificates/APKBUILD
new file mode 100644
index 000000000..81194471e
--- /dev/null
+++ b/system/ca-certificates/APKBUILD
@@ -0,0 +1,54 @@
+# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
+# Contributor: William Pitcock <nenolod@dereferenced.org>
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=ca-certificates
+pkgver=20170801
+pkgrel=0
+pkgdesc="Common CA certificates PEM files"
+url="https://www.mozilla.org/en-US/about/governance/policies/security-group/certs/"
+arch="all"
+license="MPL 2.0 GPL2+"
+depends=""
+makedepends_build="python3"
+makedepends_host="openssl-dev"
+subpackages="$pkgname-doc"
+# c_rehash is either in libcrypto1.0 or openssl depending on package, grr. replace both of them
+replaces="libcrypto1.0 openssl"
+options="!fhs !check"
+triggers="ca-certificates.trigger=/usr/share/ca-certificates:/usr/local/share/ca-certificates:/etc/ssl/certs:/etc/ca-certificates/update.d"
+install="$pkgname.post-deinstall"
+source="https://git.alpinelinux.org/cgit/ca-certificates/snapshot/ca-certificates-$pkgver.tar.bz2"
+builddir="$srcdir/ca-certificates-$pkgver"
+
+build() {
+ cd "$builddir"
+ make
+}
+
+package() {
+ cd "$builddir"
+ make install DESTDIR="$pkgdir"
+
+ (
+ echo "# Automatically generated by ${pkgname}-${pkgver}-${pkgrel}"
+ echo "# $(date -u)"
+ echo "# Do not edit."
+ cd "$pkgdir"/usr/share/ca-certificates
+ find . -name '*.crt' | sort | cut -b3-
+ ) > "$pkgdir"/etc/ca-certificates.conf
+
+ mkdir -p "$pkgdir"/etc/apk/protected_paths.d
+ cat > "$pkgdir"/etc/apk/protected_paths.d/ca-certificates.list <<-EOF
+ -etc/ssl/certs/ca-certificates.crt
+ -etc/ssl/certs/ca-cert-*.pem
+ -etc/ssl/certs/[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f].[r0-9]*
+ EOF
+
+ cat > "$pkgdir"/etc/ca-certificates/update.d/certhash <<-EOF
+ #!/bin/sh
+ exec /usr/bin/c_rehash /etc/ssl/certs
+ EOF
+ chmod +x "$pkgdir"/etc/ca-certificates/update.d/certhash
+}
+
+sha512sums="2b3de9f4ed1ae2ee66d428598f5878e3c773a7475102a234332c1430e202fa1d23889365a725a1aef3531c8c56718d206f95e02284af994d2330b3fc92f96ea2 ca-certificates-20170801.tar.bz2"
diff --git a/system/ca-certificates/ca-certificates.post-deinstall b/system/ca-certificates/ca-certificates.post-deinstall
new file mode 100644
index 000000000..ead634716
--- /dev/null
+++ b/system/ca-certificates/ca-certificates.post-deinstall
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+# clean up broken symlinks and ca-certificates.crt store
+find -L /etc/ssl/certs -maxdepth 1 \( -type l -o -name ca-certificates.crt \) \
+ -delete
+rmdir /etc/ssl/certs 2>/dev/null || true
+
diff --git a/system/ca-certificates/ca-certificates.trigger b/system/ca-certificates/ca-certificates.trigger
new file mode 100644
index 000000000..eff198163
--- /dev/null
+++ b/system/ca-certificates/ca-certificates.trigger
@@ -0,0 +1,3 @@
+#!/bin/sh
+/usr/sbin/update-ca-certificates --fresh &> /dev/null
+exit 0
diff --git a/system/check/APKBUILD b/system/check/APKBUILD
new file mode 100644
index 000000000..09af1b010
--- /dev/null
+++ b/system/check/APKBUILD
@@ -0,0 +1,42 @@
+# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
+# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
+pkgname=check
+pkgver=0.12.0
+pkgrel=1
+pkgdesc="A unit test framework for C"
+url="https://libcheck.github.io/check/"
+arch="all"
+license="LGPL2+"
+makedepends="pkgconfig"
+checkdepends="diffutils"
+subpackages="$pkgname-doc $pkgname-dev"
+source="https://github.com/libcheck/$pkgname/releases/download/$pkgver/$pkgname-$pkgver.tar.gz"
+
+builddir="$srcdir"/$pkgname-$pkgver
+
+build() {
+ cd "$builddir"
+ # NOTE: disabled forking due to hardened
+ # https://github.com/libcheck/check/issues/138
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --localstatedir=/var \
+ --disable-fork
+ make
+}
+
+check() {
+ cd "$builddir"
+ make check
+}
+
+package() {
+ cd "$builddir"
+ make DESTDIR="$pkgdir" install
+}
+
+sha512sums="403454d166ddd4e25f96d6c52028f4173f4a5ad4a249dd782e3a8d5db1ad0178956d74577cf0d4c963a5a7d09077a59042a74f74d6b528b7212e18ab5def1dd9 check-0.12.0.tar.gz"
diff --git a/system/cmake/APKBUILD b/system/cmake/APKBUILD
new file mode 100644
index 000000000..b89114090
--- /dev/null
+++ b/system/cmake/APKBUILD
@@ -0,0 +1,59 @@
+# Contributor: Valery Kartel <valery.kartel@gmail.com>
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=cmake
+pkgver=3.9.5
+pkgrel=0
+pkgdesc="CMake is a cross-platform open-source make system"
+url="http://www.cmake.org"
+arch="all"
+license="CMake"
+makedepends="ncurses-dev curl-dev expat-dev zlib-dev bzip2-dev libarchive-dev
+ libuv-dev xz-dev rhash-dev"
+options="!checkroot"
+checkdepends="musl-utils file"
+subpackages="$pkgname-doc"
+
+case $pkgver in
+*.*.*.*) _v=v${pkgver%.*.*};;
+*.*.*) _v=v${pkgver%.*};;
+esac
+
+source="http://www.cmake.org/files/$_v/cmake-${pkgver}.tar.gz"
+builddir="$srcdir/$pkgname-$pkgver"
+
+_parallel_opt() {
+ local i n
+ for i in $MAKEOPTS; do
+ case "$i" in
+ -j*) n=${i#-j};;
+ esac;
+ done
+ [ -n "$n" ] && echo "--parallel $n"
+}
+
+build() {
+ cd "$builddir"
+ # jsoncpp needs cmake to build so to avoid recursive build
+ # dependency, we use the bundled version of jsoncpp
+ ./bootstrap \
+ --prefix=/usr \
+ --mandir=/share/man \
+ --datadir=/share/$pkgname \
+ --docdir=/share/doc/$pkgname \
+ --system-libs \
+ --no-system-jsoncpp \
+ $(_parallel_opt)
+ make
+}
+
+check() {
+ cd "$builddir"
+ CTEST_OUTPUT_ON_FAILURE=TRUE bin/ctest
+}
+
+package() {
+ cd $startdir/src/$pkgname-$pkgver
+ make DESTDIR="$pkgdir" install
+}
+
+sha512sums="71a0848a0c7048c210fe16fbd2b0c2870bd4c2140098225e94fac13a53059f4ae610139115ab8c153989886baa087d506b9ffbc7b91ddc157b0c85e3223828a0 cmake-3.9.5.tar.gz"
diff --git a/system/coreutils/051_all_coreutils-mangen.patch b/system/coreutils/051_all_coreutils-mangen.patch
new file mode 100644
index 000000000..388924d06
--- /dev/null
+++ b/system/coreutils/051_all_coreutils-mangen.patch
@@ -0,0 +1,120 @@
+--- coreutils-8.27/Makefile.in.old 2017-03-08 23:24:51.000000000 -0600
++++ coreutils-8.27/Makefile.in 2017-08-24 23:01:09.582964705 -0500
+@@ -14647,117 +14647,6 @@
+ distclean-local:
+ test x$(srcdir) = x$(builddir) || rm -f $(ALL_MANS)
+
+-$(ALL_MANS): $(mandeps)
+-# Most prog.1 man pages depend on src/prog. List the exceptions:
+-@SINGLE_BINARY_FALSE@man/install.1: src/ginstall$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/test.1: src/[$(EXEEXT)
+-
+-@SINGLE_BINARY_FALSE@man/arch.1: src/arch$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/b2sum.1: src/b2sum$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/base32.1: src/base32$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/base64.1: src/base64$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/basename.1: src/basename$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/cat.1: src/cat$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/chcon.1: src/chcon$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/chgrp.1: src/chgrp$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/chmod.1: src/chmod$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/chown.1: src/chown$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/chroot.1: src/chroot$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/cksum.1: src/cksum$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/comm.1: src/comm$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/coreutils.1: src/coreutils$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/cp.1: src/cp$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/csplit.1: src/csplit$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/cut.1: src/cut$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/date.1: src/date$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/dd.1: src/dd$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/df.1: src/df$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/dir.1: src/dir$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/dircolors.1: src/dircolors$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/dirname.1: src/dirname$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/du.1: src/du$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/echo.1: src/echo$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/env.1: src/env$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/expand.1: src/expand$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/expr.1: src/expr$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/factor.1: src/factor$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/false.1: src/false$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/fmt.1: src/fmt$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/fold.1: src/fold$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/groups.1: src/groups$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/head.1: src/head$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/hostid.1: src/hostid$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/hostname.1: src/hostname$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/id.1: src/id$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/join.1: src/join$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/kill.1: src/kill$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/link.1: src/link$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/ln.1: src/ln$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/logname.1: src/logname$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/ls.1: src/ls$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/md5sum.1: src/md5sum$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/mkdir.1: src/mkdir$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/mkfifo.1: src/mkfifo$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/mknod.1: src/mknod$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/mktemp.1: src/mktemp$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/mv.1: src/mv$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/nice.1: src/nice$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/nl.1: src/nl$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/nohup.1: src/nohup$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/nproc.1: src/nproc$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/numfmt.1: src/numfmt$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/od.1: src/od$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/paste.1: src/paste$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/pathchk.1: src/pathchk$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/pinky.1: src/pinky$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/pr.1: src/pr$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/printenv.1: src/printenv$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/printf.1: src/printf$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/ptx.1: src/ptx$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/pwd.1: src/pwd$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/readlink.1: src/readlink$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/realpath.1: src/realpath$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/rm.1: src/rm$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/rmdir.1: src/rmdir$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/runcon.1: src/runcon$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/seq.1: src/seq$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/sha1sum.1: src/sha1sum$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/sha224sum.1: src/sha224sum$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/sha256sum.1: src/sha256sum$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/sha384sum.1: src/sha384sum$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/sha512sum.1: src/sha512sum$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/shred.1: src/shred$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/shuf.1: src/shuf$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/sleep.1: src/sleep$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/sort.1: src/sort$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/split.1: src/split$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/stat.1: src/stat$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/stdbuf.1: src/stdbuf$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/stty.1: src/stty$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/sum.1: src/sum$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/sync.1: src/sync$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/tac.1: src/tac$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/tail.1: src/tail$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/tee.1: src/tee$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/timeout.1: src/timeout$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/touch.1: src/touch$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/tr.1: src/tr$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/true.1: src/true$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/truncate.1: src/truncate$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/tsort.1: src/tsort$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/tty.1: src/tty$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/uname.1: src/uname$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/unexpand.1: src/unexpand$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/uniq.1: src/uniq$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/unlink.1: src/unlink$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/uptime.1: src/uptime$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/users.1: src/users$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/vdir.1: src/vdir$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/wc.1: src/wc$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/who.1: src/who$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/whoami.1: src/whoami$(EXEEXT)
+-@SINGLE_BINARY_FALSE@man/yes.1: src/yes$(EXEEXT)
+-
+ .x.1:
+ $(AM_V_GEN)name=`echo $@ | sed 's|.*/||; s|\.1$$||'` || exit 1; \
+ case $$name in \
diff --git a/system/coreutils/APKBUILD b/system/coreutils/APKBUILD
new file mode 100644
index 000000000..c92568720
--- /dev/null
+++ b/system/coreutils/APKBUILD
@@ -0,0 +1,79 @@
+# Contributor: Valery Kartel <valery.kartel@gmail.com>
+# Contributor: Michael Mason <ms13sp@gmail.com>
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=coreutils
+pkgver=8.28
+pkgrel=0
+pkgdesc="The basic file, shell and text manipulation utilities"
+url="http://www.gnu.org/software/coreutils/"
+arch="all"
+license="GPL3+"
+options="!checkroot"
+makedepends="bash acl-dev attr-dev gettext-dev"
+[ ${CBUILD} == ${CHOST} ] && makedepends="$makedepends perl"
+subpackages="$pkgname-doc"
+[ ${CBUILD} == ${CHOST} ] && subpackages="$subpackages $pkgname-lang"
+install="$pkgname.post-deinstall"
+source="http://ftp.gnu.org/gnu/coreutils/$pkgname-$pkgver.tar.xz
+ disable-mbrtowc-test.patch
+ localename-test-fix.patch
+ "
+[ ${CBUILD} != ${CHOST} ] && source="$source
+ 051_all_coreutils-mangen.patch
+ "
+
+builddir="$srcdir"/$pkgname-$pkgver
+
+build() {
+ cd "$builddir"
+ LIBS="-lrt" ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --enable-nls \
+ --without-gmp \
+ --enable-no-install-program=hostname,su,kill,uptime \
+ --with-packager="Adélie" \
+ --with-packager-bug-reports="https://bts.adelielinux.org/"
+ if [ ${CBUILD} != ${CHOST} ]; then
+ set -- man/*.x
+ touch ${@/%x/1}
+ fi
+ make
+}
+
+check() {
+ cd "$builddir"
+ make check
+}
+
+package() {
+ cd "$builddir"
+ make DESTDIR="$pkgdir" install
+
+ rm -rf "$pkgdir"/usr/lib/charset.alias
+ rmdir -p "$pkgdir"/usr/lib 2>/dev/null || true
+
+ install -d "$pkgdir"/bin "$pkgdir"/usr/sbin
+ cd "$pkgdir"/usr/bin/
+
+ # binaries that busybox puts in /bin
+ mv base64 cat chgrp chmod chown cp date dd df 'echo' false ln ls \
+ mkdir mknod mktemp mv nice printenv pwd rm rmdir sleep stat \
+ stty sync touch true uname \
+ "$pkgdir"/bin
+
+ mv chroot "$pkgdir"/usr/sbin/
+}
+
+sha512sums="1e592d0dd03b9227bf92af9a82bed6dc3bcbee46e984c7fb09833dea0962e86b309aa34d5e43823b73d4522c066bfa5cdc8ec694aa190910fb246ff32ceb63a1 coreutils-8.28.tar.xz
+532ef8210261437855ba3e2fc72ec57b0e0252b2b0f7817990c9629613ece2cdd86cf30aa049f3cff6fbda12ed3bb9a0db3a3642475378ae44ce319bdf005d9b disable-mbrtowc-test.patch
+00a517c7e3e2206ba7a60f9126d28ae1d549e86da62b48f32250d49c2caf896c53fc3d803729b544a1cfb1609dd8cb7cb4b3473defef5d1e2c154ed1de6bc5de localename-test-fix.patch"
+
+[ ${CBUILD} != ${CHOST} ] && sha512sums="$sha512sums
+bae804f057252c25452ac178c545dc2c4b4775cbfbdcfd4775edd1a4ed6507882bfac39e2b11ad01b74230ca48d761bf62f11bde5bcbc35a6e5a61cbe4a46e36 051_all_coreutils-mangen.patch
+"
+return 0
diff --git a/system/coreutils/coreutils.post-deinstall b/system/coreutils/coreutils.post-deinstall
new file mode 100644
index 000000000..24e0bdf25
--- /dev/null
+++ b/system/coreutils/coreutils.post-deinstall
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# other post scripts might need rm so we don't wait for the trigger
+exec /bin/busybox --install -s
diff --git a/system/coreutils/disable-mbrtowc-test.patch b/system/coreutils/disable-mbrtowc-test.patch
new file mode 100644
index 000000000..d338e0324
--- /dev/null
+++ b/system/coreutils/disable-mbrtowc-test.patch
@@ -0,0 +1,10 @@
+--- coreutils-8.27/gnulib-tests/test-mbrtowc5.sh.old 2016-12-31 13:54:43.000000000 +0000
++++ coreutils-8.27/gnulib-tests/test-mbrtowc5.sh 2017-07-30 17:29:50.879924130 +0000
+@@ -1,6 +1,2 @@
+ #!/bin/sh
+-# Test whether the POSIX locale has encoding errors.
+-LC_ALL=C \
+-./test-mbrtowc${EXEEXT} 5 || exit
+-LC_ALL=POSIX \
+-./test-mbrtowc${EXEEXT} 5
++exit 77
diff --git a/system/coreutils/localename-test-fix.patch b/system/coreutils/localename-test-fix.patch
new file mode 100644
index 000000000..f90d11866
--- /dev/null
+++ b/system/coreutils/localename-test-fix.patch
@@ -0,0 +1,34 @@
+--- coreutils-8.27/gnulib-tests/localename.c.old 2016-12-31 13:54:43.000000000 +0000
++++ coreutils-8.27/gnulib-tests/localename.c 2017-07-30 16:40:47.098541270 +0000
+@@ -40,7 +40,7 @@
+ # if defined __APPLE__ && defined __MACH__
+ # include <xlocale.h>
+ # endif
+-# if (__GLIBC__ >= 2 && !defined __UCLIBC__) || defined __CYGWIN__
++# if (defined __linux__ && !defined __UCLIBC__) || defined __CYGWIN__
+ # include <langinfo.h>
+ # endif
+ # if !defined IN_LIBINTL
+@@ -2692,16 +2692,19 @@
+ locale_t thread_locale = uselocale (NULL);
+ if (thread_locale != LC_GLOBAL_LOCALE)
+ {
+-# if __GLIBC__ >= 2 && !defined __UCLIBC__
++# if defined(_NL_LOCALE_NAME)
++ const char *name = nl_langinfo(_NL_LOCALE_NAME(category));
++# if __GLIBC__ >= 2 && !defined __UCLIBC__
+ /* Work around an incorrect definition of the _NL_LOCALE_NAME macro in
+ glibc < 2.12.
+ See <http://sourceware.org/bugzilla/show_bug.cgi?id=10968>. */
+- const char *name =
+- nl_langinfo (_NL_ITEM ((category), _NL_ITEM_INDEX (-1)));
++ if (name[0] == '\0')
++ name = nl_langinfo (_NL_ITEM ((category), _NL_ITEM_INDEX (-1)));
+ if (name[0] == '\0')
+ /* Fallback code for glibc < 2.4, which did not implement
+ nl_langinfo (_NL_LOCALE_NAME (category)). */
+ name = thread_locale->__names[category];
++# endif
+ return name;
+ # elif defined __FreeBSD__ || (defined __APPLE__ && defined __MACH__)
+ /* FreeBSD, Mac OS X */
diff --git a/system/coreutils/no-doc.patch b/system/coreutils/no-doc.patch
new file mode 100644
index 000000000..a1d74623b
--- /dev/null
+++ b/system/coreutils/no-doc.patch
@@ -0,0 +1,22 @@
+--- coreutils-8.27/Makefile.in.old 2017-03-09 05:24:51.000000000 +0000
++++ coreutils-8.27/Makefile.in 2017-06-22 03:07:59.568716258 +0000
+@@ -2363,7 +2363,7 @@
+ }
+ man1dir = $(mandir)/man1
+ NROFF = nroff
+-MANS = $(man1_MANS)
++MANS =
+ HEADERS = $(noinst_HEADERS)
+ RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+--- coreutils-8.27/Makefile.in.old 2017-06-22 03:08:55.821951666 +0000
++++ coreutils-8.27/Makefile.in 2017-06-22 03:19:51.770820411 +0000
+@@ -12192,7 +12192,7 @@
+
+ info-am: $(INFO_DEPS)
+
+-install-data-am: install-info-am install-man
++install-data-am: install-info-am
+
+ install-dvi: install-dvi-recursive
+
diff --git a/system/coreutils/printf-musl.patch b/system/coreutils/printf-musl.patch
new file mode 100644
index 000000000..28a951635
--- /dev/null
+++ b/system/coreutils/printf-musl.patch
@@ -0,0 +1,53 @@
+From ad5c14dcadd4603363e68da960ed0101b61439bd Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
+Date: Sat, 12 Aug 2017 23:53:33 -0700
+Subject: [PATCH] tests: fix false failure with large printf formats
+
+* tests/misc/printf-surprise.sh: With musl libc the
+large printf format does succeed, outputting data.
+To avoid SIGPIPE being generated we ignore that signal
+and then handle the subsequent EPIPE error.
+Reported by A. Wilcox
+---
+ tests/misc/printf-surprise.sh | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/tests/misc/printf-surprise.sh b/tests/misc/printf-surprise.sh
+index 2edd34c..46c0d8f 100755
+--- a/tests/misc/printf-surprise.sh
++++ b/tests/misc/printf-surprise.sh
+@@ -50,6 +50,9 @@ vm=$(get_min_ulimit_v_ env $prog %20f 0) \
+
+ mkfifo_or_skip_ fifo
+
++(trap '' PIPE && yes | :) 2>&1 | grep -qF 'Broken pipe' ||
++ skip_ 'trapping SIGPIPE is not supported'
++
+ # Disable MALLOC_PERTURB_, to avoid triggering this bug
+ # https://bugs.debian.org/481543#77
+ export MALLOC_PERTURB_=0
+@@ -60,11 +63,11 @@ cleanup_() { kill $pid 2>/dev/null && wait $pid; }
+ head -c 10 fifo > out & pid=$!
+
+ # Trigger large mem allocation failure
+-( ulimit -v $vm && env $prog %20000000f 0 2>err-msg > fifo )
++( trap '' PIPE && ulimit -v $vm && env $prog %20000000f 0 2>err-msg > fifo )
+ exit=$?
+
+ # Map this longer, and rarer, diagnostic to the common one.
+-# printf: cannot perform formatted output: Cannot allocate memory" \
++# printf: cannot perform formatted output: Cannot allocate memory"
+ sed 's/cannot perform .*/write error/' err-msg > k && mv k err-msg
+ err_msg=$(tr '\n' : < err-msg)
+
+@@ -81,6 +84,7 @@ n_out=$(wc -c < out)
+
+ case $n_out:$diagnostic:$exit in
+ 10:n:0) ;; # ok, succeeds w/no diagnostic: FreeBSD 6.1
++ 10:y:1) ;; # ok, fails with EPIPE diagnostic: musl libc
+ 0:y:1) ;; # ok, glibc-2.8 and newer, when printf(3) fails with ENOMEM
+
+ # With MALLOC_PERTURB_=0, this no longer happens.
+--
+2.9.3
+
diff --git a/system/coreutils/seq-write-error.patch b/system/coreutils/seq-write-error.patch
new file mode 100644
index 000000000..4892a82ec
--- /dev/null
+++ b/system/coreutils/seq-write-error.patch
@@ -0,0 +1,45 @@
+From 1e1dbbe0f95c7170009f3ba4d8380c1b98ff53c8 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
+Date: Sun, 13 Aug 2017 00:18:43 -0700
+Subject: [PATCH] seq: produce consistent error messages upon write error
+
+* src/seq.c (io_error): Use the same error message as would
+be generated at exit time when closing the stdout stream.
+The inconsistency was added with commit v8.25-26-gc92585b.
+This was noticed due to an inconsistency in the expected
+error message generated by seq on musl libc.
+Reported by A. Wilcox.
+---
+ src/seq.c | 2 +-
+ tests/misc/seq-epipe.sh | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/seq.c b/src/seq.c
+index bb191ba..5e5b381 100644
+--- a/src/seq.c
++++ b/src/seq.c
+@@ -284,7 +284,7 @@ io_error (void)
+ {
+ /* FIXME: consider option to silently ignore errno=EPIPE */
+ clearerr (stdout);
+- die (EXIT_FAILURE, errno, _("standard output"));
++ die (EXIT_FAILURE, errno, _("write error"));
+ }
+
+ /* Actually print the sequence of numbers in the specified range, with the
+diff --git a/tests/misc/seq-epipe.sh b/tests/misc/seq-epipe.sh
+index edbd563..69dd75d 100755
+--- a/tests/misc/seq-epipe.sh
++++ b/tests/misc/seq-epipe.sh
+@@ -33,7 +33,7 @@ compare exp code || fail=1
+
+ # The error message must begin with "standard output:"
+ # (but don't hard-code the strerror text)
+-grep '^seq: standard output: ' err \
++grep '^seq: write error: ' err \
+ || { warn_ "seq emitted incorrect error on EPIPE"; \
+ cat err;\
+ fail=1; }
+--
+2.9.3
+
diff --git a/system/coreutils/sort-debug-locale.patch b/system/coreutils/sort-debug-locale.patch
new file mode 100644
index 000000000..27921abbd
--- /dev/null
+++ b/system/coreutils/sort-debug-locale.patch
@@ -0,0 +1,79 @@
+From b938d8966c3d1afec9730d403fd6a6eb4d856b85 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
+Date: Sun, 13 Aug 2017 00:45:32 -0700
+Subject: [PATCH] sort: handle musl locale differences in --debug reporting
+
+* src/sort.c (main): Don't assume hard_LC_COLLATE implies
+a successful setting of the locale as musl defaults to
+UTF8 when failing to set the specified locale.
+* tests/misc/sort-debug-warn.sh: Adjust for the now
+separated locale debug info and map the musl specific
+message back to the common case.
+Reported by A. Wilcox.
+---
+ src/sort.c | 17 +++++++++--------
+ tests/misc/sort-debug-warn.sh | 9 +++++++--
+ 2 files changed, 16 insertions(+), 10 deletions(-)
+
+diff --git a/src/sort.c b/src/sort.c
+index 015e40e..ba6ceac 100644
+--- a/src/sort.c
++++ b/src/sort.c
+@@ -4675,18 +4675,19 @@ main (int argc, char **argv)
+
+ /* Always output the locale in debug mode, since this
+ is such a common source of confusion. */
++
++ /* OpenBSD can only set some categories with LC_ALL above,
++ so set LC_COLLATE explicitly to flag errors. */
++ if (locale_ok)
++ locale_ok = !! setlocale (LC_COLLATE, "");
++ if (! locale_ok)
++ error (0, 0, "%s", _("failed to set locale"));
+ if (hard_LC_COLLATE)
+ error (0, 0, _("using %s sorting rules"),
+ quote (setlocale (LC_COLLATE, NULL)));
+ else
+- {
+- /* OpenBSD can only set some categories with LC_ALL above,
+- so set LC_COLLATE explicitly to flag errors. */
+- if (locale_ok)
+- locale_ok = !! setlocale (LC_COLLATE, "");
+- error (0, 0, "%s%s", locale_ok ? "" : _("failed to set locale; "),
+- _("using simple byte comparison"));
+- }
++ error (0, 0, "%s", _("using simple byte comparison"));
++
+ key_warnings (&gkey, gkey_only);
+ }
+
+diff --git a/tests/misc/sort-debug-warn.sh b/tests/misc/sort-debug-warn.sh
+index 3602c84..8119693 100755
+--- a/tests/misc/sort-debug-warn.sh
++++ b/tests/misc/sort-debug-warn.sh
+@@ -71,7 +71,8 @@ sort: using simple byte comparison
+ 17
+ sort: using simple byte comparison
+ 18
+-sort: failed to set locale; using simple byte comparison
++sort: failed to set locale
++sort: using simple byte comparison
+ EOF
+
+ echo 1 >> out
+@@ -109,7 +110,11 @@ sort -rM --debug /dev/null 2>>out #no warning
+ echo 17 >> out
+ sort -rM -k1,1 --debug /dev/null 2>>out #no warning
+ echo 18 >> out
+-LC_ALL=missing sort --debug /dev/null 2>>out
++LC_ALL=missing sort --debug /dev/null 2>>out.t
++# musl libc accepts "missing" and implicitly uses UTF8,
++# so adjust the expected message accordingly.
++sed 's/using .*missing.* sorting rules/using simple byte comparison/' \
++ out.t >>out
+
+ compare exp out || fail=1
+
+--
+2.9.3
+
diff --git a/system/curl/APKBUILD b/system/curl/APKBUILD
new file mode 100644
index 000000000..fd20e55dd
--- /dev/null
+++ b/system/curl/APKBUILD
@@ -0,0 +1,93 @@
+# Contributor: Sergei Lukin <sergej.lukin@gmail.com>
+# Contributor: Valery Kartel <valery.kartel@gmail.com>
+# Contributor: Łukasz Jendrysik <scadu@yandex.com>
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=curl
+pkgver=7.56.1
+pkgrel=0
+pkgdesc="An URL retrival utility and library"
+url="http://curl.haxx.se"
+arch="all"
+license="MIT"
+depends="ca-certificates"
+makedepends_build="groff perl"
+makedepends_host="zlib-dev openssl-dev libssh2-dev"
+makedepends="$makedepends_build $makedepends_host"
+source="http://curl.haxx.se/download/$pkgname-$pkgver.tar.bz2
+ "
+subpackages="$pkgname-dbg $pkgname-doc $pkgname-dev libcurl"
+
+# secfixes:
+# 7.56.1-r0:
+# - CVE-2017-1000257
+# 7.55.0-r0:
+# - CVE-2017-1000099
+# - CVE-2017-1000100
+# - CVE-2017-1000101
+# 7.54.0-r0:
+# - CVE-2017-7468
+# 7.53.1-r2:
+# - CVE-2017-7407
+# 7.53.0:
+# - CVE-2017-2629
+# 7.52.1:
+# - CVE-2016-9594
+# 7.51.0:
+# - CVE-2016-8615
+# - CVE-2016-8616
+# - CVE-2016-8617
+# - CVE-2016-8618
+# - CVE-2016-8619
+# - CVE-2016-8620
+# - CVE-2016-8621
+# - CVE-2016-8622
+# - CVE-2016-8623
+# - CVE-2016-8624
+# - CVE-2016-8625
+# 7.50.3:
+# - CVE-2016-7167
+# 7.50.2:
+# - CVE-2016-7141
+# 7.50.1:
+# - CVE-2016-5419
+# - CVE-2016-5420
+# - CVE-2016-5421
+# 7.36.0:
+# - CVE-2014-0138
+# - CVE-2014-0139
+
+builddir="$srcdir/$pkgname-$pkgver"
+
+build() {
+ cd "$builddir"
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --enable-ipv6 \
+ --enable-unix-sockets \
+ --without-libidn \
+ --without-libidn2 \
+ --disable-ldap \
+ --with-pic \
+ || return 1
+ make || return 1
+}
+
+check() {
+ cd "$builddir"
+ make check
+}
+
+package() {
+ make DESTDIR="$pkgdir" \
+ -C "$builddir" install || return 1
+}
+
+libcurl() {
+ pkgdesc="The multiprotocol file transfer library"
+ mkdir -p "$subpkgdir"/usr
+ mv "$pkgdir"/usr/lib "$subpkgdir"/usr
+}
+
+sha512sums="f8a602e6890b2791ea9199c80801ffd027980de3733d4ab001ee80b5167f840cc821c6fe7852087c88a471edc9d3f328cf660af3e2c6f7139d6c8de62b0ade68 curl-7.56.1.tar.bz2"
diff --git a/system/curl/curl-do-bounds-check-using-a-double-comparison.patch b/system/curl/curl-do-bounds-check-using-a-double-comparison.patch
new file mode 100644
index 000000000..34e2b6c71
--- /dev/null
+++ b/system/curl/curl-do-bounds-check-using-a-double-comparison.patch
@@ -0,0 +1,32 @@
+From 45a560390c4356bcb81d933bbbb229c8ea2acb63 Mon Sep 17 00:00:00 2001
+From: Adam Sampson <ats@offog.org>
+Date: Wed, 9 Aug 2017 14:11:17 +0100
+Subject: [PATCH] curl: do bounds check using a double comparison
+
+The fix for this in 8661a0aacc01492e0436275ff36a21734f2541bb wasn't
+complete: if the parsed number in num is larger than will fit in a long,
+the conversion is undefined behaviour (causing test1427 to fail for me
+on IA32 with GCC 7.1, although it passes on AMD64 and ARMv7). Getting
+rid of the cast means the comparison will be done using doubles.
+
+It might make more sense for the max argument to also be a double...
+
+Fixes #1750
+Closes #1749
+---
+ src/tool_paramhlp.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/tool_paramhlp.c b/src/tool_paramhlp.c
+index b9dedc989e..85c5e79a7e 100644
+--- a/src/tool_paramhlp.c
++++ b/src/tool_paramhlp.c
+@@ -218,7 +218,7 @@ static ParameterError str2double(double *val, const char *str, long max)
+ num = strtod(str, &endptr);
+ if(errno == ERANGE)
+ return PARAM_NUMBER_TOO_LARGE;
+- if((long)num > max) {
++ if(num > max) {
+ /* too large */
+ return PARAM_NUMBER_TOO_LARGE;
+ }
diff --git a/system/diffutils/APKBUILD b/system/diffutils/APKBUILD
new file mode 100644
index 000000000..19331ecd8
--- /dev/null
+++ b/system/diffutils/APKBUILD
@@ -0,0 +1,50 @@
+# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
+pkgname=diffutils
+pkgver=3.6
+pkgrel=1
+pkgdesc="Show differences among files"
+subpackages="$pkgname-doc"
+url="http://www.gnu.org/software/diffutils/"
+arch="all"
+license="GPL3+"
+source="http://ftp.gnu.org/pub/gnu/$pkgname/$pkgname-$pkgver.tar.xz
+ disable-mbrtowc-test.patch
+ "
+builddir=$srcdir/$pkgname-$pkgver
+
+prepare() {
+ cd "$builddir"
+ default_prepare
+
+ # fix eglibc-2.16 build issue
+ sed -i -e '/gets is a/d' \
+ lib/stdio.in.h
+}
+
+build() {
+ cd "$builddir"
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --disable-nls
+ make
+}
+
+check() {
+ cd "$builddir"
+ make check
+}
+
+package() {
+ cd "$builddir"
+ make install DESTDIR=$pkgdir
+
+ rm -rf "$pkgdir"/usr/lib/charset.alias
+ rmdir -p "$pkgdir"/usr/lib 2>/dev/null || true
+}
+
+sha512sums="3c159ff1cb7c901b0a57518483566b5740ca3c45aeb8d3004089f052975481db52994cc18592c502c68b0d2a1e22f1f7830f0d8dd9a9ed86de96e28cce9f70c1 diffutils-3.6.tar.xz
+2602dabf0ac52a273b84160032416613da7ad111541fe25466cf9d4ce1eb2630f0ba0cb0b3013967965d8359a11a5f390f0486b4526b35516d9de1c8975f720d disable-mbrtowc-test.patch"
diff --git a/system/diffutils/disable-mbrtowc-test.patch b/system/diffutils/disable-mbrtowc-test.patch
new file mode 100644
index 000000000..1461a4093
--- /dev/null
+++ b/system/diffutils/disable-mbrtowc-test.patch
@@ -0,0 +1,10 @@
+--- diffutils-3.6/gnulib-tests/test-mbrtowc5.sh.old 2016-12-31 13:54:43.000000000 +0000
++++ diffutils-3.6/gnulib-tests/test-mbrtowc5.sh 2017-07-30 17:29:50.879924130 +0000
+@@ -1,6 +1,2 @@
+ #!/bin/sh
+-# Test whether the POSIX locale has encoding errors.
+-LC_ALL=C \
+-./test-mbrtowc${EXEEXT} 5 || exit
+-LC_ALL=POSIX \
+-./test-mbrtowc${EXEEXT} 5
++exit 77
diff --git a/system/emacs/APKBUILD b/system/emacs/APKBUILD
new file mode 100644
index 000000000..0092c9070
--- /dev/null
+++ b/system/emacs/APKBUILD
@@ -0,0 +1,140 @@
+# Contributor: Timo Teräs <timo.teras@iki.fi>
+# Maintainer: Horst Burkhardt <horst@adelielinux.org>
+pkgname=emacs
+pkgver=26.1
+pkgrel=0
+pkgdesc="The extensible, customizable, self-documenting real-time display editor"
+arch="all"
+depends="emacs-nox"
+options="!check !dbg"
+url="https://www.gnu.org/software/emacs/emacs.html"
+license="GPL-3.0"
+makedepends="autoconf automake linux-headers paxmark
+ librsvg-dev giflib-dev libxpm-dev gtk+2.0-dev gconf-dev alsa-lib-dev
+ glib-dev fontconfig-dev libpng-dev
+ libxml2-dev pango-dev tiff-dev libjpeg-turbo-dev ncurses-dev
+ ncurses-libs gnutls-dev libxaw-dev"
+subpackages="$pkgname-doc $pkgname-nox $pkgname-x11 $pkgname-gtk2"
+source="ftp://ftp.gnu.org/gnu/emacs/emacs-$pkgver.tar.xz
+ gamedir.patch"
+
+prepare() {
+ cd "$builddir/$1"
+ default_prepare || return 1
+ ./autogen.sh || return 1
+}
+
+builddir="$srcdir/emacs-$pkgver"
+_build_variant() {
+ cd "$builddir/$1"
+ shift
+ CFLAGS=-fno-pie \
+ LDFLAGS=-no-pie \
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --libexecdir=/usr/lib \
+ --localstatedir=/var \
+ --without-makeinfo \
+ --with-gameuser=:games \
+ "${@}"
+ make
+}
+
+_build_x11() {
+ _build_variant x11 \
+ --with-x-toolkit=athena \
+ --without-toolkit-scroll-bars \
+ --without-dbus \
+ --with-xft \
+ --with-jpeg=yes \
+ --with-tiff=yes
+}
+
+_build_gtk2() {
+ _build_variant gtk2 \
+ --with-x-toolkit=gtk2 \
+ --with-xft \
+ --with-jpeg=yes \
+ --with-tiff=no
+}
+
+_build_nox() {
+ _build_variant nox \
+ --without-sound \
+ --without-x \
+ --without-file-notification
+}
+
+build() {
+ cd "$builddir"
+ mkdir -p nox
+ mv * nox || true
+ cp -a nox gtk2
+ cp -a nox x11
+ _build_x11
+ _build_nox
+ _build_gtk2
+}
+
+package() {
+ mkdir -p "$pkgdir"
+}
+
+doc() {
+ mkdir -p "$subpkgdir"
+ cd "$builddir/gtk2"
+ make DESTDIR="$subpkgdir" install
+ # remove conflict with ctags package
+ mv "$subpkgdir"/usr/share/man/man1/ctags.1.gz "$subpkgdir"/usr/share/man/man1/ctags.emacs.1.gz
+ # only keep info and man directories, all other is in the specific package
+ rm -rf "$subpkgdir"/usr/bin \
+ "$subpkgdir"/usr/lib \
+ "$subpkgdir"/usr/share/appdata \
+ "$subpkgdir"/usr/share/applications \
+ "$subpkgdir"/usr/share/emacs \
+ "$subpkgdir"/usr/share/icons \
+ "$subpkgdir"/var
+}
+
+_subpackage() {
+ cd "$builddir/$1"
+ make DESTDIR="$subpkgdir" install
+
+ # remove conflict with ctags package
+ mv "$subpkgdir"/usr/bin/ctags "$subpkgdir"/usr/bin/ctags.emacs
+ rm -rf "$subpkgdir"/usr/share/info \
+ "$subpkgdir"/usr/share/man
+
+ # fix user/root permissions on usr/share files
+ find "$subpkgdir"/usr/share/emacs/ -exec chown root:root {} \;
+ find "$subpkgdir"/usr/lib -perm -g+s,g+x ! -type d -exec chmod g-s {} \;
+ # fix perms on /var/games
+ chmod 775 "$subpkgdir"/var/games
+ chmod 775 "$subpkgdir"/var/games/emacs
+ chmod 664 "$subpkgdir"/var/games/emacs/*
+ chown -R root:games "$subpkgdir"/var/games
+}
+
+nox() {
+ pkgdesc="$pkgdesc - without X11"
+ depends="!emacs-x11 !emacs-gtk2"
+ _subpackage nox
+}
+
+x11() {
+ pkgdesc="$pkgdesc - with X11"
+ depends="!emacs-nox !emacs-gtk2 hicolor-icon-theme desktop-file-utils"
+ _subpackage x11
+}
+
+gtk2() {
+ pkgdesc="$pkgdesc - with GTK2"
+ depends="!emacs-nox !emacs-x11 hicolor-icon-theme desktop-file-utils"
+ _subpackage gtk2
+}
+
+sha512sums="537c2cfdd281151b360002419dde6280c313e07a937ed96405c67f754b3401ec5541091a3c0aa6690929bc33dd79e8e0d8844e7a6b014b7798c63cb15de210c2 emacs-26.1.tar.xz
+8898f309aeaf274366849bd5c56c8e2a1be94dfee2f01b20f1700bf26203f49b9600237e5090fc3d8eaad3ea246f803ffd493d0c04cb3512084a4e3bf58f8f5e gamedir.patch"
diff --git a/system/emacs/gamedir.patch b/system/emacs/gamedir.patch
new file mode 100644
index 000000000..c1bcbadd6
--- /dev/null
+++ b/system/emacs/gamedir.patch
@@ -0,0 +1,11 @@
+diff -urw emacs-25.1/lib-src/Makefile.in emacs-25.1-gamedir/lib-src/Makefile.in
+--- emacs-25.1/lib-src/Makefile.in 2016-06-29 09:49:18.000000000 +0000
++++ emacs-25.1-gamedir/lib-src/Makefile.in 2016-10-24 15:37:46.718699816 +0000
+@@ -414,7 +414,6 @@
+
+ update-game-score${EXEEXT}: ${srcdir}/update-game-score.c $(NTLIB) $(config_h)
+ $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} \
+- -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\"" \
+ $< $(NTLIB) $(LOADLIBES) -o $@
+
+ emacsclient.res: ../nt/emacsclient.rc $(NTINC)/../icons/emacs.ico
diff --git a/system/gamin/APKBUILD b/system/gamin/APKBUILD
new file mode 100644
index 000000000..360161d27
--- /dev/null
+++ b/system/gamin/APKBUILD
@@ -0,0 +1,58 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=gamin
+pkgver=0.1.10
+pkgrel=11
+pkgdesc="Gamin is a file and directory monitoring system defined to be a subset of the FAM (File Alteration Monitor) system."
+url="http://www.gnome.org/~veillard/gamin"
+arch="all"
+license="GPL"
+subpackages="$pkgname-dev"
+depends=
+makedepends="glib-dev"
+source="http://www.gnome.org/~veillard/$pkgname/sources/$pkgname-$pkgver.tar.gz
+ fix-deprecated-const.patch
+ fix-pthread-mutex.patch"
+
+_builddir="$srcdir"/$pkgname-$pkgver
+prepare() {
+ cd "$_builddir"
+ update_config_sub
+ default_prepare
+}
+
+build() {
+ cd "$_builddir"
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --disable-static \
+ --with-threads \
+ --without-python \
+ --disable-debug-api \
+ --disable-debug \
+ --libexecdir=/usr/lib/gamin
+ make
+}
+
+check() {
+ cd "$builddir"
+ make check
+}
+
+package() {
+ cd "$_builddir"
+ # some kinde of race in the make install which is not solved with -j
+ export MKDIRPROG="mkdir -p"
+ make DESTDIR="$pkgdir" install
+}
+
+md5sums="b4ec549e57da470c04edd5ec2876a028 gamin-0.1.10.tar.gz
+f679aeb48fe9dd376c8828cc9b6941ab fix-deprecated-const.patch
+f05a8d9fe30b6ce2871795c06d74edc4 fix-pthread-mutex.patch"
+sha256sums="28085f0ae8be10eab582ff186af4fb0be92cc6c62b5cc19cd09b295c7c2899a1 gamin-0.1.10.tar.gz
+33af6c9a94b459506fc48892c169d89cb4ad7c68e160f0c4bc74475f19ce5a2f fix-deprecated-const.patch
+bfd5ee42e385367718a4dac8ab318f9a5881ab8b669e4020f87aacaef16a2f8e fix-pthread-mutex.patch"
+sha512sums="21bfe6fcf8fb3117cd5a08c8ce3b8d0d1dd23e478e60a95b76c20d02cc29b050dde086578d81037990484ff891c3e104d2cbbf3d294b4a79346b14a0cae075bb gamin-0.1.10.tar.gz
+c4c10bee70c7231db395cbfe5bdf513ade6be599a11a9d35888ddfaca42d619fe2b5e87c2b2bab469ea98ba718bc01711252313ba5f53c392379b669f5b2902b fix-deprecated-const.patch
+70628fc39521ea8bc4a40b009d0881f6ee540334a31b2f0cb67dde0f75808c69feb78088ad24c3c4a0dec9fa59e87960fd81d1a2e56963ce9268d0a5e14f88e8 fix-pthread-mutex.patch"
diff --git a/system/gamin/fix-deprecated-const.patch b/system/gamin/fix-deprecated-const.patch
new file mode 100644
index 000000000..3d5f6133f
--- /dev/null
+++ b/system/gamin/fix-deprecated-const.patch
@@ -0,0 +1,56 @@
+Description: Don't use deprecated G_CONST_RETURN. Fixes building with newer glib versions.
+Author: Matthias Klose <doko@ubuntu.com>
+Bug-Ubuntu: https://launchpad.net/bugs/829504
+
+Index: gamin/server/gam_node.c
+===================================================================
+--- gamin.orig/server/gam_node.c 2011-10-18 16:09:04.873780685 +0200
++++ gamin/server/gam_node.c 2011-10-18 16:09:01.965780543 +0200
+@@ -122,7 +122,7 @@
+ * it has finished with the string. If it must keep it longer, it
+ * should makes its own copy. The returned string must not be freed.
+ */
+-G_CONST_RETURN char *
++const char *
+ gam_node_get_path(GamNode * node)
+ {
+ g_assert(node);
+Index: gamin/server/gam_node.h
+===================================================================
+--- gamin.orig/server/gam_node.h 2011-10-18 16:09:04.729780677 +0200
++++ gamin/server/gam_node.h 2011-10-18 16:09:01.961780544 +0200
+@@ -58,7 +58,7 @@
+ void gam_node_set_is_dir (GamNode *node,
+ gboolean is_dir);
+
+-G_CONST_RETURN char *gam_node_get_path (GamNode *node);
++const char *gam_node_get_path (GamNode *node);
+
+ GList *gam_node_get_subscriptions (GamNode *node);
+
+Index: gamin/server/gam_subscription.c
+===================================================================
+--- gamin.orig/server/gam_subscription.c 2011-10-18 16:09:04.817780682 +0200
++++ gamin/server/gam_subscription.c 2011-10-18 16:09:01.965780543 +0200
+@@ -141,7 +141,7 @@
+ * @param sub the GamSubscription
+ * @returns The path being monitored. It should not be freed.
+ */
+-G_CONST_RETURN char *
++const char *
+ gam_subscription_get_path(GamSubscription * sub)
+ {
+ if (sub == NULL)
+Index: gamin/server/gam_subscription.h
+===================================================================
+--- gamin.orig/server/gam_subscription.h 2011-10-18 16:09:04.929780687 +0200
++++ gamin/server/gam_subscription.h 2011-10-18 16:09:01.965780543 +0200
+@@ -21,7 +21,7 @@
+
+ int gam_subscription_get_reqno (GamSubscription *sub);
+
+-G_CONST_RETURN char *gam_subscription_get_path (GamSubscription *sub);
++const char *gam_subscription_get_path (GamSubscription *sub);
+
+ GamListener *gam_subscription_get_listener (GamSubscription *sub);
+
diff --git a/system/gamin/fix-pthread-mutex.patch b/system/gamin/fix-pthread-mutex.patch
new file mode 100644
index 000000000..c8c5b0005
--- /dev/null
+++ b/system/gamin/fix-pthread-mutex.patch
@@ -0,0 +1,11 @@
+--- gamin-0.1.10.orig/libgamin/gam_data.c
++++ gamin-0.1.10/libgamin/gam_data.c
+@@ -470,7 +470,7 @@
+ }
+ if (is_threaded > 0) {
+ pthread_mutexattr_init(&attr);
+-#if defined(linux) || defined(PTHREAD_MUTEX_RECURSIVE_NP)
++#if defined(linux) && defined(PTHREAD_MUTEX_RECURSIVE_NP)
+ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
+ #else
+ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
diff --git a/system/git/0001-gc-use-s-type-character-for-fscanf.patch b/system/git/0001-gc-use-s-type-character-for-fscanf.patch
new file mode 100644
index 000000000..e3fe78cf6
--- /dev/null
+++ b/system/git/0001-gc-use-s-type-character-for-fscanf.patch
@@ -0,0 +1,33 @@
+From afceb0f7755a87d0dd2194e95f26c9dc8f4bc688 Mon Sep 17 00:00:00 2001
+From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
+Date: Fri, 15 Sep 2017 23:55:57 -0500
+Subject: [PATCH] gc: use 's' type character for fscanf
+
+The ISO C standard states that using a field width together with the 'c'
+type character will read the exact amount specified; if that amount of
+bytes is not available, a match error occurs.
+
+This patch allows the t6500 test to pass on the musl libc, and `git gc`
+to behave correctly on systems utilising musl.
+
+Signed-off-by: A. Wilcox <AWilcox@Wilcox-Tech.com>
+---
+ builtin/gc.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/builtin/gc.c b/builtin/gc.c
+index 3c78fcb..bb2d6c1 100644
+--- a/builtin/gc.c
++++ b/builtin/gc.c
+@@ -258,7 +258,7 @@ static const char *lock_repo_for_gc(int force, pid_t* ret_pid)
+ int should_exit;
+
+ if (!scan_fmt)
+- scan_fmt = xstrfmt("%s %%%dc", "%"SCNuMAX, HOST_NAME_MAX);
++ scan_fmt = xstrfmt("%s %%%ds", "%"SCNuMAX, HOST_NAME_MAX);
+ fp = fopen(pidfile_path, "r");
+ memset(locking_host, 0, sizeof(locking_host));
+ should_exit =
+--
+2.10.0
+
diff --git a/system/git/APKBUILD b/system/git/APKBUILD
new file mode 100644
index 000000000..0a400b851
--- /dev/null
+++ b/system/git/APKBUILD
@@ -0,0 +1,255 @@
+# Contributor: Łukasz Jendrysik <scadu@yandex.com>
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=git
+pkgver=2.15.0
+pkgrel=0
+pkgdesc="A distributed version control system"
+url="https://www.git-scm.com/"
+arch="all"
+license="GPL2+"
+depends=
+replaces="git-perl"
+
+# secfixes:
+# 2.14.1:
+# - CVE-2017-1000117
+
+# note that order matters
+subpackages="$pkgname-doc
+ $pkgname-bash-completion:completion:noarch
+ perl-$pkgname-svn:_perl_git_svn:noarch
+ perl-$pkgname:_perl_git:noarch
+ $pkgname-svn
+ $pkgname-email
+ $pkgname-fast-import:_fast_import
+ $pkgname-cvs::noarch
+ $pkgname-p4::noarch
+ $pkgname-daemon
+ $pkgname-gitweb
+ $pkgname-subtree::noarch
+ $pkgname-subtree-doc:subtree_doc:noarch
+ $pkgname-perl:_git_perl:noarch
+ $pkgname-gui::noarch
+ $pkgname-gitk::noarch
+ "
+# we need tcl and tk to be built before git due to git-gui and gitk
+makedepends="zlib-dev openssl-dev curl-dev expat-dev perl-dev
+ pcre2-dev asciidoctor xmlto perl-error tcl tk"
+checkdepends="python3"
+source="https://www.kernel.org/pub/software/scm/git/git-$pkgver.tar.xz
+ bb-tar.patch
+ dont-test-other-encodings.patch
+ git-daemon.initd
+ git-daemon.confd
+ "
+
+_gitcoredir=/usr/libexec/git-core
+builddir="$srcdir"/$pkgname-$pkgver
+
+prepare() {
+ default_prepare
+ cat >> config.mak <<-EOF
+ NO_GETTEXT=YesPlease
+ NO_SVN_TESTS=YesPlease
+ NO_REGEX=YesPlease
+ USE_ASCIIDOCTOR=1
+ USE_LIBPCRE2=YesPlease
+ NO_NSEC=YesPlease
+ NO_SYS_POLL_H=1
+ CFLAGS=$CFLAGS
+ EOF
+}
+
+build() {
+ cd "$builddir"
+ make -j1 prefix=/usr DESTDIR="$pkgdir" perl/perl.mak
+ make prefix=/usr DESTDIR="$pkgdir"
+}
+
+check() {
+ cd "$builddir"
+ make prefix=/usr DESTDIR="$pkgdir" test
+}
+
+package() {
+ cd "$builddir"
+ make -j1 prefix=/usr \
+ DESTDIR="$pkgdir" \
+ INSTALLDIRS=vendor \
+ install
+ mkdir -p "$pkgdir"/var/git
+ install -Dm755 "$srcdir"/git-daemon.initd \
+ "$pkgdir"/etc/init.d/git-daemon
+ install -Dm644 "$srcdir"/git-daemon.confd \
+ "$pkgdir"/etc/conf.d/git-daemon
+
+ make prefix=/usr DESTDIR="$pkgdir" install-man
+}
+
+_perl_git_svn() {
+ pkgdesc="Perl interface to Git::SVN"
+ depends="git=$pkgver-r$pkgrel"
+ replaces="git-perl"
+ eval local `perl -V:vendorlib`
+ mkdir -p "$subpkgdir"/$vendorlib/Git
+ mv "$pkgdir"/$vendorlib/Git/SVN* "$subpkgdir"/$vendorlib/Git/
+}
+
+_perl_git() {
+ pkgdesc="Perl interface to Git"
+ depends="git=$pkgver-r$pkgrel perl-error"
+ replaces="git-perl"
+ eval local `perl -V:vendorlib`
+ eval local `perl -V:vendorarch`
+ for i in $vendorlib $vendorarch; do
+ mkdir -p "$subpkgdir"/${i%/*}
+ mv "$pkgdir"/$i "$subpkgdir"/$i
+ done
+}
+
+email() {
+ depends="perl perl-git=$pkgver-r$pkgrel perl-net-smtp-ssl
+ perl-authen-sasl"
+ pkgdesc="Git tools for sending email"
+ replaces="git"
+ mkdir -p "$subpkgdir"/$_gitcoredir
+ mv "$pkgdir"/$_gitcoredir/*email* "$pkgdir"/$_gitcoredir/*imap* \
+ "$subpkgdir"/$_gitcoredir
+}
+
+svn() {
+ depends="perl perl-git-svn=$pkgver-r$pkgrel perl-subversion
+ perl-term-readkey"
+ pkgdesc="Subversion support for git"
+ replaces=""
+
+ mkdir -p "$subpkgdir"/$_gitcoredir
+ mv "$pkgdir"/$_gitcoredir/git-svn \
+ "$pkgdir"$_gitcoredir/git-remote-testsvn \
+ "$subpkgdir"/$_gitcoredir/
+}
+
+cvs() {
+ pkgdesc="Git tools for importing CVS repositories"
+ depends="perl perl-git=$pkgver-r$pkgrel cvs perl-dbd-sqlite"
+ replaces="git-perl"
+ mkdir -p "$subpkgdir"/usr/bin "$subpkgdir"/$_gitcoredir
+ mv "$pkgdir"/usr/bin/git-cvs* "$subpkgdir"/usr/bin/
+ mv "$pkgdir"/$_gitcoredir/*cvs* "$subpkgdir"/$_gitcoredir \
+
+}
+
+_fast_import() {
+ pkgdesc="Git backend for fast Git data importers"
+ depends="git=$pkgver-r$pkgrel"
+ mkdir -p "$subpkgdir"/$_gitcoredir
+ mv "$pkgdir"/$_gitcoredir/git-fast-import "$subpkgdir"/$_gitcoredir/
+}
+
+p4() {
+ pkgdesc="Git tools for working with Perforce depots"
+ depends="git=$pkgver-r$pkgrel git-fast-import=$pkgver-r$pkgrel"
+ replaces="git"
+ mkdir -p "$subpkgdir"/$_gitcoredir/mergetools
+ mv "$pkgdir"/$_gitcoredir/*p4* "$subpkgdir"/$_gitcoredir/
+ mv "$pkgdir"/$_gitcoredir/mergetools/*p4* \
+ "$subpkgdir"/$_gitcoredir/mergetools/
+}
+
+daemon() {
+ pkgdesc="Git protocol daemon"
+ depends="git=$pkgver-r$pkgrel"
+ replaces="git"
+ mkdir -p "$subpkgdir"/$_gitcoredir
+ mv "$pkgdir"/$_gitcoredir/git-daemon \
+ "$pkgdir"/$_gitcoredir/git-http-backend \
+ "$pkgdir"/$_gitcoredir/git-shell \
+ "$subpkgdir"/$_gitcoredir \
+
+ mv "$pkgdir"/etc "$subpkgdir"/
+}
+
+gitweb() {
+ pkgdesc="Simple web interface to git repositories"
+ depends="git=$pkgver-r$pkgrel perl"
+ replaces="git"
+ mkdir -p "$subpkgdir"/usr/share "$subpkgdir"$_gitcoredir
+ mv "$pkgdir"/usr/share/gitweb "$subpkgdir"/usr/share/
+ mv "$pkgdir"/$_gitcoredir/git-instaweb "$subpkgdir"$_gitcoredir
+}
+
+completion() {
+ pkgdesc="Bash completion for $pkgname"
+ depends=""
+ replaces=""
+ install_if="$pkgname=$pkgver-r$pkgrel bash-completion"
+
+ install -Dm644 "$builddir"/contrib/completion/git-completion.bash \
+ "$subpkgdir"/usr/share/bash-completion/completions/git
+}
+
+subtree() {
+ depends="git=$pkgver-r$pkgrel"
+ pkgdesc="Split git repository into subtrees"
+ replaces=""
+
+ cd "$builddir"/contrib/subtree
+ make prefix=/usr DESTDIR="$pkgdir"
+ make install prefix=/usr DESTDIR="$subpkgdir"
+}
+
+subtree_doc() {
+ depends=""
+ pkgdesc="Split git repository into subtrees (documentation)"
+ replaces=""
+
+ cd "$builddir"/contrib/subtree
+ make install-man prefix=/usr DESTDIR="$subpkgdir"
+ gzip -9 "$subpkgdir"/usr/share/man/man1/git-subtree.1
+}
+
+gui() {
+ depends="git=$pkgver-r$pkgrel tcl tk"
+ pkgdesc="GUI interface for git"
+ replaces=""
+
+ mkdir -p "$subpkgdir"/usr/share "$subpkgdir"/usr/libexec/git-core
+ mv "$pkgdir"/usr/share/git-gui "$subpkgdir"/usr/share/
+ mv "$pkgdir"/usr/libexec/git-core/git-citool \
+ "$pkgdir"/usr/libexec/git-core/git-gui \
+ "$pkgdir"/usr/libexec/git-core/git-gui--askpass \
+ "$subpkgdir"/usr/libexec/git-core/
+}
+
+gitk() {
+ depends="git=$pkgver-r$pkgrel tcl tk"
+ pkgdesc="Gitk interface for git"
+ replaces=""
+
+ mkdir -p "$subpkgdir"/usr/share "$subpkgdir"/usr/bin
+ mv "$pkgdir"/usr/share/gitk "$subpkgdir"/usr/share/
+ mv "$pkgdir"/usr/bin/gitk "$subpkgdir"/usr/bin/
+}
+
+# catch-the-rest of stuff that needs perl
+_git_perl() {
+ depends="git=$pkgver-r$pkgrel perl-git=$pkgver-r$pkgrel perl"
+ pkgdesc="Additional Git commands that requires perl"
+ replaces=""
+
+ mkdir -p "$subpkgdir"/usr/lib
+ mv "$pkgdir"/usr/lib/perl* "$subpkgdir"/usr/lib/
+ cd "$pkgdir"
+ find -type f | xargs file --mime-type | grep perl | cut -d: -f1| while read f; do
+ mkdir -p "$subpkgdir"/${f%/*}
+ mv "$f" "$subpkgdir"/${f%/*}
+ done
+ find "$subpkgdir" -name perllocal.pod -delete
+}
+
+
+sha512sums="994704b440ebce104a99d815dd713af3173f29e70646d7135c3fcd1ac4694a26e499f0732843606c397cbf6108809eb397546c837623a4adbe1ccb2fc825cb64 git-2.15.0.tar.xz
+85767b5e03137008d6a96199e769e3979f75d83603ac8cb13a3481a915005637409a4fd94e0720da2ec6cd1124f35eba7cf20109a94816c4b4898a81fbc46bd2 bb-tar.patch
+135645fa57c41c50bec6d09f7d3c92f26d30334b5f342d50942c24e0dd11106e40c36b11346c9e6cd69e98b7a9ebeec80e4e4f1506ef689f39d7ef4539727dae dont-test-other-encodings.patch
+89528cdd14c51fd568aa61cf6c5eae08ea0844e59f9af9292da5fc6c268261f4166017d002d494400945e248df6b844e2f9f9cd2d9345d516983f5a110e4c42a git-daemon.initd
+fbf1f425206a76e2a8f82342537ed939ff7e623d644c086ca2ced5f69b36734695f9f80ebda1728f75a94d6cd2fcb71bf845b64239368caab418e4d368c141ec git-daemon.confd"
diff --git a/system/git/bb-tar.patch b/system/git/bb-tar.patch
new file mode 100644
index 000000000..d9433ef12
--- /dev/null
+++ b/system/git/bb-tar.patch
@@ -0,0 +1,8 @@
+--- a/templates/Makefile Mon Oct 26 02:57:33 2009
++++ b/templates/Makefile Mon Nov 9 14:56:27 2009
+@@ -63,4 +63,4 @@
+ install: all
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)'
+ (cd blt && $(TAR) cf - .) | \
+- (cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xof -)
++ (cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xf -)
diff --git a/system/git/dont-test-other-encodings.patch b/system/git/dont-test-other-encodings.patch
new file mode 100644
index 000000000..98949bc1b
--- /dev/null
+++ b/system/git/dont-test-other-encodings.patch
@@ -0,0 +1,193 @@
+We can't support Japanese people using musl
+
+--- git-2.14.1/t/t3900-i18n-commit.sh.old 2017-08-09 14:54:31.000000000 -0500
++++ git-2.14.1/t/t3900-i18n-commit.sh 2017-09-10 21:10:09.269860087 -0500
+@@ -76,132 +76,4 @@
+ test_i18ngrep "did not conform" "$HOME"/stderr
+ '
+
+-for H in ISO8859-1 eucJP ISO-2022-JP
+-do
+- test_expect_success "$H setup" '
+- git config i18n.commitencoding $H &&
+- git checkout -b $H C0 &&
+- echo $H >F &&
+- git commit -a -F "$TEST_DIRECTORY"/t3900/$H.txt
+- '
+-done
+-
+-for H in ISO8859-1 eucJP ISO-2022-JP
+-do
+- test_expect_success "check encoding header for $H" '
+- E=$(git cat-file commit '$H' | sed -ne "s/^encoding //p") &&
+- test "z$E" = "z'$H'"
+- '
+-done
+-
+-test_expect_success 'config to remove customization' '
+- git config --unset-all i18n.commitencoding &&
+- if Z=$(git config --get-all i18n.commitencoding)
+- then
+- echo Oops, should have failed.
+- false
+- else
+- test z = "z$Z"
+- fi &&
+- git config i18n.commitencoding UTF-8
+-'
+-
+-test_expect_success 'ISO8859-1 should be shown in UTF-8 now' '
+- compare_with ISO8859-1 "$TEST_DIRECTORY"/t3900/1-UTF-8.txt
+-'
+-
+-for H in eucJP ISO-2022-JP
+-do
+- test_expect_success "$H should be shown in UTF-8 now" '
+- compare_with '$H' "$TEST_DIRECTORY"/t3900/2-UTF-8.txt
+- '
+-done
+-
+-test_expect_success 'config to add customization' '
+- git config --unset-all i18n.commitencoding &&
+- if Z=$(git config --get-all i18n.commitencoding)
+- then
+- echo Oops, should have failed.
+- false
+- else
+- test z = "z$Z"
+- fi
+-'
+-
+-for H in ISO8859-1 eucJP ISO-2022-JP
+-do
+- test_expect_success "$H should be shown in itself now" '
+- git config i18n.commitencoding '$H' &&
+- compare_with '$H' "$TEST_DIRECTORY"/t3900/'$H'.txt
+- '
+-done
+-
+-test_expect_success 'config to tweak customization' '
+- git config i18n.logoutputencoding UTF-8
+-'
+-
+-test_expect_success 'ISO8859-1 should be shown in UTF-8 now' '
+- compare_with ISO8859-1 "$TEST_DIRECTORY"/t3900/1-UTF-8.txt
+-'
+-
+-for H in eucJP ISO-2022-JP
+-do
+- test_expect_success "$H should be shown in UTF-8 now" '
+- compare_with '$H' "$TEST_DIRECTORY"/t3900/2-UTF-8.txt
+- '
+-done
+-
+-for J in eucJP ISO-2022-JP
+-do
+- if test "$J" = ISO-2022-JP
+- then
+- ICONV=$J
+- else
+- ICONV=
+- fi
+- git config i18n.logoutputencoding $J
+- for H in eucJP ISO-2022-JP
+- do
+- test_expect_success "$H should be shown in $J now" '
+- compare_with '$H' "$TEST_DIRECTORY"/t3900/'$J'.txt $ICONV
+- '
+- done
+-done
+-
+-for H in ISO8859-1 eucJP ISO-2022-JP
+-do
+- test_expect_success "No conversion with $H" '
+- compare_with "--encoding=none '$H'" "$TEST_DIRECTORY"/t3900/'$H'.txt
+- '
+-done
+-
+-test_commit_autosquash_flags () {
+- H=$1
+- flag=$2
+- test_expect_success "commit --$flag with $H encoding" '
+- git config i18n.commitencoding $H &&
+- git checkout -b $H-$flag C0 &&
+- echo $H >>F &&
+- git commit -a -F "$TEST_DIRECTORY"/t3900/$H.txt &&
+- test_tick &&
+- echo intermediate stuff >>G &&
+- git add G &&
+- git commit -a -m "intermediate commit" &&
+- test_tick &&
+- echo $H $flag >>F &&
+- git commit -a --$flag HEAD~1 &&
+- E=$(git cat-file commit '$H-$flag' |
+- sed -ne "s/^encoding //p") &&
+- test "z$E" = "z$H" &&
+- git config --unset-all i18n.commitencoding &&
+- git rebase --autosquash -i HEAD^^^ &&
+- git log --oneline >actual &&
+- test_line_count = 3 actual
+- '
+-}
+-
+-test_commit_autosquash_flags eucJP fixup
+-
+-test_commit_autosquash_flags ISO-2022-JP squash
+-
+ test_done
+--- git-2.14.1/t/t5100-mailinfo.sh.old 2017-08-09 14:54:31.000000000 -0500
++++ git-2.14.1/t/t5100-mailinfo.sh 2017-09-10 23:26:39.206126739 -0500
+@@ -27,6 +27,7 @@
+
+ for mail in 00*
+ do
++ if [ $mail == 0004 ]; then continue; fi
+ test_expect_success "mailinfo $mail" '
+ check_mailinfo "$mail" "" &&
+ if test -f "$DATA/msg$mail--scissors"
+--- git-2.14.1/t/t8005-blame-i18n.sh.old 2017-08-09 14:54:31.000000000 -0500
++++ git-2.14.1/t/t8005-blame-i18n.sh 2017-09-16 00:42:35.123728809 -0500
+@@ -24,43 +24,10 @@
+ git commit --author "$SJIS_NAME <sjis@localhost>" -m "$SJIS_MSG"
+ '
+
+-cat >expected <<EOF
+-author $SJIS_NAME
+-summary $SJIS_MSG
+-author $SJIS_NAME
+-summary $SJIS_MSG
+-author $SJIS_NAME
+-summary $SJIS_MSG
+-EOF
+-
+ filter_author_summary () {
+ sed -n -e '/^author /p' -e '/^summary /p' "$@"
+ }
+
+-test_expect_success !MINGW \
+- 'blame respects i18n.commitencoding' '
+- git blame --incremental file >output &&
+- filter_author_summary output >actual &&
+- test_cmp expected actual
+-'
+-
+-cat >expected <<EOF
+-author $EUC_JAPAN_NAME
+-summary $EUC_JAPAN_MSG
+-author $EUC_JAPAN_NAME
+-summary $EUC_JAPAN_MSG
+-author $EUC_JAPAN_NAME
+-summary $EUC_JAPAN_MSG
+-EOF
+-
+-test_expect_success !MINGW \
+- 'blame respects i18n.logoutputencoding' '
+- git config i18n.logoutputencoding eucJP &&
+- git blame --incremental file >output &&
+- filter_author_summary output >actual &&
+- test_cmp expected actual
+-'
+-
+ cat >expected <<EOF
+ author $UTF8_NAME
+ summary $UTF8_MSG
diff --git a/system/git/git-daemon.confd b/system/git/git-daemon.confd
new file mode 100644
index 000000000..69b209ff1
--- /dev/null
+++ b/system/git/git-daemon.confd
@@ -0,0 +1,19 @@
+# conf.d file for git-daemon
+#
+# Please check man 1 git-daemon for more information about the options
+# git-daemon accepts. You MUST edit this to include your repositories you wish
+# to serve.
+#
+# Some of the meaningful options are:
+# --syslog --- Enables syslog logging
+# --verbose --- Enables verbose logging
+# --export-all --- Exports all repositories
+# --port=XXXX --- Starts in port XXXX instead of 9418
+#
+GITDAEMON_OPTS="--syslog --base-path=/var/git"
+
+# To run an anonymous git safely, the following user should be able to only
+# read your Git repositories. It should not be able to write to anywhere on
+# your system, esp. not the repositories.
+GIT_USER="nobody"
+GIT_GROUP="nobody"
diff --git a/system/git/git-daemon.initd b/system/git/git-daemon.initd
new file mode 100644
index 000000000..394feb97e
--- /dev/null
+++ b/system/git/git-daemon.initd
@@ -0,0 +1,13 @@
+#!/sbin/openrc-run
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+pidfile="/var/run/git-daemon.pid"
+command="/usr/bin/git"
+command_args="daemon ${GITDAEMON_OPTS}"
+start_stop_daemon_args="-e HOME= -e XDG_CONFIG_HOME= -b -m -p ${pidfile} -u ${GIT_USER:-nobody}:${GIT_GROUP:-nobody}"
+
+depend() {
+ use logger
+}
diff --git a/system/iproute2/APKBUILD b/system/iproute2/APKBUILD
new file mode 100644
index 000000000..755d5e21a
--- /dev/null
+++ b/system/iproute2/APKBUILD
@@ -0,0 +1,59 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=iproute2
+pkgver=4.13.0
+pkgrel=0
+pkgdesc="IP Routing Utilities"
+url="http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2"
+arch="all"
+license="GPL2"
+depends=""
+install="$pkgname.post-install"
+makedepends="bison flex bash libelf-dev"
+options="!check"
+subpackages="$pkgname-doc $pkgname-bash-completion:bashcomp:noarch"
+source="http://kernel.org/pub/linux/utils/net/iproute2/iproute2-$pkgver.tar.xz
+ musl-fixes.patch"
+builddir="$srcdir"/$pkgname-$pkgver
+patch_args="-p0"
+
+prepare() {
+ default_prepare
+ cd "$builddir"
+
+ sed -i '/^TARGETS=/s: arpd : :' misc/Makefile
+ sed -i 's:/usr/local:/usr:' tc/m_ipt.c include/iptables.h
+ sed -i -e 's:=/share:=/usr/share:' \
+ -e 's:-Werror::' Makefile
+}
+
+build() {
+ cd "$builddir"
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --localstatedir=/var
+ make CCOPTS="-D_GNU_SOURCE $CFLAGS" LIBDIR=/lib
+}
+
+package() {
+ cd "$builddir"
+ make -j1 DESTDIR="$pkgdir" install
+}
+
+bashcomp() {
+ depends=""
+ pkgdesc="Bash completions for $pkgname"
+ install_if="$pkgname=$pkgver-r$pkgrel bash-completion"
+
+ mkdir -p "$subpkgdir"/usr/share/
+ mv "$pkgdir"/usr/share/bash-completion \
+ "$subpkgdir"/usr/share
+
+ rmdir -p "$pkgdir"/usr/share 2>/dev/null || true
+}
+
+sha512sums="f96d2839aec1f439bfac504c8e3881c063dacbf4c67b15f0e3da9882d2fa013cba33c23602de3eab624e0eecbb911a13967d60bddcdf097f47a580a5a77b5e3a iproute2-4.13.0.tar.xz
+03f41867cc728d3fbf372ef00d8e90debd03671cff052f5e75dcfbeffbdb6e2c4b10d16e0737cdf473b063b710e8e2938a8f64cfa1be93da2c7878ce6ca51583 musl-fixes.patch"
diff --git a/system/iproute2/iproute2.post-install b/system/iproute2/iproute2.post-install
new file mode 100644
index 000000000..36d567ea2
--- /dev/null
+++ b/system/iproute2/iproute2.post-install
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+if [ "$(readlink /bin/ip)" = "/bin/busybox" ]; then
+ rm -f /bin/ip
+fi
+exit 0
diff --git a/system/iproute2/musl-fixes.patch b/system/iproute2/musl-fixes.patch
new file mode 100644
index 000000000..0149f6dae
--- /dev/null
+++ b/system/iproute2/musl-fixes.patch
@@ -0,0 +1,214 @@
+--- include/linux/if_ether.h 2017-07-06 11:09:53.305214044 -0700
++++ include/linux/if_ether.h 2017-07-06 16:30:06.651369931 -0700
+@@ -22,6 +22,7 @@
+ #define _LINUX_IF_ETHER_H
+
+ #include <linux/types.h>
++#include <linux/libc-compat.h>
+
+ /*
+ * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble
+@@ -142,11 +143,13 @@
+ * This is an Ethernet frame header.
+ */
+
++#if __UAPI_DEF_ETHHDR
+ struct ethhdr {
+ unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
+ unsigned char h_source[ETH_ALEN]; /* source ether addr */
+ __be16 h_proto; /* packet type ID field */
+ } __attribute__((packed));
++#endif
+
+
+ #endif /* _LINUX_IF_ETHER_H */
+--- include/linux/if_tunnel.h 2017-07-06 11:09:53.305214044 -0700
++++ include/linux/if_tunnel.h 2017-07-06 16:32:23.814172660 -0700
+@@ -2,7 +2,6 @@
+ #define _IF_TUNNEL_H_
+
+ #include <linux/types.h>
+-#include <linux/if.h>
+ #include <linux/ip.h>
+ #include <linux/in6.h>
+ #include <asm/byteorder.h>
+--- include/linux/ip6_tunnel.h 2017-07-06 11:09:53.303214021 -0700
++++ include/linux/ip6_tunnel.h 2017-07-06 16:33:41.630158864 -0700
+@@ -2,7 +2,6 @@
+ #define _IP6_TUNNEL_H
+
+ #include <linux/types.h>
+-#include <linux/if.h> /* For IFNAMSIZ. */
+ #include <linux/in6.h> /* For struct in6_addr. */
+
+ #define IPV6_TLV_TNL_ENCAP_LIMIT 4
+--- include/linux/kernel.h 2017-07-06 11:09:53.303214021 -0700
++++ include/linux/kernel.h 2017-07-06 16:30:06.650369918 -0700
+@@ -1,7 +1,9 @@
+ #ifndef _LINUX_KERNEL_H
+ #define _LINUX_KERNEL_H
+
++#ifdef __GLIBC__
+ #include <linux/sysinfo.h>
++#endif
+
+ /*
+ * 'kernel.h' contains some often-used function prototypes etc
+--- include/linux/libc-compat.h 2017-07-06 11:09:53.302214010 -0700
++++ include/linux/libc-compat.h 2017-07-06 16:30:06.650369918 -0700
+@@ -48,47 +48,57 @@
+ #ifndef _LIBC_COMPAT_H
+ #define _LIBC_COMPAT_H
+
+-/* We have included glibc headers... */
+-#if defined(__GLIBC__)
++/* We're used from userspace... */
++#if !defined(__KERNEL__)
+
+-/* Coordinate with glibc net/if.h header. */
++/* Coordinate with libc net/if.h header. */
+ #if defined(_NET_IF_H) && defined(__USE_MISC)
+
+-/* GLIBC headers included first so don't define anything
++/* libc headers included first so don't define anything
+ * that would already be defined. */
+
+ #define __UAPI_DEF_IF_IFCONF 0
+ #define __UAPI_DEF_IF_IFMAP 0
+ #define __UAPI_DEF_IF_IFNAMSIZ 0
+ #define __UAPI_DEF_IF_IFREQ 0
+-/* Everything up to IFF_DYNAMIC, matches net/if.h until glibc 2.23 */
+ #define __UAPI_DEF_IF_NET_DEVICE_FLAGS 0
+-/* For the future if glibc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */
++/* If libc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */
++#if !defined(__GLIBC__)
++#define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 0
++#else
+ #ifndef __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO
+ #define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1
+ #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */
++#endif /* !defined(__GLIBC__) */
+
+ #else /* _NET_IF_H */
+
+ /* Linux headers included first, and we must define everything
+- * we need. The expectation is that glibc will check the
++ * we need. The expectation is that libc will check the
+ * __UAPI_DEF_* defines and adjust appropriately. */
+
+ #define __UAPI_DEF_IF_IFCONF 1
+ #define __UAPI_DEF_IF_IFMAP 1
+ #define __UAPI_DEF_IF_IFNAMSIZ 1
+ #define __UAPI_DEF_IF_IFREQ 1
+-/* Everything up to IFF_DYNAMIC, matches net/if.h until glibc 2.23 */
+ #define __UAPI_DEF_IF_NET_DEVICE_FLAGS 1
+-/* For the future if glibc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */
++/* If libc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */
+ #define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1
+
+ #endif /* _NET_IF_H */
+
+-/* Coordinate with glibc netinet/in.h header. */
++/* Coordinate with libc netinet/if_ether.h */
++#ifdef _NETINET_IF_ETHER_H
++#define __UAPI_DEF_ETHHDR 0
++#else
++/* glibc uses __NETINET_IF_ETHER_H and uses the uapi header */
++#define __UAPI_DEF_ETHHDR 1
++#endif /* _NETINET_IF_ETHER_H */
++
++/* Coordinate with libc netinet/in.h header. */
+ #if defined(_NETINET_IN_H)
+
+-/* GLIBC headers included first so don't define anything
++/* libc headers included first so don't define anything
+ * that would already be defined. */
+ #define __UAPI_DEF_IN_ADDR 0
+ #define __UAPI_DEF_IN_IPPROTO 0
+@@ -98,15 +108,7 @@
+ #define __UAPI_DEF_IN_CLASS 0
+
+ #define __UAPI_DEF_IN6_ADDR 0
+-/* The exception is the in6_addr macros which must be defined
+- * if the glibc code didn't define them. This guard matches
+- * the guard in glibc/inet/netinet/in.h which defines the
+- * additional in6_addr macros e.g. s6_addr16, and s6_addr32. */
+-#if defined(__USE_MISC) || defined (__USE_GNU)
+ #define __UAPI_DEF_IN6_ADDR_ALT 0
+-#else
+-#define __UAPI_DEF_IN6_ADDR_ALT 1
+-#endif
+ #define __UAPI_DEF_SOCKADDR_IN6 0
+ #define __UAPI_DEF_IPV6_MREQ 0
+ #define __UAPI_DEF_IPPROTO_V6 0
+@@ -117,7 +119,7 @@
+ #else
+
+ /* Linux headers included first, and we must define everything
+- * we need. The expectation is that glibc will check the
++ * we need. The expectation is that libc will check the
+ * __UAPI_DEF_* defines and adjust appropriately. */
+ #define __UAPI_DEF_IN_ADDR 1
+ #define __UAPI_DEF_IN_IPPROTO 1
+@@ -127,7 +129,7 @@
+ #define __UAPI_DEF_IN_CLASS 1
+
+ #define __UAPI_DEF_IN6_ADDR 1
+-/* We unconditionally define the in6_addr macros and glibc must
++/* We unconditionally define the in6_addr macros and libc must
+ * coordinate. */
+ #define __UAPI_DEF_IN6_ADDR_ALT 1
+ #define __UAPI_DEF_SOCKADDR_IN6 1
+@@ -168,18 +170,20 @@
+ /* If we did not see any headers from any supported C libraries,
+ * or we are being included in the kernel, then define everything
+ * that we need. */
+-#else /* !defined(__GLIBC__) */
++#else /* defined(__KERNEL__) */
+
+ /* Definitions for if.h */
+ #define __UAPI_DEF_IF_IFCONF 1
+ #define __UAPI_DEF_IF_IFMAP 1
+ #define __UAPI_DEF_IF_IFNAMSIZ 1
+ #define __UAPI_DEF_IF_IFREQ 1
+-/* Everything up to IFF_DYNAMIC, matches net/if.h until glibc 2.23 */
+ #define __UAPI_DEF_IF_NET_DEVICE_FLAGS 1
+-/* For the future if glibc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */
++/* If libc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */
+ #define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1
+
++/* Definitions for if/ether.h */
++#define __UAPI_DEF_ETHHDR 1
++
+ /* Definitions for in.h */
+ #define __UAPI_DEF_IN_ADDR 1
+ #define __UAPI_DEF_IN_IPPROTO 1
+@@ -208,6 +212,6 @@
+ /* Definitions for xattr.h */
+ #define __UAPI_DEF_XATTR 1
+
+-#endif /* __GLIBC__ */
++#endif /* defined(__KERNEL__) */
+
+ #endif /* _LIBC_COMPAT_H */
+--- include/linux/netfilter_ipv4/ip_tables.h 2017-07-06 11:09:53.310214100 -0700
++++ include/linux/netfilter_ipv4/ip_tables.h 2017-07-06 16:38:57.526211238 -0700
+@@ -17,7 +17,6 @@
+
+ #include <linux/types.h>
+
+-#include <linux/if.h>
+ #include <linux/netfilter_ipv4.h>
+
+ #include <linux/netfilter/x_tables.h>
+--- tc/f_flower.c 2017-07-06 11:09:53.289213865 -0700
++++ tc/f_flower.c 2017-07-06 16:36:04.967030780 -0700
+@@ -15,7 +15,7 @@
+ #include <syslog.h>
+ #include <string.h>
+ #include <net/if.h>
+-#include <linux/if_arp.h>
++#include <net/if_arp.h>
+ #include <linux/if_ether.h>
+ #include <linux/ip.h>
+ #include <linux/tc_act/tc_vlan.h>
diff --git a/system/kyua/APKBUILD b/system/kyua/APKBUILD
new file mode 100644
index 000000000..588e4bfcf
--- /dev/null
+++ b/system/kyua/APKBUILD
@@ -0,0 +1,41 @@
+# Maintainer: William Pitcock <nenolod@dereferenced.org>
+pkgname=kyua
+pkgver=0.13
+pkgrel=1
+pkgdesc="testing framework for infrastructure software"
+url="https://github.com/jmmv/kyua"
+arch="all"
+license="BSD"
+depends=""
+makedepends="atf-dev lutok-dev sqlite-dev"
+install=""
+options="!checkroot"
+subpackages="$pkgname-doc"
+source="https://github.com/jmmv/kyua/releases/download/kyua-$pkgver/kyua-$pkgver.tar.gz"
+builddir="$srcdir/kyua-$pkgver"
+
+build() {
+ cd "$builddir"
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --localstatedir=/var
+ make
+}
+
+check() {
+ cd "$builddir"
+ make check
+}
+
+package() {
+ cd "$builddir"
+ make -j1 DESTDIR="$pkgdir" install
+}
+
+md5sums="475203c0877ebe739edf8b8dff4606ec kyua-0.13.tar.gz"
+sha256sums="db6e5d341d5cf7e49e50aa361243e19087a00ba33742b0855d2685c0b8e721d6 kyua-0.13.tar.gz"
+sha512sums="80ecf4fd888d4759122f3c1d1d5b06a19135e06f7bca1ef8458c7a5e78c1b6baff54969c863c93f11c40611ca256fc0334402531397b16788fb3ec701dd278ae kyua-0.13.tar.gz"
diff --git a/system/libevent/APKBUILD b/system/libevent/APKBUILD
new file mode 100644
index 000000000..d49dfa5e1
--- /dev/null
+++ b/system/libevent/APKBUILD
@@ -0,0 +1,65 @@
+# Contributor: Sergei Lukin <sergej.lukin@gmail.com>
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=libevent
+pkgver=2.1.8
+pkgrel=3
+pkgdesc="An event notification library"
+url="http://libevent.org/"
+arch="all"
+license="BSD"
+depends=""
+depends_dev="python3"
+makedepends="$depends_dev openssl-dev"
+subpackages="$pkgname-dev"
+source="https://github.com/$pkgname/$pkgname/releases/download/release-${pkgver}-stable/$pkgname-${pkgver}-stable.tar.gz
+ dont-test-fallback.patch
+ fix-test-on-32bit.patch
+ py3_dumpevents.patch
+ py3_rpcgen.patch
+ "
+
+# secfixes:
+# 2.1.8-r0:
+# - CVE-2016-10195
+# - CVE-2016-10196
+# - CVE-2016-10197
+
+builddir="$srcdir"/$pkgname-$pkgver-stable
+
+prepare() {
+ cd "$builddir"
+ default_prepare
+}
+
+build() {
+ cd "$builddir"
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --disable-static
+ make
+}
+
+check() {
+ cd "$builddir"
+ make check
+}
+
+package() {
+ cd "$builddir"
+ make -j1 DESTDIR=$pkgdir install
+}
+
+dev() {
+ replaces="libevent"
+ default_dev
+ mv "$pkgdir"/usr/bin "$subpkgdir"/usr/
+}
+
+sha512sums="a2fd3dd111e73634e4aeb1b29d06e420b15c024d7b47778883b5f8a4ff320b5057a8164c6d50b53bd196c79d572ce2639fe6265e03a93304b09c22b41e4c2a17 libevent-2.1.8-stable.tar.gz
+d059a592252f83a918f0b6237e2dbee1d05822c83372bcd0f658a25428cce109fd088c5dec8320fef4c1aa7a713ada53aae9b7c04d7ca9b039ed4a483ba84146 dont-test-fallback.patch
+7898a00eeab4af7ff3b7c1ee3b90e0d718beba435dfadf015f62084524b2b0f4049c8dd9e16926c61017c01faabf7a51c2f19be7f9532e01278d691acb98465d fix-test-on-32bit.patch
+1f51788db3797870392997d0314fb744ee54d3b1a326d1b67f522fc7af65d50210cb137e8213d35a788bbf3c97aac18cd9860de8af3cb8c82f25e3ae07d662ae py3_dumpevents.patch
+00d0b09425835638a5e29d96d70c855a5c57efb188157b80a3885a2dcbe88709b49ae57aeb6b8b590458a934116cf59934e6e32fbf684b2b3b8333c0dcac837e py3_rpcgen.patch"
diff --git a/system/libevent/dont-test-fallback.patch b/system/libevent/dont-test-fallback.patch
new file mode 100644
index 000000000..42a40094a
--- /dev/null
+++ b/system/libevent/dont-test-fallback.patch
@@ -0,0 +1,16 @@
+The libevent fallback monotonic clock is broken, but it should never be used
+anyway on musl, so disable testing it.
+
+(the brokenness involves gettimeofday, you don't want to know)
+
+--- libevent-2.1.8-stable/test/regress_util.c.old 2017-01-15 03:04:34.000000000 -0600
++++ libevent-2.1.8-stable/test/regress_util.c 2017-09-14 16:25:58.887687965 -0500
+@@ -1482,7 +1482,7 @@
+ { "monotonic_res_fallback", test_evutil_monotonic_res, TT_OFF_BY_DEFAULT, &basic_setup, (void*)"fallback" },
+ { "monotonic_prc", test_evutil_monotonic_prc, 0, &basic_setup, (void*)"" },
+ { "monotonic_prc_precise", test_evutil_monotonic_prc, 0, &basic_setup, (void*)"precise" },
+- { "monotonic_prc_fallback", test_evutil_monotonic_prc, 0, &basic_setup, (void*)"fallback" },
++ /* { "monotonic_prc_fallback", test_evutil_monotonic_prc, 0, &basic_setup, (void*)"fallback" }, */
+ { "date_rfc1123", test_evutil_date_rfc1123, 0, NULL, NULL },
+ END_OF_TESTCASES,
+ };
diff --git a/system/libevent/fix-test-on-32bit.patch b/system/libevent/fix-test-on-32bit.patch
new file mode 100644
index 000000000..ec120a78c
--- /dev/null
+++ b/system/libevent/fix-test-on-32bit.patch
@@ -0,0 +1,11 @@
+--- libevent-2.1.8-stable/test/regress_util.c.old 2018-03-04 21:14:24.344542520 -0600
++++ libevent-2.1.8-stable/test/regress_util.c 2018-03-04 21:24:23.788814572 -0600
+@@ -1411,7 +1411,7 @@
+ { 1255132800, "Sat, 10 Oct 2009 00:00:00 GMT"},
+ { 1289433600, "Thu, 11 Nov 2010 00:00:00 GMT"},
+ { 1323648000, "Mon, 12 Dec 2011 00:00:00 GMT"},
+-#ifndef _WIN32
++#if !defined(_WIN32) && (!defined(__SIZEOF_LONG__) || __SIZEOF_LONG__ > 4)
+ /** In win32 case we have max "23:59:59 January 18, 2038, UTC" for time32 */
+ { 4294967296, "Sun, 07 Feb 2106 06:28:16 GMT"} /* 2^32 */,
+ /** In win32 case we have max "23:59:59, December 31, 3000, UTC" for time64 */
diff --git a/system/libevent/libressl.patch b/system/libevent/libressl.patch
new file mode 100644
index 000000000..21a750c2c
--- /dev/null
+++ b/system/libevent/libressl.patch
@@ -0,0 +1,97 @@
+diff -ru a/openssl-compat.h b/openssl-compat.h
+--- a/openssl-compat.h
++++ b/openssl-compat.h
+@@ -1,7 +1,7 @@
+ #ifndef OPENSSL_COMPAT_H
+ #define OPENSSL_COMPAT_H
+
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+
+ static inline BIO_METHOD *BIO_meth_new(int type, const char *name)
+ {
+@@ -30,6 +30,6 @@
+
+ #define TLS_method SSLv23_method
+
+-#endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */
++#endif /* OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) */
+
+ #endif /* OPENSSL_COMPAT_H */
+diff -ru a/sample/https-client.c b/sample/https-client.c
+--- a/sample/https-client.c
++++ b/sample/https-client.c
+@@ -312,7 +312,7 @@
+ }
+ uri[sizeof(uri) - 1] = '\0';
+
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+ // Initialize OpenSSL
+ SSL_library_init();
+ ERR_load_crypto_strings();
+@@ -480,7 +480,7 @@
+ SSL_CTX_free(ssl_ctx);
+ if (type == HTTP && ssl)
+ SSL_free(ssl);
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+ EVP_cleanup();
+ ERR_free_strings();
+
+@@ -492,7 +492,7 @@
+ CRYPTO_cleanup_all_ex_data();
+
+ sk_SSL_COMP_free(SSL_COMP_get_compression_methods());
+-#endif /*OPENSSL_VERSION_NUMBER < 0x10100000L */
++#endif /*OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) */
+
+ #ifdef _WIN32
+ WSACleanup();
+diff -ru a/sample/le-proxy.c b/sample/le-proxy.c
+--- a/sample/le-proxy.c
++++ b/sample/le-proxy.c
+@@ -259,7 +259,7 @@
+
+ if (use_ssl) {
+ int r;
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+ SSL_library_init();
+ ERR_load_crypto_strings();
+ SSL_load_error_strings();
+diff -ru a/sample/openssl_hostname_validation.c b/sample/openssl_hostname_validation.c
+--- a/sample/openssl_hostname_validation.c
++++ b/sample/openssl_hostname_validation.c
+@@ -48,7 +48,7 @@
+
+ #define HOSTNAME_MAX_SIZE 255
+
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+ #define ASN1_STRING_get0_data ASN1_STRING_data
+ #endif
+
+diff -ru a/test/regress_ssl.c b/test/regress_ssl.c
+--- a/test/regress_ssl.c
++++ b/test/regress_ssl.c
+@@ -186,7 +186,7 @@
+ void
+ init_ssl(void)
+ {
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+ SSL_library_init();
+ ERR_load_crypto_strings();
+ SSL_load_error_strings();
+@@ -194,6 +194,10 @@
+ if (SSLeay() != OPENSSL_VERSION_NUMBER) {
+ TT_DECLARE("WARN", ("Version mismatch for openssl: compiled with %lx but running with %lx", (unsigned long)OPENSSL_VERSION_NUMBER, (unsigned long) SSLeay()));
+ }
++ if (SSLeay() != LIBRESSL_VERSION_NUMBER) {
++ TT_DECLARE("WARN", ("Version mismatch for libressl: compiled with %lx but running with %lx", (unsigned long)LIBRESSL_VERSION_NUMBER, (unsigned long) SSLeay()));
++ }
++
+ #endif
+ }
+
diff --git a/system/libevent/py3_dumpevents.patch b/system/libevent/py3_dumpevents.patch
new file mode 100644
index 000000000..3c012ef89
--- /dev/null
+++ b/system/libevent/py3_dumpevents.patch
@@ -0,0 +1,30 @@
+--- libevent-2.1.8-stable/test/check-dumpevents.py 2016-10-04 14:55:31.000000000 -0500
++++ libevent-2.1.8-py3-rpcgen/test/check-dumpevents.py 2017-09-14 15:51:16.000000000 -0500
+@@ -15,12 +15,12 @@
+ got_inserted_pos = text.index("Inserted events:\n")
+ got_active_pos = text.index("Active events:\n")
+ except ValueError:
+- print >>sys.stderr, "Missing expected dividing line in dumpevents output"
++ sys.stderr.write("Missing expected dividing line in dumpevents output\n")
+ sys.exit(1)
+
+ if not (expect_inserted_pos < expect_active_pos <
+ got_inserted_pos < got_active_pos):
+- print >>sys.stderr, "Sections out of order in dumpevents output"
++ sys.stderr.write("Sections out of order in dumpevents output\n")
+ sys.exit(1)
+
+ now,T= text[1].split()
+@@ -45,10 +45,10 @@
+ if "Internal" not in s)
+
+ if cleaned_inserted != want_inserted:
+- print >>sys.stderr, "Inserted event lists were not as expected!"
++ sys.stderr.write("Inserted event lists were not as expected!\n")
+ sys.exit(1)
+
+ if set(got_active) != set(want_active):
+- print >>sys.stderr, "Active event lists were not as expected!"
++ sys.stderr.write("Active event lists were not as expected!\n")
+ sys.exit(1)
+
diff --git a/system/libevent/py3_rpcgen.patch b/system/libevent/py3_rpcgen.patch
new file mode 100644
index 000000000..2ebe974a6
--- /dev/null
+++ b/system/libevent/py3_rpcgen.patch
@@ -0,0 +1,423 @@
+--- libevent-2.1.8-stable/event_rpcgen.py 2016-12-06 03:44:11.000000000 -0600
++++ libevent-2.1.8-py3-rpcgen/event_rpcgen.py 2017-09-14 15:17:51.000000000 -0500
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python2
++#!/usr/bin/env python3
+ #
+ # Copyright (c) 2005-2007 Niels Provos <provos@citi.umich.edu>
+ # Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
+@@ -36,10 +36,10 @@
+
+ def declare(s):
+ if not QUIETLY:
+- print s
++ print(s)
+
+ def TranslateList(mylist, mydict):
+- return map(lambda x: x % mydict, mylist)
++ return [x % mydict for x in mylist]
+
+ # Exception class for parse errors
+ class RpcGenError(Exception):
+@@ -57,7 +57,7 @@
+ declare(' Created struct: %s' % name)
+
+ def AddEntry(self, entry):
+- if self._tags.has_key(entry.Tag()):
++ if entry.Tag() in self._tags:
+ raise RpcGenError(
+ 'Entry "%s" duplicates tag number %d from "%s" '
+ 'around line %d' % (entry.Name(), entry.Tag(),
+@@ -78,7 +78,8 @@
+ def PrintIndented(self, file, ident, code):
+ """Takes an array, add indentation to each entry and prints it."""
+ for entry in code:
+- print >>file, '%s%s' % (ident, entry)
++ file.write('{}{}\n'.format(ident, entry))
++ #file.write('%s%s' % (ident, entry))
+
+ class StructCCode(Struct):
+ """ Knows how to generate C code for a struct """
+@@ -88,20 +89,19 @@
+
+ def PrintTags(self, file):
+ """Prints the tag definitions for a structure."""
+- print >>file, '/* Tag definition for %s */' % self._name
+- print >>file, 'enum %s_ {' % self._name.lower()
++ file.write('/* Tag definition for %s */\n' % self._name)
++ file.write('enum %s_ {\n' % self._name.lower())
+ for entry in self._entries:
+- print >>file, ' %s=%d,' % (self.EntryTagName(entry),
+- entry.Tag())
+- print >>file, ' %s_MAX_TAGS' % (self._name.upper())
+- print >>file, '};\n'
++ file.write(' %s=%d,\n' % (self.EntryTagName(entry), entry.Tag()))
++ file.write(' %s_MAX_TAGS\n' % (self._name.upper()))
++ file.write('};\n\n')
+
+ def PrintForwardDeclaration(self, file):
+- print >>file, 'struct %s;' % self._name
++ file.write('struct %s;\n' % self._name)
+
+ def PrintDeclaration(self, file):
+- print >>file, '/* Structure declaration for %s */' % self._name
+- print >>file, 'struct %s_access_ {' % self._name
++ file.write('/* Structure declaration for %s */\n' % self._name)
++ file.write('struct %s_access_ {\n' % self._name)
+ for entry in self._entries:
+ dcl = entry.AssignDeclaration('(*%s_assign)' % entry.Name())
+ dcl.extend(
+@@ -110,20 +110,19 @@
+ dcl.extend(
+ entry.AddDeclaration('(*%s_add)' % entry.Name()))
+ self.PrintIndented(file, ' ', dcl)
+- print >>file, '};\n'
++ file.write('};\n\n')
+
+- print >>file, 'struct %s {' % self._name
+- print >>file, ' struct %s_access_ *base;\n' % self._name
++ file.write('struct %s {\n' % self._name)
++ file.write(' struct %s_access_ *base;\n\n' % self._name)
+ for entry in self._entries:
+ dcl = entry.Declaration()
+ self.PrintIndented(file, ' ', dcl)
+- print >>file, ''
++ file.write('\n')
+ for entry in self._entries:
+- print >>file, ' ev_uint8_t %s_set;' % entry.Name()
+- print >>file, '};\n'
++ file.write(' ev_uint8_t %s_set;\n' % entry.Name())
++ file.write('};\n\n')
+
+- print >>file, \
+-"""struct %(name)s *%(name)s_new(void);
++ file.write("""struct %(name)s *%(name)s_new(void);
+ struct %(name)s *%(name)s_new_with_arg(void *);
+ void %(name)s_free(struct %(name)s *);
+ void %(name)s_clear(struct %(name)s *);
+@@ -133,7 +132,7 @@
+ void evtag_marshal_%(name)s(struct evbuffer *, ev_uint32_t,
+ const struct %(name)s *);
+ int evtag_unmarshal_%(name)s(struct evbuffer *, ev_uint32_t,
+- struct %(name)s *);""" % { 'name' : self._name }
++ struct %(name)s *);\n""" % { 'name' : self._name })
+
+
+ # Write a setting function of every variable
+@@ -146,22 +145,21 @@
+ self.PrintIndented(file, '', entry.AddDeclaration(
+ entry.AddFuncName()))
+
+- print >>file, '/* --- %s done --- */\n' % self._name
++ file.write('/* --- %s done --- */\n\n' % self._name)
+
+ def PrintCode(self, file):
+- print >>file, ('/*\n'
++ file.write(('/*\n'
+ ' * Implementation of %s\n'
+- ' */\n') % self._name
++ ' */\n\n') % self._name)
+
+- print >>file, \
+- 'static struct %(name)s_access_ %(name)s_base__ = {' % \
+- { 'name' : self._name }
++ file.write('static struct %(name)s_access_ %(name)s_base__ = {\n' % \
++ { 'name' : self._name })
+ for entry in self._entries:
+ self.PrintIndented(file, ' ', entry.CodeBase())
+- print >>file, '};\n'
++ file.write('};\n\n')
+
+ # Creation
+- print >>file, (
++ file.write((
+ 'struct %(name)s *\n'
+ '%(name)s_new(void)\n'
+ '{\n'
+@@ -176,77 +174,77 @@
+ ' event_warn("%%s: malloc", __func__);\n'
+ ' return (NULL);\n'
+ ' }\n'
+- ' tmp->base = &%(name)s_base__;\n') % { 'name' : self._name }
++ ' tmp->base = &%(name)s_base__;\n\n') % { 'name' : self._name })
+
+ for entry in self._entries:
+ self.PrintIndented(file, ' ', entry.CodeInitialize('tmp'))
+- print >>file, ' tmp->%s_set = 0;\n' % entry.Name()
++ file.write(' tmp->%s_set = 0;\n\n' % entry.Name())
+
+- print >>file, (
++ file.write((
+ ' return (tmp);\n'
+- '}\n')
++ '}\n\n'))
+
+ # Adding
+ for entry in self._entries:
+ if entry.Array():
+ self.PrintIndented(file, '', entry.CodeAdd())
+- print >>file, ''
++ file.write('\n')
+
+ # Assigning
+ for entry in self._entries:
+ self.PrintIndented(file, '', entry.CodeAssign())
+- print >>file, ''
++ file.write('\n')
+
+ # Getting
+ for entry in self._entries:
+ self.PrintIndented(file, '', entry.CodeGet())
+- print >>file, ''
++ file.write('\n')
+
+ # Clearing
+- print >>file, ( 'void\n'
++ file.write(( 'void\n'
+ '%(name)s_clear(struct %(name)s *tmp)\n'
+ '{'
+- ) % { 'name' : self._name }
++ '\n') % { 'name' : self._name })
+ for entry in self._entries:
+ self.PrintIndented(file, ' ', entry.CodeClear('tmp'))
+
+- print >>file, '}\n'
++ file.write('}\n\n')
+
+ # Freeing
+- print >>file, ( 'void\n'
++ file.write(( 'void\n'
+ '%(name)s_free(struct %(name)s *tmp)\n'
+ '{'
+- ) % { 'name' : self._name }
++ '\n') % { 'name' : self._name })
+
+ for entry in self._entries:
+ self.PrintIndented(file, ' ', entry.CodeFree('tmp'))
+
+- print >>file, (' free(tmp);\n'
+- '}\n')
++ file.write((' free(tmp);\n'
++ '}\n\n'))
+
+ # Marshaling
+- print >>file, ('void\n'
++ file.write(('void\n'
+ '%(name)s_marshal(struct evbuffer *evbuf, '
+ 'const struct %(name)s *tmp)'
+- '{') % { 'name' : self._name }
++ '{\n') % { 'name' : self._name })
+ for entry in self._entries:
+ indent = ' '
+ # Optional entries do not have to be set
+ if entry.Optional():
+ indent += ' '
+- print >>file, ' if (tmp->%s_set) {' % entry.Name()
++ file.write(' if (tmp->%s_set) {\n' % entry.Name())
+ self.PrintIndented(
+ file, indent,
+ entry.CodeMarshal('evbuf', self.EntryTagName(entry),
+ entry.GetVarName('tmp'),
+ entry.GetVarLen('tmp')))
+ if entry.Optional():
+- print >>file, ' }'
++ file.write(' }\n')
+
+- print >>file, '}\n'
++ file.write('}\n\n')
+
+ # Unmarshaling
+- print >>file, ('int\n'
++ file.write(('int\n'
+ '%(name)s_unmarshal(struct %(name)s *tmp, '
+ ' struct evbuffer *evbuf)\n'
+ '{\n'
+@@ -255,14 +253,14 @@
+ ' if (evtag_peek(evbuf, &tag) == -1)\n'
+ ' return (-1);\n'
+ ' switch (tag) {\n'
+- ) % { 'name' : self._name }
++ '\n') % { 'name' : self._name })
+ for entry in self._entries:
+- print >>file, ' case %s:\n' % self.EntryTagName(entry)
++ file.write(' case %s:\n' % self.EntryTagName(entry))
+ if not entry.Array():
+- print >>file, (
++ file.write((
+ ' if (tmp->%s_set)\n'
+ ' return (-1);'
+- ) % (entry.Name())
++ '\n') % (entry.Name()))
+
+ self.PrintIndented(
+ file, ' ',
+@@ -271,26 +269,26 @@
+ entry.GetVarName('tmp'),
+ entry.GetVarLen('tmp')))
+
+- print >>file, ( ' tmp->%s_set = 1;\n' % entry.Name() +
+- ' break;\n' )
+- print >>file, ( ' default:\n'
++ file.write(( ' tmp->%s_set = 1;\n' % entry.Name() +
++ ' break;\n' ))
++ file.write(( ' default:\n'
+ ' return -1;\n'
+ ' }\n'
+- ' }\n' )
++ ' }\n\n' ))
+ # Check if it was decoded completely
+- print >>file, ( ' if (%(name)s_complete(tmp) == -1)\n'
++ file.write(( ' if (%(name)s_complete(tmp) == -1)\n'
+ ' return (-1);'
+- ) % { 'name' : self._name }
++ '\n') % { 'name' : self._name })
+
+ # Successfully decoded
+- print >>file, ( ' return (0);\n'
+- '}\n')
++ file.write(( ' return (0);\n'
++ '}\n\n'))
+
+ # Checking if a structure has all the required data
+- print >>file, (
++ file.write((
+ 'int\n'
+ '%(name)s_complete(struct %(name)s *msg)\n'
+- '{' ) % { 'name' : self._name }
++ '{\n' ) % { 'name' : self._name })
+ for entry in self._entries:
+ if not entry.Optional():
+ code = [
+@@ -303,12 +301,12 @@
+ self.PrintIndented(
+ file, ' ',
+ entry.CodeComplete('msg', entry.GetVarName('msg')))
+- print >>file, (
++ file.write((
+ ' return (0);\n'
+- '}\n' )
++ '}\n\n' ))
+
+ # Complete message unmarshaling
+- print >>file, (
++ file.write((
+ 'int\n'
+ 'evtag_unmarshal_%(name)s(struct evbuffer *evbuf, '
+ 'ev_uint32_t need_tag, struct %(name)s *msg)\n'
+@@ -330,10 +328,10 @@
+ ' error:\n'
+ ' evbuffer_free(tmp);\n'
+ ' return (res);\n'
+- '}\n' ) % { 'name' : self._name }
++ '}\n\n' ) % { 'name' : self._name })
+
+ # Complete message marshaling
+- print >>file, (
++ file.write((
+ 'void\n'
+ 'evtag_marshal_%(name)s(struct evbuffer *evbuf, ev_uint32_t tag, '
+ 'const struct %(name)s *msg)\n'
+@@ -343,7 +341,7 @@
+ ' %(name)s_marshal(buf_, msg);\n'
+ ' evtag_marshal_buffer(evbuf, tag, buf_);\n '
+ ' evbuffer_free(buf_);\n'
+- '}\n' ) % { 'name' : self._name }
++ '}\n\n' ) % { 'name' : self._name })
+
+ class Entry:
+ def __init__(self, type, name, tag):
+@@ -420,7 +418,7 @@
+ "optaddarg" :
+ self._optaddarg and ", const %s value" % self._ctype or ""
+ }
+- for (k, v) in extradict.items():
++ for (k, v) in list(extradict.items()):
+ mapping[k] = v
+
+ return mapping
+@@ -1127,7 +1125,7 @@
+
+ codearrayassign = self._entry.CodeArrayAssign(
+ 'msg->%(name)s_data[off]' % self.GetTranslation(), 'value')
+- code += map(lambda x: ' ' + x, codearrayassign)
++ code += [' ' + x for x in codearrayassign]
+
+ code += TranslateList([
+ ' }',
+@@ -1168,7 +1166,7 @@
+
+ code = TranslateList(code, self.GetTranslation())
+
+- code += map(lambda x: ' ' + x, codearrayadd)
++ code += [' ' + x for x in codearrayadd]
+
+ code += TranslateList([
+ ' msg->%(name)s_set = 1;',
+@@ -1196,7 +1194,7 @@
+
+ code = TranslateList(code, translate)
+
+- code += map(lambda x: ' ' + x, tmp)
++ code += [' ' + x for x in tmp]
+
+ code += [
+ ' }',
+@@ -1261,7 +1259,7 @@
+ code = TranslateList(code, translate)
+
+ if codearrayfree:
+- code += map(lambda x: ' ' + x, codearrayfree)
++ code += [' ' + x for x in codearrayfree]
+ code += [
+ ' }' ]
+
+@@ -1687,23 +1685,23 @@
+
+ declare('... creating "%s"' % header_file)
+ header_fp = open(header_file, 'w')
+- print >>header_fp, factory.HeaderPreamble(filename)
++ header_fp.write(factory.HeaderPreamble(filename))
+
+ # Create forward declarations: allows other structs to reference
+ # each other
+ for entry in entities:
+ entry.PrintForwardDeclaration(header_fp)
+- print >>header_fp, ''
++ header_fp.write('\n')
+
+ for entry in entities:
+ entry.PrintTags(header_fp)
+ entry.PrintDeclaration(header_fp)
+- print >>header_fp, factory.HeaderPostamble(filename)
++ header_fp.write(factory.HeaderPostamble(filename))
+ header_fp.close()
+
+ declare('... creating "%s"' % impl_file)
+ impl_fp = open(impl_file, 'w')
+- print >>impl_fp, factory.BodyPreamble(filename, header_file)
++ impl_fp.write(factory.BodyPreamble(filename, header_file))
+ for entry in entities:
+ entry.PrintCode(impl_fp)
+ impl_fp.close()
+@@ -1713,16 +1711,16 @@
+ CommandLine(sys.argv).run()
+ sys.exit(0)
+
+- except RpcGenError, e:
+- print >>sys.stderr, e
++ except RpcGenError as e:
++ sys.stderr.write(e)
+ sys.exit(1)
+
+- except EnvironmentError, e:
++ except EnvironmentError as e:
+ if e.filename and e.strerror:
+- print >>sys.stderr, "%s: %s" % (e.filename, e.strerror)
++ sys.stderr.write("%s: %s" % (e.filename, e.strerror))
+ sys.exit(1)
+ elif e.strerror:
+- print >> sys.stderr, e.strerror
++ sys.stderr.write(e.strerror)
+ sys.exit(1)
+ else:
+ raise
diff --git a/system/libexecinfo/10-execinfo.patch b/system/libexecinfo/10-execinfo.patch
new file mode 100644
index 000000000..97bd8cd5d
--- /dev/null
+++ b/system/libexecinfo/10-execinfo.patch
@@ -0,0 +1,64 @@
+--- a/execinfo.c
++++ b/execinfo.c
+@@ -69,7 +69,8 @@
+ char **
+ backtrace_symbols(void *const *buffer, int size)
+ {
+- int i, clen, alen, offset;
++ size_t clen, alen;
++ int i, offset;
+ char **rval;
+ char *cp;
+ Dl_info info;
+@@ -78,7 +79,6 @@
+ rval = malloc(clen);
+ if (rval == NULL)
+ return NULL;
+- (char **)cp = &(rval[size]);
+ for (i = 0; i < size; i++) {
+ if (dladdr(buffer[i], &info) != 0) {
+ if (info.dli_sname == NULL)
+@@ -92,14 +92,14 @@
+ 2 + /* " <" */
+ strlen(info.dli_sname) + /* "function" */
+ 1 + /* "+" */
+- D10(offset) + /* "offset */
++ 10 + /* "offset */
+ 5 + /* "> at " */
+ strlen(info.dli_fname) + /* "filename" */
+ 1; /* "\0" */
+ rval = realloc_safe(rval, clen + alen);
+ if (rval == NULL)
+ return NULL;
+- snprintf(cp, alen, "%p <%s+%d> at %s",
++ snprintf((char *) rval + clen, alen, "%p <%s+%d> at %s",
+ buffer[i], info.dli_sname, offset, info.dli_fname);
+ } else {
+ alen = 2 + /* "0x" */
+@@ -108,12 +108,15 @@
+ rval = realloc_safe(rval, clen + alen);
+ if (rval == NULL)
+ return NULL;
+- snprintf(cp, alen, "%p", buffer[i]);
++ snprintf((char *) rval + clen, alen, "%p", buffer[i]);
+ }
+- rval[i] = cp;
+- cp += alen;
++ rval[i] = (char *) clen;
++ clen += alen;
+ }
+
++ for (i = 0; i < size; i++)
++ rval[i] += (long) rval;
++
+ return rval;
+ }
+
+@@ -155,6 +158,6 @@
+ return;
+ snprintf(buf, len, "%p\n", buffer[i]);
+ }
+- write(fd, buf, len - 1);
++ write(fd, buf, strlen(buf));
+ }
+ }
diff --git a/system/libexecinfo/20-define-gnu-source.patch b/system/libexecinfo/20-define-gnu-source.patch
new file mode 100644
index 000000000..ac18f6eeb
--- /dev/null
+++ b/system/libexecinfo/20-define-gnu-source.patch
@@ -0,0 +1,24 @@
+--- a/execinfo.c
++++ b/execinfo.c
+@@ -26,6 +26,7 @@
+ * $Id: execinfo.c,v 1.3 2004/07/19 05:21:09 sobomax Exp $
+ */
+
++#define _GNU_SOURCE
+ #include <sys/types.h>
+ #include <sys/uio.h>
+ #include <dlfcn.h>
+--- a/stacktraverse.c
++++ b/stacktraverse.c
+@@ -1,3 +1,4 @@
++#define _GNU_SOURCE
+ #include <stddef.h>
+
+ #include "stacktraverse.h"
+--- a/test.c
++++ b/test.c
+@@ -1,3 +1,4 @@
++#define _GNU_SOURCE
+ #include <stdio.h>
+ #include <stdlib.h>
+
diff --git a/system/libexecinfo/30-linux-makefile.patch b/system/libexecinfo/30-linux-makefile.patch
new file mode 100644
index 000000000..f832adce7
--- /dev/null
+++ b/system/libexecinfo/30-linux-makefile.patch
@@ -0,0 +1,44 @@
+--- a/Makefile
++++ b/Makefile
+@@ -23,24 +23,25 @@
+ # SUCH DAMAGE.
+ #
+ # $Id: Makefile,v 1.3 2004/07/19 05:19:55 sobomax Exp $
++#
++# Linux Makefile by Matt Smith <mcs@darkregion.net>, 2011/01/04
+
+-LIB= execinfo
++CC=cc
++AR=ar
++EXECINFO_CFLAGS=$(CFLAGS) -O2 -pipe -fno-strict-aliasing -std=gnu99 -fstack-protector -c
++EXECINFO_LDFLAGS=$(LDFLAGS)
+
+-SRCS= stacktraverse.c stacktraverse.h execinfo.c execinfo.h
++all: static dynamic
+
+-INCS= execinfo.h
++static:
++ $(CC) $(EXECINFO_CFLAGS) $(EXECINFO_LDFLAGS) stacktraverse.c
++ $(CC) $(EXECINFO_CFLAGS) $(EXECINFO_LDFLAGS) execinfo.c
++ $(AR) rcs libexecinfo.a stacktraverse.o execinfo.o
+
+-SHLIB_MAJOR= 1
+-SHLIB_MINOR= 0
++dynamic:
++ $(CC) -fpic -DPIC $(EXECINFO_CFLAGS) $(EXECINFO_LDFLAGS) stacktraverse.c -o stacktraverse.So
++ $(CC) -fpic -DPIC $(EXECINFO_CFLAGS) $(EXECINFO_LDFLAGS) execinfo.c -o execinfo.So
++ $(CC) -shared -Wl,-soname,libexecinfo.so.1 -o libexecinfo.so.1 stacktraverse.So execinfo.So
+
+-NOPROFILE= yes
+-
+-DPADD= ${LIBM}
+-LDADD= -lm
+-
+-#WARNS?= 4
+-
+-#stacktraverse.c: gen.py
+-# ./gen.py > stacktraverse.c
+-
+-.include <bsd.lib.mk>
++clean:
++ rm -rf *.o *.So *.a *.so
diff --git a/system/libexecinfo/APKBUILD b/system/libexecinfo/APKBUILD
new file mode 100644
index 000000000..bdc921c11
--- /dev/null
+++ b/system/libexecinfo/APKBUILD
@@ -0,0 +1,46 @@
+# Contributor: Philipp Andronov <filipp.andronov@gmail.com>
+# Maintainer: Matt Smith <mcs@darkregion.net>
+
+pkgname=libexecinfo
+pkgver=1.1
+pkgrel=1
+pkgdesc="Experimental BSD clone of the GNU libc backtrace facility"
+url="https://www.freshports.org/devel/libexecinfo"
+arch="all"
+license="BSD-2-Clause"
+options="!check" # Test file would require manual inspection of output.
+depends=
+makedepends=
+install=
+subpackages="${pkgname}-dev"
+source="http://distcache.freebsd.org/local-distfiles/itetcu/$pkgname-$pkgver.tar.bz2
+ 10-execinfo.patch
+ 20-define-gnu-source.patch
+ 30-linux-makefile.patch
+ "
+
+build() {
+ cd "$builddir"
+ export CFLAGS="${CFLAGS} -fno-omit-frame-pointer"
+ make
+}
+
+package() {
+ cd "$builddir"
+
+ install -D -m755 "$builddir"/execinfo.h \
+ "$pkgdir"/usr/include/execinfo.h
+ install -D -m755 "$builddir"/stacktraverse.h \
+ "$pkgdir"/usr/include/stacktraverse.h
+ install -D -m755 "$builddir"/libexecinfo.a \
+ "$pkgdir"/usr/lib/libexecinfo.a
+ install -D -m755 "$builddir"/libexecinfo.so.1 \
+ "$pkgdir"/usr/lib/libexecinfo.so.1
+ ln -s /usr/lib/libexecinfo.so.1 \
+ "$pkgdir"/usr/lib/libexecinfo.so
+}
+
+sha512sums="51fea7910ef6873061a25c22434ce4da724e9d8e37616a069ad0a58c0463755be4c6c7da88cd747484c2f3373909d7be4678b32a4bd91b6d9e0f74526094e92c libexecinfo-1.1.tar.bz2
+97dab43979f6bc07deb11b20cc134c7d95619536b108058388856bcc48dc5a7de4ebceebe88e79d92ccbb9307975bb91a630cc569a5ed35a37a0f92f2d7f83d0 10-execinfo.patch
+6b1d5ba0a2765fcbcde2d88e85c6ee9fb49ef1878284fd7da15afebed17b8415959233c735574661b0a5e77d4d40c132552477dbbf4432512a32629727ebdbbc 20-define-gnu-source.patch
+7d83e3113b93ed9d54a2077d6b9381aa69c6a5d2066dd3cd7c5ec3ce0c93eb7b86fd47481151117f9c8f3790bde6125498a49e32e81d3ff6630b6d8e0ec391d0 30-linux-makefile.patch"
diff --git a/system/libffi/APKBUILD b/system/libffi/APKBUILD
new file mode 100644
index 000000000..4f4923b38
--- /dev/null
+++ b/system/libffi/APKBUILD
@@ -0,0 +1,57 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=libffi
+pkgver=3.2.1
+pkgrel=4
+pkgdesc="A portable, high level programming interface to various calling conventions."
+url="http://sourceware.org/libffi"
+arch="all"
+license="MIT"
+depends=
+makedepends="texinfo"
+checkdepends="dejagnu"
+install=
+subpackages="$pkgname-dev $pkgname-doc"
+source="ftp://sourceware.org/pub/$pkgname/$pkgname-$pkgver.tar.gz
+ disable-ppc-ldvariant.patch
+ fix-testsuite-longdouble.patch
+ gnu-linux-define.patch
+ pax-dlmmap.patch
+ "
+
+builddir="$srcdir"/$pkgname-$pkgver
+
+build () {
+ cd "$builddir"
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --enable-pax_emutramp
+ make
+}
+
+check() {
+ cd "$builddir"
+ make check
+}
+
+package() {
+ cd "$builddir"
+ make DESTDIR=""$pkgdir"" install
+ install -m755 -d ""$pkgdir"/usr/share/licenses/$pkgname"
+ install -m644 LICENSE ""$pkgdir"/usr/share/licenses/$pkgname/"
+ # fix location for headers
+ # see also: https://github.com/libffi/libffi/issues/24
+ mkdir -p "$pkgdir"/usr/include/
+ mv "$pkgdir"/usr/lib/libffi-$pkgver/include/*.h \
+ "$pkgdir"/usr/include/
+ rmdir "$pkgdir"/usr/lib/libffi-$pkgver/include || true
+ sed -i -e '/^includedir=/{s,=.*,=/usr/include,g}' \
+ "$pkgdir"/usr/lib/pkgconfig/libffi.pc
+}
+
+sha512sums="980ca30a8d76f963fca722432b1fe5af77d7a4e4d2eac5144fbc5374d4c596609a293440573f4294207e1bdd9fda80ad1e1cafb2ffb543df5a275bc3bd546483 libffi-3.2.1.tar.gz
+cfd3b11a0e168fd74da0a6219c95610df3466b0769966351b2a5076c93a75996daf9aed41644bebb80e28793bbe18d62272385afd7813c472104cc6c93dcba41 disable-ppc-ldvariant.patch
+de92cb20ded7bfefc3e469ba2ac2d9d869d67dc172ec7e2d1222f8530944eb6d5016ae913baf01ac2e26bee1624c682ae9dd08d0e45d5532d59298dbe7e417eb fix-testsuite-longdouble.patch
+264af568ae5388d50f647f891a406945c73cc358692266f65ad341787c0bf5f6bf31203b86c39fa1b338101c1a6d2f4fec60f95a90d379951ff5153f8f9e178f gnu-linux-define.patch
+72486b389db16055ae4d7d33ba0cb05840537e28fe7a86aa89e2cb922592125d99c18c26c5df7ffde6282742e79f2b9126353e58b58f091f0486589e14dd6474 pax-dlmmap.patch"
diff --git a/system/libffi/disable-ppc-ldvariant.patch b/system/libffi/disable-ppc-ldvariant.patch
new file mode 100644
index 000000000..8b3f9cea0
--- /dev/null
+++ b/system/libffi/disable-ppc-ldvariant.patch
@@ -0,0 +1,11 @@
+--- libffi-3.2.1/configure.old 2014-11-12 06:59:57.000000000 -0500
++++ libffi-3.2.1/configure 2017-10-10 05:44:12.732989967 -0400
+@@ -17237,7 +17237,7 @@
+
+ powerpc*-*-linux* | powerpc-*-sysv*)
+ TARGET=POWERPC; TARGETDIR=powerpc
+- HAVE_LONG_DOUBLE_VARIANT=1
++ #HAVE_LONG_DOUBLE_VARIANT=1
+ ;;
+ powerpc-*-amigaos*)
+ TARGET=POWERPC; TARGETDIR=powerpc
diff --git a/system/libffi/fix-testsuite-longdouble.patch b/system/libffi/fix-testsuite-longdouble.patch
new file mode 100644
index 000000000..20fe4b8c6
--- /dev/null
+++ b/system/libffi/fix-testsuite-longdouble.patch
@@ -0,0 +1,44 @@
+--- libffi-3.2.1/testsuite/libffi.call/cls_align_longdouble_split.c.old 2014-11-08 07:47:24.000000000 -0500
++++ libffi-3.2.1/testsuite/libffi.call/cls_align_longdouble_split.c 2017-10-10 06:04:26.293045176 -0400
+@@ -6,7 +6,7 @@
+
+ /* { dg-excess-errors "no long double format" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */
+ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */
+-/* { dg-options -mlong-double-128 { target powerpc64*-*-linux* } } */
++/* { dg-options -mlong-double-64 { target powerpc64*-*-linux* } } */
+ /* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */
+
+ #include "ffitest.h"
+--- libffi-3.2.1/testsuite/libffi.call/cls_align_longdouble_split2.c.old 2014-11-08 07:47:24.000000000 -0500
++++ libffi-3.2.1/testsuite/libffi.call/cls_align_longdouble_split2.c 2017-10-10 06:04:54.283046103 -0400
+@@ -7,7 +7,7 @@
+
+ /* { dg-excess-errors "no long double format" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */
+ /* { dg-do run { xfail strongarm*-*-* } } */
+-/* { dg-options -mlong-double-128 { target powerpc64*-*-linux* } } */
++/* { dg-options -mlong-double-64 { target powerpc64*-*-linux* } } */
+ /* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */
+
+ #include "ffitest.h"
+--- libffi-3.2.1/testsuite/libffi.call/cls_longdouble.c.old 2014-11-08 07:47:24.000000000 -0500
++++ libffi-3.2.1/testsuite/libffi.call/cls_longdouble.c 2017-10-10 06:05:19.683046965 -0400
+@@ -8,7 +8,7 @@
+ /* This test is known to PASS on armv7l-unknown-linux-gnueabihf, so I have
+ remove the xfail for arm*-*-* below, until we know more. */
+ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */
+-/* { dg-options -mlong-double-128 { target powerpc64*-*-linux* } } */
++/* { dg-options -mlong-double-64 { target powerpc64*-*-linux* } } */
+ /* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */
+
+ #include "ffitest.h"
+--- libffi-3.2.1/testsuite/libffi.call/huge_struct.c.old 2014-11-08 07:47:24.000000000 -0500
++++ libffi-3.2.1/testsuite/libffi.call/huge_struct.c 2017-10-10 06:05:39.383047674 -0400
+@@ -7,7 +7,7 @@
+
+ /* { dg-excess-errors "" { target x86_64-*-mingw* x86_64-*-cygwin* } } */
+ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */
+-/* { dg-options -mlong-double-128 { target powerpc64*-*-linux* } } */
++/* { dg-options -mlong-double-64 { target powerpc64*-*-linux* } } */
+ /* { dg-options -Wformat=0 { target moxie*-*-elf } } */
+ /* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */
+
diff --git a/system/libffi/gnu-linux-define.patch b/system/libffi/gnu-linux-define.patch
new file mode 100644
index 000000000..8dcae738b
--- /dev/null
+++ b/system/libffi/gnu-linux-define.patch
@@ -0,0 +1,15 @@
+http://bugs.alpinelinux.org/issues/4275
+
+diff --git a/closures.c.orig b/closures.c
+index 721ff00..22a699c 100644
+--- a/src/closures.c.orig
++++ b/src/closures.c
+@@ -34,7 +34,7 @@
+ #include <ffi_common.h>
+
+ #if !FFI_MMAP_EXEC_WRIT && !FFI_EXEC_TRAMPOLINE_TABLE
+-# if __gnu_linux__ && !defined(__ANDROID__)
++# if __linux__ && !defined(__ANDROID__)
+ /* This macro indicates it may be forbidden to map anonymous memory
+ with both write and execute permission. Code compiled when this
+ option is defined will attempt to map such pages once, but if it
diff --git a/system/libffi/pax-dlmmap.patch b/system/libffi/pax-dlmmap.patch
new file mode 100644
index 000000000..ec4150410
--- /dev/null
+++ b/system/libffi/pax-dlmmap.patch
@@ -0,0 +1,120 @@
+From 48d2e46528fb6e621d95a7fa194069fd136b712d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Stefan=20B=C3=BChler?= <buehler@cert.uni-stuttgart.de>
+Date: Wed, 7 Sep 2016 15:49:48 +0200
+Subject: [PATCH 1/2] dlmmap_locked always needs locking as it always modifies
+ execsize
+
+---
+ src/closures.c | 13 ++++---------
+ 1 file changed, 4 insertions(+), 9 deletions(-)
+
+diff --git a/src/closures.c b/src/closures.c
+index 2e0ffb45..04d6e27f 100644
+--- a/src/closures.c
++++ b/src/closures.c
+@@ -769,16 +769,11 @@ dlmmap (void *start, size_t length, int prot,
+ MREMAP_DUP and prot at this point. */
+ }
+
+- if (execsize == 0 || execfd == -1)
+- {
+- pthread_mutex_lock (&open_temp_exec_file_mutex);
+- ptr = dlmmap_locked (start, length, prot, flags, offset);
+- pthread_mutex_unlock (&open_temp_exec_file_mutex);
++ pthread_mutex_lock (&open_temp_exec_file_mutex);
++ ptr = dlmmap_locked (start, length, prot, flags, offset);
++ pthread_mutex_unlock (&open_temp_exec_file_mutex);
+
+- return ptr;
+- }
+-
+- return dlmmap_locked (start, length, prot, flags, offset);
++ return ptr;
+ }
+
+ /* Release memory at the given address, as well as the corresponding
+
+From 7aad5f895e2dfdb79d2ef67e1b231d21063e6511 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Stefan=20B=C3=BChler?= <buehler@cert.uni-stuttgart.de>
+Date: Wed, 7 Sep 2016 15:50:54 +0200
+Subject: [PATCH 2/2] ignore PaX EMUTRAMP flag; instead check for MPROTECT
+
+- code using ffi_closure_alloc doesn't necessarily generate gcc compatible trampolines; only those are allowed by PaX
+- if MPROTECT is enabled use the same workaround as is used for SELinux (double mmap())
+---
+ src/closures.c | 29 +++++++++++++----------------
+ 1 file changed, 13 insertions(+), 16 deletions(-)
+
+diff --git a/src/closures.c b/src/closures.c
+index 04d6e27f..babecc1a 100644
+--- a/src/closures.c
++++ b/src/closures.c
+@@ -401,14 +401,15 @@ selinux_enabled_check (void)
+
+ #endif /* !FFI_MMAP_EXEC_SELINUX */
+
+-/* On PaX enable kernels that have MPROTECT enable we can't use PROT_EXEC. */
++/* On PaX enable kernels that have MPROTECT enabled we can't use PROT_EXEC. */
+ #ifdef FFI_MMAP_EXEC_EMUTRAMP_PAX
+ #include <stdlib.h>
+
+-static int emutramp_enabled = -1;
++/* -1: not read yet; 0: no PaX or MPROTECT disabled; 1: MPROTECT enabled. */
++static int mprotect_enabled = -1;
+
+ static int
+-emutramp_enabled_check (void)
++mprotect_enabled_check (void)
+ {
+ char *buf = NULL;
+ size_t len = 0;
+@@ -422,9 +423,7 @@ emutramp_enabled_check (void)
+ while (getline (&buf, &len, f) != -1)
+ if (!strncmp (buf, "PaX:", 4))
+ {
+- char emutramp;
+- if (sscanf (buf, "%*s %*c%c", &emutramp) == 1)
+- ret = (emutramp == 'E');
++ ret = (NULL != strchr (buf + 4, 'M'));
+ break;
+ }
+ free (buf);
+@@ -432,8 +431,9 @@ emutramp_enabled_check (void)
+ return ret;
+ }
+
+-#define is_emutramp_enabled() (emutramp_enabled >= 0 ? emutramp_enabled \
+- : (emutramp_enabled = emutramp_enabled_check ()))
++#define is_mprotect_enabled() (mprotect_enabled >= 0 ? mprotect_enabled \
++ : (mprotect_enabled = mprotect_enabled_check ()))
++
+ #endif /* FFI_MMAP_EXEC_EMUTRAMP_PAX */
+
+ #elif defined (__CYGWIN__) || defined(__INTERIX)
+@@ -446,7 +446,7 @@ emutramp_enabled_check (void)
+ #endif /* !defined(X86_WIN32) && !defined(X86_WIN64) */
+
+ #ifndef FFI_MMAP_EXEC_EMUTRAMP_PAX
+-#define is_emutramp_enabled() 0
++#define is_mprotect_enabled() 0
+ #endif /* FFI_MMAP_EXEC_EMUTRAMP_PAX */
+
+ /* Declare all functions defined in dlmalloc.c as static. */
+@@ -750,13 +750,10 @@ dlmmap (void *start, size_t length, int prot,
+ && flags == (MAP_PRIVATE | MAP_ANONYMOUS)
+ && fd == -1 && offset == 0);
+
+- if (execfd == -1 && is_emutramp_enabled ())
+- {
+- ptr = mmap (start, length, prot & ~PROT_EXEC, flags, fd, offset);
+- return ptr;
+- }
+-
+- if (execfd == -1 && !is_selinux_enabled ())
++ /* -1 != execfd hints that we already decided to use dlmmap_locked
++ last time. If PaX MPROTECT or SELinux is active fallback to
++ dlmmap_locked. */
++ if (execfd == -1 && !is_mprotect_enabled () && !is_selinux_enabled ())
+ {
+ ptr = mmap (start, length, prot | PROT_EXEC, flags, fd, offset);
+
diff --git a/system/libtool/APKBUILD b/system/libtool/APKBUILD
new file mode 100644
index 000000000..518d33a0a
--- /dev/null
+++ b/system/libtool/APKBUILD
@@ -0,0 +1,55 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=libtool
+pkgver=2.4.6
+pkgrel=5
+pkgdesc="A generic library support script"
+arch="all"
+license="GPL"
+url="http://www.gnu.org/software/libtool"
+source="ftp://ftp.gnu.org/pub/gnu/libtool/${pkgname}-${pkgver}.tar.gz
+ libtool-fix-cross-compile.patch
+ "
+depends="bash libltdl"
+makedepends="m4 help2man"
+checkdepends="mawk autoconf automake gzip"
+subpackages="libltdl $pkgname-doc"
+options="libtool"
+
+builddir="$srcdir"/$pkgname-$pkgver
+
+build() {
+ cd "$builddir"
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --disable-static \
+ lt_cv_shlibpath_overrides_runpath=yes
+ make
+}
+
+package() {
+ cd "$builddir"
+ make DESTDIR="$pkgdir" install
+}
+
+check() {
+ cd "$builddir"
+ # Test 70 and 117 are known to fail
+ # Test 170 repeats the entire test suite with shorter max_cmd_len
+ make check TESTSUITEFLAGS="1-69 71-116 118-169"
+}
+
+libltdl() {
+ pkgdesc="Runtime libraries for GNU Libtool Dynamic Module Loader"
+ depends=
+ mkdir -p "$subpkgdir/usr/lib"
+ mv "$pkgdir/usr/lib/libltdl.so"* "$subpkgdir/usr/lib/"
+}
+
+md5sums="addf44b646ddb4e3919805aa88fa7c5e libtool-2.4.6.tar.gz
+3657a65e226879586c29360eac6ae41b libtool-fix-cross-compile.patch"
+sha256sums="e3bd4d5d3d025a36c21dd6af7ea818a2afcd4dfc1ea5a17b39d7854bcd0c06e3 libtool-2.4.6.tar.gz
+c98362e9b1efd90618813a6901144452dc03f51e6300686bb07e068ac851c245 libtool-fix-cross-compile.patch"
+sha512sums="3233d81cb2739a54b840a0a82064eebbfaa4fb442fb993a35d6bd41d8395c51f038c90ae048b9252f172d0a5bbfb4b36e2b13d4477001f9ff7d4124237819a18 libtool-2.4.6.tar.gz
+aa14cadd70a633520249fa3a6a4c45b309a980380e62dd5982b3ae842c478a77401ad809297fceebd167c167b0a19f380e6a6c295bc75d1029d56d3bf262b209 libtool-fix-cross-compile.patch"
diff --git a/system/libtool/libtool-fix-cross-compile.patch b/system/libtool/libtool-fix-cross-compile.patch
new file mode 100644
index 000000000..585897e0d
--- /dev/null
+++ b/system/libtool/libtool-fix-cross-compile.patch
@@ -0,0 +1,36 @@
+--- libtool-2.4.6.orig/build-aux/ltmain.in
++++ libtool-2.4.6/build-aux/ltmain.in
+@@ -6449,7 +6449,7 @@
+ fi
+ else
+ # We cannot seem to hardcode it, guess we'll fake it.
+- add_dir=-L$libdir
++ add_dir="-L$lt_sysroot$libdir"
+ # Try looking first in the location we're being installed to.
+ if test -n "$inst_prefix_dir"; then
+ case $libdir in
+@@ -7628,9 +7628,11 @@
+ test relink = "$opt_mode" || rpath=$compile_rpath$rpath
+ for libdir in $rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
++ func_replace_sysroot "$libdir"
++ libdir=$func_replace_sysroot_result
++ func_stripname '=' '' "$libdir"
++ libdir=$func_stripname_result
+ if test -n "$hardcode_libdir_separator"; then
+- func_replace_sysroot "$libdir"
+- libdir=$func_replace_sysroot_result
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs=$libdir
+ else
+@@ -8360,6 +8362,10 @@
+ hardcode_libdirs=
+ for libdir in $compile_rpath $finalize_rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
++ func_replace_sysroot "$libdir"
++ libdir=$func_replace_sysroot_result
++ func_stripname '=' '' "$libdir"
++ libdir=$func_stripname_result
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs=$libdir
diff --git a/system/libtool/libtool.patch b/system/libtool/libtool.patch
new file mode 100644
index 000000000..4302b7e07
--- /dev/null
+++ b/system/libtool/libtool.patch
@@ -0,0 +1,41 @@
+diff --git a/main/libtool/APKBUILD b/main/libtool/APKBUILD
+index de86f2aeb7..3a7d137533 100644
+--- a/main/libtool/APKBUILD
++++ b/main/libtool/APKBUILD
+@@ -4,13 +4,14 @@ pkgver=2.4.6
+ pkgrel=1
+ pkgdesc="A generic library support script"
+ arch="all"
+-license='GPL'
++license="GPL"
+ url="http://www.gnu.org/software/libtool"
+ source="ftp://ftp.gnu.org/pub/gnu/libtool/${pkgname}-${pkgver}.tar.gz
+ libtool-fix-cross-compile.patch
+ "
+ depends="bash libltdl"
+ makedepends="m4 help2man"
++checkdepends="mawk autoconf automake gzip"
+ subpackages="libltdl $pkgname-doc"
+ options="libtool"
+
+@@ -23,7 +24,7 @@ build() {
+ --host=$CHOST \
+ --prefix=/usr \
+ --disable-static \
+- || return 1
++ lt_cv_shlibpath_overrides_runpath=yes
+ make
+ }
+
+@@ -32,6 +33,11 @@ package() {
+ make DESTDIR="$pkgdir" install
+ }
+
++check() {
++ cd "$builddir"
++ make check
++}
++
+ libltdl() {
+ pkgdesc="Runtime libraries for GNU Libtool Dynamic Module Loader"
+ depends=
diff --git a/system/libxml2/APKBUILD b/system/libxml2/APKBUILD
new file mode 100644
index 000000000..8f7207c16
--- /dev/null
+++ b/system/libxml2/APKBUILD
@@ -0,0 +1,77 @@
+# Contributor: Carlo Landmeter <clandmeter@gmail.com>
+# Maintainer: Carlo Landmeter <clandmeter@gmail.com>
+pkgname=libxml2
+pkgver=2.9.7
+pkgrel=2
+pkgdesc="XML parsing library, version 2"
+url="http://www.xmlsoft.org/"
+arch="all"
+license="MIT"
+depends=
+depends_dev="zlib-dev icu-dev"
+checkdepends="perl tar"
+makedepends="$depends_dev python3-dev"
+subpackages="$pkgname-doc $pkgname-dev $pkgname-utils py-libxml2:py"
+options="!check !strip" # Impossible to run on Python 3
+source="ftp://ftp.xmlsoft.org/${pkgname}/${pkgname}-${pkgver}.tar.gz
+ libxml2-2.9.4-remove-pyverify_fd.patch
+ python-segfault-fix.patch
+ "
+builddir="$srcdir/$pkgname-$pkgver"
+
+# secfixes:
+# 2.9.4-r1:
+# - CVE-2016-5131
+# 2.9.4-r2:
+# - CVE-2016-9318
+# 2.9.4-r4:
+# - CVE-2017-5969
+
+prepare() {
+ default_prepare
+ # setup.py is generated
+ rm python/setup.py
+}
+
+build() {
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --with-icu \
+ --with-python=/usr/bin/python3
+ make
+}
+
+package() {
+ cd "$builddir"
+ make -j1 DESTDIR="$pkgdir" install
+}
+
+dev() {
+ default_dev
+ mv "$pkgdir"/usr/lib/*.sh "$subpkgdir"/usr/lib/
+}
+
+py() {
+ cd "$builddir"
+
+ pkgdesc="$pkgname Python bindings"
+ provides="py3-libxml2=$pkgver-r$pkgrel"
+ install -d "$subpkgdir"/usr/lib
+ mv "$pkgdir"/usr/lib/python3* "$subpkgdir"/usr/lib/
+}
+
+utils() {
+ pkgdesc="XML utilities"
+ replaces="libxml2"
+ mkdir -p "$subpkgdir"/usr
+ mv "$pkgdir"/usr/bin "$subpkgdir"/usr/
+}
+
+sha512sums="da06cb7c5032ef4b7c8e902fabb9d2c74634c42c161be07a7c66a00d53a68029f89b0d4de32a6b9d4ff338c2d1d9c4e53aefb9cf50cb1c2d6c6b06b442ef42d5 libxml2-2.9.7.tar.gz
+271e701daf08f10a8b591c5128f596105901a29ecc9ee72f088afab266eaec7932a4a7d2194baa07c69e1aa93f3e9dc01a4a890456f53416c45d490598be41d9 libxml2-2.9.4-remove-pyverify_fd.patch
+384b3d2031cd8f77528190bbb7652faa9ccb22bc604bcf4927e59046d38830dac38010828fe1568b6514976f725981a6d3ac1aa595d31477a36db2afe491452c python-segfault-fix.patch"
diff --git a/system/libxml2/libxml2-2.9.4-remove-pyverify_fd.patch b/system/libxml2/libxml2-2.9.4-remove-pyverify_fd.patch
new file mode 100644
index 000000000..d05d4cb60
--- /dev/null
+++ b/system/libxml2/libxml2-2.9.4-remove-pyverify_fd.patch
@@ -0,0 +1,12 @@
+diff -Nur libxml2-2.9.4.orig/python/types.c libxml2-2.9.4/python/types.c
+--- libxml2-2.9.4.orig/python/types.c 2016-02-09 03:17:33.000000000 -0700
++++ libxml2-2.9.4/python/types.c 2016-12-21 12:34:06.755650986 -0700
+@@ -31,8 +31,6 @@
+ const char *mode;
+
+ fd = PyObject_AsFileDescriptor(f);
+- if (!_PyVerify_fd(fd))
+- return(NULL);
+ /*
+ * Get the flags on the fd to understand how it was opened
+ */
diff --git a/system/libxml2/python-segfault-fix.patch b/system/libxml2/python-segfault-fix.patch
new file mode 100644
index 000000000..f1f7554eb
--- /dev/null
+++ b/system/libxml2/python-segfault-fix.patch
@@ -0,0 +1,36 @@
+Upstream: https://bugzilla.gnome.org/show_bug.cgi?id=791691
+
+From d1ea6250dd00a3b7a92b52a743ec53f7751196e5 Mon Sep 17 00:00:00 2001
+From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
+Date: Sat, 16 Dec 2017 19:22:23 -0600
+Subject: [PATCH] Python: if message is NULL, use Py_None instead
+
+If the error message is malformed / invalid UTF-8, and the Python 3
+binding is being used, then message may be NULL. This will cause the
+Python interpreter to crash (Segmentation fault) trying to unpack the
+argument list into local variables.
+
+This uses Py_None for message if message is NULL, so that the
+interpreter does not crash.
+---
+ python/libxml.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/python/libxml.c b/python/libxml.c
+index 5b1ff6e8..dae77b88 100644
+--- a/python/libxml.c
++++ b/python/libxml.c
+@@ -1640,6 +1640,10 @@ libxml_xmlErrorFuncHandler(ATTRIBUTE_UNUSED void *ctx, const char *msg,
+ PyTuple_SetItem(list, 0, libxml_xmlPythonErrorFuncCtxt);
+ Py_XINCREF(libxml_xmlPythonErrorFuncCtxt);
+ message = libxml_charPtrConstWrap(str);
++ if (message == NULL) {
++ Py_INCREF(Py_None);
++ message = Py_None;
++ }
+ PyTuple_SetItem(list, 1, message);
+ result = PyEval_CallObject(libxml_xmlPythonErrorFuncHandler, list);
+ Py_XDECREF(list);
+--
+2.14.1
+
diff --git a/system/libxslt/APKBUILD b/system/libxslt/APKBUILD
new file mode 100644
index 000000000..a43c0ffd3
--- /dev/null
+++ b/system/libxslt/APKBUILD
@@ -0,0 +1,40 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+# Contributor: Francesco Colista <fcolista@alpinelinux.org>
+pkgname=libxslt
+pkgver=1.1.31
+pkgrel=0
+pkgdesc="XML stylesheet transformation library"
+url="http://xmlsoft.org/XSLT/"
+arch="all"
+license="custom"
+makedepends="libxml2-dev libgcrypt-dev libgpg-error-dev python3-dev"
+subpackages="$pkgname-dev $pkgname-doc"
+source="ftp://xmlsoft.org/$pkgname/$pkgname-$pkgver.tar.gz"
+
+# secfixes:
+# 1.1.29-r1:
+# - CVE-2017-5029
+
+build() {
+ cd "$builddir"
+
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr
+ make
+}
+
+check() {
+ cd "$builddir"
+ make check
+}
+
+package() {
+ cd "$builddir"
+
+ make DESTDIR="$pkgdir" install
+ install -D -m644 COPYING "$pkgdir"/usr/share/licenses/$pkgname/COPYING
+}
+
+sha512sums="9012d643625d827b131c825a103f2e2a5f3cbd45d3cdf3318378e8f046da8d084db51c6b0078b5850a26adc81ba3bf357101d65ef510eff54c8b416a71efed92 libxslt-1.1.31.tar.gz"
diff --git a/system/linux-pam/APKBUILD b/system/linux-pam/APKBUILD
new file mode 100644
index 000000000..f55963c5c
--- /dev/null
+++ b/system/linux-pam/APKBUILD
@@ -0,0 +1,91 @@
+# Contributor: William Pitcock <nenolod@dereferenced.org>
+# Maintainer: William Pitcock <nenolod@dereferenced.org>
+pkgname=linux-pam
+pkgver=1.3.0
+pkgrel=1
+pkgdesc="pluggable authentication modules for linux"
+url="http://www.kernel.org/pub/linux/libs/pam"
+arch="all"
+license="BSD"
+depends_dev="gettext-dev"
+makedepends_host="$depends_dev"
+makedepends_build="$depends_dev bison flex-dev autoconf automake libtool"
+makedepends="$makedepends_host $makedepends_build"
+options="suid !check"
+subpackages="$pkgname-dev $pkgname-doc"
+source="http://linux-pam.org/library/Linux-PAM-$pkgver.tar.bz2
+ fix-compat.patch
+ libpam-fix-build-with-eglibc-2.16.patch
+ musl-fix-pam_exec.patch
+
+ base-auth.pamd
+ base-account.pamd
+ base-password.pamd
+ base-session.pamd
+ base-session-noninteractive.pamd
+ other.pamd
+ su.pamd
+ "
+
+builddir="$srcdir"/Linux-PAM-$pkgver
+prepare() {
+ cd "$builddir"
+ default_prepare
+ # disable insecure modules
+ sed -e 's/pam_rhosts//g' -i modules/Makefile.am
+}
+
+build() {
+ cd "$builddir"
+ autoreconf -vif
+ [ "$CLIBC" = "musl" ] && export ac_cv_search_crypt=no
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --libdir=/lib \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --localstatedir=/var \
+ --disable-nls \
+ --disable-db
+ make
+}
+
+package() {
+ cd "$builddir"
+ make DESTDIR="$pkgdir" install
+
+ # do not install pam.d files bundled with the source, they could be broken
+ rm -rf "$pkgdir"/etc/pam.d
+
+ # install our pam.d files
+ mkdir "$pkgdir"/etc/pam.d
+ for i in $source; do
+ case $i in
+ *.pamd)
+ basename=$(echo $i | cut -d. -f1)
+ cp "$srcdir"/$i "$pkgdir"/etc/pam.d/"$basename"
+ # ensure users can use PAM services without SUID
+ chmod 644 "$pkgdir"/etc/pam.d/"$basename"
+ ;;
+ esac
+ done
+
+ # delete pointless libtool archives.
+ chgrp shadow "$pkgdir"/sbin/unix_chkpwd \
+ && chmod g+s "$pkgdir"/sbin/unix_chkpwd
+}
+
+sha512sums="4a89ca4b6f4676107aca4018f7c11addf03495266b209cb11c913f8b5d191d9a1f72197715dcf2a69216b4036de88780bcbbb5a8652e386910d71ba1b6282e42 Linux-PAM-1.3.0.tar.bz2
+52b97e23084f7b835ce1fa441663f91a50ea797cb38ba2c6662bcdaf0d25ba487118442674ac347fb17353af126dd6b3b696612faa56cac428dd842d14e1c90d fix-compat.patch
+f49edf3876cc6bcb87bbea4e7beaeb0a382d596898c755f5fbaf6c2ed4e0c8f082b2cd16dde8a74af82bb09a1334f463e07a4bb5b8a48f023ff90a67ad2fdd44 libpam-fix-build-with-eglibc-2.16.patch
+bc443d2a9b1d90b81959ce6fa154042365d5e7840f8696f847a145bbaaeffcbe1e9cd2b8ba76131a7b48737929e281f4fe864582fa4fc40315f2d10c650e0cd9 musl-fix-pam_exec.patch
+0672ab21adb969af2a0082e2559f1196d8a4f8b1cff2836f97e5f24edb03b6aed156c61cf335a4df978e423dcd9934ffee8cb5784ed5dde704d7e5ddec4ba9f6 base-auth.pamd
+85462201a4044c7e170e617d39b0eceb4790abc6c0504999117548030a16d80a9d2078d1ad97690d7d346e6374201f0c52e792ccb08ce2b1c4bbf0cc2be96f5b base-account.pamd
+8223b815148c3b9b874d2c283840f6428c266e56c7cf49ce8fc508c4945ae31c837bef96dab17f64a60812d1c9cd0055cf0a50d7951d23070b69bd2e5bb9666d base-password.pamd
+b0138f662715974bd865d755c5e7d403faf5b9ad1b7e2b1d1598ad7eb5764a9ff407f1a5e6ce7f16db9fc10f8d643323b494563416fd6a654032529b52213c5b base-session.pamd
+444e20046843057b17c0aac14d2b71a68923b989b3d8b478bbf684698673683186e928e5ca2e6cb9a1c76abc4248044a0e10ef6b06b3f51857106796ecce250d base-session-noninteractive.pamd
+d103ba06b2c4929171e09c845f9866539220cd20d8d56a03d25850342ef5eabe281e958dfe1eaefd550c00f9440e8700c1d74c88c3001f933134ca6fd7cb9b7b other.pamd
+b512d691f2a6b11fc329bf91dd05ca9c589bbd444308b27d3c87c75262dedf6afc68a9739229249a4bd3d0c43cb1f871eecbb93c4fe559e0f38bdabbffd06ad7 su.pamd"
diff --git a/system/linux-pam/base-account.pamd b/system/linux-pam/base-account.pamd
new file mode 100644
index 000000000..591092944
--- /dev/null
+++ b/system/linux-pam/base-account.pamd
@@ -0,0 +1,3 @@
+# basic PAM configuration for Alpine.
+
+account required pam_unix.so
diff --git a/system/linux-pam/base-auth.pamd b/system/linux-pam/base-auth.pamd
new file mode 100644
index 000000000..012445aa3
--- /dev/null
+++ b/system/linux-pam/base-auth.pamd
@@ -0,0 +1,5 @@
+# basic PAM configuration for Alpine.
+
+auth required pam_env.so
+auth required pam_unix.so nullok_secure
+auth required pam_nologin.so successok
diff --git a/system/linux-pam/base-password.pamd b/system/linux-pam/base-password.pamd
new file mode 100644
index 000000000..a146a93fe
--- /dev/null
+++ b/system/linux-pam/base-password.pamd
@@ -0,0 +1,3 @@
+# basic PAM configuration for Alpine.
+
+password required pam_unix.so nullok obscure md5 sha512
diff --git a/system/linux-pam/base-session-noninteractive.pamd b/system/linux-pam/base-session-noninteractive.pamd
new file mode 100644
index 000000000..85e07d594
--- /dev/null
+++ b/system/linux-pam/base-session-noninteractive.pamd
@@ -0,0 +1,4 @@
+# basic PAM configuration for Alpine.
+
+session required pam_limits.so
+session required pam_unix.so
diff --git a/system/linux-pam/base-session.pamd b/system/linux-pam/base-session.pamd
new file mode 100644
index 000000000..bf5bcb734
--- /dev/null
+++ b/system/linux-pam/base-session.pamd
@@ -0,0 +1,4 @@
+# basic PAM configuration for Alpine.
+
+session include base-session-noninteractive
+session required pam_motd.so
diff --git a/system/linux-pam/fix-compat.patch b/system/linux-pam/fix-compat.patch
new file mode 100644
index 000000000..4096c3a47
--- /dev/null
+++ b/system/linux-pam/fix-compat.patch
@@ -0,0 +1,21 @@
+--- Linux-PAM-1.1.6.orig/modules/pam_lastlog/pam_lastlog.c
++++ Linux-PAM-1.1.6/modules/pam_lastlog/pam_lastlog.c
+@@ -10,6 +10,7 @@
+
+ #include "config.h"
+
++#include <paths.h>
+ #include <fcntl.h>
+ #include <time.h>
+ #include <errno.h>
+@@ -48,6 +49,10 @@
+
+ #ifndef _PATH_BTMP
+ # define _PATH_BTMP "/var/log/btmp"
++#endif
++
++#ifndef __GLIBC__
++#define logwtmp(args...)
+ #endif
+
+ /* XXX - time before ignoring lock. Is 1 sec enough? */
diff --git a/system/linux-pam/libpam-fix-build-with-eglibc-2.16.patch b/system/linux-pam/libpam-fix-build-with-eglibc-2.16.patch
new file mode 100644
index 000000000..1a0716598
--- /dev/null
+++ b/system/linux-pam/libpam-fix-build-with-eglibc-2.16.patch
@@ -0,0 +1,10 @@
+--- Linux-PAM-1.1.5/modules/pam_unix/pam_unix_acct.c.orig
++++ Linux-PAM-1.1.5/modules/pam_unix/pam_unix_acct.c
+@@ -47,6 +47,7 @@
+ #include <time.h> /* for time() */
+ #include <errno.h>
+ #include <sys/wait.h>
++#include <sys/resource.h>
+
+ #include <security/_pam_macros.h>
+
diff --git a/system/linux-pam/musl-fix-pam_exec.patch b/system/linux-pam/musl-fix-pam_exec.patch
new file mode 100644
index 000000000..b6b999fae
--- /dev/null
+++ b/system/linux-pam/musl-fix-pam_exec.patch
@@ -0,0 +1,31 @@
+--- ./modules/pam_exec/pam_exec.c.orig
++++ ./modules/pam_exec/pam_exec.c
+@@ -103,11 +103,14 @@
+ int optargc;
+ const char *logfile = NULL;
+ const char *authtok = NULL;
++ char authtok_buf[PAM_MAX_RESP_SIZE+1];
++
+ pid_t pid;
+ int fds[2];
+ int stdout_fds[2];
+ FILE *stdout_file = NULL;
+
++ memset(authtok_buf, 0, sizeof(authtok_buf));
+ if (argc < 1) {
+ pam_syslog (pamh, LOG_ERR,
+ "This module needs at least one argument");
+@@ -178,11 +181,11 @@
+ }
+
+ pam_set_item (pamh, PAM_AUTHTOK, resp);
+- authtok = strndupa (resp, PAM_MAX_RESP_SIZE);
++ authtok = strncpy(authtok_buf, resp, sizeof(authtok_buf));
+ _pam_drop (resp);
+ }
+ else
+- authtok = strndupa (void_pass, PAM_MAX_RESP_SIZE);
++ authtok = strncpy(authtok_buf, void_pass, sizeof(authtok_buf));
+
+ if (pipe(fds) != 0)
+ {
diff --git a/system/linux-pam/other.pamd b/system/linux-pam/other.pamd
new file mode 100644
index 000000000..8c9797e71
--- /dev/null
+++ b/system/linux-pam/other.pamd
@@ -0,0 +1,6 @@
+# basic PAM configuration for Alpine.
+
+auth include base-auth
+account include base-account
+password include base-password
+session include base-session-noninteractive
diff --git a/system/linux-pam/su.pamd b/system/linux-pam/su.pamd
new file mode 100644
index 000000000..84f2ae7ea
--- /dev/null
+++ b/system/linux-pam/su.pamd
@@ -0,0 +1,6 @@
+# basic PAM configuration for Alpine.
+auth sufficient pam_rootok.so
+auth include base-auth
+account include base-account
+password include base-password
+session include base-session-noninteractive
diff --git a/system/mkinitfs/0001-features-add-virtio_net-to-network-modules.patch b/system/mkinitfs/0001-features-add-virtio_net-to-network-modules.patch
new file mode 100644
index 000000000..012738163
--- /dev/null
+++ b/system/mkinitfs/0001-features-add-virtio_net-to-network-modules.patch
@@ -0,0 +1,21 @@
+From d15cc41a7892d48f8255225003a89b91f0c13349 Mon Sep 17 00:00:00 2001
+From: Carlo Landmeter <clandmeter@alpinelinux.org>
+Date: Sun, 29 Apr 2018 11:15:18 +0000
+Subject: [PATCH] features: add virtio_net to network modules
+
+---
+ features.d/network.modules | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/features.d/network.modules b/features.d/network.modules
+index 311df0b..caa37a8 100644
+--- a/features.d/network.modules
++++ b/features.d/network.modules
+@@ -2,3 +2,4 @@ kernel/drivers/net/ethernet
+ kernel/net/packet/af_packet.ko
+ kernel/drivers/net/hyperv
+ kernel/drivers/net/vmxnet3
++kernel/drivers/net/virtio_net*
+--
+2.17.0
+
diff --git a/system/mkinitfs/0001-features-virtio_net-depends-on-virtio_pci.patch b/system/mkinitfs/0001-features-virtio_net-depends-on-virtio_pci.patch
new file mode 100644
index 000000000..8b01d294a
--- /dev/null
+++ b/system/mkinitfs/0001-features-virtio_net-depends-on-virtio_pci.patch
@@ -0,0 +1,23 @@
+From 56d4208345b8da08ada6e6176a0a46cf94f89516 Mon Sep 17 00:00:00 2001
+From: Carlo Landmeter <clandmeter@alpinelinux.org>
+Date: Sun, 29 Apr 2018 21:14:36 +0000
+Subject: [PATCH] features: virtio_net depends on virtio_pci
+
+---
+ features.d/network.modules | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/features.d/network.modules b/features.d/network.modules
+index caa37a8..e4f084c 100644
+--- a/features.d/network.modules
++++ b/features.d/network.modules
+@@ -2,4 +2,5 @@ kernel/drivers/net/ethernet
+ kernel/net/packet/af_packet.ko
+ kernel/drivers/net/hyperv
+ kernel/drivers/net/vmxnet3
+-kernel/drivers/net/virtio_net*
++kernel/drivers/virtio/virtio_pci.ko
++kernel/drivers/net/virtio_net.ko
+--
+2.17.0
+
diff --git a/system/mkinitfs/0001-generate-mkinitfs.conf.patch b/system/mkinitfs/0001-generate-mkinitfs.conf.patch
new file mode 100644
index 000000000..a556879d7
--- /dev/null
+++ b/system/mkinitfs/0001-generate-mkinitfs.conf.patch
@@ -0,0 +1,49 @@
+From 9e1b472701fa1785989f6757243a3d81e97944f2 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Mon, 14 May 2018 16:32:08 +0200
+Subject: [PATCH 1/3] generate mkinitfs.conf
+
+we may want have conditional default config depending on architecture
+---
+ Makefile | 7 +++++--
+ mkinitfs.conf | 2 --
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+ delete mode 100644 mkinitfs.conf
+
+diff --git a/Makefile b/Makefile
+index 68959fe..fc01d1a 100644
+--- a/Makefile
++++ b/Makefile
+@@ -70,12 +70,13 @@ SED_REPLACE := -e 's:@VERSION@:$(FULL_VERSION):g' \
+ -e 's:@sysconfdir@:$(sysconfdir):g' \
+ -e 's:@datadir@:$(datadir):g'
+
++DEFAULT_FEATURES ?= ata base cdrom ext2 ext4 keymap kms mmc raid scsi usb virtio
+
+
+-all: $(SBIN_FILES) $(SCRIPTS)
++all: $(SBIN_FILES) $(SCRIPTS) $(CONF_FILES)
+
+ clean:
+- rm -f $(SCRIPTS)
++ rm -f $(SCRIPTS) mkinitfs.conf
+
+ help:
+ @echo mkinitfs $(VERSION)
+@@ -116,3 +117,5 @@ install: $(SBIN_FILES) $(SHARE_FILES) $(CONF_FILES)
+ $(INSTALL) -D $$i $(DESTDIR)/usr/share/mkinitfs/$$i;\
+ done
+
++mkinitfs.conf:
++ echo 'features="$(DEFAULT_FEATURES)"' > $@
+diff --git a/mkinitfs.conf b/mkinitfs.conf
+deleted file mode 100644
+index 67a5444..0000000
+--- a/mkinitfs.conf
++++ /dev/null
+@@ -1,2 +0,0 @@
+-# run mkinitfs -L for a list of available features
+-features="ata base cdrom ext2 ext3 ext4 keymap kms mmc raid scsi usb virtio"
+--
+2.17.0
+
diff --git a/system/mkinitfs/0001-initramfs-do-not-relocate-mountpoint-for-netboot.patch b/system/mkinitfs/0001-initramfs-do-not-relocate-mountpoint-for-netboot.patch
new file mode 100644
index 000000000..e6e580a14
--- /dev/null
+++ b/system/mkinitfs/0001-initramfs-do-not-relocate-mountpoint-for-netboot.patch
@@ -0,0 +1,28 @@
+From 1d115251816a3f83a008883f1b9665c3d8f4d3a4 Mon Sep 17 00:00:00 2001
+From: Carlo Landmeter <clandmeter@alpinelinux.org>
+Date: Tue, 20 Feb 2018 10:18:11 +0000
+Subject: [PATCH] initramfs: do not relocate mountpoint for netboot
+
+mountpoint cannot be located when repo is external.
+---
+ initramfs-init.in | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/initramfs-init.in b/initramfs-init.in
+index 95fcd97..bf2d9bd 100755
+--- a/initramfs-init.in
++++ b/initramfs-init.in
+@@ -221,6 +221,10 @@ relocate_mount() {
+ return
+ fi
+ while read dir; do
++ # skip http(s)/ftp repos for netboot
++ if ! [ -d "$dir" ]; then
++ continue
++ fi
+ local dev=$(df -P "$dir" | tail -1 | awk '{print $1}')
+ local mnt=$(find_mnt $dev $fstab)
+ if [ -n "$mnt" ]; then
+--
+2.16.1
+
diff --git a/system/mkinitfs/0001-nlplug-findfs-add-primitive-support-for-LUKS2-contai.patch b/system/mkinitfs/0001-nlplug-findfs-add-primitive-support-for-LUKS2-contai.patch
new file mode 100644
index 000000000..7681be46b
--- /dev/null
+++ b/system/mkinitfs/0001-nlplug-findfs-add-primitive-support-for-LUKS2-contai.patch
@@ -0,0 +1,31 @@
+From 15e312961e1bc86da98f2d3dc1d43331bd6f98f7 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
+Date: Sat, 20 Jan 2018 00:50:15 +0100
+Subject: [PATCH] nlplug-findfs: add primitive support for LUKS2 containers
+
+Since we previously specified an explicit request_type for the
+crypt_load() function nlplug-findfs couldn't open LUKS2 containers. By
+using CRYPT_LUKS crypt_load accepts any known LUKUS container format.
+
+We could add an additional command line flag to nlplug-finds for
+specifying the request_type but I guess this is good enough for now.
+---
+ nlplug-findfs.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/nlplug-findfs.c b/nlplug-findfs.c
+index be525cc..7fb5468 100644
+--- a/nlplug-findfs.c
++++ b/nlplug-findfs.c
+@@ -582,7 +582,7 @@ static void *cryptsetup_thread(void *data)
+ goto notify_out;
+ }
+
+- r = crypt_load(cd, CRYPT_LUKS1, params);
++ r = crypt_load(cd, CRYPT_LUKS, params);
+ if (r < 0) {
+ warnx("crypt_load(%s)", data_devnode);
+ goto free_out;
+--
+2.15.0
+
diff --git a/system/mkinitfs/0001-skip-hooks-on-diskless-install.patch b/system/mkinitfs/0001-skip-hooks-on-diskless-install.patch
new file mode 100644
index 000000000..a20ebc200
--- /dev/null
+++ b/system/mkinitfs/0001-skip-hooks-on-diskless-install.patch
@@ -0,0 +1,30 @@
+From 0bd97e8aef5208bc92c3e72049f7fea198a90bd1 Mon Sep 17 00:00:00 2001
+From: Henrik Riomar <henrik.riomar@gmail.com>
+Date: Mon, 8 Jan 2018 16:37:44 +0100
+Subject: [PATCH] skip hooks on diskless install
+
+We can not run hooks before musl and busybox is installed.
+
+Use the new flag --initramfs-diskless-boot in order to skip hooks.
+This flag also implies --initdb and the relevant --force flags for
+initramfs diskless boot.
+---
+ initramfs-init.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/initramfs-init.in b/initramfs-init.in
+index f3a3ee5..7c78c58 100755
+--- a/initramfs-init.in
++++ b/initramfs-init.in
+@@ -598,7 +598,7 @@ if [ "$KOPT_chart" = yes ]; then
+ pkgs="$pkgs acct"
+ fi
+
+-apkflags="--initdb --progress --force"
++apkflags="--initramfs-diskless-boot --progress"
+ if [ -z "$ALPINE_REPO" ]; then
+ apkflags="$apkflags --no-network"
+ else
+--
+2.15.0
+
diff --git a/system/mkinitfs/0002-initramfs-init-add-disk-and-network-detection-on-s39.patch b/system/mkinitfs/0002-initramfs-init-add-disk-and-network-detection-on-s39.patch
new file mode 100644
index 000000000..aef8293a1
--- /dev/null
+++ b/system/mkinitfs/0002-initramfs-init-add-disk-and-network-detection-on-s39.patch
@@ -0,0 +1,97 @@
+From 7f77e0b383330265be27f551b2e384a6a8648afa Mon Sep 17 00:00:00 2001
+From: "Tuan M. Hoang" <tmhoang@flatglobe.org>
+Date: Mon, 14 May 2018 10:14:29 -0500
+Subject: [PATCH 2/3] initramfs-init: add disk and network detection on s390x
+
+- Allow including dasd and qeth modules when building initramfs
+- Add detection for dasd and qeth devices from cmdline in init
+---
+ Makefile | 7 ++++++-
+ features.d/dasd_mod.modules | 1 +
+ features.d/qeth.modules | 1 +
+ initramfs-init.in | 21 ++++++++++++++++++++-
+ 4 files changed, 28 insertions(+), 2 deletions(-)
+ create mode 100644 features.d/dasd_mod.modules
+ create mode 100644 features.d/qeth.modules
+
+diff --git a/Makefile b/Makefile
+index fc01d1a..40dc284 100644
+--- a/Makefile
++++ b/Makefile
+@@ -48,7 +48,9 @@ CONF_FILES := mkinitfs.conf \
+ features.d/xfs.files \
+ features.d/xfs.modules \
+ features.d/zfs.files \
+- features.d/zfs.modules
++ features.d/zfs.modules \
++ features.d/qeth.modules \
++ features.d/dasd_mod.modules
+
+ SCRIPTS := mkinitfs bootchartd initramfs-init
+ IN_FILES := $(addsuffix .in,$(SCRIPTS))
+@@ -71,6 +73,9 @@ SED_REPLACE := -e 's:@VERSION@:$(FULL_VERSION):g' \
+ -e 's:@datadir@:$(datadir):g'
+
+ DEFAULT_FEATURES ?= ata base cdrom ext2 ext4 keymap kms mmc raid scsi usb virtio
++ifeq ($(shell uname -m), s390x)
++DEFAULT_FEATURES += qeth dasd_mod
++endif
+
+
+ all: $(SBIN_FILES) $(SCRIPTS) $(CONF_FILES)
+diff --git a/features.d/dasd_mod.modules b/features.d/dasd_mod.modules
+new file mode 100644
+index 0000000..ce843c5
+--- /dev/null
++++ b/features.d/dasd_mod.modules
+@@ -0,0 +1 @@
++kernel/drivers/s390/block/dasd*
+diff --git a/features.d/qeth.modules b/features.d/qeth.modules
+new file mode 100644
+index 0000000..bb5c320
+--- /dev/null
++++ b/features.d/qeth.modules
+@@ -0,0 +1 @@
++kernel/drivers/s390/net/qeth*
+diff --git a/initramfs-init.in b/initramfs-init.in
+index bf2d9bd..933c8c1 100755
+--- a/initramfs-init.in
++++ b/initramfs-init.in
+@@ -269,7 +269,7 @@ set -- $(cat /proc/cmdline)
+ myopts="alpine_dev autodetect autoraid chart cryptroot cryptdm cryptheader cryptoffset
+ cryptdiscards debug_init dma init_args keep_apk_new modules ovl_dev pkgs quiet
+ root_size root usbdelay ip alpine_repo apkovl alpine_start splash blacklist
+- overlaytmpfs rootfstype rootflags nbd resume"
++ overlaytmpfs rootfstype rootflags nbd resume s390x_net dasd"
+
+ for opt; do
+ case "$opt" in
+@@ -345,6 +345,25 @@ mount -t devpts -o gid=5,mode=0620,noexec,nosuid devpts /dev/pts
+ [ -d /dev/shm ] || mkdir /dev/shm
+ mount -t tmpfs -o nodev,nosuid,noexec shm /dev/shm
+
++if [ -n "$dasd" ]; then
++ for mod in dasd_mod dasd_eckd_mod dasd_fba_mod; do
++ modprobe $mod
++ done
++ for _dasd in $(echo "$dasd" | tr ',' ' ' ); do
++ echo 1 > /sys/bus/ccw/devices/"${_dasd%%:*}"/online
++ done
++fi
++
++if [ "${s390x_net%%,*}" = "qeth_l2" ]; then
++ for mod in qeth qeth_l2 qeth_l3; do
++ modprobe $mod
++ done
++ _channel="${s390x_net#*,}"
++ echo "$_channel" > /sys/bus/ccwgroup/drivers/qeth/group
++ echo 1 > /sys/bus/ccwgroup/drivers/qeth/"${_channel%%,*}"/layer2
++ echo 1 > /sys/bus/ccwgroup/drivers/qeth/"${_channel%%,*}"/online
++fi
++
+ # load available drivers to get access to modloop media
+ ebegin "Loading boot drivers"
+
+--
+2.17.0
+
diff --git a/system/mkinitfs/0003-initramfs-init-add-support-for-ssh-installer.patch b/system/mkinitfs/0003-initramfs-init-add-support-for-ssh-installer.patch
new file mode 100644
index 000000000..bcc4e0d49
--- /dev/null
+++ b/system/mkinitfs/0003-initramfs-init-add-support-for-ssh-installer.patch
@@ -0,0 +1,121 @@
+From 64be7028a529d940f81fda31a8e1dfa2281e4989 Mon Sep 17 00:00:00 2001
+From: "Tuan M. Hoang" <tmhoang@flatglobe.org>
+Date: Mon, 21 May 2018 11:54:44 +0000
+Subject: [PATCH 3/3] initramfs-init: add support for ssh installer
+
+This commit allows starting 'firstboot' service (see aports/openrc),
+which will setup installation through SSH if specified in kernel
+parameters.
+
+Real wget is used instead since busybox's wget is broken without
+openssl binary #8917. Credits to clandmeter.
+
+- Allow adding DNS server in configure_ip()
+- Prefix kernel parameters with KOPT_
+---
+ initramfs-init.in | 37 ++++++++++++++++++++++++++++++++-----
+ 1 file changed, 32 insertions(+), 5 deletions(-)
+
+diff --git a/initramfs-init.in b/initramfs-init.in
+index 933c8c1..f33f010 100755
+--- a/initramfs-init.in
++++ b/initramfs-init.in
+@@ -183,6 +183,8 @@ configure_ip() {
+ local netmask="$4"
+ local device="$6"
+ local autoconf="$7"
++ local dns1="$8"
++ local dns2="$9"
+ case "$client_ip" in
+ off|none|'') return;;
+ dhcp) autoconf="dhcp";;
+@@ -209,6 +211,8 @@ configure_ip() {
+ ebegin "Setting IP ($device)..."
+ ip_set "$device" "$client_ip" "$netmask" "$gw_ip"
+ eend $?
++ [ -n "$dns1" ] && echo "nameserver $dns1" >> /etc/resolv.conf
++ [ -n "$dns2" ] && echo "nameserver $dns2" >> /etc/resolv.conf
+ fi
+ MAC_ADDRESS=$(cat /sys/class/net/$device/address)
+ }
+@@ -262,6 +266,19 @@ setup_nbd() {
+ [ "$n" != 0 ] || return 1
+ }
+
++# possible cmdline options which could have secure urls.
++# this does not include apkovl as it need to be fetched inside of initramfs
++need_wget() {
++ local opt= ret=1
++ for opt in modloop ssh_key; do
++ eval "opt=\$KOPT_$opt"
++ case "$opt" in
++ https://*|ftps://*) ret=0;;
++ esac
++ done
++ return $ret
++}
++
+ # read the kernel options. we need surve things like:
+ # acpi_osi="!Windows 2006" xen-pciback.hide=(01:00.0)
+ set -- $(cat /proc/cmdline)
+@@ -269,7 +286,7 @@ set -- $(cat /proc/cmdline)
+ myopts="alpine_dev autodetect autoraid chart cryptroot cryptdm cryptheader cryptoffset
+ cryptdiscards debug_init dma init_args keep_apk_new modules ovl_dev pkgs quiet
+ root_size root usbdelay ip alpine_repo apkovl alpine_start splash blacklist
+- overlaytmpfs rootfstype rootflags nbd resume s390x_net dasd"
++ overlaytmpfs rootfstype rootflags nbd resume s390x_net dasd ssh_key ssh_pass"
+
+ for opt; do
+ case "$opt" in
+@@ -345,20 +362,20 @@ mount -t devpts -o gid=5,mode=0620,noexec,nosuid devpts /dev/pts
+ [ -d /dev/shm ] || mkdir /dev/shm
+ mount -t tmpfs -o nodev,nosuid,noexec shm /dev/shm
+
+-if [ -n "$dasd" ]; then
++if [ -n "$KOPT_dasd" ]; then
+ for mod in dasd_mod dasd_eckd_mod dasd_fba_mod; do
+ modprobe $mod
+ done
+- for _dasd in $(echo "$dasd" | tr ',' ' ' ); do
++ for _dasd in $(echo "$KOPT_dasd" | tr ',' ' ' ); do
+ echo 1 > /sys/bus/ccw/devices/"${_dasd%%:*}"/online
+ done
+ fi
+
+-if [ "${s390x_net%%,*}" = "qeth_l2" ]; then
++if [ "${KOPT_s390x_net%%,*}" = "qeth_l2" ]; then
+ for mod in qeth qeth_l2 qeth_l3; do
+ modprobe $mod
+ done
+- _channel="${s390x_net#*,}"
++ _channel="${KOPT_s390x_net#*,}"
+ echo "$_channel" > /sys/bus/ccwgroup/drivers/qeth/group
+ echo 1 > /sys/bus/ccwgroup/drivers/qeth/"${_channel%%,*}"/layer2
+ echo 1 > /sys/bus/ccwgroup/drivers/qeth/"${_channel%%,*}"/online
+@@ -540,6 +557,8 @@ if [ -f "$sysroot/etc/.default_boot_services" -o ! -f "$ovl" ]; then
+ rc_add killprocs shutdown
+ rc_add savecache shutdown
+
++ rc_add firstboot default
++
+ rm -f "$sysroot/etc/.default_boot_services"
+ fi
+
+@@ -622,6 +641,14 @@ if [ "$KOPT_chart" = yes ]; then
+ pkgs="$pkgs acct"
+ fi
+
++# add openssh
++if [ -n "$KOPT_ssh_key" ] || [ -n "$KOPT_ssh_pass" ]; then
++ pkgs="$pkgs openssh"
++fi
++
++# add wget if using secure urls in cmdline
++need_wget && pkgs="$pkgs wget"
++
+ apkflags="--initramfs-diskless-boot --progress"
+ if [ -z "$ALPINE_REPO" ]; then
+ apkflags="$apkflags --no-network"
+--
+2.17.0
+
diff --git a/system/mkinitfs/APKBUILD b/system/mkinitfs/APKBUILD
new file mode 100644
index 000000000..ecb51abeb
--- /dev/null
+++ b/system/mkinitfs/APKBUILD
@@ -0,0 +1,48 @@
+# Maintainer:
+pkgname=mkinitfs
+pkgver=3.2.0
+_ver=${pkgver%_git*}
+pkgrel=14
+pkgdesc="Tool to generate initramfs images for Alpine"
+url="https://git.alpinelinux.org/cgit/mkinitfs"
+arch="all"
+license="GPL-2.0"
+# currently we do not ship any testsuite
+options="!check"
+makedepends_build=""
+makedepends_host="busybox kmod-dev util-linux-dev cryptsetup-dev linux-headers"
+makedepends="$makedepends_build $makedepends_host"
+depends="busybox>=1.28.2-r1 apk-tools>=2.9.1 lddtree>=1.25"
+install="$pkgname.pre-upgrade $pkgname.post-install $pkgname.post-upgrade"
+triggers="$pkgname.trigger=/usr/share/kernel/*"
+source="http://dev.alpinelinux.org/archive/$pkgname/$pkgname-$_ver.tar.xz
+ 0001-skip-hooks-on-diskless-install.patch
+ 0001-nlplug-findfs-add-primitive-support-for-LUKS2-contai.patch
+ 0001-initramfs-do-not-relocate-mountpoint-for-netboot.patch
+ 0001-features-add-virtio_net-to-network-modules.patch
+ 0001-features-virtio_net-depends-on-virtio_pci.patch
+ 0001-generate-mkinitfs.conf.patch
+ 0002-initramfs-init-add-disk-and-network-detection-on-s39.patch
+ 0003-initramfs-init-add-support-for-ssh-installer.patch
+ "
+builddir="$srcdir/$pkgname-$_ver"
+
+build() {
+ cd "$builddir"
+ make VERSION=$pkgver-r$pkgrel
+}
+
+package() {
+ cd "$builddir"
+ make install DESTDIR="$pkgdir"
+}
+
+sha512sums="906bfbce677d4ece9c9fea7b2a529121740bc9d96ea011be083303cc5c56162f09271b0a673e9e335234ccf2f293109bda1eda333698a95357d0772c86f498af mkinitfs-3.2.0.tar.xz
+f5c9b21e53c663dac1b8f33f929dbe067492f0dc1bd5ef5310ef531033f31fc3fa0b6de6dce03cecaf90b8ed47b278d0f1f7c64dbbeede7621c895ee3ea79864 0001-skip-hooks-on-diskless-install.patch
+4d298d73cc6e557c51de805721ef4b9f002498af5dd9f0aebfd6620ec84d1fadde76888bc2d40efc71dc0a8497aa0586ac65d596eb0021bfed633adcc3aca3b4 0001-nlplug-findfs-add-primitive-support-for-LUKS2-contai.patch
+4387357cfcd3441c5d8777e42c0e62a73fa446aacd2faac081947afc39bdd8fb91e12b34f3b69a6827bd7d0705f54514b77c0ff4c38ee0d70553050117c42576 0001-initramfs-do-not-relocate-mountpoint-for-netboot.patch
+530a33638e7ba1faceed9a5cb0a2e08bec5d29d160a99730b7a2fb6c98f93a511908df8ab14cc47884397c9affee899a23896aab1c6c9073015ce077cc16552f 0001-features-add-virtio_net-to-network-modules.patch
+e5a6a25ea51b0ef16f525af20f8e44e64f5c4bb56f46b220151fc03cfa2c530ec55e2755a5dca766f9dad467815b5949bd22e029bcda89fbcef0d40bb3fd1a0f 0001-features-virtio_net-depends-on-virtio_pci.patch
+3dfc39cf9c97ed63869b7d36f9c666b6d4d2250240ed64a6e827056e4fc0ed2d2cb03f63772761404e745fa57e8ea2e3157107c323866fa8f32f7195c0555770 0001-generate-mkinitfs.conf.patch
+92ef3fb695aa060ff4d7c682eead8eae0065c4e28dc155d233cfdbd6b7ac55d1d5ba0258e3f48fb47512acd8594a893c809c5b93ad7715c99a1697331c27491d 0002-initramfs-init-add-disk-and-network-detection-on-s39.patch
+64840c34d91549c6e68a22a6eb0093d84a53a78ebbe3f12287e0ccb0fabbb1bb7829ca246522e0bdfdb45c32b0afb598447dfc688f261911c3d1d48d55f05503 0003-initramfs-init-add-support-for-ssh-installer.patch"
diff --git a/system/mkinitfs/mkinitfs.post-install b/system/mkinitfs/mkinitfs.post-install
new file mode 100644
index 000000000..a2a404b09
--- /dev/null
+++ b/system/mkinitfs/mkinitfs.post-install
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+# safety. if nlplug-findfs is missing in the initramfs image we may end up
+# with an unbootable system.
+
+if ! grep -q -w /sbin/nlplug-findfs /etc/mkinitfs/features.d/base.files; then
+ echo "/sbin/nlplug-findfs" >> /etc/mkinitfs/features.d/base.files
+fi
diff --git a/system/mkinitfs/mkinitfs.post-upgrade b/system/mkinitfs/mkinitfs.post-upgrade
new file mode 120000
index 000000000..78caf2e57
--- /dev/null
+++ b/system/mkinitfs/mkinitfs.post-upgrade
@@ -0,0 +1 @@
+mkinitfs.post-install \ No newline at end of file
diff --git a/system/mkinitfs/mkinitfs.pre-upgrade b/system/mkinitfs/mkinitfs.pre-upgrade
new file mode 100644
index 000000000..0ece527f9
--- /dev/null
+++ b/system/mkinitfs/mkinitfs.pre-upgrade
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+mkdir -p /etc/mkinitfs/features.d
+for i in files modules; do
+ for j in /etc/mkinitfs/$i.d/*; do
+ [ -e "$j" ] || continue
+ case "$j" in
+ *.apk-new) continue;;
+ esac
+ mv $j /etc/mkinitfs/features.d/${j##*/}.$i
+ done
+done
+exit 0
diff --git a/system/mkinitfs/mkinitfs.trigger b/system/mkinitfs/mkinitfs.trigger
new file mode 100644
index 000000000..e8acc9785
--- /dev/null
+++ b/system/mkinitfs/mkinitfs.trigger
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+for i in "$@"; do
+ # get last element in path
+ flavor=${i##*/}
+ if ! [ -f "$i"/kernel.release ]; then
+ # kernel was uninstalled
+ rm -f $( readlink -f /boot/initramfs-$flavor ) \
+ /boot/initramfs-$flavor /boot/vmlinuz-$flavor \
+ /boot/$flavor /boot/$flavor.gz /$flavor /$flavor.gz
+ continue
+ fi
+ abi_release=$(cat "$i"/kernel.release)
+ initfs=initramfs-$flavor
+ mkinitfs -o /boot/$initfs $abi_release
+done
+
+# extlinux will use path relative partition, so if /boot is on a
+# separate partition we want /boot/<kernel> resolve to /<kernel>
+if ! [ -e /boot/boot ]; then
+ ln -sf . /boot/boot
+fi
+
+# cleanup unused initramfs
+for i in /boot/initramfs-[0-9]*; do
+ [ -f $i ] || continue
+ if ! [ -f /boot/vmlinuz-${i#/boot/initramfs-} ]; then
+ rm "$i"
+ fi
+done
+
+sync
+exit 0
diff --git a/system/parted/APKBUILD b/system/parted/APKBUILD
new file mode 100644
index 000000000..0a4680a60
--- /dev/null
+++ b/system/parted/APKBUILD
@@ -0,0 +1,60 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=parted
+pkgver=3.2
+pkgrel=7
+pkgdesc="Utility to create, destroy, resize, check and copy partitions"
+url="http://www.gnu.org/software/parted/parted.html"
+arch="all"
+license="GPL3"
+subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
+depends=
+makedepends="readline-dev ncurses-dev lvm2-dev bash util-linux-dev gettext-dev autoconf automake"
+checkdepends="check-dev python3"
+options="!checkroot"
+source="ftp://ftp.gnu.org/pub/gnu/$pkgname/$pkgname-$pkgver.tar.xz
+ disable-two-tests.patch
+ fix-includes.patch
+ fix-libintl-header-s390x.patch
+ tests-call-name-correctly.patch
+ tests-python3.patch
+ "
+
+builddir="$srcdir"/$pkgname-$pkgver
+
+prepare() {
+ cd "$builddir"
+ default_prepare
+ autoreconf
+}
+
+build() {
+ cd "$builddir"
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --disable-debug \
+ --disable-static \
+ --enable-shared \
+ --enable-device-mapper \
+ --with-readline
+ make
+}
+
+check() {
+ cd "$builddir"
+ make check
+}
+
+package() {
+ cd "$builddir"
+ make DESTDIR="$pkgdir" install
+ rm -rf "$pkgdir"/usr/lib/charset.alias
+ rmdir -p "$pkgdir"/usr/lib 2>/dev/null || true
+}
+sha512sums="4e37dbdd6f5032c9ebfec43704f6882379597d038167b9c4d04053efa083c68a705196713864451fa9e11d32777e16c68982877945c5efd9ea5f8252cb20e1c4 parted-3.2.tar.xz
+b49eb0211c405a4ef69e1bb0079621c22fec4adf0309f0a58b5d881540913de01d05ccd3eb521f35c3cf6f4eb8aa0f4c5270ce3dea47270a5c3fe8fae635c6f0 disable-two-tests.patch
+55ee63c218d1867c0f2c596e7c3eec5c42af160181456cc551fe3d432eabed0ac2dd3a3955ff0c375f76aeec8071e7f55a32834b87a0d39b8ef30361f671bfdd fix-includes.patch
+444a7e2fb3235dfd218f6b71fb25adde107d001f638d988ee1fa79686d8efee94a9499e27bdfdd75f9718760b448938b70a90a74285b93a39338d21f4ab4c9dc fix-libintl-header-s390x.patch
+8bd86d2b0401566e7757c43d849b7f913cc4ec1bf50d5641dc72d7e278ca38db2ac746cd8dcc756b245021ea1f9738875b6a831f05185b9217d3f1c287944748 tests-call-name-correctly.patch
+7486f98d535380a9e6598b9ac6153564319d5effa25456dc393cf3540ea47ac5b462be79cbd7d8efbd1fc2d2ef240a00873a2e2b138d4b4b0bb1494893de1eac tests-python3.patch"
diff --git a/system/parted/disable-two-tests.patch b/system/parted/disable-two-tests.patch
new file mode 100644
index 000000000..a6481dde3
--- /dev/null
+++ b/system/parted/disable-two-tests.patch
@@ -0,0 +1,16 @@
+These tests do not appear to work right upstream. Disable for now.
+
+--- parted-3.2/tests/Makefile.am.old 2014-06-15 19:15:54.000000000 +0000
++++ parted-3.2/tests/Makefile.am 2017-08-19 19:44:28.886245388 +0000
+@@ -24,11 +24,9 @@
+ t0209-gpt-pmbr_boot.sh \
+ t0210-gpt-resized-partition-entry-array.sh \
+ t0211-gpt-rewrite-header.sh \
+- t0212-gpt-many-partitions.sh \
+ t0220-gpt-msftres.sh \
+ t0250-gpt.sh \
+ t0251-gpt-unicode.sh \
+- t0280-gpt-corrupt.sh \
+ t0281-gpt-grow.sh \
+ t0282-gpt-move-backup.sh \
+ t0283-overlap-partitions.sh \
diff --git a/system/parted/fix-includes.patch b/system/parted/fix-includes.patch
new file mode 100644
index 000000000..c6eff0eb2
--- /dev/null
+++ b/system/parted/fix-includes.patch
@@ -0,0 +1,10 @@
+--- parted-3.1.orig/libparted/fs/xfs/platform_defs.h
++++ parted-3.1/libparted/fs/xfs/platform_defs.h
+@@ -35,6 +35,7 @@
+ #define __XFS_PLATFORM_DEFS_H__
+
+ #include <stdio.h>
++#include <fcntl.h>
+ #include <stdarg.h>
+ #include <assert.h>
+ #include <endian.h>
diff --git a/system/parted/fix-libintl-header-s390x.patch b/system/parted/fix-libintl-header-s390x.patch
new file mode 100644
index 000000000..68ae7d270
--- /dev/null
+++ b/system/parted/fix-libintl-header-s390x.patch
@@ -0,0 +1,58 @@
+From 4b2a566a3e007184d3ee9ce5b399a63eebbdadc3 Mon Sep 17 00:00:00 2001
+From: "Tuan M. Hoang" <tmhoang@flatglobe.org>
+Date: Thu, 23 Feb 2017 07:53:02 +0000
+Subject: [PATCH] main/parted: disable nls on s390x
+
+Because we build with --disable-nls by default, we need to remove libintl.h in
+these files on s390x. This is specific for DASD devices only on s390x.
+---
+ libparted/labels/dasd.c | 2 +-
+ libparted/labels/fdasd.c | 2 +-
+ libparted/labels/vtoc.c | 2 +-
+ 3 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c
+index fa9414f..5acf844 100644
+--- a/libparted/labels/dasd.c
++++ b/libparted/labels/dasd.c
+@@ -40,8 +40,8 @@
+ #include <parted/fdasd.h>
+ #include <arch/linux.h>
+
+-#include <libintl.h>
+ #if ENABLE_NLS
++# include <libintl.h>
+ # define _(String) dgettext (PACKAGE, String)
+ #else
+ # define _(String) (String)
+diff --git a/libparted/labels/fdasd.c b/libparted/labels/fdasd.c
+index 1f87937..e6a9086 100644
+--- a/libparted/labels/fdasd.c
++++ b/libparted/labels/fdasd.c
+@@ -24,8 +24,8 @@
+
+ #include <parted/parted.h>
+
+-#include <libintl.h>
+ #if ENABLE_NLS
++# include <libintl.h>
+ # define _(String) dgettext (PACKAGE, String)
+ #else
+ # define _(String) (String)
+diff --git a/libparted/labels/vtoc.c b/libparted/labels/vtoc.c
+index fdfa94f..64ba149 100644
+--- a/libparted/labels/vtoc.c
++++ b/libparted/labels/vtoc.c
+@@ -12,8 +12,8 @@
+
+ #include <parted/parted.h>
+
+-#include <libintl.h>
+ #if ENABLE_NLS
++# include <libintl.h>
+ # define _(String) dgettext (PACKAGE, String)
+ #else
+ # define _(String) (String)
+--
+2.11.1
+
diff --git a/system/parted/tests-call-name-correctly.patch b/system/parted/tests-call-name-correctly.patch
new file mode 100644
index 000000000..27a6287e8
--- /dev/null
+++ b/system/parted/tests-call-name-correctly.patch
@@ -0,0 +1,42 @@
+mkpart syntax recently changed, tests do not reflect that.
+
+--- parted-3.2/tests/t5000-tags.sh.old 2014-06-15 18:17:43.000000000 +0000
++++ parted-3.2/tests/t5000-tags.sh 2017-08-19 18:55:03.207451920 +0000
+@@ -48,7 +48,7 @@
+ compare exp out || fail=1
+
+ # add a partition
+-parted -s $dev u s mkpart name1 ${start_sector} ${end_sector} >out 2>&1 \
++parted -s $dev u s mkpart primary ${start_sector} ${end_sector} name 1 name1 >out 2>&1 \
+ || fail=1
+
+ # print the table before modification
+--- parted-3.2/tests/t0208-mkpart-end-in-IEC.sh.old 2014-06-15 18:17:43.000000000 +0000
++++ parted-3.2/tests/t0208-mkpart-end-in-IEC.sh 2017-08-19 20:05:19.650875813 +0000
+@@ -25,22 +25,22 @@
+
+ dd if=/dev/null of=$dev bs=1M seek=$n_mbs || fail=1
+ # create 1st partition
+-parted --align=none -s $dev mklabel gpt mkpart p1 1MiB 2MiB > err 2>&1 || fail=1
++parted --align=none -s $dev mklabel gpt mkpart primary 1MiB 2MiB name 1 p1 > err 2>&1 || fail=1
+ compare /dev/null err || fail=1 # expect no output
+ #parted -m -s $dev u s p > exp || fail=1
+
+ # create 2nd partition - they should not overlap
+ # this time specify default unit
+-parted --align=none -s $dev unit MiB mkpart p2 2 3 > err 2>&1 || fail=1
++parted --align=none -s $dev unit MiB mkpart primary 2 3 name 2 p2 > err 2>&1 || fail=1
+ compare /dev/null err || fail=1 # expect no output
+
+ # create 3rd partition - expect no overlap
+ # specify default unit, but explicitly override it
+-parted --align=none -s $dev unit TB mkpart p3 3MiB 4MiB > err 2>&1 || fail=1
++parted --align=none -s $dev unit TB mkpart primary 3MiB 4MiB name 3 p3 > err 2>&1 || fail=1
+ compare /dev/null err || fail=1 # expect no output
+
+ # Specify default unit of MiB, yet use explicit ending sector number.
+-parted --align=none -s $dev unit MiB mkpart p4 4MiB 10239s > err 2>&1 || fail=1
++parted --align=none -s $dev unit MiB mkpart primary 4MiB 10239s name 4 p4 > err 2>&1 || fail=1
+ compare /dev/null err || fail=1 # expect no output
+
+ # check boundaries of the partitions
diff --git a/system/parted/tests-python3.patch b/system/parted/tests-python3.patch
new file mode 100644
index 000000000..8811b7237
--- /dev/null
+++ b/system/parted/tests-python3.patch
@@ -0,0 +1,68 @@
+--- parted-3.2/tests/gpt-header-move.old 2014-06-15 18:27:30.000000000 +0000
++++ parted-3.2/tests/gpt-header-move 2017-08-19 20:47:02.443283140 +0000
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/env python3
+
+ # open img file, subtract 33 from altlba address, and move the last 33 sectors
+ # back by 33 sectors
+@@ -11,12 +11,12 @@
+ file.seek(512)
+ gptheader = file.read(512)
+ altlba = unpack_from('<q', gptheader,offset=32)[0]
+-gptheader = array.array('c',gptheader)
++gptheader = array.array('B',gptheader)
+ pack_into('<Q', gptheader, 32, altlba-33)
+ #zero header crc
+ pack_into('<L', gptheader, 16, 0)
+ #compute new crc
+-newcrc = ((crc32(buffer(gptheader,0,92))) & 0xFFFFFFFF)
++newcrc = ((crc32(memoryview(gptheader[0:92]))) & 0xFFFFFFFF)
+ pack_into('<L', gptheader, 16, newcrc)
+ file.seek(512)
+ file.write(gptheader)
+@@ -25,7 +25,7 @@
+ file.seek(512*(altlba-32))
+ backup = file.read(512*32)
+ altlba -= 33
+-gptheader = array.array('c',gptheader)
++gptheader = array.array('B',gptheader)
+ #update mylba
+ pack_into('<Q', gptheader, 24, altlba)
+ #update table lba
+@@ -33,7 +33,7 @@
+ #zero header crc
+ pack_into('<L', gptheader, 16, 0)
+ #compute new crc
+-newcrc = ((crc32(buffer(gptheader,0,92))) & 0xFFFFFFFF)
++newcrc = ((crc32(memoryview(gptheader[0:92]))) & 0xFFFFFFFF)
+ pack_into('<L', gptheader, 16, newcrc)
+ file.seek(512*(altlba-32))
+ file.write(backup)
+@@ -38,4 +38,4 @@
+ file.seek(512*(altlba-32))
+ file.write(backup)
+ file.write(gptheader)
+-file.write("\0" * (512 * 33))
++file.write(b"\0" * (512 * 33))
+--- parted-3.2/tests/msdos-overlap.old 2014-06-15 18:27:30.000000000 +0000
++++ parted-3.2/tests/msdos-overlap 2017-08-19 20:48:16.279847771 +0000
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/env python3
+ """
+ Write an overlapping partition to a msdos disk
+
+@@ -14,10 +14,10 @@
+ OFFSET = 0x1b8
+
+ if len(sys.argv) < 2:
+- print "%s: <image or device>"
++ print("%s: <image or device>")
+ sys.exit(1)
+
+-data = "".join(chr(c) for c in BAD_ENTRY)
++data = bytearray(BAD_ENTRY)
+ with open(sys.argv[1], "rb+") as f:
+ f.seek(OFFSET, 0)
+ f.write(data)
diff --git a/system/pcre/APKBUILD b/system/pcre/APKBUILD
new file mode 100644
index 000000000..43ac2a9d6
--- /dev/null
+++ b/system/pcre/APKBUILD
@@ -0,0 +1,90 @@
+# Contributor: Sergei Lukin <sergej.lukin@gmail.com>
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=pcre
+pkgver=8.41
+pkgrel=1
+pkgdesc="Perl-compatible regular expression library"
+url="http://pcre.sourceforge.net"
+arch="all"
+license="BSD"
+depends=
+makedepends=""
+checkdepends="paxmark"
+subpackages="$pkgname-dev $pkgname-doc $pkgname-tools
+ libpcrecpp libpcre16 libpcre32"
+source="ftp://ftp.csx.cam.ac.uk/pub/software/programming/$pkgname/$pkgname-$pkgver.tar.bz2
+ "
+
+# secfixes:
+# 8.40-r2:
+# - CVE-2017-7186
+# 7.8-r0:
+# - CVE-2017-11164
+
+builddir="$srcdir/$pkgname-$pkgver"
+
+build() {
+ cd "$builddir"
+ ([ "$CARCH" = "s390x" ] || [ "$CARCH" = "ppc64" ]) && _enable_jit="" || _enable_jit="--enable-jit"
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ $_enable_jit \
+ --enable-utf8 \
+ --enable-unicode-properties \
+ --enable-pcre8 \
+ --enable-pcre16 \
+ --enable-pcre32 \
+ --with-match-limit-recursion=8192 \
+ --htmldir=/usr/share/doc/$pkgname-$pkgver/html \
+ --docdir=/usr/share/doc/$pkgname-$pkgver
+
+ make
+}
+
+package() {
+ cd "$builddir"
+ make DESTDIR="$pkgdir" install
+}
+
+check() {
+ cd "$builddir"
+
+ # paxmark tests requiring JIT
+ for fn in pcre_jit_test pcretest; do
+ ./$fn &>/dev/null < /dev/null || true
+ [ -x .libs/lt-$fn ] && paxmark -m .libs/lt-$fn
+ done
+
+ # skip locale specific tests
+ sed -i -e 's/do3=yes//g' RunTest
+
+ make check
+}
+
+libpcrecpp() {
+ pkgdesc="C++ bindings for PCRE"
+ mkdir -p "$subpkgdir"/usr/lib
+ mv "$pkgdir"/usr/lib/libpcrecpp.so* "$subpkgdir"/usr/lib/
+}
+
+libpcre16() {
+ pkgdesc="PCRE with 16 bit character support"
+ mkdir -p "$subpkgdir"/usr/lib
+ mv "$pkgdir"/usr/lib/libpcre16.so* "$subpkgdir"/usr/lib/
+}
+
+libpcre32() {
+ pkgdesc="PCRE with 32 bit character support"
+ mkdir -p "$subpkgdir"/usr/lib
+ mv "$pkgdir"/usr/lib/libpcre32.so* "$subpkgdir"/usr/lib/
+}
+
+tools() {
+ pkgdesc="Auxiliary utilities for PCRE"
+ mkdir -p "$subpkgdir"/usr/
+ mv "$pkgdir"/usr/bin "$subpkgdir"/usr/
+}
+
+sha512sums="cc9cdbeb98c010fe4f093a019bebfb91965dae4c6a48f8e49c38ec8df7d9da7f0d32c12fc58f22c51f1c2f010e72b65bcbf8bbf180060e93edf464fa9a7c3551 pcre-8.41.tar.bz2"
diff --git a/system/pcre2/APKBUILD b/system/pcre2/APKBUILD
new file mode 100644
index 000000000..d06c4b22c
--- /dev/null
+++ b/system/pcre2/APKBUILD
@@ -0,0 +1,88 @@
+# Contributor: Jakub Jirutka <jakub@jirutka.cz>
+# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
+pkgname=pcre2
+pkgver=10.30
+pkgrel=1
+pkgdesc="Perl-compatible regular expression library"
+url="http://pcre.sourceforge.net/"
+arch="all"
+license="BSD"
+depends=""
+depends_dev="libedit-dev zlib-dev"
+makedepends="$depends_dev paxmark"
+subpackages="$pkgname-dev $pkgname-doc $pkgname-tools
+ libpcre2-16:_libpcre libpcre2-32:_libpcre"
+source="ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/$pkgname-$pkgver.tar.gz"
+builddir="$srcdir/$pkgname-$pkgver"
+
+case "$CARCH" in
+ s390x) _enable_jit="";;
+ ppc64) _enable_jit="";;
+ pmmx) _enable_jit="";; # maybe someday fix sse2 detection
+ *) _enable_jit="--enable-jit";;
+esac
+
+build() {
+ cd "$builddir"
+
+ # Note: Forced -O3 is recommended (needed?) for Julia.
+ ./configure \
+ CFLAGS="$CFLAGS -O3" \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --docdir=/usr/share/doc/$pkgname-$pkgver \
+ --htmldir=/usr/share/doc/$pkgname-$pkgver/html \
+ --enable-pcre2-16 \
+ --enable-pcre2-32 \
+ --enable-pcre2grep-libz \
+ --enable-pcre2test-libedit \
+ --with-match-limit-recursion=8192 \
+ $_enable_jit
+ make
+}
+
+# Note: RunTest and pcre2_jit_test generates some binaries in .libs that needs
+# to disable MPROTECT on grsecurity kernel. That's why it's so complicated...
+check() {
+ cd "$builddir"
+
+ local is_pax=$(grep -q PaX /proc/$$/status && echo 'yes' || echo 'no')
+
+ if [ "$is_pax" = yes ]; then
+ timeout -t 1 -s KILL ./RunTest 2>/dev/null || true
+ find .libs -type f ! -name 'lib*' | xargs paxmark m
+ fi
+ ./RunTest
+
+ if [ -n "$_enable_jit" ]; then
+ if [ "$is_pax" = yes ]; then
+ timeout -t 1 -s KILL ./pcre2_jit_test >/dev/null || true
+ find .libs -type f ! -name 'lib*' | xargs paxmark m
+ fi
+ ./pcre2_jit_test
+ fi
+}
+
+package() {
+ cd "$builddir"
+
+ make DESTDIR="$pkgdir" install
+}
+
+_libpcre() {
+ local bits="${subpkgname##*-}"
+ pkgdesc="PCRE2 with $bits bit character support"
+
+ mkdir -p "$subpkgdir"/usr/lib
+ mv "$pkgdir"/usr/lib/libpcre2-$bits.so* "$subpkgdir"/usr/lib/
+}
+
+tools() {
+ pkgdesc="Auxiliary utilities for PCRE2"
+
+ mkdir -p "$subpkgdir"/usr/
+ mv "$pkgdir"/usr/bin "$subpkgdir"/usr/
+}
+
+sha512sums="af6c7cd8e25ec1ed538c89808b144a508ee6f5ca08134f04119e4786d69643bea99bec3c9527d201cec47ba52032d55ad7692b448b4696d68fd4ed1081dbaa62 pcre2-10.30.tar.gz"
diff --git a/system/polkit/0001-Bug-50145-make-netgroup-support-optional.patch b/system/polkit/0001-Bug-50145-make-netgroup-support-optional.patch
deleted file mode 100644
index 1498e831a..000000000
--- a/system/polkit/0001-Bug-50145-make-netgroup-support-optional.patch
+++ /dev/null
@@ -1,108 +0,0 @@
-From 2428beec9189bb93e6e1fdd5bdde35acf5279a03 Mon Sep 17 00:00:00 2001
-From: Natanael Copa <ncopa@alpinelinux.org>
-Date: Sun, 20 May 2012 15:42:56 +0200
-Subject: [PATCH] Bug 50145 - make netgroup support optional
-
-https://bugs.freedesktop.org/show_bug.cgi?id=50145
-
-netgroups are not defined in POSIX and are not be available on
-all systems.
-
-We check for getnetgrent in configure script.
-
-Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
----
- configure.ac | 2 +-
- src/polkitbackend/polkitbackendlocalauthority.c | 8 ++++++--
- src/polkitbackend/polkitbackendlocalauthorizationstore.c | 3 ++-
- 3 files changed, 9 insertions(+), 4 deletions(-)
-
-diff --git a/configure.ac b/configure.ac
-index f325922..711aa7c 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -141,7 +141,7 @@ AC_CHECK_LIB(expat,XML_ParserCreate,[EXPAT_LIBS="-lexpat"],
- [AC_MSG_ERROR([Can't find expat library. Please install expat.])])
- AC_SUBST(EXPAT_LIBS)
-
--AC_CHECK_FUNCS(clearenv)
-+AC_CHECK_FUNCS(clearenv getnetgrent)
-
- if test "x$GCC" = "xyes"; then
- LDFLAGS="-Wl,--as-needed $LDFLAGS"
-diff --git a/src/polkitbackend/polkitbackendlocalauthority.c b/src/polkitbackend/polkitbackendlocalauthority.c
-index b53eda3..f14e924 100644
---- a/src/polkitbackend/polkitbackendlocalauthority.c
-+++ b/src/polkitbackend/polkitbackendlocalauthority.c
-@@ -52,9 +52,10 @@
-
- static GList *get_users_in_group (PolkitIdentity *group,
- gboolean include_root);
--
-+#if defined HAVE_GETNETGRENT
- static GList *get_users_in_net_group (PolkitIdentity *group,
- gboolean include_root);
-+#endif
-
- static GList *get_groups_for_user (PolkitIdentity *user);
-
-@@ -511,10 +512,12 @@ polkit_backend_local_authority_get_admin_auth_identities (PolkitBackendInteracti
- {
- ret = g_list_concat (ret, get_users_in_group (identity, FALSE));
- }
-+#if defined HAVE_GETNETGRENT
- else if (POLKIT_IS_UNIX_NETGROUP (identity))
- {
- ret = g_list_concat (ret, get_users_in_net_group (identity, FALSE));
- }
-+#endif
- else
- {
- g_warning ("Unsupported identity %s", admin_identities[n]);
-@@ -690,6 +693,7 @@ get_users_in_group (PolkitIdentity *group,
- return ret;
- }
-
-+#if defined HAVE_GETNETGRENT
- static GList *
- get_users_in_net_group (PolkitIdentity *group,
- gboolean include_root)
-@@ -741,7 +745,7 @@ get_users_in_net_group (PolkitIdentity *group,
- endnetgrent ();
- return ret;
- }
--
-+#endif
-
- static GList *
- get_groups_for_user (PolkitIdentity *user)
-diff --git a/src/polkitbackend/polkitbackendlocalauthorizationstore.c b/src/polkitbackend/polkitbackendlocalauthorizationstore.c
-index 2ddfe75..02553c4 100644
---- a/src/polkitbackend/polkitbackendlocalauthorizationstore.c
-+++ b/src/polkitbackend/polkitbackendlocalauthorizationstore.c
-@@ -725,6 +725,7 @@ polkit_backend_local_authorization_store_lookup (PolkitBackendLocalAuthorization
- break;
- }
-
-+#if defined HAVE_GETNETGRENT
- /* if no identity specs matched and identity is a user, match against netgroups */
- if (ll == NULL && POLKIT_IS_UNIX_USER (identity))
- {
-@@ -732,13 +733,13 @@ polkit_backend_local_authorization_store_lookup (PolkitBackendLocalAuthorization
- const gchar *user_name = polkit_unix_user_get_name (user_identity);
- if (!user_name)
- continue;
--
- for (ll = authorization->netgroup_identities; ll != NULL; ll = ll->next)
- {
- if (innetgr ((const gchar *) ll->data, NULL, user_name, NULL))
- break;
- }
- }
-+#endif
-
- if (ll == NULL)
- continue;
---
-1.7.10.2
-
diff --git a/system/polkit/APKBUILD b/system/polkit/APKBUILD
deleted file mode 100644
index fdc37d634..000000000
--- a/system/polkit/APKBUILD
+++ /dev/null
@@ -1,80 +0,0 @@
-# Contributor: Carlo Landmeter
-# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
-pkgname=polkit
-pkgver=0.105
-pkgrel=8
-pkgdesc="Application development toolkit for controlling system-wide privileges"
-url="http://www.freedesktop.org/wiki/Software/polkit/"
-arch="all"
-license="LGPL"
-depends=
-options="suid"
-depends_dev="eggdbus-dev dbus-glib-dev linux-pam-dev"
-makedepends="$depends_dev expat-dev glib-dev gtk-doc gobject-introspection-dev
- intltool autoconf automake libtool"
-install=
-subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
-source="http://www.freedesktop.org/software/polkit/releases/polkit-$pkgver.tar.gz
- 0001-Bug-50145-make-netgroup-support-optional.patch
- CVE-2013-4288.patch
- CVE-2015-3218.patch
- CVE-2015-3255.patch
- CVE-2015-4625.patch
- automake.patch
- fix-parallel-make.patch
- fix-consolekit-db-stat.patch
- fix-test-fgetpwent.patch
- disable-ck-test.patch
-"
-
-prepare() {
- cd "$builddir"
- update_config_sub
- default_prepare
- libtoolize --force && aclocal && autoconf && automake --add-missing
-}
-
-build() {
- cd "$builddir"
- ./configure \
- --build=$CBUILD \
- --host=$CHOST \
- --prefix=/usr \
- --sysconfdir=/etc \
- --mandir=/usr/share/man \
- --infodir=/usr/share/info \
- --libexecdir=/usr/lib/polkit-1 \
- --localstatedir=/var \
- --disable-static \
- --enable-nls \
- --enable-introspection \
- --with-os-type=alpine \
- --with-pam-include=base-auth \
- --disable-gtk-doc \
- --disable-gtk-doc-html \
- --disable-gtk-doc-pdf
-
- make
-}
-
-check() {
- cd "$builddir"
- make check
-}
-
-package() {
- cd "$builddir"
- make DESTDIR="$pkgdir" install
-}
-
-sha512sums="7c0f84b9639814b4690e42b570285ff2018a5ea4cfd7216d9abf44c84ece6592c530f2d6211511c1346963daf4f135e9fa79d1b2f592b454115950991b5e4bc3 polkit-0.105.tar.gz
-09ca9c14044c0a281e9069919efbb6d14918f23f58a282b5ce25c8a6640966396904373822869fe994c711f40c33d5c34cf3b77f85a59e239ba3d0c22a31ca8e 0001-Bug-50145-make-netgroup-support-optional.patch
-d6de3beb063243c11906f525ef2eb65aeca823c25b1f44dde4a16f4fc2c5ce587b129e0bfb25a4a4b88ac2bf5713c47e57700c139323d961c9f9b6ba4c03fffb CVE-2013-4288.patch
-625be61ca38267508bb360002c410414f7ca814487f4a51257906118731e208be0c90d21f45ac90fd9f64f2f5937fa1e312d6900179853fabbaaf5e75073c82c CVE-2015-3218.patch
-0b26b819da0b34f10ff8a768850560b3207a6e10a7141bd1aa4769c1cb2829eb110164974b99d993d4e3a62145ace0fc5375489f84d2b56fe08e3430e3232aa8 CVE-2015-3255.patch
-32ecc38db938fc1e3d14ffd9c492d12a42a91750e0eb1f66f8346d0cefd6e18fd0dffac8bffc65578cfb56c9598d3b336721477e8496de2619d6d69f1a6b309e CVE-2015-4625.patch
-25465a23332247d0873e24cb5f011a267413615526755a8295a6367d64fc5eb8c2aa3c9c1fdcfa183b39e3ece14f33b25f15a339d966a31f3feb861b3f17adbf automake.patch
-6b0d9262ba8b3c000acdcc8c86bd6fc043e5750a0155730638d4e3a92e63f43cb476d63b11856c041d60d8f38f7eb5ada0eb0eced9100bdac3bc2c7dd5108ddd fix-parallel-make.patch
-95493ef842b46ce9e724933a5d86083589075fb452435057b8f629643cac7c7eff67a24fd188087987e98057f0130757fad546d0c090767da3d71ebaf8485a24 fix-consolekit-db-stat.patch
-966825aded565432f4fda9e54113a773b514ebf7ee7faa83bcb8b97d218ae84a8707d6747bbc3cb8a828638d692fdef34c05038f150ad38e02a29f2c782aba5b fix-test-fgetpwent.patch
-f73ab05ab5fdc90d3961fdcf88fa57eee8c90af4960b20d7ac845d2395c4cc20873ddc72bfd00fd127471336807faa705d0845444a0218343e74063e8f190980 disable-ck-test.patch"
diff --git a/system/polkit/CVE-2013-4288.patch b/system/polkit/CVE-2013-4288.patch
deleted file mode 100644
index 0ca8131e8..000000000
--- a/system/polkit/CVE-2013-4288.patch
+++ /dev/null
@@ -1,123 +0,0 @@
-From a3fa3b86f0015e42a534526ed800bcde5b3f2a15 Mon Sep 17 00:00:00 2001
-From: Colin Walters <walters@verbum.org>
-Date: Mon, 19 Aug 2013 12:16:11 -0400
-Subject: [PATCH] pkcheck: Support --process=pid,start-time,uid syntax too
-
-The uid is a new addition; this allows callers such as libvirt to
-close a race condition in reading the uid of the process talking to
-them. They can read it via getsockopt(SO_PEERCRED) or equivalent,
-rather than having pkcheck look at /proc later after the fact.
-
-Programs which invoke pkcheck but need to know beforehand (i.e. at
-compile time) whether or not it supports passing the uid can
-use:
-
-pkcheck_supports_uid=$($PKG_CONFIG --variable pkcheck_supports_uid polkit-gobject-1)
-test x$pkcheck_supports_uid = xyes
-
-Conflicts:
- docs/man/pkcheck.xml
- src/programs/pkcheck.c
----
- data/polkit-gobject-1.pc.in | 3 +++
- docs/man/pkcheck.xml | 33 +++++++++++++++++++++------------
- src/programs/pkcheck.c | 7 ++++++-
- 3 files changed, 30 insertions(+), 13 deletions(-)
-
-diff --git a/data/polkit-gobject-1.pc.in b/data/polkit-gobject-1.pc.in
-index c39677d..5c4c620 100644
---- a/data/polkit-gobject-1.pc.in
-+++ b/data/polkit-gobject-1.pc.in
-@@ -11,3 +11,6 @@ Version: @VERSION@
- Libs: -L${libdir} -lpolkit-gobject-1
- Cflags: -I${includedir}/polkit-1
- Requires: gio-2.0 >= 2.18 glib-2.0 >= 2.18
-+# Programs using pkcheck can use this to determine
-+# whether or not it can be passed a uid.
-+pkcheck_supports_uid=true
-diff --git a/docs/man/pkcheck.xml b/docs/man/pkcheck.xml
-index 6b8a874..9f2faef 100644
---- a/docs/man/pkcheck.xml
-+++ b/docs/man/pkcheck.xml
-@@ -55,6 +55,9 @@
- <arg choice="plain">
- <replaceable>pid,pid-start-time</replaceable>
- </arg>
-+ <arg choice="plain">
-+ <replaceable>pid,pid-start-time,uid</replaceable>
-+ </arg>
- </group>
- </arg>
- <arg choice="plain">
-@@ -90,7 +93,7 @@
- <title>DESCRIPTION</title>
- <para>
- <command>pkcheck</command> is used to check whether a process, specified by
-- either <option>--process</option> or <option>--system-bus-name</option>,
-+ either <option>--process</option> (see below) or <option>--system-bus-name</option>,
- is authorized for <replaceable>action</replaceable>. The <option>--detail</option>
- option can be used zero or more times to pass details about <replaceable>action</replaceable>.
- If <option>--allow-user-interaction</option> is passed, <command>pkcheck</command> blocks
-@@ -160,17 +163,23 @@ KEY3=VALUE3
- <refsect1 id="pkcheck-notes">
- <title>NOTES</title>
- <para>
-- Since process identifiers can be recycled, the caller should always use
-- <replaceable>pid,pid-start-time</replaceable> to specify the process
-- to check for authorization when using the <option>--process</option> option.
-- The value of <replaceable>pid-start-time</replaceable>
-- can be determined by consulting e.g. the
-- <citerefentry>
-- <refentrytitle>proc</refentrytitle><manvolnum>5</manvolnum>
-- </citerefentry>
-- file system depending on the operating system. If only <replaceable>pid</replaceable>
-- is passed to the <option>--process</option> option, then <command>pkcheck</command>
-- will look up the start time itself but note that this may be racy.
-+ Do not use either the bare <replaceable>pid</replaceable> or
-+ <replaceable>pid,start-time</replaceable> syntax forms for
-+ <option>--process</option>. There are race conditions in both.
-+ New code should always use
-+ <replaceable>pid,pid-start-time,uid</replaceable>. The value of
-+ <replaceable>start-time</replaceable> can be determined by
-+ consulting e.g. the
-+ <citerefentry><refentrytitle>proc</refentrytitle><manvolnum>5</manvolnum></citerefentry>
-+ file system depending on the operating system. If fewer than 3
-+ arguments are passed, <command>pkcheck</command> will attempt to
-+ look up them up internally, but note that this may be racy.
-+ </para>
-+ <para>
-+ If your program is a daemon with e.g. a custom Unix domain
-+ socket, you should determine the <replaceable>uid</replaceable>
-+ parameter via operating system mechanisms such as
-+ <literal>PEERCRED</literal>.
- </para>
- </refsect1>
-
-diff --git a/src/programs/pkcheck.c b/src/programs/pkcheck.c
-index 719a36c..057e926 100644
---- a/src/programs/pkcheck.c
-+++ b/src/programs/pkcheck.c
-@@ -372,6 +372,7 @@ main (int argc, char *argv[])
- else if (g_strcmp0 (argv[n], "--process") == 0 || g_strcmp0 (argv[n], "-p") == 0)
- {
- gint pid;
-+ guint uid;
- guint64 pid_start_time;
-
- n++;
-@@ -381,7 +382,11 @@ main (int argc, char *argv[])
- goto out;
- }
-
-- if (sscanf (argv[n], "%i,%" G_GUINT64_FORMAT, &pid, &pid_start_time) == 2)
-+ if (sscanf (argv[n], "%i,%" G_GUINT64_FORMAT ",%u", &pid, &pid_start_time, &uid) == 3)
-+ {
-+ subject = polkit_unix_process_new_for_owner (pid, pid_start_time, uid);
-+ }
-+ else if (sscanf (argv[n], "%i,%" G_GUINT64_FORMAT, &pid, &pid_start_time) == 2)
- {
- subject = polkit_unix_process_new_full (pid, pid_start_time);
- }
---
-1.8.5.1
-
diff --git a/system/polkit/CVE-2015-3218.patch b/system/polkit/CVE-2015-3218.patch
deleted file mode 100644
index 977825102..000000000
--- a/system/polkit/CVE-2015-3218.patch
+++ /dev/null
@@ -1,115 +0,0 @@
-From 48e646918efb2bf0b3b505747655726d7869f31c Mon Sep 17 00:00:00 2001
-From: Colin Walters <walters@redhat.com>
-Date: Sat, 30 May 2015 09:06:23 -0400
-Subject: CVE-2015-3218: backend: Handle invalid object paths in
- RegisterAuthenticationAgent
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Properly propagate the error, otherwise we dereference a `NULL`
-pointer. This is a local, authenticated DoS.
-
-`RegisterAuthenticationAgentWithOptions` and
-`UnregisterAuthentication` have been validated to not need changes for
-this.
-
-http://lists.freedesktop.org/archives/polkit-devel/2015-May/000420.html
-https://bugs.freedesktop.org/show_bug.cgi?id=90829
-
-Reported-by: Tavis Ormandy <taviso@google.com>
-Reviewed-by: Philip Withnall <philip@tecnocode.co.uk>
-Reviewed-by: Miloslav Trmač <mitr@redhat.com>
-Signed-off-by: Colin Walters <walters@redhat.com>
-
-diff --git a/src/polkitbackend/polkitbackendinteractiveauthority.c b/src/polkitbackend/polkitbackendinteractiveauthority.c
-index f6ea0fc..587f954 100644
---- a/src/polkitbackend/polkitbackendinteractiveauthority.c
-+++ b/src/polkitbackend/polkitbackendinteractiveauthority.c
-@@ -1566,36 +1566,42 @@ authentication_agent_new (PolkitSubject *scope,
- const gchar *unique_system_bus_name,
- const gchar *locale,
- const gchar *object_path,
-- GVariant *registration_options)
-+ GVariant *registration_options,
-+ GError **error)
- {
- AuthenticationAgent *agent;
-- GError *error;
-+ GDBusProxy *proxy;
-
-- agent = g_new0 (AuthenticationAgent, 1);
-+ if (!g_variant_is_object_path (object_path))
-+ {
-+ g_set_error (error, POLKIT_ERROR, POLKIT_ERROR_FAILED,
-+ "Invalid object path '%s'", object_path);
-+ return NULL;
-+ }
-+
-+ proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
-+ G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES |
-+ G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS,
-+ NULL, /* GDBusInterfaceInfo* */
-+ unique_system_bus_name,
-+ object_path,
-+ "org.freedesktop.PolicyKit1.AuthenticationAgent",
-+ NULL, /* GCancellable* */
-+ error);
-+ if (proxy == NULL)
-+ {
-+ g_prefix_error (error, "Failed to construct proxy for agent: " );
-+ return NULL;
-+ }
-
-+ agent = g_new0 (AuthenticationAgent, 1);
- agent->ref_count = 1;
- agent->scope = g_object_ref (scope);
- agent->object_path = g_strdup (object_path);
- agent->unique_system_bus_name = g_strdup (unique_system_bus_name);
- agent->locale = g_strdup (locale);
- agent->registration_options = registration_options != NULL ? g_variant_ref (registration_options) : NULL;
--
-- error = NULL;
-- agent->proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
-- G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES |
-- G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS,
-- NULL, /* GDBusInterfaceInfo* */
-- agent->unique_system_bus_name,
-- agent->object_path,
-- "org.freedesktop.PolicyKit1.AuthenticationAgent",
-- NULL, /* GCancellable* */
-- &error);
-- if (agent->proxy == NULL)
-- {
-- g_warning ("Error constructing proxy for agent: %s", error->message);
-- g_error_free (error);
-- /* TODO: Make authentication_agent_new() return NULL and set a GError */
-- }
-+ agent->proxy = proxy;
-
- return agent;
- }
-@@ -2398,8 +2404,6 @@ polkit_backend_interactive_authority_register_authentication_agent (PolkitBacken
- caller_cmdline = NULL;
- agent = NULL;
-
-- /* TODO: validate that object path is well-formed */
--
- interactive_authority = POLKIT_BACKEND_INTERACTIVE_AUTHORITY (authority);
- priv = POLKIT_BACKEND_INTERACTIVE_AUTHORITY_GET_PRIVATE (interactive_authority);
-
-@@ -2486,7 +2490,10 @@ polkit_backend_interactive_authority_register_authentication_agent (PolkitBacken
- polkit_system_bus_name_get_name (POLKIT_SYSTEM_BUS_NAME (caller)),
- locale,
- object_path,
-- options);
-+ options,
-+ error);
-+ if (!agent)
-+ goto out;
-
- g_hash_table_insert (priv->hash_scope_to_authentication_agent,
- g_object_ref (subject),
---
-cgit v0.10.2
-
diff --git a/system/polkit/CVE-2015-3255.patch b/system/polkit/CVE-2015-3255.patch
deleted file mode 100644
index 1bd7c6bcf..000000000
--- a/system/polkit/CVE-2015-3255.patch
+++ /dev/null
@@ -1,67 +0,0 @@
-From 9f5e0c731784003bd4d6fc75ab739ff8b2ea269f Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= <mitr@redhat.com>
-Date: Wed, 1 Apr 2015 05:22:37 +0200
-Subject: CVE-2015-3255 Fix GHashTable usage.
-
-Don't assume that the hash table with free both the key and the value
-at the same time, supply proper deallocation functions for the key
-and value separately.
-
-Then drop ParsedAction::action_id which is no longer used for anything.
-
-https://bugs.freedesktop.org/show_bug.cgi?id=69501
-and
-https://bugs.freedesktop.org/show_bug.cgi?id=83590
-
-CVE: CVE-2015-3255
-
-diff --git a/src/polkitbackend/polkitbackendactionpool.c b/src/polkitbackend/polkitbackendactionpool.c
-index bc14381..3894fe9 100644
---- a/src/polkitbackend/polkitbackendactionpool.c
-+++ b/src/polkitbackend/polkitbackendactionpool.c
-@@ -40,7 +40,6 @@
-
- typedef struct
- {
-- gchar *action_id;
- gchar *vendor_name;
- gchar *vendor_url;
- gchar *icon_name;
-@@ -62,7 +61,6 @@ typedef struct
- static void
- parsed_action_free (ParsedAction *action)
- {
-- g_free (action->action_id);
- g_free (action->vendor_name);
- g_free (action->vendor_url);
- g_free (action->icon_name);
-@@ -134,7 +132,7 @@ polkit_backend_action_pool_init (PolkitBackendActionPool *pool)
-
- priv->parsed_actions = g_hash_table_new_full (g_str_hash,
- g_str_equal,
-- NULL,
-+ g_free,
- (GDestroyNotify) parsed_action_free);
-
- priv->parsed_files = g_hash_table_new_full (g_str_hash,
-@@ -988,7 +986,6 @@ _end (void *data, const char *el)
- icon_name = pd->global_icon_name;
-
- action = g_new0 (ParsedAction, 1);
-- action->action_id = g_strdup (pd->action_id);
- action->vendor_name = g_strdup (vendor);
- action->vendor_url = g_strdup (vendor_url);
- action->icon_name = g_strdup (icon_name);
-@@ -1003,7 +1000,8 @@ _end (void *data, const char *el)
- action->implicit_authorization_inactive = pd->implicit_authorization_inactive;
- action->implicit_authorization_active = pd->implicit_authorization_active;
-
-- g_hash_table_insert (priv->parsed_actions, action->action_id, action);
-+ g_hash_table_insert (priv->parsed_actions, g_strdup (pd->action_id),
-+ action);
-
- /* we steal these hash tables */
- pd->annotations = NULL;
---
-cgit v0.10.2
-
diff --git a/system/polkit/CVE-2015-4625.patch b/system/polkit/CVE-2015-4625.patch
deleted file mode 100644
index 4a43fb433..000000000
--- a/system/polkit/CVE-2015-4625.patch
+++ /dev/null
@@ -1,1008 +0,0 @@
-From ea544ffc18405237ccd95d28d7f45afef49aca17 Mon Sep 17 00:00:00 2001
-From: Colin Walters <walters@redhat.com>
-Date: Thu, 4 Jun 2015 12:15:18 -0400
-Subject: CVE-2015-4625: Use unpredictable cookie values, keep them secret
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Tavis noted that it'd be possible with a 32 bit counter for someone to
-cause the cookie to wrap by creating Authentication requests in a
-loop.
-
-Something important to note here is that wrapping of signed integers
-is undefined behavior in C, so we definitely want to fix that. All
-counter integers used in this patch are unsigned.
-
-See the comment above `authentication_agent_generate_cookie` for
-details, but basically we're now using a cookie of the form:
-
-```
- <agent serial> - <agent random id> - <session serial> - <session
-random id>
-```
-
-Which has multiple 64 bit counters, plus unpredictable random 128 bit
-integer ids (effectively UUIDs, but we're not calling them that
-because we don't need to be globally unique.
-
-We further ensure that the cookies are not visible to other processes
-by changing the setuid helper to accept them over standard input. This
-means that an attacker would have to guess both ids.
-
-In any case, the security hole here is better fixed with the other
-change to bind user id (uid) of the agent with cookie lookups, making
-cookie guessing worthless.
-
-Nevertheless, I think it's worth doing this change too, for defense in
-depth.
-
-Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90832
-CVE: CVE-2015-4625
-Reported-by: Tavis Ormandy <taviso@google.com>
-Reviewed-by: Miloslav Trmač <mitr@redhat.com>
-Signed-off-by: Colin Walters <walters@redhat.com>
-
-diff --git a/src/polkitagent/polkitagenthelper-pam.c b/src/polkitagent/polkitagenthelper-pam.c
-index 937386e..19062aa 100644
---- a/src/polkitagent/polkitagenthelper-pam.c
-+++ b/src/polkitagent/polkitagenthelper-pam.c
-@@ -65,7 +65,7 @@ main (int argc, char *argv[])
- {
- int rc;
- const char *user_to_auth;
-- const char *cookie;
-+ char *cookie = NULL;
- struct pam_conv pam_conversation;
- pam_handle_t *pam_h;
- const void *authed_user;
-@@ -97,7 +97,7 @@ main (int argc, char *argv[])
- openlog ("polkit-agent-helper-1", LOG_CONS | LOG_PID, LOG_AUTHPRIV);
-
- /* check for correct invocation */
-- if (argc != 3)
-+ if (!(argc == 2 || argc == 3))
- {
- syslog (LOG_NOTICE, "inappropriate use of helper, wrong number of arguments [uid=%d]", getuid ());
- fprintf (stderr, "polkit-agent-helper-1: wrong number of arguments. This incident has been logged.\n");
-@@ -105,7 +105,10 @@ main (int argc, char *argv[])
- }
-
- user_to_auth = argv[1];
-- cookie = argv[2];
-+
-+ cookie = read_cookie (argc, argv);
-+ if (!cookie)
-+ goto error;
-
- if (getuid () != 0)
- {
-@@ -203,6 +206,8 @@ main (int argc, char *argv[])
- goto error;
- }
-
-+ free (cookie);
-+
- #ifdef PAH_DEBUG
- fprintf (stderr, "polkit-agent-helper-1: successfully sent D-Bus message to PolicyKit daemon\n");
- #endif /* PAH_DEBUG */
-@@ -212,6 +217,7 @@ main (int argc, char *argv[])
- return 0;
-
- error:
-+ free (cookie);
- if (pam_h != NULL)
- pam_end (pam_h, rc);
-
-diff --git a/src/polkitagent/polkitagenthelper-shadow.c b/src/polkitagent/polkitagenthelper-shadow.c
-index a4f73ac..e877915 100644
---- a/src/polkitagent/polkitagenthelper-shadow.c
-+++ b/src/polkitagent/polkitagenthelper-shadow.c
-@@ -46,7 +46,7 @@ main (int argc, char *argv[])
- {
- struct spwd *shadow;
- const char *user_to_auth;
-- const char *cookie;
-+ char *cookie = NULL;
- time_t now;
-
- /* clear the entire environment to avoid attacks with
-@@ -67,7 +67,7 @@ main (int argc, char *argv[])
- openlog ("polkit-agent-helper-1", LOG_CONS | LOG_PID, LOG_AUTHPRIV);
-
- /* check for correct invocation */
-- if (argc != 3)
-+ if (!(argc == 2 || argc == 3))
- {
- syslog (LOG_NOTICE, "inappropriate use of helper, wrong number of arguments [uid=%d]", getuid ());
- fprintf (stderr, "polkit-agent-helper-1: wrong number of arguments. This incident has been logged.\n");
-@@ -86,7 +86,10 @@ main (int argc, char *argv[])
- }
-
- user_to_auth = argv[1];
-- cookie = argv[2];
-+
-+ cookie = read_cookie (argc, argv);
-+ if (!cookie)
-+ goto error;
-
- #ifdef PAH_DEBUG
- fprintf (stderr, "polkit-agent-helper-1: user to auth is '%s'.\n", user_to_auth);
-@@ -153,6 +156,8 @@ main (int argc, char *argv[])
- goto error;
- }
-
-+ free (cookie);
-+
- #ifdef PAH_DEBUG
- fprintf (stderr, "polkit-agent-helper-1: successfully sent D-Bus message to PolicyKit daemon\n");
- #endif /* PAH_DEBUG */
-@@ -162,6 +167,7 @@ main (int argc, char *argv[])
- return 0;
-
- error:
-+ free (cookie);
- fprintf (stdout, "FAILURE\n");
- flush_and_wait ();
- return 1;
-diff --git a/src/polkitagent/polkitagenthelperprivate.c b/src/polkitagent/polkitagenthelperprivate.c
-index cfa77fc..e23f9f5 100644
---- a/src/polkitagent/polkitagenthelperprivate.c
-+++ b/src/polkitagent/polkitagenthelperprivate.c
-@@ -23,6 +23,7 @@
- #include "config.h"
- #include "polkitagenthelperprivate.h"
- #include <stdio.h>
-+#include <string.h>
- #include <stdlib.h>
- #include <unistd.h>
-
-@@ -45,6 +46,38 @@ _polkit_clearenv (void)
- #endif
-
-
-+char *
-+read_cookie (int argc, char **argv)
-+{
-+ /* As part of CVE-2015-4625, we started passing the cookie
-+ * on standard input, to ensure it's not visible to other
-+ * processes. However, to ensure that things continue
-+ * to work if the setuid binary is upgraded while old
-+ * agents are still running (this will be common with
-+ * package managers), we support both modes.
-+ */
-+ if (argc == 3)
-+ return strdup (argv[2]);
-+ else
-+ {
-+ char *ret = NULL;
-+ size_t n = 0;
-+ ssize_t r = getline (&ret, &n, stdin);
-+ if (r == -1)
-+ {
-+ if (!feof (stdin))
-+ perror ("getline");
-+ free (ret);
-+ return NULL;
-+ }
-+ else
-+ {
-+ g_strchomp (ret);
-+ return ret;
-+ }
-+ }
-+}
-+
- gboolean
- send_dbus_message (const char *cookie, const char *user)
- {
-diff --git a/src/polkitagent/polkitagenthelperprivate.h b/src/polkitagent/polkitagenthelperprivate.h
-index aeca2c7..547fdcc 100644
---- a/src/polkitagent/polkitagenthelperprivate.h
-+++ b/src/polkitagent/polkitagenthelperprivate.h
-@@ -38,6 +38,8 @@
-
- int _polkit_clearenv (void);
-
-+char *read_cookie (int argc, char **argv);
-+
- gboolean send_dbus_message (const char *cookie, const char *user);
-
- void flush_and_wait ();
-diff --git a/src/polkitagent/polkitagentsession.c b/src/polkitagent/polkitagentsession.c
-index f014773..8b93ad0 100644
---- a/src/polkitagent/polkitagentsession.c
-+++ b/src/polkitagent/polkitagentsession.c
-@@ -55,6 +55,7 @@
- #include <stdio.h>
- #include <sys/types.h>
- #include <sys/wait.h>
-+#include <gio/gunixoutputstream.h>
- #include <pwd.h>
-
- #include "polkitagentmarshal.h"
-@@ -88,7 +89,7 @@ struct _PolkitAgentSession
- gchar *cookie;
- PolkitIdentity *identity;
-
-- int child_stdin;
-+ GOutputStream *child_stdin;
- int child_stdout;
- GPid child_pid;
-
-@@ -129,7 +130,6 @@ G_DEFINE_TYPE (PolkitAgentSession, polkit_agent_session, G_TYPE_OBJECT);
- static void
- polkit_agent_session_init (PolkitAgentSession *session)
- {
-- session->child_stdin = -1;
- session->child_stdout = -1;
- }
-
-@@ -395,11 +395,7 @@ kill_helper (PolkitAgentSession *session)
- session->child_stdout = -1;
- }
-
-- if (session->child_stdin != -1)
-- {
-- g_warn_if_fail (close (session->child_stdin) == 0);
-- session->child_stdin = -1;
-- }
-+ g_clear_object (&session->child_stdin);
-
- session->helper_is_running = FALSE;
-
-@@ -545,9 +541,9 @@ polkit_agent_session_response (PolkitAgentSession *session,
-
- add_newline = (response[response_len] != '\n');
-
-- write (session->child_stdin, response, response_len);
-+ (void) g_output_stream_write_all (session->child_stdin, response, response_len, NULL, NULL, NULL);
- if (add_newline)
-- write (session->child_stdin, newline, 1);
-+ (void) g_output_stream_write_all (session->child_stdin, newline, 1, NULL, NULL, NULL);
- }
-
- /**
-@@ -567,8 +563,9 @@ polkit_agent_session_initiate (PolkitAgentSession *session)
- {
- uid_t uid;
- GError *error;
-- gchar *helper_argv[4];
-+ gchar *helper_argv[3];
- struct passwd *passwd;
-+ int stdin_fd = -1;
-
- g_return_if_fail (POLKIT_AGENT_IS_SESSION (session));
-
-@@ -600,10 +597,8 @@ polkit_agent_session_initiate (PolkitAgentSession *session)
-
- helper_argv[0] = PACKAGE_PREFIX "/lib/polkit-1/polkit-agent-helper-1";
- helper_argv[1] = passwd->pw_name;
-- helper_argv[2] = session->cookie;
-- helper_argv[3] = NULL;
-+ helper_argv[2] = NULL;
-
-- session->child_stdin = -1;
- session->child_stdout = -1;
-
- error = NULL;
-@@ -615,7 +610,7 @@ polkit_agent_session_initiate (PolkitAgentSession *session)
- NULL,
- NULL,
- &session->child_pid,
-- &session->child_stdin,
-+ &stdin_fd,
- &session->child_stdout,
- NULL,
- &error))
-@@ -628,6 +623,13 @@ polkit_agent_session_initiate (PolkitAgentSession *session)
- if (G_UNLIKELY (_show_debug ()))
- g_print ("PolkitAgentSession: spawned helper with pid %d\n", (gint) session->child_pid);
-
-+ session->child_stdin = (GOutputStream*)g_unix_output_stream_new (stdin_fd, TRUE);
-+
-+ /* Write the cookie on stdin so it can't be seen by other processes */
-+ (void) g_output_stream_write_all (session->child_stdin, session->cookie, strlen (session->cookie),
-+ NULL, NULL, NULL);
-+ (void) g_output_stream_write_all (session->child_stdin, "\n", 1, NULL, NULL, NULL);
-+
- session->child_stdout_channel = g_io_channel_unix_new (session->child_stdout);
- session->child_stdout_watch_source = g_io_create_watch (session->child_stdout_channel,
- G_IO_IN | G_IO_ERR | G_IO_HUP);
-diff --git a/src/polkitbackend/polkitbackendinteractiveauthority.c b/src/polkitbackend/polkitbackendinteractiveauthority.c
-index 3f339e9..15adc6a 100644
---- a/src/polkitbackend/polkitbackendinteractiveauthority.c
-+++ b/src/polkitbackend/polkitbackendinteractiveauthority.c
-@@ -214,6 +214,8 @@ typedef struct
-
- GDBusConnection *system_bus_connection;
- guint name_owner_changed_signal_id;
-+
-+ guint64 agent_serial;
- } PolkitBackendInteractiveAuthorityPrivate;
-
- /* ---------------------------------------------------------------------------------------------------- */
-@@ -439,11 +441,15 @@ struct AuthenticationAgent
- volatile gint ref_count;
-
- PolkitSubject *scope;
-+ guint64 serial;
-
- gchar *locale;
- GVariant *registration_options;
- gchar *object_path;
- gchar *unique_system_bus_name;
-+ GRand *cookie_pool;
-+ gchar *cookie_prefix;
-+ guint64 cookie_serial;
-
- GDBusProxy *proxy;
-
-@@ -1427,9 +1433,54 @@ authentication_session_cancelled_cb (GCancellable *cancellable,
- authentication_session_cancel (session);
- }
-
-+/* We're not calling this a UUID, but it's basically
-+ * the same thing, just not formatted that way because:
-+ *
-+ * - I'm too lazy to do it
-+ * - If we did, people might think it was actually
-+ * generated from /dev/random, which we're not doing
-+ * because this value doesn't actually need to be
-+ * globally unique.
-+ */
-+static void
-+append_rand_u128_str (GString *buf,
-+ GRand *pool)
-+{
-+ g_string_append_printf (buf, "%08x%08x%08x%08x",
-+ g_rand_int (pool),
-+ g_rand_int (pool),
-+ g_rand_int (pool),
-+ g_rand_int (pool));
-+}
-+
-+/* A value that should be unique to the (AuthenticationAgent, AuthenticationSession)
-+ * pair, and not guessable by other agents.
-+ *
-+ * <agent serial> - <agent uuid> - <session serial> - <session uuid>
-+ *
-+ * See http://lists.freedesktop.org/archives/polkit-devel/2015-June/000425.html
-+ *
-+ */
-+static gchar *
-+authentication_agent_generate_cookie (AuthenticationAgent *agent)
-+{
-+ GString *buf = g_string_new ("");
-+
-+ g_string_append (buf, agent->cookie_prefix);
-+
-+ g_string_append_c (buf, '-');
-+ agent->cookie_serial++;
-+ g_string_append_printf (buf, "%" G_GUINT64_FORMAT,
-+ agent->cookie_serial);
-+ g_string_append_c (buf, '-');
-+ append_rand_u128_str (buf, agent->cookie_pool);
-+
-+ return g_string_free (buf, FALSE);
-+}
-+
-+
- static AuthenticationSession *
- authentication_session_new (AuthenticationAgent *agent,
-- const gchar *cookie,
- PolkitSubject *subject,
- PolkitIdentity *user_of_subject,
- PolkitSubject *caller,
-@@ -1447,7 +1498,7 @@ authentication_session_new (AuthenticationAgent *agent,
-
- session = g_new0 (AuthenticationSession, 1);
- session->agent = authentication_agent_ref (agent);
-- session->cookie = g_strdup (cookie);
-+ session->cookie = authentication_agent_generate_cookie (agent);
- session->subject = g_object_ref (subject);
- session->user_of_subject = g_object_ref (user_of_subject);
- session->caller = g_object_ref (caller);
-@@ -1496,16 +1547,6 @@ authentication_session_free (AuthenticationSession *session)
- g_free (session);
- }
-
--static gchar *
--authentication_agent_new_cookie (AuthenticationAgent *agent)
--{
-- static gint counter = 0;
--
-- /* TODO: use a more random-looking cookie */
--
-- return g_strdup_printf ("cookie%d", counter++);
--}
--
- static PolkitSubject *
- authentication_agent_get_scope (AuthenticationAgent *agent)
- {
-@@ -1553,12 +1594,15 @@ authentication_agent_unref (AuthenticationAgent *agent)
- g_free (agent->unique_system_bus_name);
- if (agent->registration_options != NULL)
- g_variant_unref (agent->registration_options);
-+ g_rand_free (agent->cookie_pool);
-+ g_free (agent->cookie_prefix);
- g_free (agent);
- }
- }
-
- static AuthenticationAgent *
--authentication_agent_new (PolkitSubject *scope,
-+authentication_agent_new (guint64 serial,
-+ PolkitSubject *scope,
- const gchar *unique_system_bus_name,
- const gchar *locale,
- const gchar *object_path,
-@@ -1592,6 +1636,7 @@ authentication_agent_new (PolkitSubject *scope,
-
- agent = g_new0 (AuthenticationAgent, 1);
- agent->ref_count = 1;
-+ agent->serial = serial;
- agent->scope = g_object_ref (scope);
- agent->object_path = g_strdup (object_path);
- agent->unique_system_bus_name = g_strdup (unique_system_bus_name);
-@@ -1599,6 +1644,25 @@ authentication_agent_new (PolkitSubject *scope,
- agent->registration_options = registration_options != NULL ? g_variant_ref (registration_options) : NULL;
- agent->proxy = proxy;
-
-+ {
-+ GString *cookie_prefix = g_string_new ("");
-+ GRand *agent_private_rand = g_rand_new ();
-+
-+ g_string_append_printf (cookie_prefix, "%" G_GUINT64_FORMAT "-", agent->serial);
-+
-+ /* Use a uniquely seeded PRNG to get a prefix cookie for this agent,
-+ * whose sequence will not correlate with the per-authentication session
-+ * cookies.
-+ */
-+ append_rand_u128_str (cookie_prefix, agent_private_rand);
-+ g_rand_free (agent_private_rand);
-+
-+ agent->cookie_prefix = g_string_free (cookie_prefix, FALSE);
-+
-+ /* And a newly seeded pool for per-session cookies */
-+ agent->cookie_pool = g_rand_new ();
-+ }
-+
- return agent;
- }
-
-@@ -2193,7 +2257,6 @@ authentication_agent_initiate_challenge (AuthenticationAgent *agent,
- {
- PolkitBackendInteractiveAuthorityPrivate *priv = POLKIT_BACKEND_INTERACTIVE_AUTHORITY_GET_PRIVATE (authority);
- AuthenticationSession *session;
-- gchar *cookie;
- GList *l;
- GList *identities;
- gchar *localized_message;
-@@ -2215,8 +2278,6 @@ authentication_agent_initiate_challenge (AuthenticationAgent *agent,
- &localized_icon_name,
- &localized_details);
-
-- cookie = authentication_agent_new_cookie (agent);
--
- identities = NULL;
-
- /* select admin user if required by the implicit authorization */
-@@ -2279,7 +2340,6 @@ authentication_agent_initiate_challenge (AuthenticationAgent *agent,
- user_identities = g_list_prepend (NULL, polkit_unix_user_new (0));
-
- session = authentication_session_new (agent,
-- cookie,
- subject,
- user_of_subject,
- caller,
-@@ -2335,7 +2395,6 @@ authentication_agent_initiate_challenge (AuthenticationAgent *agent,
- g_list_free_full (user_identities, g_object_unref);
- g_list_foreach (identities, (GFunc) g_object_unref, NULL);
- g_list_free (identities);
-- g_free (cookie);
-
- g_free (localized_message);
- g_free (localized_icon_name);
-@@ -2482,7 +2541,9 @@ polkit_backend_interactive_authority_register_authentication_agent (PolkitBacken
- goto out;
- }
-
-- agent = authentication_agent_new (subject,
-+ priv->agent_serial++;
-+ agent = authentication_agent_new (priv->agent_serial,
-+ subject,
- polkit_system_bus_name_get_name (POLKIT_SYSTEM_BUS_NAME (caller)),
- locale,
- object_path,
---
-cgit v0.10.2
-
-From 493aa5dc1d278ab9097110c1262f5229bbaf1766 Mon Sep 17 00:00:00 2001
-From: Colin Walters <walters@redhat.com>
-Date: Wed, 17 Jun 2015 13:07:02 -0400
-Subject: CVE-2015-4625: Bind use of cookies to specific uids
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-http://lists.freedesktop.org/archives/polkit-devel/2015-June/000425.html
-
-The "cookie" value that Polkit hands out is global to all polkit
-users. And when `AuthenticationAgentResponse` is invoked, we
-previously only received the cookie and *target* identity, and
-attempted to find an agent from that.
-
-The problem is that the current cookie is just an integer
-counter, and if it overflowed, it would be possible for
-an successful authorization in one session to trigger a response
-in another session.
-
-The overflow and ability to guess the cookie were fixed by the
-previous patch.
-
-This patch is conceptually further hardening on top of that. Polkit
-currently treats uids as equivalent from a security domain
-perspective; there is no support for
-SELinux/AppArmor/etc. differentiation.
-
-We can retrieve the uid from `getuid()` in the setuid helper, which
-allows us to ensure the uid invoking `AuthenticationAgentResponse2`
-matches that of the agent.
-
-Then the authority only looks at authentication sessions matching the
-cookie that were created by a matching uid, thus removing the ability
-for different uids to interfere with each other entirely.
-
-Several fixes to this patch were contributed by:
-Miloslav Trmač <mitr@redhat.com>
-
-Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90837
-CVE: CVE-2015-4625
-Reported-by: Tavis Ormandy <taviso@google.com>
-Reviewed-by: Miloslav Trmač <mitr@redhat.com>
-Signed-off-by: Colin Walters <walters@redhat.com>
-
-diff --git a/data/org.freedesktop.PolicyKit1.AuthenticationAgent.xml b/data/org.freedesktop.PolicyKit1.AuthenticationAgent.xml
-index 3b519c2..5beef7d 100644
---- a/data/org.freedesktop.PolicyKit1.AuthenticationAgent.xml
-+++ b/data/org.freedesktop.PolicyKit1.AuthenticationAgent.xml
-@@ -8,7 +8,19 @@
- <annotation name="org.gtk.EggDBus.DocString" value="<para>This D-Bus interface is used for communication between the system-wide PolicyKit daemon and one or more authentication agents each running in a user session.</para><para>An authentication agent must implement this interface and register (passing the object path of the object implementing the interface) using the org.freedesktop.PolicyKit1.Authority.RegisterAuthenticationAgent() and org.freedesktop.PolicyKit1.Authority.UnregisterAuthenticationAgent() methods on the #org.freedesktop.PolicyKit1.Authority interface of the PolicyKit daemon.</para>"/>
-
- <method name="BeginAuthentication">
-- <annotation name="org.gtk.EggDBus.DocString" value="<para>Called by the PolicyKit daemon when the authentication agent needs the user to authenticate as one of the identities in @identities for the action with the identifier @action_id.</para><para>Upon succesful authentication, the authentication agent must invoke the org.freedesktop.PolicyKit1.Authority.AuthenticationAgentResponse() method on the #org.freedesktop.PolicyKit1.Authority interface of the PolicyKit daemon before returning.</para><para>If the user dismisses the authentication dialog, the authentication agent should return an error.</para>"/>
-+ <annotation name="org.gtk.EggDBus.DocString" value="<para>Called
-+ by the PolicyKit daemon when the authentication agent needs the
-+ user to authenticate as one of the identities in @identities for
-+ the action with the identifier @action_id.</para><para>This
-+ authentication is normally achieved via the
-+ polkit_agent_session_response() API, which invokes a private
-+ setuid helper process to verify the authentication. When
-+ successful, it calls the
-+ org.freedesktop.PolicyKit1.Authority.AuthenticationAgentResponse2()
-+ method on the #org.freedesktop.PolicyKit1.Authority interface of
-+ the PolicyKit daemon before returning. If the user dismisses the
-+ authentication dialog, the authentication agent should call
-+ polkit_agent_session_cancel().</para>"/>
-
- <arg name="action_id" direction="in" type="s">
- <annotation name="org.gtk.EggDBus.DocString" value="The identifier for the action that the user is authentication for."/>
-diff --git a/data/org.freedesktop.PolicyKit1.Authority.xml b/data/org.freedesktop.PolicyKit1.Authority.xml
-index fbfb9cd..f9021ee 100644
---- a/data/org.freedesktop.PolicyKit1.Authority.xml
-+++ b/data/org.freedesktop.PolicyKit1.Authority.xml
-@@ -313,7 +313,29 @@
- </method>
-
- <method name="AuthenticationAgentResponse">
-- <annotation name="org.gtk.EggDBus.DocString" value="Method for authentication agents to invoke on successful authentication. This method will fail unless a sufficiently privileged caller invokes it."/>
-+ <annotation name="org.gtk.EggDBus.DocString" value="Method for authentication agents to invoke on successful
-+authentication, intended only for use by a privileged helper process
-+internal to polkit."/>
-+
-+ <arg name="cookie" direction="in" type="s">
-+ <annotation name="org.gtk.EggDBus.DocString" value="The cookie identifying the authentication request that was passed to the authentication agent."/>
-+ </arg>
-+
-+ <arg name="identity" direction="in" type="(sa{sv})">
-+ <annotation name="org.gtk.EggDBus.Type" value="Identity"/>
-+ <annotation name="org.gtk.EggDBus.DocString" value="A #Identity struct describing what identity was authenticated."/>
-+ </arg>
-+ </method>
-+
-+ <method name="AuthenticationAgentResponse2">
-+ <annotation name="org.gtk.EggDBus.DocString" value="Method for authentication agents to invoke on successful
-+authentication, intended only for use by a privileged helper process
-+internal to polkit. Note this method was added in 0.114, and should be preferred over AuthenticationAgentResponse
-+as it fixes a security issue."/>
-+
-+ <arg name="uid" direction="in" type="u">
-+ <annotation name="org.gtk.EggDBus.DocString" value="The real uid of the agent. Normally set by the setuid helper program."/>
-+ </arg>
-
- <arg name="cookie" direction="in" type="s">
- <annotation name="org.gtk.EggDBus.DocString" value="The cookie identifying the authentication request that was passed to the authentication agent."/>
-diff --git a/docs/polkit/docbook-interface-org.freedesktop.PolicyKit1.Authority.xml b/docs/polkit/docbook-interface-org.freedesktop.PolicyKit1.Authority.xml
-index 6525e25..e66bf53 100644
---- a/docs/polkit/docbook-interface-org.freedesktop.PolicyKit1.Authority.xml
-+++ b/docs/polkit/docbook-interface-org.freedesktop.PolicyKit1.Authority.xml
-@@ -42,6 +42,8 @@ Structure <link linkend="eggdbus-struct-TemporaryAuthorization">TemporaryAuth
- IN String object_path)
- <link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.AuthenticationAgentResponse">AuthenticationAgentResponse</link> (IN String cookie,
- IN <link linkend="eggdbus-struct-Identity">Identity</link> identity)
-+<link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.AuthenticationAgentResponse">AuthenticationAgentResponse2</link> (IN uint32 uid, IN String cookie,
-+ IN <link linkend="eggdbus-struct-Identity">Identity</link> identity)
- <link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.EnumerateTemporaryAuthorizations">EnumerateTemporaryAuthorizations</link> (IN <link linkend="eggdbus-struct-Subject">Subject</link> subject,
- OUT Array&lt;<link linkend="eggdbus-struct-TemporaryAuthorization">TemporaryAuthorization</link>&gt; temporary_authorizations)
- <link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.RevokeTemporaryAuthorizations">RevokeTemporaryAuthorizations</link> (IN <link linkend="eggdbus-struct-Subject">Subject</link> subject)
-@@ -777,10 +779,52 @@ AuthenticationAgentResponse (IN String cookie,
- IN <link linkend="eggdbus-struct-Identity">Identity</link> identity)
- </programlisting>
- <para>
--Method for authentication agents to invoke on successful authentication. This method will fail unless a sufficiently privileged caller invokes it.
-+Method for authentication agents to invoke on successful
-+authentication, intended only for use by a privileged helper process
-+internal to polkit. Deprecated in favor of AuthenticationAgentResponse2.
-+ </para>
-+<variablelist role="params">
-+ <varlistentry>
-+ <term><literal>IN String <parameter>cookie</parameter></literal>:</term>
-+ <listitem>
-+ <para>
-+The cookie identifying the authentication request that was passed to the authentication agent.
-+ </para>
-+ </listitem>
-+ </varlistentry>
-+ <varlistentry>
-+ <term><literal>IN <link linkend="eggdbus-struct-Identity">Identity</link> <parameter>identity</parameter></literal>:</term>
-+ <listitem>
-+ <para>
-+A <link linkend="eggdbus-struct-Identity">Identity</link> struct describing what identity was authenticated.
-+ </para>
-+ </listitem>
-+ </varlistentry>
-+</variablelist>
-+ </refsect2>
-+ <refsect2 role="function" id="eggdbus-method-org.freedesktop.PolicyKit1.Authority.AuthenticationAgentResponse2">
-+ <title>AuthenticationAgentResponse2 ()</title>
-+ <programlisting>
-+AuthenticationAgentResponse2 (IN uint32 uid,
-+ IN String cookie,
-+ IN <link linkend="eggdbus-struct-Identity">Identity</link> identity)
-+ </programlisting>
-+ <para>
-+Method for authentication agents to invoke on successful
-+authentication, intended only for use by a privileged helper process
-+internal to polkit. Note this method was introduced in 0.114 to fix a security issue.
- </para>
- <variablelist role="params">
- <varlistentry>
-+ <term><literal>IN uint32 <parameter>uid</parameter></literal>:</term>
-+ <listitem>
-+ <para>
-+The user id of the agent; normally this is the owner of the parent pid
-+of the process that invoked the internal setuid helper.
-+ </para>
-+ </listitem>
-+ </varlistentry>
-+ <varlistentry>
- <term><literal>IN String <parameter>cookie</parameter></literal>:</term>
- <listitem>
- <para>
-diff --git a/docs/polkit/overview.xml b/docs/polkit/overview.xml
-index 150a7bc..176d2ea 100644
---- a/docs/polkit/overview.xml
-+++ b/docs/polkit/overview.xml
-@@ -314,16 +314,18 @@
- <para>
- Authentication agents are provided by desktop environments. When
- an user session starts, the agent registers with the polkit
-- Authority using
-- the <link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.RegisterAuthenticationAgent">RegisterAuthenticationAgent()</link>
-+ Authority using the <link
-+ linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.RegisterAuthenticationAgent">RegisterAuthenticationAgent()</link>
- method. When services are needed, the authority will invoke
-- methods on
-- the <link linkend="eggdbus-interface-org.freedesktop.PolicyKit1.AuthenticationAgent">org.freedesktop.PolicyKit1.AuthenticationAgent</link>
-+ methods on the <link
-+ linkend="eggdbus-interface-org.freedesktop.PolicyKit1.AuthenticationAgent">org.freedesktop.PolicyKit1.AuthenticationAgent</link>
- D-Bus interface. Once the user is authenticated, (a privileged
-- part of) the agent invokes
-- the <link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.AuthenticationAgentResponse">AuthenticationAgentResponse()</link>
-- method. Note that the polkit Authority itself does not care
-- how the agent authenticates the user.
-+ part of) the agent invokes the <link
-+ linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.AuthenticationAgentResponse">AuthenticationAgentResponse()</link>
-+ method. This method should be treated as an internal
-+ implementation detail, and callers should use the public shared
-+ library API to invoke it, which currently uses a setuid helper
-+ program.
- </para>
- <para>
- The <link linkend="ref-authentication-agent-api">libpolkit-agent-1</link>
-diff --git a/src/polkit/polkitauthority.c b/src/polkit/polkitauthority.c
-index ab6d3cd..6bd684a 100644
---- a/src/polkit/polkitauthority.c
-+++ b/src/polkit/polkitauthority.c
-@@ -1492,6 +1492,14 @@ polkit_authority_authentication_agent_response (PolkitAuthority *authority,
- gpointer user_data)
- {
- GVariant *identity_value;
-+ /* Note that in reality, this API is only accessible to root, and
-+ * only called from the setuid helper `polkit-agent-helper-1`.
-+ *
-+ * However, because this is currently public API, we avoid
-+ * triggering warnings from ABI diff type programs by just grabbing
-+ * the real uid of the caller here.
-+ */
-+ uid_t uid = getuid ();
-
- g_return_if_fail (POLKIT_IS_AUTHORITY (authority));
- g_return_if_fail (cookie != NULL);
-@@ -1501,8 +1509,9 @@ polkit_authority_authentication_agent_response (PolkitAuthority *authority,
- identity_value = polkit_identity_to_gvariant (identity);
- g_variant_ref_sink (identity_value);
- g_dbus_proxy_call (authority->proxy,
-- "AuthenticationAgentResponse",
-- g_variant_new ("(s@(sa{sv}))",
-+ "AuthenticationAgentResponse2",
-+ g_variant_new ("(us@(sa{sv}))",
-+ (guint32)uid,
- cookie,
- identity_value),
- G_DBUS_CALL_FLAGS_NONE,
-diff --git a/src/polkitbackend/polkitbackendauthority.c b/src/polkitbackend/polkitbackendauthority.c
-index 601a974..03a4e84 100644
---- a/src/polkitbackend/polkitbackendauthority.c
-+++ b/src/polkitbackend/polkitbackendauthority.c
-@@ -355,6 +355,7 @@ polkit_backend_authority_unregister_authentication_agent (PolkitBackendAuthority
- gboolean
- polkit_backend_authority_authentication_agent_response (PolkitBackendAuthority *authority,
- PolkitSubject *caller,
-+ uid_t uid,
- const gchar *cookie,
- PolkitIdentity *identity,
- GError **error)
-@@ -373,7 +374,7 @@ polkit_backend_authority_authentication_agent_response (PolkitBackendAuthority
- }
- else
- {
-- return klass->authentication_agent_response (authority, caller, cookie, identity, error);
-+ return klass->authentication_agent_response (authority, caller, uid, cookie, identity, error);
- }
- }
-
-@@ -587,6 +588,11 @@ static const gchar *server_introspection_data =
- " <arg type='s' name='cookie' direction='in'/>"
- " <arg type='(sa{sv})' name='identity' direction='in'/>"
- " </method>"
-+ " <method name='AuthenticationAgentResponse2'>"
-+ " <arg type='u' name='uid' direction='in'/>"
-+ " <arg type='s' name='cookie' direction='in'/>"
-+ " <arg type='(sa{sv})' name='identity' direction='in'/>"
-+ " </method>"
- " <method name='EnumerateTemporaryAuthorizations'>"
- " <arg type='(sa{sv})' name='subject' direction='in'/>"
- " <arg type='a(ss(sa{sv})tt)' name='temporary_authorizations' direction='out'/>"
-@@ -1035,6 +1041,57 @@ server_handle_authentication_agent_response (Server *server,
- error = NULL;
- if (!polkit_backend_authority_authentication_agent_response (server->authority,
- caller,
-+ (uid_t)-1,
-+ cookie,
-+ identity,
-+ &error))
-+ {
-+ g_dbus_method_invocation_return_gerror (invocation, error);
-+ g_error_free (error);
-+ goto out;
-+ }
-+
-+ g_dbus_method_invocation_return_value (invocation, g_variant_new ("()"));
-+
-+ out:
-+ if (identity != NULL)
-+ g_object_unref (identity);
-+}
-+
-+static void
-+server_handle_authentication_agent_response2 (Server *server,
-+ GVariant *parameters,
-+ PolkitSubject *caller,
-+ GDBusMethodInvocation *invocation)
-+{
-+ const gchar *cookie;
-+ GVariant *identity_gvariant;
-+ PolkitIdentity *identity;
-+ GError *error;
-+ guint32 uid;
-+
-+ identity = NULL;
-+
-+ g_variant_get (parameters,
-+ "(u&s@(sa{sv}))",
-+ &uid,
-+ &cookie,
-+ &identity_gvariant);
-+
-+ error = NULL;
-+ identity = polkit_identity_new_for_gvariant (identity_gvariant, &error);
-+ if (identity == NULL)
-+ {
-+ g_prefix_error (&error, "Error getting identity: ");
-+ g_dbus_method_invocation_return_gerror (invocation, error);
-+ g_error_free (error);
-+ goto out;
-+ }
-+
-+ error = NULL;
-+ if (!polkit_backend_authority_authentication_agent_response (server->authority,
-+ caller,
-+ (uid_t)uid,
- cookie,
- identity,
- &error))
-@@ -1222,6 +1279,8 @@ server_handle_method_call (GDBusConnection *connection,
- server_handle_unregister_authentication_agent (server, parameters, caller, invocation);
- else if (g_strcmp0 (method_name, "AuthenticationAgentResponse") == 0)
- server_handle_authentication_agent_response (server, parameters, caller, invocation);
-+ else if (g_strcmp0 (method_name, "AuthenticationAgentResponse2") == 0)
-+ server_handle_authentication_agent_response2 (server, parameters, caller, invocation);
- else if (g_strcmp0 (method_name, "EnumerateTemporaryAuthorizations") == 0)
- server_handle_enumerate_temporary_authorizations (server, parameters, caller, invocation);
- else if (g_strcmp0 (method_name, "RevokeTemporaryAuthorizations") == 0)
-diff --git a/src/polkitbackend/polkitbackendauthority.h b/src/polkitbackend/polkitbackendauthority.h
-index f9f7385..88df82e 100644
---- a/src/polkitbackend/polkitbackendauthority.h
-+++ b/src/polkitbackend/polkitbackendauthority.h
-@@ -147,6 +147,7 @@ struct _PolkitBackendAuthorityClass
-
- gboolean (*authentication_agent_response) (PolkitBackendAuthority *authority,
- PolkitSubject *caller,
-+ uid_t uid,
- const gchar *cookie,
- PolkitIdentity *identity,
- GError **error);
-@@ -249,6 +250,7 @@ gboolean polkit_backend_authority_unregister_authentication_agent (PolkitBackend
-
- gboolean polkit_backend_authority_authentication_agent_response (PolkitBackendAuthority *authority,
- PolkitSubject *caller,
-+ uid_t uid,
- const gchar *cookie,
- PolkitIdentity *identity,
- GError **error);
-diff --git a/src/polkitbackend/polkitbackendinteractiveauthority.c b/src/polkitbackend/polkitbackendinteractiveauthority.c
-index 15adc6a..96725f7 100644
---- a/src/polkitbackend/polkitbackendinteractiveauthority.c
-+++ b/src/polkitbackend/polkitbackendinteractiveauthority.c
-@@ -108,8 +108,9 @@ static AuthenticationAgent *get_authentication_agent_for_subject (PolkitBackendI
- PolkitSubject *subject);
-
-
--static AuthenticationSession *get_authentication_session_for_cookie (PolkitBackendInteractiveAuthority *authority,
-- const gchar *cookie);
-+static AuthenticationSession *get_authentication_session_for_uid_and_cookie (PolkitBackendInteractiveAuthority *authority,
-+ uid_t uid,
-+ const gchar *cookie);
-
- static GList *get_authentication_sessions_initiated_by_system_bus_unique_name (PolkitBackendInteractiveAuthority *authority,
- const gchar *system_bus_unique_name);
-@@ -169,6 +170,7 @@ static gboolean polkit_backend_interactive_authority_unregister_authentication_a
-
- static gboolean polkit_backend_interactive_authority_authentication_agent_response (PolkitBackendAuthority *authority,
- PolkitSubject *caller,
-+ uid_t uid,
- const gchar *cookie,
- PolkitIdentity *identity,
- GError **error);
-@@ -440,6 +442,7 @@ struct AuthenticationAgent
- {
- volatile gint ref_count;
-
-+ uid_t creator_uid;
- PolkitSubject *scope;
- guint64 serial;
-
-@@ -1603,6 +1606,7 @@ authentication_agent_unref (AuthenticationAgent *agent)
- static AuthenticationAgent *
- authentication_agent_new (guint64 serial,
- PolkitSubject *scope,
-+ PolkitIdentity *creator,
- const gchar *unique_system_bus_name,
- const gchar *locale,
- const gchar *object_path,
-@@ -1611,6 +1615,10 @@ authentication_agent_new (guint64 serial,
- {
- AuthenticationAgent *agent;
- GDBusProxy *proxy;
-+ PolkitUnixUser *creator_user;
-+
-+ g_assert (POLKIT_IS_UNIX_USER (creator));
-+ creator_user = POLKIT_UNIX_USER (creator);
-
- if (!g_variant_is_object_path (object_path))
- {
-@@ -1638,6 +1646,7 @@ authentication_agent_new (guint64 serial,
- agent->ref_count = 1;
- agent->serial = serial;
- agent->scope = g_object_ref (scope);
-+ agent->creator_uid = (uid_t)polkit_unix_user_get_uid (creator_user);
- agent->object_path = g_strdup (object_path);
- agent->unique_system_bus_name = g_strdup (unique_system_bus_name);
- agent->locale = g_strdup (locale);
-@@ -1736,8 +1745,9 @@ get_authentication_agent_for_subject (PolkitBackendInteractiveAuthority *authori
- }
-
- static AuthenticationSession *
--get_authentication_session_for_cookie (PolkitBackendInteractiveAuthority *authority,
-- const gchar *cookie)
-+get_authentication_session_for_uid_and_cookie (PolkitBackendInteractiveAuthority *authority,
-+ uid_t uid,
-+ const gchar *cookie)
- {
- PolkitBackendInteractiveAuthorityPrivate *priv;
- GHashTableIter hash_iter;
-@@ -1755,6 +1765,23 @@ get_authentication_session_for_cookie (PolkitBackendInteractiveAuthority *author
- {
- GList *l;
-
-+ /* We need to ensure that if somehow we have duplicate cookies
-+ * due to wrapping, that the cookie used is matched to the user
-+ * who called AuthenticationAgentResponse2. See
-+ * http://lists.freedesktop.org/archives/polkit-devel/2015-June/000425.html
-+ *
-+ * Except if the legacy AuthenticationAgentResponse is invoked,
-+ * we don't know the uid and hence use -1. Continue to support
-+ * the old behavior for backwards compatibility, although everyone
-+ * who is using our own setuid helper will automatically be updated
-+ * to the new API.
-+ */
-+ if (uid != (uid_t)-1)
-+ {
-+ if (agent->creator_uid != uid)
-+ continue;
-+ }
-+
- for (l = agent->active_sessions; l != NULL; l = l->next)
- {
- AuthenticationSession *session = l->data;
-@@ -2544,6 +2571,7 @@ polkit_backend_interactive_authority_register_authentication_agent (PolkitBacken
- priv->agent_serial++;
- agent = authentication_agent_new (priv->agent_serial,
- subject,
-+ user_of_caller,
- polkit_system_bus_name_get_name (POLKIT_SYSTEM_BUS_NAME (caller)),
- locale,
- object_path,
-@@ -2757,6 +2785,7 @@ polkit_backend_interactive_authority_unregister_authentication_agent (PolkitBack
- static gboolean
- polkit_backend_interactive_authority_authentication_agent_response (PolkitBackendAuthority *authority,
- PolkitSubject *caller,
-+ uid_t uid,
- const gchar *cookie,
- PolkitIdentity *identity,
- GError **error)
-@@ -2799,7 +2828,7 @@ polkit_backend_interactive_authority_authentication_agent_response (PolkitBacken
- }
-
- /* find the authentication session */
-- session = get_authentication_session_for_cookie (interactive_authority, cookie);
-+ session = get_authentication_session_for_uid_and_cookie (interactive_authority, uid, cookie);
- if (session == NULL)
- {
- g_set_error (error,
---
-cgit v0.10.2
-
---- ./configure.ac.orig
-+++ ./configure.ac
-@@ -122,7 +122,7 @@
- changequote([,])dnl
- fi
-
--PKG_CHECK_MODULES(GLIB, [gio-2.0 >= 2.28.0])
-+PKG_CHECK_MODULES(GLIB, [gmodule-2.0 gio-unix-2.0 gio-2.0 >= 2.30.0])
- AC_SUBST(GLIB_CFLAGS)
- AC_SUBST(GLIB_LIBS)
-
diff --git a/system/polkit/automake.patch b/system/polkit/automake.patch
deleted file mode 100644
index 0f6825a26..000000000
--- a/system/polkit/automake.patch
+++ /dev/null
@@ -1,19 +0,0 @@
---- ./configure.ac.orig 2012-12-31 21:39:08.969445979 +0000
-+++ ./configure.ac 2012-12-31 21:39:30.136285425 +0000
-@@ -3,7 +3,7 @@
- AC_PREREQ(2.59c)
- AC_INIT(polkit, 0.105, http://lists.freedesktop.org/mailman/listinfo/polkit-devel)
- AM_INIT_AUTOMAKE(polkit, 0.105)
--AM_CONFIG_HEADER(config.h)
-+AC_CONFIG_HEADER(config.h)
- AM_MAINTAINER_MODE
-
- m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
-@@ -24,7 +24,6 @@
-
- AC_ISC_POSIX
- AC_PROG_CC
--AM_PROG_CC_STDC
- AC_HEADER_STDC
- AM_PROG_LIBTOOL
- AC_PROG_MAKE_SET
diff --git a/system/polkit/disable-ck-test.patch b/system/polkit/disable-ck-test.patch
deleted file mode 100644
index e1987d40d..000000000
--- a/system/polkit/disable-ck-test.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-This test requires ConsoleKit to be running.
-
---- polkit-0.105/test/polkitbackend/Makefile.am.old 2012-04-24 11:05:34.000000000 -0500
-+++ polkit-0.105/test/polkitbackend/Makefile.am 2017-09-27 20:48:42.479959296 -0500
-@@ -36,8 +36,8 @@
- TEST_PROGS += polkitbackendlocalauthorizationstoretest
- polkitbackendlocalauthorizationstoretest_SOURCES = polkitbackendlocalauthorizationstoretest.c
-
--TEST_PROGS += polkitbackendlocalauthoritytest
--polkitbackendlocalauthoritytest_SOURCES = polkitbackendlocalauthoritytest.c
-+#TEST_PROGS += polkitbackendlocalauthoritytest
-+#polkitbackendlocalauthoritytest_SOURCES = polkitbackendlocalauthoritytest.c
-
- # ----------------------------------------------------------------------------------------------------
-
diff --git a/system/polkit/fix-consolekit-db-stat.patch b/system/polkit/fix-consolekit-db-stat.patch
deleted file mode 100644
index 3deceb639..000000000
--- a/system/polkit/fix-consolekit-db-stat.patch
+++ /dev/null
@@ -1,30 +0,0 @@
---- polkit-0.105.orig/src/polkitbackend/polkitbackendsessionmonitor.c 2012-04-24 19:05:34.000000000 +0300
-+++ polkit-0.105/src/polkitbackend/polkitbackendsessionmonitor.c 2015-08-17 14:50:51.428580856 +0300
-@@ -47,7 +47,7 @@ struct _PolkitBackendSessionMonitor
-
- GKeyFile *database;
- GFileMonitor *database_monitor;
-- time_t database_mtime;
-+ struct timespec database_mtim;
- };
-
- struct _PolkitBackendSessionMonitorClass
-@@ -95,7 +95,7 @@ reload_database (PolkitBackendSessionMon
- goto out;
- }
-
-- monitor->database_mtime = statbuf.st_mtime;
-+ monitor->database_mtim = statbuf.st_mtim;
-
- monitor->database = g_key_file_new ();
- if (!g_key_file_load_from_file (monitor->database,
-@@ -131,7 +131,8 @@ ensure_database (PolkitBackendSessionMon
- strerror (errno));
- goto out;
- }
-- if (statbuf.st_mtime == monitor->database_mtime)
-+ if (statbuf.st_mtim.tv_sec == monitor->database_mtim.tv_sec &&
-+ statbuf.st_mtim.tv_nsec == monitor->database_mtim.tv_nsec)
- {
- ret = TRUE;
- goto out;
diff --git a/system/polkit/fix-parallel-make.patch b/system/polkit/fix-parallel-make.patch
deleted file mode 100644
index b693a34dd..000000000
--- a/system/polkit/fix-parallel-make.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From 7bd30764a5230684c7c979a08a83dfa6e327f719 Mon Sep 17 00:00:00 2001
-From: Ryan Lortie <desrt@velocity.(none)>
-Date: Tue, 13 Nov 2012 16:50:14 +0000
-Subject: build: Fix .gir generation for parallel make
-
-As per the intructions in the introspection Makefile, we should have a
-line declaring a dependency between the .gir and .la files.
-
-https://bugs.freedesktop.org/show_bug.cgi?id=57077
-
-Signed-off-by: David Zeuthen <zeuthen@gmail.com>
----
-diff --git a/src/polkit/Makefile.am b/src/polkit/Makefile.am
-index 39d6d84..d648d29 100644
---- a/src/polkit/Makefile.am
-+++ b/src/polkit/Makefile.am
-@@ -106,6 +106,8 @@ if HAVE_INTROSPECTION
-
- INTROSPECTION_GIRS = Polkit-1.0.gir
-
-+Polkit-1.0.gir: libpolkit-gobject-1.la
-+
- girdir = $(INTROSPECTION_GIRDIR)
- gir_DATA = Polkit-1.0.gir
-
-diff --git a/src/polkitagent/Makefile.am b/src/polkitagent/Makefile.am
-index 1cfb73c..5b7d4c7 100644
---- a/src/polkitagent/Makefile.am
-+++ b/src/polkitagent/Makefile.am
-@@ -108,6 +108,8 @@ if HAVE_INTROSPECTION
- girdir = $(INTROSPECTION_GIRDIR)
- gir_DATA = PolkitAgent-1.0.gir
-
-+PolkitAgent-1.0.gir: libpolkit-agent-1.la
-+
- typelibsdir = $(INTROSPECTION_TYPELIBDIR)
- typelibs_DATA = PolkitAgent-1.0.typelib
-
---
-cgit v0.9.0.2-2-gbebe
diff --git a/system/polkit/fix-test-fgetpwent.patch b/system/polkit/fix-test-fgetpwent.patch
deleted file mode 100644
index 7bc6481cc..000000000
--- a/system/polkit/fix-test-fgetpwent.patch
+++ /dev/null
@@ -1,20 +0,0 @@
---- polkit-0.105/test/mocklibc/src/pwd.c.old 2012-04-24 11:05:34.000000000 -0500
-+++ polkit-0.105/test/mocklibc/src/pwd.c 2017-09-27 19:40:57.883227673 -0500
-@@ -16,6 +16,7 @@
- * Author: Nikki VonHollen <vonhollen@gmail.com>
- */
-
-+#define _GNU_SOURCE
- #include <pwd.h>
-
- #include <stdio.h>
---- polkit-0.105/test/mocklibc/src/grp.c.old 2012-04-24 11:05:34.000000000 -0500
-+++ polkit-0.105/test/mocklibc/src/grp.c 2017-09-27 19:44:57.759238450 -0500
-@@ -16,6 +16,7 @@
- * Author: Nikki VonHollen <vonhollen@gmail.com>
- */
-
-+#define _GNU_SOURCE
- #include <grp.h>
-
- #include <stdio.h>
diff --git a/system/postgresql/APKBUILD b/system/postgresql/APKBUILD
new file mode 100644
index 000000000..e618eeb39
--- /dev/null
+++ b/system/postgresql/APKBUILD
@@ -0,0 +1,259 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+# Contributor: G.J.R. Timmer <gjr.timmer@gmail.com>
+# Contributor: Jakub Jirutka <jakub@jirutka.cz>
+pkgname=postgresql
+pkgver=10.0
+pkgrel=0
+pkgdesc="A sophisticated object-relational DBMS"
+url="http://www.postgresql.org/"
+arch="all"
+license="BSD"
+depends="postgresql-client tzdata"
+options="!checkroot"
+install="$pkgname.pre-upgrade"
+pkgusers="postgres"
+pkggroups="postgres"
+checkdepends="diffutils"
+depends_dev="openssl-dev"
+makedepends="$depends_dev libedit-dev zlib-dev libxml2-dev util-linux-dev
+ openldap-dev tcl-dev perl-dev python3-dev"
+subpackages="$pkgname-contrib $pkgname-dev $pkgname-doc libpq $pkgname-libs
+ $pkgname-client $pkgname-pltcl
+ $pkgname-plperl $pkgname-plperl-contrib:plperl_contrib
+ $pkgname-plpython3 $pkgname-plpython3-contrib:plpython3_contrib"
+source="https://ftp.postgresql.org/pub/source/v$pkgver/$pkgname-$pkgver.tar.bz2
+ initdb.patch
+ perl-rpath.patch
+ conf-unix_socket_directories.patch
+ disable-broken-tests.patch
+ $pkgname.initd
+ $pkgname.confd
+ pg-restore.initd
+ pg-restore.confd
+ pltcl_create_tables.sql
+ "
+builddir="$srcdir/$pkgname-$pkgver"
+options="!checkroot"
+
+# secfixes:
+# 9.6.4-r0:
+# - CVE-2017-7546
+# - CVE-2017-7547
+# - CVE-2017-7548
+# 9.6.3-r0:
+# - CVE-2017-7484
+# - CVE-2017-7485
+# - CVE-2017-7486
+
+prepare() {
+ default_prepare
+ cd "$builddir"
+
+ local file; for file in $pkgname.initd $pkgname.confd; do
+ sed "s|@VERSION@|${pkgver%.*}|" "$srcdir"/$file > $file
+ done
+}
+
+build() {
+ _configure
+ make world
+}
+
+# Note: (...) instead of {...} is NOT a typo!
+_configure() (
+ export CFLAGS="${CFLAGS/-Os/-O2}"
+ export CPPFLAGS="${CPPFLAGS/-Os/-O2}"
+
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --mandir=/usr/share/man \
+ --with-system-tzdata=/usr/share/zoneinfo \
+ --with-ldap \
+ --with-libedit-preferred \
+ --with-libxml \
+ --with-openssl \
+ --with-uuid=e2fs \
+ --disable-rpath \
+ --with-perl \
+ --with-python \
+ --with-tcl
+)
+
+check() {
+ cd "$builddir"
+
+ _run_tests src/test
+ _run_tests src/pl
+ _run_tests contrib
+}
+
+check() {
+ cd "$builddir"
+ make check
+}
+
+package() {
+ cd "$builddir"
+
+ make DESTDIR="$pkgdir" install install-docs
+
+ cd "$pkgdir"
+
+ install -d -m750 -o postgres -g postgres \
+ ./var/lib/postgresql \
+ ./var/log/$pkgname
+
+ install -D -m755 "$builddir"/postgresql.initd ./etc/init.d/postgresql
+ install -D -m644 "$builddir"/postgresql.confd ./etc/conf.d/postgresql
+
+ install -D -m755 "$srcdir"/pg-restore.initd ./etc/init.d/pg-restore
+ install -D -m644 "$srcdir"/pg-restore.confd ./etc/conf.d/pg-restore
+}
+
+dev() {
+ default_dev
+
+ _submv usr/bin/pg_config \
+ usr/bin/ecpg \
+ usr/lib/postgresql/pgxs
+}
+
+libpq() {
+ pkgdesc="PostgreSQL libraries"
+ depends=""
+
+ _submv usr/lib/libpq.so.*
+}
+
+libs() {
+ depends=""
+ default_libs
+}
+
+client() {
+ pkgdesc="PostgreSQL client"
+ depends=""
+
+ cd "$pkgdir"/usr/bin
+ mkdir -p "$subpkgdir"/usr/bin
+ mv clusterdb \
+ createdb \
+ createuser \
+ dropdb \
+ dropuser \
+ pg_basebackup \
+ pg_dump \
+ pg_dumpall \
+ pg_isready \
+ pg_receivewal \
+ pg_recvlogical \
+ pg_restore \
+ psql \
+ reindexdb \
+ vacuumdb \
+ "$subpkgdir"/usr/bin/
+}
+
+contrib() {
+ pkgdesc="Extension modules distributed with PostgreSQL"
+ depends=""
+
+ cd "$builddir"
+
+ # Avoid installing plperl and plpython extensions, these will be
+ # installed into separate subpackages.
+ sed -Ei -e 's/(.*_plperl)/#\1/' \
+ -e 's/(.*_plpython)/#\1/' \
+ contrib/Makefile
+
+ make -C contrib DESTDIR="$subpkgdir" install
+
+ mv "$subpkgdir"/usr/share/doc/postgresql/extension \
+ "$pkgdir"/usr/share/doc/postgresql/
+ rmdir -p "$subpkgdir"/usr/share/doc/postgresql || true
+}
+
+pltcl() {
+ pkgdesc="PL/Tcl procedural language for PostgreSQL"
+ depends="pgtcl"
+
+ _submv usr/lib/postgresql/pltcl.so \
+ usr/share/postgresql/extension/pltcl*
+
+ install -m 644 "$srcdir"/pltcl_create_tables.sql \
+ "$subpkgdir"/usr/share/postgresql/
+}
+
+plperl() {
+ pkgdesc="PL/Perl procedural language for PostgreSQL"
+ depends=""
+
+ _submv usr/lib/postgresql/plperl.so \
+ usr/share/postgresql/extension/plperl*
+}
+
+plperl_contrib() {
+ _plcontrib plperl "PL/Perl"
+
+ cd "$builddir"
+ make -C contrib/hstore_plperl DESTDIR="$subpkgdir" install
+}
+
+plpython3() {
+ pkgdesc="PL/Python3 procedural language for PostgreSQL"
+ depends="python3"
+
+ cd "$builddir"
+ make -C src/pl/plpython DESTDIR="$subpkgdir" install
+ rm -R "$subpkgdir"/usr/include
+}
+
+plpython3_contrib() {
+ _plcontrib plpython3 "PL/Python 3"
+
+ cd "$builddir"
+ make -C contrib/hstore_plpython DESTDIR="$subpkgdir" install
+ make -C contrib/ltree_plpython DESTDIR="$subpkgdir" install
+}
+
+_plcontrib() {
+ local subname="$1"
+ pkgdesc="$2 extension modules distributed with PostgreSQL"
+ depends="$pkgname-$subname"
+ install_if="$pkgname-$subname=$pkgver-r$pkgrel $pkgname-contrib=$pkgver-r$pkgrel"
+}
+
+_run_tests() {
+ local path="$1"; shift
+
+ msg "Running test suite at $path..."
+ # Note: some tests fail when running in parallel.
+ make -k -j 1 -C "$path" $@ check MAX_CONNECTIONS=5 || {
+ printf "\n%s\n\n" "Trying to find all regression.diffs files in build directory..." >&2
+ find "$path" -name regression.diffs | while read file; do
+ echo "=== test failure: $file ===" >&2
+ cat "$file" >&2
+ done
+ return 1
+ }
+}
+
+_submv() {
+ local path; for path in "$@"; do
+ mkdir -p "$subpkgdir/${path%/*}"
+ mv "$pkgdir"/$path "$subpkgdir"/${path%/*}/
+ done
+}
+
+sha512sums="88295af13db77a85a604c925aa627d383fdac62c1185119bba87753ce4167a13aed0f055a7a1329b3051f8757c6ba7529baed00a564ef0cfbee685720f282678 postgresql-10.0.tar.bz2
+1f8e7dc58f5b0a12427cf2fd904ffa898a34f23f3332c8382b94e0d991c007289e7913a69e04498f3d93fc5701855796c207b4b1cc4a0b366f586050124d7fcc initdb.patch
+5f9d8bb4957194069d01af8ab3abc6d4d83a7e7f8bd7ebe1caae5361d621a3e58f91b14b952958138a794e0a80bc154fbb7e3e78d211e2a95b9b7901335de854 perl-rpath.patch
+8439a6fdfdea0a4867daeb8bc23d6c825f30c00d91d4c39f48653f5ee77341f23282ce03a77aad94b5369700f11d2cb28d5aee360e59138352a9ab331a9f9d0f conf-unix_socket_directories.patch
+1966b2a3971f56fbecd8daa45965236d487683e13300e5c000e595bbadbbe9d0e1301fbbfa034f452abe8a4e4a427781f772370b9ff392bb03fc11ee43c9dee7 disable-broken-tests.patch
+224e80f9e62843fd248e625abdd0d9fe477729ff3f9a64fc5c86dd37bb7176d3504107fbed7ce578e3a1db7f60b8cf2abf5fe4862c81f76b6d026e29ca495cfc postgresql.initd
+a6d9cba5c7270484b3a22083b2b37742faefb01b6643040050c92235840c601b2e206ebda32804937b729c6cf42c79a558b921900e52fc420df2a03b5f29e1f7 postgresql.confd
+f5a1cba051e7d846c2d16703514601cb25729ed96b677c9bd0c199d64552120a8b14b238af01917fdb87106681e12dee6fff7447558155ba273e4f96be5e2892 pg-restore.initd
+c14a5684e914abb3b0ee71bbf15eed71a9264deacaa404a6e3af6bfc330d93e7598624d0ed11a94263106cc660f7f54c8ff57e759033cf606a795f69ff6c1c7c pg-restore.confd
+5c9bfd9e295dcf678298bf0aa974347a7c311d6e7c2aa76a6920fcb751d01fd1ab77abbec11f3c672f927ad9deaa88e04e370c0b5cd1b60087554c474b748731 pltcl_create_tables.sql"
diff --git a/system/postgresql/conf-unix_socket_directories.patch b/system/postgresql/conf-unix_socket_directories.patch
new file mode 100644
index 000000000..24c51e7b9
--- /dev/null
+++ b/system/postgresql/conf-unix_socket_directories.patch
@@ -0,0 +1,14 @@
+Creating socket in /tmp is silly, but unfortunately it's default location,
+so many clients expect it. Thus we preconfigure PostgreSQL to create socket
+both in /run/postgresql and /tmp.
+--- a/src/backend/utils/misc/postgresql.conf.sample
++++ b/src/backend/utils/misc/postgresql.conf.sample
+@@ -63,7 +63,7 @@
+ #port = 5432 # (change requires restart)
+ #max_connections = 100 # (change requires restart)
+ #superuser_reserved_connections = 3 # (change requires restart)
+-#unix_socket_directories = '/tmp' # comma-separated list of directories
++unix_socket_directories = '/run/postgresql,/tmp' # comma-separated list of directories
+ # (change requires restart)
+ #unix_socket_group = '' # (change requires restart)
+ #unix_socket_permissions = 0777 # begin with 0 to use octal notation
diff --git a/system/postgresql/disable-broken-tests.patch b/system/postgresql/disable-broken-tests.patch
new file mode 100644
index 000000000..0bb5b03fa
--- /dev/null
+++ b/system/postgresql/disable-broken-tests.patch
@@ -0,0 +1,119 @@
+These tests fail due to some really weird linking issue like:
+
+ ERROR: could not load library "<builddir>/tmp_install/usr/lib/postgresql/libpqwalreceiver.so": Error loading shared library libpq.so.5: No such file or directory (needed by <builddir>/tmp_install/usr/lib/postgresql/libpqwalreceiver.so)
+
+psql dynamically loads libpq and libpqwalreceiver libs using pg_dlopen()
+which is an alias for dlopen() on Linux. The above message comes from
+src/backend/utils/fmgr/dfmgr.c. The part "Error loading ..." is from
+pg_dlerror() which is alias for dlerror().
+
+LD_LIBRARY_PATH is set and passed correctly. However, the error
+disappeared when I've copied libpq.so* to /usr/lib...
+
+Also:
+
+ $ LD_LIBRARY_PATH=$(pwd) ldd postgresql/libpqwalreceiver.so
+ ldd (0x280d565e000)
+ libpq.so.5 => <builddir>/tmp_install/usr/lib/libpq.so.5 (0x280d520d000)
+ libc.musl-x86_64.so.1 => ldd (0x280d565e000)
+ libssl.so.43 => /lib/libssl.so.43 (0x280d4fc2000)
+ libcrypto.so.41 => /lib/libcrypto.so.41 (0x280d4c1c000)
+ libldap_r-2.4.so.2 => /usr/lib/libldap_r-2.4.so.2 (0x280d49d6000)
+ liblber-2.4.so.2 => /usr/lib/liblber-2.4.so.2 (0x280d47c9000)
+ libsasl2.so.3 => /usr/lib/libsasl2.so.3 (0x280d45b0000)
+ Error relocating postgresql/libpqwalreceiver.so: appendStringInfoChar: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: MyLatch: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: MemoryContextDelete: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: errstart: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: pg_atoi: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: TupleDescGetAttInMetadata: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: WalReceiverFunctions: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: WaitLatchOrSocket: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: MemoryContextReset: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: pfree: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: errmsg: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: tuplestore_puttuple: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: pchomp: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: appendStringInfoString: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: errfinish: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: pstrdup: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: palloc0: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: errdetail: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: ResetLatch: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: work_mem: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: AllocSetContextCreate: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: CurrentMemoryContext: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: tuplestore_begin_heap: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: BuildTupleFromCStrings: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: errcode: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: MyDatabaseId: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: GetDatabaseEncodingName: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: palloc: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: pg_lsn_in: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: ProcessInterrupts: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: elog_start: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: DirectFunctionCall1Coll: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: elog_finish: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: CreateTemplateTupleDesc: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: InterruptPending: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: TupleDescInitEntry: symbol not found
+ Error relocating postgresql/libpqwalreceiver.so: initStringInfo: symbol not found w
+
+These symbols are really not provided by libpq.
+
+I wasted one day trying to figure out what's going on here, but still
+have no idea. :(
+
+--- a/src/test/regress/parallel_schedule
++++ b/src/test/regress/parallel_schedule
+@@ -84,7 +84,7 @@
+ # ----------
+ # Another group of parallel tests
+ # ----------
+-test: brin gin gist spgist privileges init_privs security_label collate matview lock replica_identity rowsecurity object_address tablesample groupingsets drop_operator password
++test: brin gin gist spgist privileges init_privs security_label collate matview lock replica_identity rowsecurity tablesample groupingsets drop_operator password
+
+ # ----------
+ # Another group of parallel tests
+@@ -98,7 +98,7 @@
+ test: select_parallel
+
+ # no relation related tests can be put in this group
+-test: publication subscription
++test: publication
+
+ # ----------
+ # Another group of parallel tests
+--- a/src/test/modules/dummy_seclabel/Makefile
++++ b/src/test/modules/dummy_seclabel/Makefile
+@@ -6,7 +6,7 @@
+ EXTENSION = dummy_seclabel
+ DATA = dummy_seclabel--1.0.sql
+
+-REGRESS = dummy_seclabel
++#REGRESS = dummy_seclabel
+
+ ifdef USE_PGXS
+ PG_CONFIG = pg_config
+--- a/contrib/postgres_fdw/Makefile
++++ b/contrib/postgres_fdw/Makefile
+@@ -10,7 +10,7 @@
+ EXTENSION = postgres_fdw
+ DATA = postgres_fdw--1.0.sql
+
+-REGRESS = postgres_fdw
++#REGRESS = postgres_fdw
+
+ ifdef USE_PGXS
+ PG_CONFIG = pg_config
+--- a/contrib/dblink/Makefile
++++ b/contrib/dblink/Makefile
+@@ -10,7 +10,7 @@
+ dblink--unpackaged--1.0.sql
+ PGFILEDESC = "dblink - connect to other PostgreSQL databases"
+
+-REGRESS = paths dblink
++#REGRESS = paths dblink
+ REGRESS_OPTS = --dlpath=$(top_builddir)/src/test/regress
+ EXTRA_CLEAN = sql/paths.sql expected/paths.out
+
diff --git a/system/postgresql/initdb.patch b/system/postgresql/initdb.patch
new file mode 100644
index 000000000..59a872a49
--- /dev/null
+++ b/system/postgresql/initdb.patch
@@ -0,0 +1,14 @@
+diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
+--- a/src/bin/initdb/initdb.c
++++ b/src/bin/initdb/initdb.c
+@@ -3259,9 +3259,7 @@
+ /* translator: This is a placeholder in a shell command. */
+ appendPQExpBuffer(start_db_cmd, " -l %s start", _("logfile"));
+
+- printf(_("\nSuccess. You can now start the database server using:\n\n"
+- " %s\n\n"),
+- start_db_cmd->data);
++ printf(_("\nSuccess.\n\n"));
+
+ destroyPQExpBuffer(start_db_cmd);
+
diff --git a/system/postgresql/perl-rpath.patch b/system/postgresql/perl-rpath.patch
new file mode 100644
index 000000000..a2505acf7
--- /dev/null
+++ b/system/postgresql/perl-rpath.patch
@@ -0,0 +1,22 @@
+We configure Postgres with --disable-rpath because for the most part we
+want to leave it to ldconfig to determine where libraries are. However,
+for some reason the Perl package puts libperl.so in a nonstandard place
+and doesn't add that place to the ldconfig search path. I think this
+is a Perl packaging bug, myself, but apparently it's not going to change.
+So work around it by adding an rpath spec to plperl.so (only).
+
+Alpine notes:
+This patch is copied from Fedora.
+
+--- a/src/pl/plperl/GNUmakefile
++++ b/src/pl/plperl/GNUmakefile
+@@ -43,6 +43,9 @@
+
+ SHLIB_LINK = $(perl_embed_ldflags)
+
++# Force rpath to be used even though we disable it everywhere else
++SHLIB_LINK += $(rpath)
++
+ REGRESS_OPTS = --dbname=$(PL_TESTDB) --load-extension=plperl --load-extension=plperlu
+ REGRESS = plperl plperl_lc plperl_trigger plperl_shared plperl_elog plperl_util plperl_init plperlu plperl_array
+ # if Perl can support two interpreters in one backend,
diff --git a/system/postgresql/pg-restore.confd b/system/postgresql/pg-restore.confd
new file mode 100644
index 000000000..84a179f6c
--- /dev/null
+++ b/system/postgresql/pg-restore.confd
@@ -0,0 +1,16 @@
+
+# Enable this to dump databases on shutdown and restore on boot
+#
+#PGDUMP="/var/lib/postgresql/backup/databases.pgdump"
+
+# The dump file will be deleted once restored unless KEEP_DUMP is set.
+# This is to avoid accidental restoring of running database. If you know what
+# you are doing and want keep the dump, then enable the KEEP_DUMP option
+# below.
+#
+#KEEP_DUMP=yes
+
+# If you enable KEEP_DUMP above you probably also want the --clean option
+# the the pg_dumpall command.
+#PG_DUMPALL_OPTS="--clean"
+
diff --git a/system/postgresql/pg-restore.initd b/system/postgresql/pg-restore.initd
new file mode 100644
index 000000000..e9fe65c19
--- /dev/null
+++ b/system/postgresql/pg-restore.initd
@@ -0,0 +1,36 @@
+#!/sbin/openrc-run
+
+extra_commands="${opts} dump restore purge"
+
+depend() {
+ need postgresql
+}
+
+restore() {
+ yesno "$PGDUMP" && return 0
+ ebegin "Restoring PostgreSQL $PGDUMP"
+ psql -U ${PG_USER:-postgres} ${PSQL_OPTS} -f "$PGDUMP" >/dev/null 2>/dev/null
+ local res=$?
+ yesno "$KEEP_DUMP" || rm -f "$PGDUMP"
+ eend $res
+ /etc/init.d/postgresql reload
+}
+
+dump() {
+ yesno "$PGDUMP" && return 0
+ mkdir -p "$( dirname "$PGDUMP" )"
+ ebegin "Saving PostgreSQL databases to $PGDUMP"
+ pg_dumpall -U ${PG_USER:-postgres} ${PG_DUMPALL_OPTS} -f "$PGDUMP"
+ eend $?
+}
+
+purge() {
+ yesno "$PGDUMP" && return 0
+ ebegin "Removing temporary $PGDUMP PostgreSQL backup"
+ rm -f "$PGDUMP"
+ eend $?
+}
+
+start() {
+ restore
+}
diff --git a/system/postgresql/pltcl_create_tables.sql b/system/postgresql/pltcl_create_tables.sql
new file mode 100644
index 000000000..76c7a954a
--- /dev/null
+++ b/system/postgresql/pltcl_create_tables.sql
@@ -0,0 +1,13 @@
+-- Create tables needed for PL/Tcl autoloading. This script should be run by
+-- the database administrator only.
+--
+-- Statements in this script are extracted from pltcl_loadmod script.
+--
+-- Author: G.J.R. Timmer
+-- Date: 2017-01-28
+
+create table pltcl_modules (modname name, modseq int2, modsrc text);
+create index pltcl_modules_i on pltcl_modules using btree (modname name_ops);
+
+create table pltcl_modfuncs (funcname name, modname name);
+create index pltcl_modfuncs_i on pltcl_modfuncs using hash (funcname name_ops);
diff --git a/system/postgresql/postgresql.confd b/system/postgresql/postgresql.confd
new file mode 100644
index 000000000..6a25cc381
--- /dev/null
+++ b/system/postgresql/postgresql.confd
@@ -0,0 +1,59 @@
+# Which port and socket to bind PostgreSQL.
+# This may be overriden in postgresql.conf.
+#port="5432"
+
+# How long to wait for server to start in seconds.
+#start_timeout=10
+
+# Number of seconds to wait for clients to disconnect from the server before
+# shutting down. Set to zero to disable this timeout.
+#nice_timeout=60
+
+# Timeout in seconds for rude quit - forecfully disconnect clients from server
+# and shut down. This is performed after nice_timeout exceeded. Terminated
+# client connections have their open transactions rolled back.
+# Set "rude_quit=no" to disable.
+#rude_quit="yes"
+#rude_timeout=30
+
+# Timeout in seconds for force quit - if the server still fails to shutdown,
+# you can force it to quit and a recover-run will execute on the next startup.
+# Set "force_quit=yes" to enable.
+#force_quit="no"
+#force_timeout="2"
+
+# Extra options to run postmaster with, e.g.:
+# -N is the maximal number of client connections
+# -B is the number of shared buffers (has to be at least 2x the value for -N)
+# Please read man postgres(1) for more options. Many of these options can be
+# set directly in the configuration file.
+#pg_opts="-N 512 -B 1024"
+
+# Pass extra environment variables. If you have to export environment variables
+# for the database process, this can be done here.
+# Don't forget to escape quotes.
+#env_vars="PGPASSFILE=\"/path/to/.pgpass\""
+
+# Location of postmaster.log. Default is $data_dir/postmaster.log.
+logfile="/var/log/postgresql/postmaster.log"
+
+# Automatically set up a new database if missing on startup.
+#auto_setup="yes"
+
+
+##############################################################################
+#
+# The following values should NOT be arbitrarily changed!
+#
+# The initscript uses these variables to inform PostgreSQL where to find
+# its data directory and configuration files.
+
+# Where the data directory is located/to be created.
+#data_dir="/var/lib/postgresql/@VERSION@/data"
+
+# Location of configuration files. Default is $data_dir.
+conf_dir="/etc/postgresql"
+
+# Additional options to pass to initdb.
+# See man initdb(1) for available options.
+#initdb_opts="--locale=en_US.UTF-8"
diff --git a/system/postgresql/postgresql.initd b/system/postgresql/postgresql.initd
new file mode 100644
index 000000000..846229a40
--- /dev/null
+++ b/system/postgresql/postgresql.initd
@@ -0,0 +1,220 @@
+#!/sbin/openrc-run
+
+extra_started_commands="reload"
+description_reload="Reload configuration"
+
+extra_stopped_commands="setup"
+description_setup="Initialize a new PostgreSQL cluster"
+
+# Note: Uppercase variables are here for backward compatibility.
+
+: ${user:=${PGUSER:-"postgres"}}
+: ${group:=${PGGROUP:-"postgres"}}
+
+: ${auto_setup:=${AUTO_SETUP:-"yes"}}
+: ${start_timeout:=${START_TIMEOUT:-10}}
+: ${nice_timeout:=${NICE_TIMEOUT:-60}}
+: ${rude_quit:=${RUDE_QUIT:-"yes"}}
+: ${rude_timeout:=${RUDE_TIMEOUT:-30}}
+: ${force_quit:=${FORCE_QUIT:-"no"}}
+: ${force_timeout:=${FORCE_TIMEOUT:-2}}
+
+: ${data_dir:=${PGDATA:-"/var/lib/postgresql/@VERSION@/data"}}
+: ${conf_dir:=$data_dir}
+: ${env_vars:=${PG_EXTRA_ENV:-}}
+: ${initdb_opts:=${PG_INITDB_OPTS:-}}
+: ${logfile:="$data_dir/postmaster.log"}
+: ${pg_opts:=${PGOPTS:-}}
+: ${port:=${PGPORT:-5432}}
+
+command="/usr/bin/postgres"
+
+conffile="$conf_dir/postgresql.conf"
+pidfile="$data_dir/postmaster.pid"
+start_stop_daemon_args="
+ --user $user
+ --group $group
+ --pidfile $pidfile
+ --wait 100"
+
+depend() {
+ use net
+ after firewall
+
+ if [ "$(get_config log_destination)" = "syslog" ]; then
+ use logger
+ fi
+}
+
+start_pre() {
+ check_deprecated_var WAIT_FOR_START start_timeout
+ check_deprecated_var WAIT_FOR_DISCONNECT nice_timeout
+ check_deprecated_var WAIT_FOR_CLEANUP rude_timeout
+ check_deprecated_var WAIT_FOR_QUIT force_timeout
+
+ if [ ! -d "$data_dir/base" ]; then
+ if yesno "$auto_setup"; then
+ setup || return 1
+ else
+ eerror "Database not found at: $data_dir"
+ eerror "Please make sure that 'data_dir' points to the right path."
+ eerror "You can run '/etc/init.d/postgresql setup' to setup a new database cluster."
+ return 1
+ fi
+ fi
+
+ local socket_dirs=$(get_config "unix_socket_directories" "/run/postgresql")
+ local port=$(get_config "port" "$port")
+
+ start_stop_daemon_args="$start_stop_daemon_args --env PGPORT=$port"
+
+ (
+ # Set the proper permission for the socket paths and create them if
+ # then don't exist.
+ set -f; IFS=","
+ for dir in $socket_dirs; do
+ if [ -e "${dir%/}/.s.PGSQL.$port" ]; then
+ eerror "Socket conflict. A server is already listening on:"
+ eerror " ${dir%/}/.s.PGSQL.$port"
+ eerror "Hint: Change 'port' to listen on a different socket."
+ return 1
+ elif [ "${dir%/}" != "/tmp" ]; then
+ checkpath -d -m 1775 -o $user:$group "$dir"
+ fi
+ done
+ )
+}
+
+start() {
+ local retval
+
+ ebegin "Starting PostgreSQL"
+
+ local var; for var in $env_vars; do
+ start_stop_daemon_args="$start_stop_daemon_args --env $var"
+ done
+
+ rm -f "$pidfile"
+ start-stop-daemon --start \
+ $start_stop_daemon_args \
+ --exec /usr/bin/pg_ctl \
+ -- start \
+ --silent \
+ -w --timeout="$start_timeout" \
+ --log="$logfile" \
+ --pgdata="$conf_dir" \
+ -o "--data-directory=$data_dir $pg_opts"
+ retval=$?
+
+ if [ $retval -ne 0 ]; then
+ eerror "Check the log for a possible explanation of the above error:"
+ eerror " $logfile"
+ fi
+ eend $retval
+}
+
+stop() {
+ local retry="SIGTERM/$nice_timeout"
+
+ yesno "$rude_quit" \
+ && retry="$retry/SIGINT/$rude_timeout" \
+ || rude_timeout=0
+
+ yesno "$force_quit" \
+ && retry="$retry/SIGQUIT/$force_timeout" \
+ || force_timeout=0
+
+ local seconds=$(( $nice_timeout + $rude_timeout + $force_timeout ))
+
+ ebegin "Stopping PostgreSQL (this can take up to $seconds seconds)"
+
+ start-stop-daemon --stop \
+ --exec "$command" \
+ --retry "$retry" \
+ --progress \
+ --pidfile "$pidfile"
+ eend $?
+}
+
+reload() {
+ ebegin "Reloading PostgreSQL configuration"
+
+ start-stop-daemon --signal HUP --pidfile "$pidfile"
+ eend $?
+}
+
+setup() {
+ local bkpdir
+
+ ebegin "Creating a new PostgreSQL database cluster"
+
+ if [ -d "$data_dir/base" ]; then
+ eend 1 "$data_dir/base already exists!"; return 1
+ fi
+
+ # If data_dir exists, backup configs.
+ if [ -d "$data_dir" ]; then
+ bkpdir="$(mktemp -d)"
+ find "$data_dir" -type f -name "*.conf" -maxdepth 1 \
+ -exec mv -v {} "$bkpdir"/ \;
+ rm -rf "$data_dir"/*
+ fi
+
+ install -d -m 0700 -o $user -g $group "$data_dir"
+ install -d -m 0750 -o $user -g $group "$conf_dir"
+
+ cd "$data_dir" # to avoid the: could not change directory to "/root"
+ su $user -c "/usr/bin/initdb $initdb_opts --pgdata $data_dir"
+ local retval=$?
+
+ if [ -d "$bkpdir" ]; then
+ # Move backuped configs back.
+ mv -v "$bkpdir"/* "$data_dir"/
+ rm -rf "$bkpdir"
+ fi
+
+ if [ "${data_dir%/}" != "${conf_dir%/}" ]; then
+ # Move configs from data_dir to conf_dir and symlink them to data_dir.
+ local name newname
+ for name in postgresql.conf pg_hba.conf pg_ident.conf; do
+ newname="$name"
+ [ ! -e "$conf_dir"/$name ] || newname="$name.new"
+
+ mv "$data_dir"/$name "$conf_dir"/$newname
+ ln -s "$conf_dir"/$name "$data_dir"/$name
+ done
+ fi
+
+ eend $retval
+}
+
+
+get_config() {
+ local name="$1"
+ local default="${2:-}"
+
+ if [ ! -f "$conffile" ]; then
+ printf '%s\n' "$default"
+ return 1
+ fi
+ sed -En "/^\s*${name}\b/{ # find line starting with the name
+ s/^\s*${name}\s*=?\s*([^#]+).*/\1/; # capture the value
+ s/\s*$//; # trim trailing whitespaces
+ s/^['\"](.*)['\"]$/\1/; # remove delimiting quotes
+ p
+ }" "$conffile" \
+ | grep . || printf '%s\n' "$default"
+}
+
+check_deprecated_var() {
+ local old_name="$1"
+ local new_name="$2"
+
+ if [ -n "$(getval "$old_name")" ]; then
+ ewarn "Variable '$old_name' has been removed, please use '$new_name' instead."
+ fi
+}
+
+getval() {
+ eval "printf '%s\n' \"\$$1\""
+}
diff --git a/system/postgresql/postgresql.pre-upgrade b/system/postgresql/postgresql.pre-upgrade
new file mode 100644
index 000000000..6116252c1
--- /dev/null
+++ b/system/postgresql/postgresql.pre-upgrade
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+new="$1"
+old="$2"
+
+pgver=${new%.*}
+compare=$(apk version -t "$old" $pgver)
+
+# check if we upgrade from earlier than $pgver and if it is running
+if [ "$compare" != "<" ] || ! /etc/init.d/postgresql --quiet status; then
+ exit 0
+fi
+
+if [ -f /etc/conf.d/postgresql ]; then
+ . /etc/conf.d/postgresql
+fi
+
+cat <<EOF
+* You are upgrading to postgres $pgver wich is not compatible with the running
+* See: http://www.postgresql.org/docs/$pgver/static/upgrading.html
+*
+* The corresponding steps for Alpine Linux is:
+*
+* pg_dumpall -U ${PGUSER:-postgres} > dumpfile
+* /etc/init.d/postgresql stop
+* apk add -u postgresql
+* /etc/init.d/postgresql setup
+* /etc/init.d/postgresql start
+* psql -U ${PGUSER:-postgres} -f dumpfile
+*
+EOF
+exit 1
diff --git a/system/py-mako/APKBUILD b/system/py-mako/APKBUILD
new file mode 100644
index 000000000..2ef83e096
--- /dev/null
+++ b/system/py-mako/APKBUILD
@@ -0,0 +1,51 @@
+# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
+# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
+pkgname=py-mako
+_pkgname=Mako
+pkgver=1.0.7
+pkgrel=0
+pkgdesc="A Python fast templating language"
+url="http://www.makotemplates.org/"
+arch="noarch"
+license="MIT"
+depends=""
+makedepends="python3-dev"
+checkdepends="py-six"
+subpackages="py3-${pkgname#py-}:_py3"
+source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
+builddir="$srcdir"/$_pkgname-$pkgver
+
+build() {
+ cd "$builddir"
+ python3 setup.py build
+}
+
+package() {
+ mkdir -p "$pkgdir"
+}
+
+check() {
+ cd "$builddir"
+ python3 setup.py test
+}
+
+_py2() {
+ replaces="$pkgname"
+ _py python2
+}
+
+_py3() {
+ _py python3
+}
+
+_py() {
+ local python="$1"
+ pkgdesc="$pkgdesc (for $python)"
+ depends="$depends $python"
+ install_if="$pkgname=$pkgver-r$pkgrel $python"
+
+ cd "$builddir"
+ $python setup.py install --prefix=/usr --root="$subpkgdir"
+}
+
+sha512sums="d67af6788bf8603010361ce8b6d0355b0191657c07f3b5845f9d5e91653c3e349a7b35d5b36aa9c7f291973c83911ce94075e1cad78e6935d0ed4ee9c6e2a571 Mako-1.0.7.tar.gz"
diff --git a/system/rsync/APKBUILD b/system/rsync/APKBUILD
new file mode 100644
index 000000000..af06ccd38
--- /dev/null
+++ b/system/rsync/APKBUILD
@@ -0,0 +1,65 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=rsync
+pkgver=3.1.2
+pkgrel=7
+pkgdesc="A file transfer program to keep remote files in sync"
+url="https://rsync.samba.org/"
+arch="all"
+license="GPL3"
+options="!checkroot"
+makedepends="perl acl-dev attr-dev popt-dev"
+subpackages="$pkgname-doc $pkgname-openrc rrsync"
+source="https://download.samba.org/pub/$pkgname/$pkgname-$pkgver.tar.gz
+ rsyncd.initd
+ rsyncd.confd
+ rsyncd.conf
+ rsyncd.logrotate
+ "
+builddir="$srcdir/$pkgname-$pkgver"
+
+build() {
+ cd "$builddir"
+ # Force IPv6 enabled, upstream bug https://bugzilla.samba.org/show_bug.cgi?id=10715
+ CFLAGS="$CFLAGS -DINET6" \
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --localstatedir=/var \
+ --enable-acl-support \
+ --enable-xattr-support
+ make
+}
+
+check() {
+ cd "$builddir"
+ make check
+}
+
+package() {
+ cd "$builddir"
+ make DESTDIR="$pkgdir" install
+
+ install -D -m 755 "$srcdir"/rsyncd.initd "$pkgdir"/etc/init.d/rsyncd
+ install -D -m 644 "$srcdir"/rsyncd.conf "$pkgdir"/etc/rsyncd.conf
+ install -D -m 644 "$srcdir"/rsyncd.confd "$pkgdir"/etc/conf.d/rsyncd
+ install -D -m 644 "$srcdir"/rsyncd.logrotate "$pkgdir"/etc/logrotate.d/rsyncd
+
+}
+
+rrsync() {
+ pkgdesc="Restricted rsync, restricts rsync to a subdir declared in .ssh/authorized_keys"
+ depends="rsync perl"
+ arch="noarch"
+
+ cd "$builddir"
+ install -D -m 755 ./support/rrsync "$subpkgdir"/usr/bin/rrsync
+}
+
+sha512sums="4c55fd69f436ead0cb5a0b7c6fdfef9bb28ddb9c63534eb619e756b118d5b08cfc5e696498650932c86e865b37e06633da947e6720ca0c27ed5c034313ae208b rsync-3.1.2.tar.gz
+638d87c9a753b35044f6321ccd09d2c0addaab3c52c40863eb6905905576b5268bec67b496df81225528c9e39fbd92e9225d7b3037ab1fda78508d452c78158f rsyncd.initd
+c7527e289c81bee5e4c14b890817cdb47d14f0d26dd8dcdcbe85c7199cf27c57a0b679bdd1b115bfe00de77b52709cc5d97522a47f63c1bb5104f4a7220c9961 rsyncd.confd
+3db8a2b364fc89132af6143af90513deb6be3a78c8180d47c969e33cb5edde9db88aad27758a6911f93781e3c9846aeadc80fffc761c355d6a28358853156b62 rsyncd.conf
+b8d6c0bb467a5c963317dc55478d2c10874564cd264d943d4a42037e2fce134fe001fabc92af5c6b5775e84dc310b1c8da147afaa61c99e5663c36580d8651a5 rsyncd.logrotate"
diff --git a/system/rsync/rsyncd.conf b/system/rsync/rsyncd.conf
new file mode 100644
index 000000000..6318016e9
--- /dev/null
+++ b/system/rsync/rsyncd.conf
@@ -0,0 +1,7 @@
+# /etc/rsyncd.conf
+# Minimal configuration file for rsync daemon.
+# See rsync(1) and rsyncd.conf(5) man pages for help.
+# Do not set "pid file" here.
+
+use chroot = yes
+read only = yes
diff --git a/system/rsync/rsyncd.confd b/system/rsync/rsyncd.confd
new file mode 100644
index 000000000..7128f97fd
--- /dev/null
+++ b/system/rsync/rsyncd.confd
@@ -0,0 +1,8 @@
+# Config file for /etc/init.d/rsyncd
+
+# Path to configuration file.
+#cfgfile="/etc/rsyncd.conf"
+
+# See man pages for rsync or run `rsync --daemon --help`
+# for valid cmdline options.
+#command_args=""
diff --git a/system/rsync/rsyncd.initd b/system/rsync/rsyncd.initd
new file mode 100644
index 000000000..eb05b3b59
--- /dev/null
+++ b/system/rsync/rsyncd.initd
@@ -0,0 +1,16 @@
+#!/sbin/openrc-run
+
+: ${cfgfile:="/etc/rsyncd.conf"}
+
+command="/usr/bin/rsync"
+command_args="--daemon --no-detach --config=$cfgfile
+ $command_args $RSYNC_OPTS"
+command_background="yes"
+
+pidfile="/run/$RC_SVCNAME.pid"
+required_files="$cfgfile"
+
+depend() {
+ use net
+ after firewall
+}
diff --git a/system/rsync/rsyncd.logrotate b/system/rsync/rsyncd.logrotate
new file mode 100644
index 000000000..34bcf72d2
--- /dev/null
+++ b/system/rsync/rsyncd.logrotate
@@ -0,0 +1,9 @@
+/var/log/rsync.log {
+ compress
+ maxage 365
+ rotate 7
+ size=+1024k
+ notifempty
+ missingok
+ copytruncate
+}
diff --git a/system/sed/APKBUILD b/system/sed/APKBUILD
new file mode 100644
index 000000000..08fe6a55a
--- /dev/null
+++ b/system/sed/APKBUILD
@@ -0,0 +1,49 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=sed
+pkgver=4.4
+pkgrel=1
+subpackages="$pkgname-doc"
+pkgdesc="GNU stream editor"
+url="http://www.gnu.org/software/sed"
+arch="all"
+license="GPL"
+options="!checkroot"
+makedepends="perl"
+install="$pkgname.post-deinstall"
+source="http://ftp.gnu.org/pub/gnu/$pkgname/$pkgname-$pkgver.tar.xz
+ disable-mbrtowc-test.patch
+ localename-test-fix.patch
+ "
+
+builddir="$srcdir/$pkgname-$pkgver"
+
+build() {
+ cd "$builddir"
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --bindir=/bin \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --disable-i18n \
+ --disable-nls
+ make
+}
+
+check() {
+ cd "$builddir"
+ make check
+}
+
+package() {
+ cd "$builddir"
+ make DESTDIR="$pkgdir" install
+
+ rm -rf "$pkgdir"/usr/lib/charset.alias || true
+ rmdir -p "$pkgdir"/usr/lib 2>/dev/null || true
+}
+
+sha512sums="4e1b0a7403913f1e25047eb2292a0a9b3488b15b4463ce2803e05eaecbc2da19f477a18e6a70c992461c38ced90774415091aa2d8ce85cb74e391610d9eedb70 sed-4.4.tar.xz
+aeb55f85a5c724f0dacbf2f39e0f99ae4c66159115b00aa36d65f234f87e52e660878cb18b772a494349632dfa1b616b9306a4cafe87e91182ea8936c308506a disable-mbrtowc-test.patch
+3fbf7f5fbdef19f1212c4efad560b85e62744eecfe60eceaba1c8d093764f34bff844d31d704afdc064ca3d31bb7e46860a4b91e671b96930554a72953e88edf localename-test-fix.patch"
diff --git a/system/sed/disable-mbrtowc-test.patch b/system/sed/disable-mbrtowc-test.patch
new file mode 100644
index 000000000..51cdf3c25
--- /dev/null
+++ b/system/sed/disable-mbrtowc-test.patch
@@ -0,0 +1,10 @@
+--- sed-4.4/gnulib-tests/test-mbrtowc5.sh.old 2016-12-31 13:54:43.000000000 +0000
++++ sed-4.4/gnulib-tests/test-mbrtowc5.sh 2017-07-30 17:29:50.879924130 +0000
+@@ -1,6 +1,2 @@
+ #!/bin/sh
+-# Test whether the POSIX locale has encoding errors.
+-LC_ALL=C \
+-./test-mbrtowc${EXEEXT} 5 || exit
+-LC_ALL=POSIX \
+-./test-mbrtowc${EXEEXT} 5
++exit 77
diff --git a/system/sed/localename-test-fix.patch b/system/sed/localename-test-fix.patch
new file mode 100644
index 000000000..8a5d68dde
--- /dev/null
+++ b/system/sed/localename-test-fix.patch
@@ -0,0 +1,34 @@
+--- sed-4.4/gnulib-tests/localename.c.old 2016-12-31 13:54:43.000000000 +0000
++++ sed-4.4/gnulib-tests/localename.c 2017-07-30 16:40:47.098541270 +0000
+@@ -40,7 +40,7 @@
+ # if defined __APPLE__ && defined __MACH__
+ # include <xlocale.h>
+ # endif
+-# if __GLIBC__ >= 2 && !defined __UCLIBC__
++# if defined __linux__
+ # include <langinfo.h>
+ # endif
+ # if !defined IN_LIBINTL
+@@ -2692,16 +2692,19 @@
+ locale_t thread_locale = uselocale (NULL);
+ if (thread_locale != LC_GLOBAL_LOCALE)
+ {
+-# if __GLIBC__ >= 2 && !defined __UCLIBC__
++# if defined(_NL_LOCALE_NAME)
++ const char *name = nl_langinfo(_NL_LOCALE_NAME(category));
++# if __GLIBC__ >= 2 && !defined __UCLIBC__
+ /* Work around an incorrect definition of the _NL_LOCALE_NAME macro in
+ glibc < 2.12.
+ See <http://sourceware.org/bugzilla/show_bug.cgi?id=10968>. */
+- const char *name =
+- nl_langinfo (_NL_ITEM ((category), _NL_ITEM_INDEX (-1)));
++ if (name[0] == '\0')
++ name = nl_langinfo (_NL_ITEM ((category), _NL_ITEM_INDEX (-1)));
+ if (name[0] == '\0')
+ /* Fallback code for glibc < 2.4, which did not implement
+ nl_langinfo (_NL_LOCALE_NAME (category)). */
+ name = thread_locale->__names[category];
++# endif
+ return name;
+ # elif defined __FreeBSD__ || (defined __APPLE__ && defined __MACH__)
+ /* FreeBSD, Mac OS X */
diff --git a/system/sed/sed.post-deinstall b/system/sed/sed.post-deinstall
new file mode 100644
index 000000000..5ec0031a4
--- /dev/null
+++ b/system/sed/sed.post-deinstall
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# we cannot rely on the busybox trigger since sed might be used from install
+# scripts
+
+[ -x /bin/busybox ] && exec /bin/busybox --install -s
diff --git a/system/spice/APKBUILD b/system/spice/APKBUILD
deleted file mode 100644
index a40b5853f..000000000
--- a/system/spice/APKBUILD
+++ /dev/null
@@ -1,43 +0,0 @@
-# Contributor: A. Wilcox <awilfox@adelielinux.org>
-# Maintainer: A. Wilcox <awilfox@adelielinux.org>
-pkgname=spice
-pkgver=0.14.0
-pkgrel=0
-pkgdesc="Solution for seamless access to virtual machines"
-url="https://www.spice-space.org/"
-arch="all"
-license="LGPL-2.1+"
-depends="gst-plugins-base"
-depends_dev=""
-makedepends="$depends_dev openssl-dev zlib-dev libjpeg-turbo-dev cyrus-sasl-dev
- opus-dev lz4-dev gstreamer-dev gst-plugins-base-dev glib-dev orc-dev
- python3 spice-protocol pixman-dev gstreamer-tools"
-install=""
-subpackages="$pkgname-dev"
-source="https://www.spice-space.org/download/releases/spice-$pkgver.tar.bz2"
-builddir="$srcdir/spice-$pkgver"
-
-build() {
- cd "$builddir"
- ./configure \
- --build=$CBUILD \
- --host=$CHOST \
- --prefix=/usr \
- --sysconfdir=/etc \
- --mandir=/usr/share/man \
- --localstatedir=/var \
- --disable-celt051
- make
-}
-
-check() {
- cd "$builddir"
- make check
-}
-
-package() {
- cd "$builddir"
- make DESTDIR="$pkgdir" install
-}
-
-sha512sums="84532146aa628ca6ca459a82afb89d6391892e063668fd4a68023c92cee7ca868b6c82e31dd9886819b76ea745ebdae0d0030e1f608d8f58f51c00f0b09bae1f spice-0.14.0.tar.bz2"
diff --git a/system/ssmtp/APKBUILD b/system/ssmtp/APKBUILD
new file mode 100644
index 000000000..b7ae28bc7
--- /dev/null
+++ b/system/ssmtp/APKBUILD
@@ -0,0 +1,52 @@
+# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+
+pkgname=ssmtp
+pkgver=2.64
+pkgrel=11
+pkgdesc="Extremely simple MTA to get mail off the system to a mail hub"
+subpackages="$pkgname-doc"
+arch="all"
+url="https://packages.debian.org/stable/mail/ssmtp"
+license="GPL2"
+depends=
+makedepends="openssl-dev autoconf"
+options="!check"
+provides="/usr/sbin/sendmail"
+source="http://ftp.debian.org/debian/pool/main/s/$pkgname/${pkgname}_${pkgver}.orig.tar.bz2
+ generate_config.patch
+ libcrypto-underlinking.patch
+ inet6-getaddrinfo.patch
+ "
+_builddir="$srcdir"/$pkgname-$pkgver
+
+build() {
+ cd "$_builddir"
+ sed -i -e 's:$(CC) -o:$(CC) @LDFLAGS@ -o:' Makefile.in
+ autoconf
+
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --mandir=/usr/share/man \
+ --sysconfdir=/etc \
+ --enable-ssl \
+ --enable-inet6 \
+ || return 1
+ make
+}
+
+package() {
+ cd "$srcdir"/$pkgname-$pkgver
+ make prefix="$pkgdir"/usr \
+ etcdir="$pkgdir"/etc \
+ mandir="$pkgdir"/usr/share/man \
+ install
+ ln -s ssmtp "$pkgdir"/usr/sbin/sendmail
+}
+
+sha512sums="911752e744420adf58552b9cf3a6e558d8b39103e5ad33a9ed4429b9a3a2091f7674aac11fe9bbd66747a61cdabe6bd638b80efcaadc86b057c12e2e235cca72 ssmtp_2.64.orig.tar.bz2
+a4273d7c5b50984994b35de052c450a872f0014c45c1d3bfe36f2edd4f224281aacea234be61c6e966da2c4d3e033042628b79b2216340001487e6bb3a55b6cd generate_config.patch
+9da89ec5ea66dae8b7a22ffcf196c45005c0403e6505162dba05003feac38eb397f8aff4f140d720f826ea057f92e47302ec3c24bddf5786c10b214ec906e82f libcrypto-underlinking.patch
+92dc128b2f6ce234843e8f1e6ddb72653825652544cd68f693457b3fdc4ee22b0f9861feec0dfd123d012c294c7083dd8d24a9a589a3c2ae5bcdde697d30a290 inet6-getaddrinfo.patch"
diff --git a/system/ssmtp/generate_config.patch b/system/ssmtp/generate_config.patch
new file mode 100644
index 000000000..23285b193
--- /dev/null
+++ b/system/ssmtp/generate_config.patch
@@ -0,0 +1,49 @@
+--- ./generate_config 2004-07-23 05:58:48.000000000 +0000
++++ ./generate_config 2009-01-27 10:09:11.000000000 +0000
+@@ -4,7 +4,7 @@
+ # Figure out the system's mailname
+ #
+
+-syshostname=`hostname --fqdn`
++syshostname="localhost"
+ if test -f /etc/mailname
+ then
+ mailname="`head -1 /etc/mailname`"
+@@ -15,23 +15,7 @@
+ mailname=$syshostname
+ fi
+
+-echo "Please enter the mail name of your system."
+-echo "This is the hostname portion of the address to be shown"
+-echo "on outgoing news and mail messages headers."
+-echo "The default is $syshostname, your system's host name."
+-echo
+-echo -n "Mail name [$syshostname]: "
+-read mailname
+-echo
+-
+-echo -n "Please enter the SMTP port number [25]: "
+-read smtpport
+-if test -z "$smtpport"
+-then
+- mailhub=$mailhub
+-else
+- mailhub="$mailhub:$smtpport"
+-fi
++mailhub="$mailhub:$smtpport"
+
+ #
+ # Generate configuration file
+@@ -56,11 +40,5 @@
+ # Where will the mail seem to come from?
+ #rewriteDomain=`echo -n $mailname`
+ # The full hostname
+-hostname=`hostname --fqdn`
++#hostname="localhost"
+ EOF
+-
+-echo
+-echo
+-echo "Please check the configuration file $1 for correctness."
+-echo
+-echo
diff --git a/system/ssmtp/inet6-getaddrinfo.patch b/system/ssmtp/inet6-getaddrinfo.patch
new file mode 100644
index 000000000..bbc2d90ba
--- /dev/null
+++ b/system/ssmtp/inet6-getaddrinfo.patch
@@ -0,0 +1,12 @@
+diff -up ssmtp.orig/ssmtp.c ssmtp/ssmtp.c
+--- ssmtp.orig/ssmtp.c 2009-11-23 10:55:11.000000000 +0100
++++ ssmtp/ssmtp.c 2015-07-27 17:34:12.498140804 +0200
+@@ -1157,7 +1157,7 @@ int smtp_open(char *host, int port)
+ snprintf(servname, sizeof(servname), "%d", port);
+
+ /* Check we can reach the host */
+- if (getaddrinfo(host, servname, &hints, &ai0)) {
++ if (getaddrinfo(host, servname, &hints, &ai0) != 0) {
+ log_event(LOG_ERR, "Unable to locate %s", host);
+ return(-1);
+ }
diff --git a/system/ssmtp/libcrypto-underlinking.patch b/system/ssmtp/libcrypto-underlinking.patch
new file mode 100644
index 000000000..4928f271c
--- /dev/null
+++ b/system/ssmtp/libcrypto-underlinking.patch
@@ -0,0 +1,11 @@
+--- ./configure.in.orig
++++ ./configure.in
+@@ -52,7 +52,7 @@
+ [ --enable-ssl support for secure connection to mail server])
+ if test x$enableval = xyes ; then
+ AC_DEFINE(HAVE_SSL)
+- LIBS="$LIBS -lssl"
++ LIBS="$LIBS -lssl -lcrypto"
+ fi
+ enableval=""
+
diff --git a/system/strace/APKBUILD b/system/strace/APKBUILD
new file mode 100644
index 000000000..aecde405f
--- /dev/null
+++ b/system/strace/APKBUILD
@@ -0,0 +1,65 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=strace
+pkgver=4.19
+pkgrel=0
+pkgdesc="A useful diagnositic, instructional, and debugging tool"
+url="https://strace.io/"
+arch="all"
+license="BSD"
+depends=""
+makedepends="linux-headers autoconf automake"
+subpackages="$pkgname-doc"
+options="!checkroot"
+source="$pkgname-$pkgver.tar.gz::https://github.com/strace/$pkgname/archive/v$pkgver.tar.gz
+ disable-fortify.patch
+ fix-ppc-pt-regs-collision.patch
+ nlattr-fix.patch
+ "
+
+builddir="$srcdir/$pkgname-$pkgver"
+
+build() {
+ cd "$builddir"
+ case "$CLIBC" in
+ musl) export CFLAGS="$CFLAGS -Dsigcontext_struct=sigcontext" ;;
+ esac
+
+ case "$CARCH" in
+ s390x)
+ # __SIGNAL_FRAMESIZE is defined in asm/sigcontext.h
+ # but including it would make conflict with struct sigcontext
+ # since we compile with it in musl.
+ # Temporarily add this until musl upstream has a proper fix
+ # for struct sigcontext.
+ export CFLAGS="$CFLAGS -D__SIGNAL_FRAMESIZE=160"
+ ;;
+ esac
+
+ ./bootstrap
+
+ ac_cv_have_long_long_off_t=yes \
+ st_cv_m32_mpers=no \
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --localstatedir=/var
+ make
+}
+
+check() {
+ cd "$builddir"
+ make check
+}
+
+package() {
+ cd "$builddir"
+ make -j1 DESTDIR="$pkgdir" install
+}
+
+sha512sums="fbf953d64b43785648e2df0eb6beee409c6b6f6c6a4d227b54c02a049031c5ff3a3a6af52a68a2980d89eb06dcafc36be5f8784728e9a28348145cdb4a7764f9 strace-4.19.tar.gz
+273b92ebf0069f19bef7ec26c7860e2af7ef01e782255c70ded1ae5e967f8f6bf031ecba96612c6083bf58f46278ba4ab3ec0fb35b08c8c8d668191f97adee52 disable-fortify.patch
+b70cee89dd49a2b5a69dc2a56c3a11169d3306e1a73981155188b574486965c034aa52b4ac1c6edff5ef55c9d52f27750acb242fac095a8a9f69689b51b3fad1 fix-ppc-pt-regs-collision.patch
+44b1872cf996caa4970fa6c2875a3a2cffe4a38455e328d968bd7855ef9a05cf41190794dc137bc8667576635f5271057cf0e6cde9a6c7aee66afd1dba9bdba0 nlattr-fix.patch"
diff --git a/system/strace/disable-fortify.patch b/system/strace/disable-fortify.patch
new file mode 100644
index 000000000..26b2978c5
--- /dev/null
+++ b/system/strace/disable-fortify.patch
@@ -0,0 +1,39 @@
+Subject: [PATCH] don't use fortify-headers on netlink test sources
+From: A. Wilcox <AWilcox@Wilcox-Tech.com>
+
+We can't use fortify-headers on netlink tests because it tests what happens
+when a buffer overrun occurs.
+
+--- strace-4.18/tests/netlink_protocol.c.old 2017-07-05 07:08:09.000000000 +0000
++++ strace-4.18/tests/netlink_protocol.c 2017-08-17 01:09:45.822502012 +0000
+@@ -28,6 +28,8 @@
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
++#define _FORTIFY_SOURCE 0
++
+ #include "tests.h"
+
+ #ifdef HAVE_SYS_XATTR_H
+--- strace-4.18/tests/netlink_sock_diag.c.old 2017-07-05 07:08:09.000000000 +0000
++++ strace-4.18/tests/netlink_sock_diag.c 2017-08-17 01:10:00.935807300 +0000
+@@ -27,6 +27,8 @@
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
++#define _FORTIFY_SOURCE 0
++
+ #include "tests.h"
+ #include <stdio.h>
+ #include <string.h>
+--- strace-4.18/tests/nlattr.c.old 2017-07-05 07:08:09.000000000 +0000
++++ strace-4.18/tests/nlattr.c 2017-08-17 01:10:11.862453682 +0000
+@@ -28,6 +28,8 @@
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
++#define _FORTIFY_SOURCE 0
++
+ #include "tests.h"
+
+ #include <stdio.h>
diff --git a/system/strace/fix-ppc-pt-regs-collision.patch b/system/strace/fix-ppc-pt-regs-collision.patch
new file mode 100644
index 000000000..6de0fcdd6
--- /dev/null
+++ b/system/strace/fix-ppc-pt-regs-collision.patch
@@ -0,0 +1,19 @@
+--- a/ptrace.h
++++ b/ptrace.h
+@@ -48,7 +48,15 @@
+ # define ptrace_peeksiginfo_args XXX_ptrace_peeksiginfo_args
+ #endif
+
+-#include <linux/ptrace.h>
++#if defined(__powerpc__) || defined(__powerpc64__)
++# include <linux/types.h>
++# define __ASSEMBLY__
++# include <linux/ptrace.h>
++# undef __ASSEMBLY__
++#else
++# include <linux/ptrace.h>
++#endif
++
+
+ #ifdef HAVE_STRUCT_IA64_FPREG
+ # undef ia64_fpreg
diff --git a/system/strace/nlattr-fix.patch b/system/strace/nlattr-fix.patch
new file mode 100644
index 000000000..6d480fabb
--- /dev/null
+++ b/system/strace/nlattr-fix.patch
@@ -0,0 +1,21 @@
+--- strace-4.18/tests/nlattr.c.old 2017-07-05 07:08:09.000000000 +0000
++++ strace-4.18/tests/nlattr.c 2017-08-17 00:25:26.734218699 +0000
+@@ -61,7 +61,7 @@
+ };
+ struct msg *msg;
+ struct nlattr *nla;
+- unsigned int msg_len;
++ uint32_t msg_len;
+ long rc;
+
+ /* fetch fail: len < sizeof(struct nlattr) */
+@@ -259,7 +259,7 @@
+ };
+ struct msg *msg;
+ struct nlattr *nla;
+- unsigned int msg_len;
++ uint32_t msg_len;
+ long rc;
+
+ msg_len = NLMSG_SPACE(sizeof(msg->udm)) + sizeof(*nla);
+
diff --git a/system/syslinux/APKBUILD b/system/syslinux/APKBUILD
deleted file mode 100644
index 43ac057b1..000000000
--- a/system/syslinux/APKBUILD
+++ /dev/null
@@ -1,51 +0,0 @@
-# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
-pkgname=syslinux
-pkgver=6.04_pre1
-pkgrel=3
-_ver=${pkgver/_/-}
-pkgdesc="Boot loader for the Linux operating system"
-url="http://syslinux.org"
-arch="pmmx x86 x86_64"
-license="GPL"
-makedepends="linux-headers nasm perl util-linux-dev gnu-efi-dev"
-depends="mtools blkid mawk"
-triggers="syslinux.trigger=/boot"
-install="syslinux.post-upgrade"
-options="!check textrels" # does not ship tests in tarball
-ldpath="/usr/share/syslinux"
-
-source="https://www.kernel.org/pub/linux/utils/boot/syslinux/Testing/${pkgver%_pre*}/syslinux-$_ver.tar.xz
- update-extlinux.conf
- update-extlinux
- "
-subpackages="$pkgname-doc $pkgname-dev"
-
-_loaderarch=
-case "$CARCH" in
-x86) _loaderarch=efi32;;
-x86_64) _loaderarch=efi64;;
-esac
-
-builddir="$srcdir"/$pkgname-$_ver
-
-build() {
- cd "$builddir"
- unset LDFLAGS
- make $_loaderarch installer
-}
-
-package() {
- cd "$builddir"
- make -j1 INSTALLROOT="$pkgdir" MANDIR=/usr/share/man \
- bios $_loaderarch install
-
- mkdir -p "$pkgdir"/etc/update-extlinux.d
- cp "$srcdir"/update-extlinux.conf "$pkgdir"/etc/
- sed "/^version=/s/=.*/=$pkgver-r$pkgrel/" "$srcdir"/update-extlinux \
- > "$pkgdir"/sbin/update-extlinux
- chmod 755 "$pkgdir"/sbin/update-extlinux
-}
-
-sha512sums="7927dd39be8e2dcf4138a6fea33def67d19d938379d694f15b48fdd2f5924c028b7a9e7bd71d0c7c6630c203e9e2a54296628e530632ad5e6f55b1ebefe8fc98 syslinux-6.04-pre1.tar.xz
-9071be450e543597f6f95b9a5811869c5351a71f4c42f7879b9f7ec1b13e2e4d455e9f2900e3897d5e5870bd87c934b7168328186c5f17631f2b09a524e10a1a update-extlinux.conf
-8f4f003053a3a265a11522b5bd6c71998ae3bf7ef1fbc2ed51675e432485ba4453f707b1bc1a1ed2089cf226456a56e7742b197b45b015099820b7fed5c2f153 update-extlinux"
diff --git a/system/syslinux/syslinux.post-upgrade b/system/syslinux/syslinux.post-upgrade
deleted file mode 100644
index 90388668d..000000000
--- a/system/syslinux/syslinux.post-upgrade
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/bin/sh
-
-# find given append opt
-get_append_opt() {
- awk -v search="$1" '
- $1 == "append" || $1 == "APPEND" {
- split($0, a);
- for (i in a) {
- if (index(a[i], search) == 1) {
- print a[i];
- }
- }
- }' /boot/extlinux.conf | sort | uniq
-}
-
-# print default kernel options
-get_default_opts() {
- awk '
- $1 == "append" || $1 == "APPEND" {
- opts="";
- space="";
- split($0, a);
- for (i in a) {
- if (i != 1 \
- && (index(a[i], "root=") != 1) \
- && (index(a[i], "initrd=") != 1) \
- && (index(a[i], "modules=") != 1)) {
- opts = opts space a[i];
- space = " ";
- }
- }
- print opts;
- }
- ' /boot/extlinux.conf | sort | uniq
-}
-
-if ! [ -f /boot/extlinux.conf ]; then
- exit 0
-fi
-
-# check if we already have a generated extlinux.conf
-if grep -q '^# Generated by update-extlinux' /boot/extlinux.conf; then
- exit 0
-fi
-
-# try fish out the kernel opts from extlinuix.conf's append line
-root=$(get_append_opt 'root=' | head -n 1)
-modules=$(get_append_opt 'modules=' | head -n 1)
-opts=$(get_default_opts | head -n 1)
-
-# populate update-extlinux.conf with the info we know
-if [ -n "$root" ]; then
- sed -i -e "/^root=/s|.*|$root|g" /etc/update-extlinux.conf
-fi
-if [ -n "$modules" ]; then
- sed -i -e "/^modules=/s|.*|$modules|g" /etc/update-extlinux.conf
-fi
-if [ -n "$opts" ]; then
- sed -i -e "/^default_kernel_opts=/s|.*|default_kernel_opts=\"$opts\"|g" /etc/update-extlinux.conf
-fi
-
diff --git a/system/syslinux/syslinux.trigger b/system/syslinux/syslinux.trigger
deleted file mode 100644
index fe91f4379..000000000
--- a/system/syslinux/syslinux.trigger
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-update-extlinux --warn-only
diff --git a/system/syslinux/update-extlinux b/system/syslinux/update-extlinux
deleted file mode 100755
index 5e1183ba9..000000000
--- a/system/syslinux/update-extlinux
+++ /dev/null
@@ -1,252 +0,0 @@
-#!/bin/sh
-
-version=
-default=0
-timeout=5
-verbose=0
-
-conf=/boot/extlinux.conf
-myconf=/etc/update-extlinux.conf
-
-# read in extlinux settings
-if [ -f "$myconf" ]; then
- . $myconf
-fi
-
-everbose() {
- if [ "$verbose" = "0" ]; then
- return
- fi
-
- echo $*
-}
-
-ewarn() {
- echo "WARNING:" $@ >&2
-}
-
-eerror() {
- echo "ERROR:" $@ >&2
- return 1
-}
-
-usage() {
- echo "usage: $0 [-v|--verbose] [--warn-only]"
-}
-
-while [ $# -gt 0 ]; do
- opt="$1"
- shift
- case "$opt" in
- -v|--verbose)
- verbose=1
- ;;
- --warn-only)
- warn_only=1
- ;;
- --)
- break
- ;;
- -*)
- usage
- exit 1
- ;;
- esac
-done
-
-everbose "Updating extlinux configuration."
-
-if [ "x$root" = "x" ]; then
- ewarn "Root device is not specified in $myconf."
- blkid_export=$(blkid -o export /dev/root)
- if [ -n "$blkid_export" ]; then
- export $blkid_export
- fi
- if [ -z "$UUID" ]; then
- # try parse /proc/mount for mounted /
- dev=$(awk '$2 == "/" {dev=$1} END {print dev}' /proc/mounts)
- if [ -n "$dev" ]; then
- blkid_export=$(blkid -o export $dev)
- if [ -n "$blkid_export" ]; then
- export "$blkid_export"
- fi
- fi
- fi
- if [ -z "$UUID" ]; then
- if [ -z "$dev" ]; then
- if [ -n "$warn_only" ]; then
- ewarn "Failed to detect root device. extlinux.conf is not updated"
- exit 0
- else
- eerror "Failed to detect root device"
- exit 1
- fi
- else
- root=$dev
- fi
- else
- root=UUID=$UUID
- fi
- everbose "Root device is: $root"
-fi
-
-rtimeout=$(( ${timeout} * 10 ))
-syslinux_menu=menu.c32
-menu_hidden=
-
-# vesa menu has been requested?
-if [ "$vesa_menu" = "1" ]; then
- syslinux_menu=vesamenu.c32
-fi
-
-umask 0022
-rm -f $conf.new
-echo "# Generated by update-extlinux $version" > $conf.new
-if [ -n "$serial_port" ]; then
- echo "SERIAL $serial_port ${serial_baud:-115200}" >> $conf.new
-fi
-echo "DEFAULT $syslinux_menu" >> $conf.new
-echo "PROMPT 0" >> $conf.new
-echo "MENU TITLE Adelie $(uname -s) Boot Menu" >> $conf.new
-if [ "$hidden" = "1" ]; then
- echo "MENU HIDDEN" >> $conf.new
-fi
-echo "MENU AUTOBOOT Adelie will be booted automatically in # seconds." >> $conf.new
-echo "TIMEOUT $rtimeout" >> $conf.new
-
-lst=0
-if [ -f "/boot/xen.gz" ]; then
- for kernel in $(find /boot -name "vmlinuz-*" -type f); do
- tag=$(basename $kernel | cut -b9-)
- everbose "Found Xen hypervisor: /boot/xen.gz, kernel: $kernel"
-
- if [ -f "/boot/initramfs-$tag" ]; then
- everbose "Found initramfs: /boot/initramfs-$tag"
- initramfs="initramfs-$tag"
- else
- initramfs=
- fi
- label=xen-$(grep -w -l $tag /usr/share/kernel/*/kernel.release \
- | cut -d/ -f5)
- if [ "$label" = "xen-" ]; then
- label=xen-$lst
- fi
-
- echo "LABEL $label" >> $conf.new
- if [ "$label" = "$default" ]; then
- echo " MENU DEFAULT" >> $conf.new
- fi
- echo " MENU LABEL Xen + Linux $tag" >> $conf.new
- echo " COM32 mboot.c32" >> $conf.new
- echo " APPEND xen.gz $xen_opts --- $(basename $kernel) root=$root modules=${modules}${TYPE:+,$TYPE} $default_kernel_opts --- $initramfs" >> $conf.new
- echo "" >> $conf.new
- lst=$(($lst + 1))
- done
-fi
-
-for kernel in $(find /boot -name "vmlinuz*" -type f); do
- case $kernel in
- *vmlinuz) tag=vanilla;;
- *vmlinuz-*) tag=$(basename $kernel | cut -b9-);;
- *) continue;;
- esac
- everbose "Found kernel: $kernel"
- label=$(grep -w -l $tag /usr/share/kernel/*/kernel.release | cut -d/ -f5)
- if [ -z "$label" ]; then
- if [ "$tag" = vanilla ]; then
- label="vanilla"
- else
- label=$lst
- fi
- fi
- echo "LABEL $label" >> $conf.new
- if [ "$label" = "$default" ]; then
- echo " MENU DEFAULT" >> $conf.new
- fi
- echo " MENU LABEL Linux $tag" >> $conf.new
- echo " LINUX $(basename $kernel)" >> $conf.new
- if [ -f "/boot/initramfs-$tag" ]; then
- everbose "Found initramfs: /boot/initramfs-$tag"
- echo " INITRD initramfs-$tag" >> $conf.new
- fi
- echo " APPEND root=$root modules=${modules}${TYPE:+,$TYPE} $default_kernel_opts" >> $conf.new
- echo "" >> $conf.new
- lst=$(($lst + 1))
-done
-
-if [ -n "$password" ]; then
- echo "NOESCAPE 1" >> $conf.new
- echo "MENU MASTER PASSWD $password" >> $conf.new
- echo "" >> $conf.new
- chmod o-r $conf.new
-fi
-
-everbose "$lst entries found."
-
-for entry in /etc/update-extlinux.d/*; do
- [ -f "$entry" ] && { cat $entry; echo ""; } >> $conf.new
-done
-
-echo "MENU SEPARATOR" >> $conf.new
-echo "" >> $conf.new
-
-if [ -f "/boot/hdt.c32" ]; then
- everbose "Found Hardware Detection Tool: /boot/hdt.c32"
- echo "LABEL hdt" >> $conf.new
- echo " MENU LABEL Hardware info" >> $conf.new
- if [ -n "$password" ]; then
- echo " MENU PASSWD" >> $conf.new
- fi
- echo " COM32 hdt.c32" >> $conf.new
- if [ -f "/boot/memtest" ]; then
- everbose "Found memtest86+: /boot/memtest"
- echo " APPEND memtest=memtest" >> $conf.new
- fi
- echo "" >> $conf.new
-elif [ -f "/boot/memtest" ]; then
- everbose "Found memtest86+: /boot/memtest"
- echo "LABEL memtest" >> $conf.new
- echo " MENU LABEL Memtest86+" >> $conf.new
- echo " KERNEL memtest" >> $conf.new
- echo "" >> $conf.new
-fi
-
-for i in reboot poweroff; do
- [ -f "/boot/$i.c32" ] || continue
- everbose "Found $i"
- # make first char capital
- cap=$( echo $i | awk '{sub(".", substr(toupper($0),1,1), $0); print}' )
- echo "LABEL $i" >> $conf.new
- echo " MENU LABEL $cap" >> $conf.new
- echo " COM32 $i.c32" >> $conf.new
- echo "" >> $conf.new
-done
-
-if cmp -s $conf.new $conf; then
- everbose "Configuration unchanged."
- rm $conf.new
-fi
-
-if [ "$overwrite" != "1" ]; then
- exit 0
-elif [ -f "$conf.new" ]; then
- # keep a backup just in case
- if [ -f "$conf" ]; then
- mv $conf $conf.old
- fi
-
- mv $conf.new $conf
-fi
-
-everbose "Installing libutil.c32 libcom32.c32 mboot.c32 menu.c32 vesamenu.c32 to /boot."
-cp /usr/share/syslinux/libutil.c32 \
- /usr/share/syslinux/libcom32.c32 \
- /usr/share/syslinux/mboot.c32 \
- /usr/share/syslinux/menu.c32 \
- /usr/share/syslinux/vesamenu.c32 \
- /boot
-
-case "$(stat -f -c '%T' /boot)" in
-ext*) extlinux --update /boot || [ -n "$warn_only" ];;
-esac
-
diff --git a/system/syslinux/update-extlinux.conf b/system/syslinux/update-extlinux.conf
deleted file mode 100644
index 39598cb99..000000000
--- a/system/syslinux/update-extlinux.conf
+++ /dev/null
@@ -1,75 +0,0 @@
-# configuration for extlinux config builder
-
-# overwrite
-# Overwrite current /boot/extlinux.conf. If this is not '1' we will only
-# write to /boot/extlinux.conf.new
-overwrite=1
-
-# vesa_menu
-# use fancy vesa menu (vesamenu.c32) menus, won't work with serial
-vesa_menu=1
-
-# default_kernel_opts
-# default kernel options
-default_kernel_opts=ro
-
-# modules
-# modules which should be loaded before pivot_root
-modules=
-#sd-mod,usb-storage,ext3
-
-# root
-# root device - if not specified, will be guessed using
-# blkid -o export /dev/root
-root=
-
-# verbose
-# if set to non-zero, update-extlinux will be a lot more verbose.
-verbose=0
-
-# hidden
-# if set to non-zero, the boot menu will be hidden by default.
-hidden=0
-
-# timeout
-# number of seconds to wait before booting default
-timeout=5
-
-# default
-# default kernel to boot
-default=vanilla
-
-# serial_port
-# serial port number - if not specified, serial console will be disabled
-serial_port=
-
-# serial_baud
-# the baudrate for the serial port. Will use 115200 if unset
-serial_baud=115200
-
-# xen_opts
-# options to hand to xen hypervisor, useful ones are:
-# dom0_mem=256M (give domain-0 environment 256M ram)
-xen_opts=dom0_mem=256M
-
-# if you copy /usr/share/syslinux/reboot.c32 to /boot/, a menu entry
-# will be auto-generated for it
-
-# if you copy hdt.c32, libgpl.c32, and libmenu.c32 from /usr/share/syslinux/
-# to /boot/, a menu entry will be auto-generated for HDT
-
-# if you download and install /boot/memtest, then if HDT is present it
-# will use it, else a separate menu entry will be auto-generated for
-# memtest
-
-# optional password
-# you can generate a SHA512 password using: mkpasswd
-#
-# if you assign a password, you should make this file world-unreadable
-#
-# if a password is assigned, the menu entries can't be edited at boot
-# time, and HDT if present is password-protected
-#
-# you can also include "MENU PASSWD" in any custom entries you have in
-# /etc/update-extlinux.d/
-password=''
diff --git a/system/tzdata/0001-posixtz-fix-up-lseek.patch b/system/tzdata/0001-posixtz-fix-up-lseek.patch
new file mode 100644
index 000000000..4bf164fec
--- /dev/null
+++ b/system/tzdata/0001-posixtz-fix-up-lseek.patch
@@ -0,0 +1,27 @@
+From 5c4cd3cee03428636e8d7cc4ed644389a4d598b3 Mon Sep 17 00:00:00 2001
+From: William Pitcock <nenolod@dereferenced.org>
+Date: Thu, 28 Apr 2011 02:56:42 -0500
+Subject: [PATCH] posixtz: ensure the file offset we pass to lseek is off_t
+
+on 32-bit systems, sizeof(off_t) is 4, on 64-bit sizeof(off_t) is 8
+causing a word masking issue.
+---
+ posixtz.c | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/posixtz.c b/posixtz.c
+index cddcb3e..972ca31 100644
+--- a/posixtz-0.5/posixtz.c
++++ b/posixtz-0.5/posixtz.c
+@@ -36,7 +36,7 @@ char *posix_tz(const char *filename)
+ if (r != TZ_BUFLEN
+ || strncmp(buf, "TZif", 4) != 0
+ || (unsigned char)buf[4] < 2
+- || lseek(fd, -TZ_BUFLEN, SEEK_END) < 0
++ || lseek(fd, (off_t) -TZ_BUFLEN, SEEK_END) < 0
+ )
+ goto ERROR;
+
+--
+1.7.4.5
+
diff --git a/system/tzdata/APKBUILD b/system/tzdata/APKBUILD
new file mode 100644
index 000000000..e4ff75efd
--- /dev/null
+++ b/system/tzdata/APKBUILD
@@ -0,0 +1,66 @@
+# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
+# Contributor: Natanael Copa <ncopa@alpinelinux.org>
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=tzdata
+pkgver=2017c
+_tzcodever=2017c
+_ptzver=0.5
+pkgrel=1
+pkgdesc="Timezone data"
+url="https://www.iana.org/time-zones"
+arch="all"
+license="Public Domain"
+depends=""
+depends_dev=""
+makedepends=""
+checkdepends="sp"
+install=""
+subpackages="$pkgname-doc"
+source="http://www.iana.org/time-zones/repository/releases/tzcode$_tzcodever.tar.gz
+ http://www.iana.org/time-zones/repository/releases/tzdata$pkgver.tar.gz
+ http://dev.alpinelinux.org/archive/posixtz/posixtz-$_ptzver.tar.xz
+ 0001-posixtz-fix-up-lseek.patch"
+
+builddir="$srcdir"
+_timezones="africa antarctica asia australasia europe northamerica \
+ southamerica pacificnew etcetera backward systemv factory"
+
+build() {
+ cd "$builddir"
+ make cc="${CC:-gcc}" CFLAGS="$CFLAGS -DHAVE_STDINT_H=1"
+ TZDIR="/usr/share/zoneinfo"
+
+ cd "$builddir"/posixtz-$_ptzver
+ make posixtz
+}
+
+check() {
+ cd "$builddir"
+ make -j1 check
+}
+
+package() {
+ cd "$builddir"
+
+ ./zic -y ./yearistype -d "$pkgdir"/usr/share/zoneinfo ${_timezones}
+ ./zic -y ./yearistype -d "$pkgdir"/usr/share/zoneinfo/right -L leapseconds ${_timezones}
+ #./zic -y ./yearistype -d "$pkgdir"/usr/share/zoneinfo/posix ${_timezones}
+
+ ./zic -y ./yearistype -d "$pkgdir"/usr/share/zoneinfo -p America/New_York
+ install -m444 -t "$pkgdir"/usr/share/zoneinfo iso3166.tab zone1970.tab zone.tab
+
+ mkdir -p "$pkgdir"/usr/sbin
+ install -m755 zic zdump "$pkgdir"/usr/sbin
+
+ mkdir -p "$pkgdir"/usr/share/man/man8
+ install -m644 zic.8 zdump.8 "$pkgdir"/usr/share/man/man8
+
+ rm -f "$pkgdir"/usr/share/zoneinfo/localtime
+ install -Dm755 "$srcdir"/posixtz-$_ptzver/posixtz \
+ "$pkgdir"/usr/bin/posixtz
+}
+
+sha512sums="0d8c3e07b0de9015a137602450468ceb6358312a50eeda2a860882367107b8ba9ef275880b292570a671b9910afc54e6209e1e642387d246bc9c08c4ff660ffb tzcode2017c.tar.gz
+feb5c544e617b30c73a397e5a1c51f9847d0fddf1dfa0f9ace2e6f686786f09b666937b2048e07075c84593fc584bd5a25d639fce70eca9735267df28621ab4c tzdata2017c.tar.gz
+68dbaab9f4aef166ac2f2d40b49366527b840bebe17a47599fe38345835e4adb8a767910745ece9c384b57af815a871243c3e261a29f41d71f8054df3061b3fd posixtz-0.5.tar.xz
+f54ce213d74c5a8387e1a7c56299bc6eee65a035772288222128abc249a112067b8791b88b45c342b2d4d8d12e9e4f1f2f5c92c5de67f8b6413b1ebf1d7de467 0001-posixtz-fix-up-lseek.patch"
diff --git a/system/vlc/APKBUILD b/system/vlc/APKBUILD
deleted file mode 100644
index fd433bdf1..000000000
--- a/system/vlc/APKBUILD
+++ /dev/null
@@ -1,361 +0,0 @@
-# Contributor: Łukasz Jendrysik <scadu@yandex.com>
-# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
-# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
-pkgname=vlc
-pkgver=3.0.3
-_pkgver=${pkgver/_/-}
-_ver=${_pkgver%[a-z]}
-pkgrel=0
-pkgdesc="A multi-platform MPEG, VCD/DVD, and DivX player"
-triggers="vlc-libs.trigger=/usr/lib/vlc/plugins"
-pkgusers="vlc"
-pkggroups="vlc"
-url="https://www.videolan.org/vlc/"
-arch="all"
-license="GPL-2.0-or-later"
-options="!checkroot textrel"
-subpackages="$pkgname-dev
- $pkgname-doc
- $pkgname-qt
- $pkgname-xorg
- $pkgname-daemon::noarch
- $pkgname-libs
- $pkgname-plugins
-
- $pkgname-plugins-access:plugins_access
- $pkgname-plugins-access_output:plugins_access_output
- $pkgname-plugins-audio_filter:plugins_audio_filter
- $pkgname-plugins-audio_mixer:plugins_audio_mixer
- $pkgname-plugins-audio_output:plugins_audio_output
- $pkgname-plugins-codec:plugins_codec
- $pkgname-plugins-control:plugins_control
- $pkgname-plugins-demux:plugins_demux
- $pkgname-plugins-gui:plugins_gui
- $pkgname-plugins-lua:plugins_lua
- $pkgname-plugins-meta_engine:plugins_meta_engine
- $pkgname-plugins-misc:plugins_misc
- $pkgname-plugins-mux:plugins_mux
- $pkgname-plugins-notify:plugins_notify
- $pkgname-plugins-packetizer:plugins_packetizer
- $pkgname-plugins-services_discovery:plugins_services_discovery
- $pkgname-plugins-stream_filter:plugins_stream_filter
- $pkgname-plugins-stream_out:plugins_stream_out
- $pkgname-plugins-text_renderer:plugins_text_renderer
- $pkgname-plugins-video_chroma:plugins_video_chroma
- $pkgname-plugins-video_filter:plugins_video_filter
- $pkgname-plugins-video_output:plugins_video_output
- $pkgname-plugins-visualization:plugins_visualization"
-depends="ttf-dejavu $pkgname-plugins"
-makedepends="
- a52dec-dev
- alsa-lib-dev
- automake
- autoconf
- bison
- libtool
- dbus-dev
- faad2-dev
- ffmpeg-dev
- flac-dev
- flex
- fluidsynth-dev
- freetype-dev
- fribidi-dev
- gtk+3.0-dev
- libbluray-dev>=0.2.1 libbluray-dev<20100000
- libavc1394-dev
- libcddb-dev
- libdc1394-dev>=2.1.0
- libdca-dev
- libdvbpsi-dev
- libdvdnav-dev
- libdvdread-dev
- libgcrypt-dev
- libice-dev
- libjpeg-turbo-dev
- libmad-dev
- libmatroska-dev
- libmpeg2-dev
- libnotify-dev
- libogg-dev
- libraw1394-dev>=2.0.1
- librsvg-dev
- libshout-dev
- libsm-dev
- libtheora-dev
- libva-dev
- libvdpau-dev
- libvorbis-dev
- libvpx-dev
- libx11-dev
- libxext-dev
- libxinerama-dev
- libxml2-dev
- libxpm-dev
- libxv-dev
- live-media-dev>=2012.01.26
- lua5.2-dev
- mesa-dev
- ncurses-dev
- opus-dev
- pkgconfig
- pulseaudio-dev
- qt5-qtbase-dev
- qt5-qtsvg-dev
- sdl2-dev
- speex-dev
- speexdsp-dev
- sysfsutils-dev
- taglib-dev
- eudev-dev
- v4l-utils-dev
- wayland-protocols
- x264-dev
- x265-dev
- xcb-util-renderutil-dev
- xcb-util-keysyms-dev
- xdg-utils
- "
-source="http://get.videolan.org/vlc/$_ver/vlc-$_ver.tar.xz
- omxil-rpi-codecs.patch
- check-headless.patch
- disable-sub-autodetect-fuzzy-1-test.patch
- fribidi-update.patch
- tar-compat.patch
- test-s390x.patch
- vlc-libs.trigger"
-
-builddir="$srcdir"/$pkgname-$_ver
-
-prepare() {
- default_prepare
- NOCONFIGURE=1 ./bootstrap
-}
-
-build() {
- local _arch_opts=
- cd "$builddir"
- export CFLAGS="$CFLAGS -D_GNU_SOURCE"
-
- case "$CARCH" in
- arm*) _arch_opts="--enable-omxil --enable-omxil-vout --enable-rpi-omxil" ;;
- aarch64) _arch_opts="--enable-neon" ;;
- ppc64*) _arch_opts="--enable-altivec" ;;
- esac
-
- LUA=lua5.2 \
- LUAC=luac5.2 \
- BUILDCC="${CC:-gcc} -std=c99" \
- ./configure \
- --build=$CBUILD \
- --host=$CHOST \
- --prefix=/usr \
- --disable-mmx \
- --disable-sse \
- --enable-nls \
- --enable-optimizations \
- --enable-optimize-memory \
- --disable-rpath \
- --enable-a52 \
- --enable-avcodec \
- --enable-avformat \
- --enable-bluray \
- --enable-cdda \
- --enable-dbus \
- --enable-dc1394 \
- --enable-dca \
- --enable-dvbpsi \
- --enable-dvdread \
- --enable-dvdnav \
- --enable-faad \
- --enable-flac \
- --enable-fluidsynth \
- --enable-jpeg \
- --enable-libcddb \
- --enable-libmpeg2 \
- --enable-libva \
- --enable-live555 \
- --enable-mad \
- --enable-merge-ffmpeg \
- --enable-notify \
- --enable-ncurses \
- --enable-ogg \
- --enable-opus \
- --enable-png \
- --enable-pulse \
- --enable-qt \
- --enable-realrtsp \
- --enable-shout \
- --enable-skins2 \
- --enable-speex \
- --enable-sout \
- --enable-taglib \
- --enable-theora \
- --enable-udev \
- --enable-v4l2 \
- --enable-vdpau \
- --enable-vlm \
- --enable-vorbis \
- --enable-vpx \
- --enable-wma-fixed \
- --enable-x264 \
- --enable-x265 \
- --enable-xvideo \
- $_arch_opts
-
- make
-}
-
-package() {
- cd "$builddir"
- make DESTDIR="$pkgdir" install
- # delete cache as it's autocreated by trigger
- rm -rf "$pkgdir"/usr/lib/vlc/plugins/plugins.dat
- # delete unneeded mozilla and kde support files
- rm -rf "$pkgdir"/usr/lib/mozilla
- rm -rf "$pkgdir"/usr/share/kde4
-}
-
-check() {
- cd "$builddir"
- make check
-}
-
-plugins() {
- pkgdesc="$pkgname all plugins meta package"
- depends="$pkgname-plugins-access
- $pkgname-plugins-access_output
- $pkgname-plugins-audio_filter
- $pkgname-plugins-audio_mixer
- $pkgname-plugins-audio_output
- $pkgname-plugins-codec
- $pkgname-plugins-control
- $pkgname-plugins-demux
- $pkgname-plugins-gui
- $pkgname-plugins-lua
- $pkgname-plugins-meta_engine
- $pkgname-plugins-misc
- $pkgname-plugins-mux
- $pkgname-plugins-notify
- $pkgname-plugins-packetizer
- $pkgname-plugins-services_discovery
- $pkgname-plugins-stream_filter
- $pkgname-plugins-stream_out
- $pkgname-plugins-text_renderer
- $pkgname-plugins-video_chroma
- $pkgname-plugins-video_filter
- $pkgname-plugins-video_output
- $pkgname-plugins-visualization"
- mkdir -p "$subpkgdir"
-}
-
-_mv() {
- local dir=${1%/*}
- mkdir -p "$subpkgdir"/$dir
- mv "$1" "$subpkgdir"/$dir/
-}
-
-qt() {
- pkgdesc="Qt frontend for VLC"
- depends="vlc-xorg=$pkgver-r$pkgrel"
- cd "$pkgdir"
- # scan for elf files that directly or indirectly depends on
- # libQt* libraries
- cd "$pkgdir"
- for i in $(find . -type f ); do
- if ldd $i 2>/dev/null | grep -q "libQt"; then
- _mv "$i" || return 1
- fi
- done
- mkdir -p "$subpkgdir"/usr/bin
- mv "$pkgdir"/usr/bin/qvlc \
- "$subpkgdir"/usr/bin/
-}
-
-xorg() {
- pkgdesc="Video LAN X.org support"
- depends="xdg-utils vlc=$pkgver-r$pkgrel"
-
- # scan for elf files that directly or indirectly depends on
- # libX* libraries
- cd "$pkgdir"
- for i in $(find . -type f ); do
- if ldd $i 2>/dev/null | grep -E -q "libX|x11|libxcb|libGL"; then
- echo $i | grep libavcodec_plugin.so || _mv "$i" || return 1
- fi
- done
-
- mkdir -p "$subpkgdir"/usr/bin
- mv "$pkgdir"/usr/bin/svlc \
- "$subpkgdir"/usr/bin
-
- mkdir -p "$subpkgdir"/usr/share/vlc
- mv "$pkgdir"/usr/share/applications \
- "$pkgdir"/usr/share/icons \
- "$subpkgdir"/usr/share/
-
- mv "$pkgdir"/usr/share/vlc/skins2 \
- "$subpkgdir"/usr/share/vlc
-}
-
-daemon() {
- pkgdesc="Support for running VLC as a daemon"
- install="vlc-daemon.pre-install"
- depends="vlc=$pkgver-r$pkgrel"
-
- mkdir -p "$subpkgdir"
- cd "$pkgdir"
- install -D -m755 ../../vlc.initd $subpkgdir/etc/init.d/vlc
- install -D -m664 ../../vlc.confd $subpkgdir/etc/conf.d/vlc
- install -d -o vlc -g vlc "$subpkgdir"/var/log/vlc
-}
-
-libs() {
- depends=
- mkdir -p "$subpkgdir"/usr/lib/vlc
- mv "$pkgdir"/usr/lib/vlc/vlc-cache-gen \
- "$subpkgdir"/usr/lib/vlc/
- default_libs
-}
-
-_mv_plugins() {
- local plugin=$1
- pkgdesc="$pkgname $plugin plugin"
- depends=
- mkdir -p "$subpkgdir"/usr/lib/vlc/plugins
- mv "$pkgdir"/usr/lib/vlc/plugins/"$plugin" \
- "$subpkgdir"/usr/lib/vlc/plugins
-}
-
-plugins_access() { _mv_plugins access; }
-plugins_access_output() { _mv_plugins access_output; }
-plugins_audio_filter() { _mv_plugins audio_filter; }
-plugins_audio_mixer() { _mv_plugins audio_mixer; }
-plugins_audio_output() { _mv_plugins audio_output; }
-plugins_codec() { _mv_plugins codec; }
-plugins_control() { _mv_plugins control; }
-plugins_demux() { _mv_plugins demux; }
-plugins_gui() { _mv_plugins gui; }
-plugins_lua() { _mv_plugins lua; }
-plugins_meta_engine() { _mv_plugins meta_engine; }
-plugins_misc() { _mv_plugins misc; }
-plugins_mux() { _mv_plugins mux; }
-plugins_notify() { _mv_plugins notify; }
-plugins_packetizer() { _mv_plugins packetizer; }
-plugins_services_discovery() { _mv_plugins services_discovery; }
-plugins_stream_filter() { _mv_plugins stream_filter; }
-plugins_stream_out() { _mv_plugins stream_out; }
-plugins_text_renderer() { _mv_plugins text_renderer; }
-plugins_video_chroma() { _mv_plugins video_chroma; }
-plugins_video_filter() { _mv_plugins video_filter; }
-plugins_video_output() { _mv_plugins video_output; }
-plugins_visualization() { _mv_plugins visualization; }
-
-sha512sums="1569cefa6623b2631a832679bc9a63ebeba222901e5221d254e896a68d2ee467054da8de9eda566924e80a11bb29a673a9f0c4243793845547d8027b58a238ab vlc-3.0.3.tar.xz
-e13e398b7bfd977f6e099bcb6cf8dc5cd5bad6dea3eff715881826246dc4329468846084aff2576de2b7fd28d3f06e7c327a6e4511a28d22e5cd198a81146c89 omxil-rpi-codecs.patch
-22d80df599b8b65a5439cefbb7140af8e9530f326d54945da3769af65f37518b99ec2cc8647aafd2763324a0698280915afe043cc87e5720c4694881ed35bffa check-headless.patch
-e214b407235cb3afb8bec93f20c9b42957b57e6fd3960679d3d4235e77762e03e64d03c01f00ef63d589e7c85aaad02ce6abbeeccd66b1867bc92451a5b5e9b0 disable-sub-autodetect-fuzzy-1-test.patch
-3338531d385f76d9eedf10498d1b0b78565c531eedb3018d4500e377815f9ccbfcc16ec398cb8559bcc624f65b61d376125c4a5e6880cbad90ec9880dd4b9ce5 fribidi-update.patch
-a117ca4d7fd66a5f959fdeaddfdce2f8442fe9f2c13995bb7f4792a7745c00813813aa962f76e957e3b0735344a5dc000e0644ce09f23458802a2932231655c3 tar-compat.patch
-c0107655249687655846a9547ca1a5670b9207443180600e7a149c69ffb96d7226787c19b018d4033db9b284c1a5faa8d7d42188ed40c3b8bb051256febf11c5 test-s390x.patch
-b67b6e21e9d4027aef1006e6057f9ba8e65ce3895b08f7b911b1675cff9bc423f64ee2c187c584860e9e5d4635a30408a7781add9694d9bba753eac37f357406 vlc-libs.trigger"
diff --git a/system/vlc/check-headless.patch b/system/vlc/check-headless.patch
deleted file mode 100644
index 25016f437..000000000
--- a/system/vlc/check-headless.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/test/run_vlc.sh b/test/run_vlc.sh
-index af35987..9a0175b 100755
---- a/test/run_vlc.sh
-+++ b/test/run_vlc.sh
-@@ -2,7 +2,7 @@
-
- set -e
-
--VLC="./vlc --ignore-config --rc-fake-tty"
-+VLC="./vlc -I dummy --ignore-config --rc-fake-tty"
-
- $VLC -H
- $VLC -vv vlc://quit
diff --git a/system/vlc/disable-sub-autodetect-fuzzy-1-test.patch b/system/vlc/disable-sub-autodetect-fuzzy-1-test.patch
deleted file mode 100644
index b3dd8a1b7..000000000
--- a/system/vlc/disable-sub-autodetect-fuzzy-1-test.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-This test fails on x86 and s390x so disable it for now
-reported upstream: https://trac.videolan.org/vlc/ticket/19321
-
-diff --git a/test/libvlc/slaves.c b/test/libvlc/slaves.c
-index 7b2c24fa43..7c47b3147b 100644
---- a/test/libvlc/slaves.c
-+++ b/test/libvlc/slaves.c
-@@ -194,10 +194,12 @@ main (void)
- assert(p_expected_slaves[i].psz_uri != NULL);
- }
-
-+#if 0
- printf("== Testing --sub-autodetect-fuzzy 1 (everything) ==\n");
- test_media_has_slaves_from_parent(p_vlc, SLAVES_DIR "/test.mp4",
- p_expected_slaves,
- EXPECTED_SLAVES_COUNT);
-+#endif
- libvlc_release(p_vlc);
-
- printf("== Testing --sub-autodetect-fuzzy 2 (full, left, and right match) ==\n");
diff --git a/system/vlc/fribidi-update.patch b/system/vlc/fribidi-update.patch
deleted file mode 100644
index fd293eea4..000000000
--- a/system/vlc/fribidi-update.patch
+++ /dev/null
@@ -1,83 +0,0 @@
-From 26e2d3906658c30f2f88f4b1bc9630ec43bf5525 Mon Sep 17 00:00:00 2001
-From: Shaleen Jain <shaleen@jain.sh>
-Date: Sun, 25 Feb 2018 18:42:27 +0530
-Subject: [PATCH 1/1] fribidi: update for version 1.0
-
-Update functions deprecated in version 1.0 when building with release 1.0 and
-above.
-
-Signed-off-by: Thomas Guillem <thomas@gllm.fr>
----
- modules/text_renderer/freetype/text_layout.c | 24 ++++++++++++++++++++++++
- 1 file changed, 24 insertions(+)
-
-diff --git a/modules/text_renderer/freetype/text_layout.c b/modules/text_renderer/freetype/text_layout.c
-index 13efd567b4..1a28786d09 100644
---- a/modules/text_renderer/freetype/text_layout.c
-+++ b/modules/text_renderer/freetype/text_layout.c
-@@ -153,6 +153,9 @@ typedef struct paragraph_t
-
- #ifdef HAVE_FRIBIDI
- FriBidiCharType *p_types;
-+#if FRIBIDI_MAJOR_VERSION >= 1
-+ FriBidiBracketType *p_btypes;
-+#endif
- FriBidiLevel *p_levels;
- FriBidiStrIndex *pi_reordered_indices;
- FriBidiParType paragraph_type;
-@@ -361,6 +364,9 @@ static paragraph_t *NewParagraph( filter_t *p_filter,
- #ifdef HAVE_FRIBIDI
- p_paragraph->p_levels = vlc_alloc( i_size, sizeof( *p_paragraph->p_levels ) );
- p_paragraph->p_types = vlc_alloc( i_size, sizeof( *p_paragraph->p_types ) );
-+#if FRIBIDI_MAJOR_VERSION >= 1
-+ p_paragraph->p_btypes = vlc_alloc( i_size, sizeof( *p_paragraph->p_btypes ) );
-+#endif
- p_paragraph->pi_reordered_indices =
- vlc_alloc( i_size, sizeof( *p_paragraph->pi_reordered_indices ) );
-
-@@ -398,6 +404,9 @@ error:
- #ifdef HAVE_FRIBIDI
- if( p_paragraph->p_levels ) free( p_paragraph->p_levels );
- if( p_paragraph->p_types ) free( p_paragraph->p_types );
-+#if FRIBIDI_MAJOR_VERSION >= 1
-+ if( p_paragraph->p_btypes ) free( p_paragraph->p_btypes );
-+#endif
- if( p_paragraph->pi_reordered_indices )
- free( p_paragraph->pi_reordered_indices );
- #endif
-@@ -424,6 +433,9 @@ static void FreeParagraph( paragraph_t *p_paragraph )
- #ifdef HAVE_FRIBIDI
- free( p_paragraph->pi_reordered_indices );
- free( p_paragraph->p_types );
-+#if FRIBIDI_MAJOR_VERSION >= 1
-+ free( p_paragraph->p_btypes );
-+#endif
- free( p_paragraph->p_levels );
- #endif
-
-@@ -436,10 +448,22 @@ static int AnalyzeParagraph( paragraph_t *p_paragraph )
- fribidi_get_bidi_types( p_paragraph->p_code_points,
- p_paragraph->i_size,
- p_paragraph->p_types );
-+#if FRIBIDI_MAJOR_VERSION >= 1
-+ fribidi_get_bracket_types( p_paragraph->p_code_points,
-+ p_paragraph->i_size,
-+ p_paragraph->p_types,
-+ p_paragraph->p_btypes );
-+ fribidi_get_par_embedding_levels_ex( p_paragraph->p_types,
-+ p_paragraph->p_btypes,
-+ p_paragraph->i_size,
-+ &p_paragraph->paragraph_type,
-+ p_paragraph->p_levels );
-+#else
- fribidi_get_par_embedding_levels( p_paragraph->p_types,
- p_paragraph->i_size,
- &p_paragraph->paragraph_type,
- p_paragraph->p_levels );
-+#endif
-
- #ifdef HAVE_HARFBUZZ
- hb_unicode_funcs_t *p_funcs = hb_unicode_funcs_get_default();
---
-2.11.0
-
diff --git a/system/vlc/omxil-rpi-codecs.patch b/system/vlc/omxil-rpi-codecs.patch
deleted file mode 100644
index 9b7accfe7..000000000
--- a/system/vlc/omxil-rpi-codecs.patch
+++ /dev/null
@@ -1,15 +0,0 @@
---- vlc-2.2.0/modules/codec/omxil/omxil_core.c.orig 2015-02-28 08:37:54.044936036 -0200
-+++ vlc-2.2.0/modules/codec/omxil/omxil_core.c 2015-02-28 08:38:38.738271654 -0200
-@@ -204,6 +204,12 @@
- #ifdef RPI_OMX
- { "video_decoder.avc", "OMX.broadcom.video_decode" },
- { "video_decoder.mpeg2", "OMX.broadcom.video_decode" },
-+ { "video_decoder.mpeg4", "OMX.broadcom.video_decode" },
-+ { "video_decoder.vp6", "OMX.broadcom.video_decode" },
-+ { "video_decoder.vp8", "OMX.broadcom.video_decode" },
-+ { "video_decoder.theora", "OMX.broadcom.video_decode" },
-+ { "video_decoder.mjpg", "OMX.broadcom.video_decode" },
-+ { "video_decoder.vc1", "OMX.broadcom.video_decode" },
- { "iv_renderer", "OMX.broadcom.video_render" },
- #endif
- { 0, 0 }
diff --git a/system/vlc/tar-compat.patch b/system/vlc/tar-compat.patch
deleted file mode 100644
index 34169ef56..000000000
--- a/system/vlc/tar-compat.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- vlc-3.0.1/share/Makefile.am.old 2018-02-06 18:41:06.000000000 +0000
-+++ vlc-3.0.1/share/Makefile.am 2018-04-05 23:19:37.081889895 +0000
-@@ -94,7 +94,7 @@
- $(AM_V_at)rm -f -- skins2/default.vlt.tmp
- $(AM_V_GEN)GZIP=--no-name \
- tar cvvzf skins2/default.vlt.tmp \
-- --owner=root --group=root --directory="$(srcdir)/skins2" \
-+ --uid=0 --gid=0 --directory="$(srcdir)/skins2" \
- default/
- $(AM_V_at)mv -f -- skins2/default.vlt.tmp skins2/default.vlt
-
diff --git a/system/vlc/test-s390x.patch b/system/vlc/test-s390x.patch
deleted file mode 100644
index 8f221ee06..000000000
--- a/system/vlc/test-s390x.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/test/modules/packetizer/hxxx.c b/test/modules/packetizer/hxxx.c
-index 93362a1..e1b7604 100644
---- a/test/modules/packetizer/hxxx.c
-+++ b/test/modules/packetizer/hxxx.c
-@@ -210,7 +210,7 @@ static void test_annexb()
-
- int main( void )
- {
-- test_annexb();
-+ //test_annexb();
-
- return 0;
- }
diff --git a/system/vlc/vlc-daemon.pre-install b/system/vlc/vlc-daemon.pre-install
deleted file mode 100644
index aed6c1893..000000000
--- a/system/vlc/vlc-daemon.pre-install
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-
-groups="vlc audio video"
-
-for group in $groups; do
- addgroup -S $group 2>/dev/null
-done
-adduser -S -D -h /home/vlc -s /bin/sh -G vlc -g vlc vlc 2>/dev/null
-
-# make sure vlc are in all groups
-for group in $groups; do
- addgroup vlc $group 2>/dev/null
-done
-
-exit 0
diff --git a/system/vlc/vlc-libs.trigger b/system/vlc/vlc-libs.trigger
deleted file mode 100644
index c13bace99..000000000
--- a/system/vlc/vlc-libs.trigger
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-exec /usr/lib/vlc/vlc-cache-gen "$@" >&/dev/null
-exit 0
-
diff --git a/system/vlc/vlc.confd b/system/vlc/vlc.confd
deleted file mode 100644
index 9a58842bd..000000000
--- a/system/vlc/vlc.confd
+++ /dev/null
@@ -1,15 +0,0 @@
-# Sample vlc params suitable for running as a daemon
-
-## --file-logging enable file logging
-## --logfile logfile name/path
-## -vvv verbose logging
-## -I dummy disable X11 interface
-## --sout PARAMS encoding parameters
-
-
-## Do NOT quote 'PARAMS' otherwise shell expansions will broke vlc
-##
-## The --daemon option will automatically be added so no need to add it
-## here.
-
-VLC_OPTS="--quiet -I dummy alsa://hw:0,0 --file-logging --logfile /var/log/vlc/vlc.log --sout #transcode{acodec=mp3,ab=48,channels=1,samplerate=22050}:std{access=http,mux=ogg,dst=:8080}"
diff --git a/system/vlc/vlc.initd b/system/vlc/vlc.initd
deleted file mode 100755
index 541a07180..000000000
--- a/system/vlc/vlc.initd
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/sbin/openrc-run
-
-description="VideoLAN daemon"
-pidfile="/var/run/vlc/${RC_SVCNAME}.pid"
-command="/usr/bin/vlc"
-
-depend() {
- need net
- after firewall
-}
-
-start_pre() {
- checkpath --directory --owner vlc:vlc --mode 775 ${pidfile%/*}
-}
-
-start() {
- ebegin "Starting ${RC_SVCNAME}"
- start-stop-daemon --start \
- --user vlc \
- --pidfile ${pidfile} \
- --exec ${command} \
- -- \
- --daemon --pidfile ${pidfile} ${VLC_OPTS}
- eend $?
-}
-
-stop() {
- ebegin "Stopping ${RC_SVCNAME}"
- start-stop-daemon --stop \
- --pidfile ${pidfile}
- eend $?
-}
diff --git a/system/zsh/APKBUILD b/system/zsh/APKBUILD
new file mode 100644
index 000000000..3672a0445
--- /dev/null
+++ b/system/zsh/APKBUILD
@@ -0,0 +1,160 @@
+# Contributor: <kalonji@gmail.com>
+# Contributor: Jakub Jirutka <jakub@jirutka.cz>
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=zsh
+pkgver=5.4.1
+pkgrel=1
+pkgdesc="A very advanced and programmable command interpreter (shell)"
+url="http://www.zsh.org/"
+arch="all"
+license="BSD"
+depends="debianutils" # add-shell
+makedepends_host="ncurses-dev pcre-dev"
+install="zsh.post-install zsh.post-upgrade zsh.pre-deinstall"
+source="http://www.zsh.org/pub/$pkgname-$pkgver.tar.gz
+ zprofile
+ "
+subpackages="$pkgname-doc $pkgname-calendar::noarch $pkgname-vcs::noarch"
+[ "$CBUILD" != "$CHOST" ] || subpackages="$subpackages $pkgname-zftp"
+builddir="$srcdir/$pkgname-$pkgver"
+
+_libdir="usr/lib/zsh/$pkgver"
+_sharedir="usr/share/zsh/$pkgver"
+
+# Move some bigger completion files to subpackages.
+_comps="android-tools:Unix/_adb
+ bzr:Unix/_bzr
+ cvs:Unix/_cvs
+ gcc:Unix/_gcc
+ git:Unix/_git
+ graphicsmagick:Unix/_graphicsmagick
+ imagemagick:Unix/_imagemagick
+ lynx:Unix/_lynx
+ mercurial:Unix/_hg
+ rsync:Unix/_rsync
+ subversion:Unix/_subversion
+ tmux:Unix/_tmux
+ zfs:Unix/_zfs*:Unix/_zpool"
+for _i in $_comps; do
+ subpackages="$subpackages ${_i%%:*}-zsh-completion:_completion:noarch"
+done
+
+prepare() {
+ cd "$builddir"
+
+ default_prepare
+ update_config_sub
+
+ # Remove completions for other systems.
+ cd Completion
+ rm -Rf AIX BSD Cygwin Darwin Debian Mandriva Redhat Solaris openSUSE
+
+ # Remove completions for programs that are not available on Alpine
+ # (just to decrease size of the package).
+ cd Unix/Command
+ rm -f _aap _apm _baz _bittorrent _bpython _ccal _cdcd _chkconfig _clay \
+ _cowsay _cplay _cssh _darcs _devtodo _dict _dsh _elfdump _elm \
+ _enscript _finger _flasher _fsh _gnupod _guilt _initctl _lzop \
+ _mencal _module _monotone _moosic _mysqldiff _nkf \
+ _pack _perforce _pine _pkgadd _pkginfo _pkgrm _prcs \
+ _quilt _raggle _rcs _rlogin _rubber _sablotron _sisu _socket \
+ _stgit _surfraw _tardy _tin _tla _topgit _totd _twidge \
+ _unace _unison _units _uzbl _vcsh _vux _wiggle _xmms2 _yodl
+ cd ../../Linux/Command
+ rm -f _mondo _tpb _tpconfig _uml _vserver
+ cd ../../X/Command
+ rm -f _acroread _dcop _gnome-gv _gqview _gv _kfmclient _matlab \
+ _nautilus _netscape _qiv _vnc _xfig _xloadimage \
+ _xournal _xv _xwit
+}
+
+build() {
+ cd "$builddir"
+
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --bindir=/bin \
+ --enable-etcdir=/etc/zsh \
+ --enable-multibyte \
+ --enable-pcre \
+ --enable-function-subdirs \
+ --enable-zsh-secure-free \
+ --sysconfdir=/etc \
+ --with-tcsetpgrp \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info
+ make
+}
+
+check() {
+ cd "$builddir"
+ # Does not work with musl due to UTF-8
+ rm "$builddir"/Test/A03quoting.ztst
+ # Does not work with musl due to locale
+ rm "$builddir"/Test/B03print.ztst
+ # Not guaranteed to work portably (requires atime)
+ rm "$builddir"/Test/C02cond.ztst
+ # PPC?
+ rm "$builddir"/Test/V09datetime.ztst
+ make test
+}
+
+package() {
+ cd "$builddir"
+
+ make DESTDIR="$pkgdir" install
+ install -Dm644 "$srcdir"/zprofile "$pkgdir"/etc/zsh/zprofile
+}
+
+doc() {
+ default_doc
+ _submv $_sharedir/help
+}
+
+calendar() {
+ pkgdesc="Calendar Function System for ZSH"
+ depends="$pkgname"
+
+ _submv $_sharedir/functions/Calendar
+}
+
+vcs() {
+ pkgdesc="Version Control Information module for ZSH (vcs_info)"
+ depends="$pkgname"
+
+ _submv $_sharedir/functions/VCS_Info
+}
+
+zftp() {
+ pkgdesc="Zftp Function System for ZSH"
+ depends="$pkgname"
+
+ _submv $_libdir/zsh/zftp.so
+ _submv $_sharedir/functions/Zftp
+}
+
+_completion() {
+ local name="${subpkgname%-zsh-completion}"
+ pkgdesc="Zsh completions for $name"
+ depends="$pkgname"
+ install_if="$pkgname=$pkgver-r$pkgrel $name"
+
+ local files="$(printf '%s\n' $_comps \
+ | sed -En "s|^$name:(.*)|\1|p" | tr : ' ')"
+ test -n "$files" || { echo "$name not found in \$_comps" >&2; return 1; }
+
+ local f; for f in $files; do
+ _submv $_sharedir/functions/Completion/$f
+ done
+}
+
+_submv() {
+ local path="$1"
+ mkdir -p "$subpkgdir"/${path%/*}
+ mv "$pkgdir"/$path "$subpkgdir"/${path%/*}/
+}
+
+sha512sums="56a83b4a8ae97656ea5a2d7b15632a288017552c276ab306be6d242d83dc92ce871330aeb46a0e8a49e9f30f6bff32e3c956c62e5ce19361e52ea0799cb59f50 zsh-5.4.1.tar.gz
+cbc184f0c4af1441eaad2a3f7255be9941c64bd5a05977aea5ca3a0a11a3d121c34c1fc9e633465eda087cd196dabf9591082117bbb42cc6e6bc9352ec2c207d zprofile"
diff --git a/system/zsh/zprofile b/system/zsh/zprofile
new file mode 100644
index 000000000..363d4863c
--- /dev/null
+++ b/system/zsh/zprofile
@@ -0,0 +1,24 @@
+#
+# /etc/zprofile and ~/.zprofile are run for login shells
+#
+
+export PATH="$PATH:$HOME/bin"
+
+_src_etc_profile()
+{
+ # Make /etc/profile happier, and have possible ~/.zshenv options like
+ # NOMATCH ignored.
+ #
+ emulate -L ksh
+
+ # source profile
+ if [ -f /etc/profile ]; then
+ source /etc/profile
+ fi
+}
+_src_etc_profile
+
+export EDITOR=${EDITOR:-/usr/bin/vim}
+export PAGER=${PAGER:-/usr/bin/less}
+
+unset -f _src_etc_profile
diff --git a/system/zsh/zsh.post-install b/system/zsh/zsh.post-install
new file mode 100644
index 000000000..d2399cd8b
--- /dev/null
+++ b/system/zsh/zsh.post-install
@@ -0,0 +1,3 @@
+#!/bin/sh
+add-shell '/bin/zsh'
+exit 0
diff --git a/system/zsh/zsh.post-upgrade b/system/zsh/zsh.post-upgrade
new file mode 100644
index 000000000..1b42f8258
--- /dev/null
+++ b/system/zsh/zsh.post-upgrade
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+add-shell '/bin/zsh'
+
+ver_new="$1"
+ver_old="$2"
+
+if [ "$(apk version -t "$ver_old" "5.2-r2")" = "<" ]; then
+ cat <<-EOF
+ *
+ * Some modules has been moved into subpackages:
+ * zsh-calendar calendar function system
+ * zsh-vcs version control information (vcs_info)
+ * zsh-zftp zftp function system
+ *
+ EOF
+fi
+
+exit 0
diff --git a/system/zsh/zsh.pre-deinstall b/system/zsh/zsh.pre-deinstall
new file mode 100644
index 000000000..215f9a2e8
--- /dev/null
+++ b/system/zsh/zsh.pre-deinstall
@@ -0,0 +1,3 @@
+#!/bin/sh
+remove-shell '/bin/zsh'
+exit 0