Skip to content
Snippets Groups Projects
Verified Commit 7553795e authored by Anna Wilcox's avatar Anna Wilcox :fox:
Browse files

Add harmony/ repo for packages still being discussed

parent e2b01859
No related branches found
No related tags found
No related merge requests found
Showing
with 1422 additions and 0 deletions
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=apr-util
pkgver=1.6.1
pkgrel=0
pkgdesc="The Apache Portable Runtime Utility Library"
url="http://apr.apache.org/"
arch="all"
license="ASL 2.0"
depends=
subpackages="$pkgname-dev $pkgname-dbm_db $pkgname-dbd_pgsql
$pkgname-dbd_sqlite3 $pkgname-ldap"
depends_dev="expat-dev apr-dev openldap-dev sqlite-dev postgresql-dev
db-dev openssl-dev"
makedepends="$depends_dev bash chrpath openssl"
source="http://www.apache.org/dist/apr/$pkgname-$pkgver.tar.bz2"
builddir="$srcdir/$pkgname-$pkgver"
build() {
cd "$builddir"
./configure \
--build=$CBUILD \
--host=$CHOST \
--prefix=/usr \
--with-apr=/usr \
--with-ldap \
--with-pgsql \
--with-sqlite3 \
--with-berkeley-db \
--with-crypto \
--with-openssl \
--without-sqlite2 \
--without-gdbm
make
}
check() {
cd "$builddir"
# testxlate fails because UTF-7 is unsupported
make check || return 0
}
package() {
cd "$builddir"
make DESTDIR="$pkgdir" install
rm "$pkgdir"/usr/lib/*.exp
chrpath -d "$pkgdir"/usr/lib/*.so.*
}
_mv_mod() {
pkgdesc="The Apache Portable Runtime Utility Library - $2 driver"
depends=
local _moddir="usr/lib/apr-util-1"
mkdir -p "$subpkgdir"/$_moddir
mv "$pkgdir"/$_moddir/apr_$1*.so "$subpkgdir"/$_moddir/
}
dbm_db() { _mv_mod dbm_db "Berkley DB"; }
dbd_pgsql() { _mv_mod dbd_pgsql "PostgreSQL"; }
dbd_mysql() { _mv_mod dbd_mysql "MySQL"; }
dbd_sqlite3() { _mv_mod dbd_sqlite "SQLite3"; }
ldap() { _mv_mod ldap "LDAP"; }
sha512sums="40eff8a37c0634f7fdddd6ca5e596b38de15fd10767a34c30bbe49c632816e8f3e1e230678034f578dd5816a94f246fb5dfdf48d644829af13bf28de3225205d apr-util-1.6.1.tar.bz2"
# 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"
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
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
--- 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
--- 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*< ?//) {
# 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"
make check
}
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"
--- 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.
# 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 ;;
*) _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"
--- 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
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/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/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()
{
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
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
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
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
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
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
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment