Merge branch 'master' of github.com:postmarketOS/pmbootstrap into device-nokia-rx51
This commit is contained in:
commit
e599f28113
37 changed files with 48 additions and 4534 deletions
25
0xffff/APKBUILD
Normal file
25
0xffff/APKBUILD
Normal file
|
@ -0,0 +1,25 @@
|
|||
pkgname=0xffff
|
||||
pkgver=0.7
|
||||
pkgrel=1
|
||||
pkgdesc="Flasher for Maemo devices"
|
||||
url="https://github.com/pali/0xFFFF"
|
||||
arch="all"
|
||||
license="GPL3"
|
||||
depends="libusb-compat"
|
||||
makedepends="linux-headers libusb-compat-dev libusb-dev"
|
||||
subpackages="$pkgname-doc"
|
||||
source="https://github.com/pali/0xFFFF/releases/download/${pkgver}/0xffff_${pkgver}.orig.tar.gz"
|
||||
options="!check"
|
||||
|
||||
builddir="$srcdir"/"$pkgname"-"$pkgver"
|
||||
build() {
|
||||
cd "$builddir"
|
||||
make
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "$builddir"
|
||||
make PREFIX=/usr DESTDIR="$pkgdir"/ install
|
||||
}
|
||||
|
||||
sha512sums="d9ff0d05c2806068169216474c7ba211d180769d6ec6d67559f5918a8294ca7e755da9760a6f56fcb77407c926f12d67fe313e1c181fedfe362a5dfa5e0ac045 0xffff_0.7.orig.tar.gz"
|
|
@ -1,25 +0,0 @@
|
|||
From 6ad2305eb299c864dbe04b368a9921e91fd41bcb 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/12] ash: exec busybox.static
|
||||
|
||||
---
|
||||
shell/ash.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/shell/ash.c b/shell/ash.c
|
||||
index 8d8cc466b..1b1012e76 100644
|
||||
--- a/shell/ash.c
|
||||
+++ b/shell/ash.c
|
||||
@@ -7552,6 +7552,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.11.0
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
From a3016293eb42eb3679400148ed4520005ff6b8a7 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/12] app location for vi and lspci
|
||||
|
||||
---
|
||||
editors/vi.c | 2 +-
|
||||
util-linux/lspci.c | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/editors/vi.c b/editors/vi.c
|
||||
index 38a4692fd..dd3efda75 100644
|
||||
--- a/editors/vi.c
|
||||
+++ b/editors/vi.c
|
||||
@@ -166,7 +166,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.11.0
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
From 5b9fc802f7f3bb7e1b0c539a3d6101dcca5399e9 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/12] 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 0e236261b..3c36bc39b 100644
|
||||
--- a/networking/udhcp/dhcpc.c
|
||||
+++ b/networking/udhcp/dhcpc.c
|
||||
@@ -1189,7 +1189,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"
|
||||
@@ -1272,7 +1272,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.11.0
|
||||
|
|
@ -1,197 +0,0 @@
|
|||
From 9432235d7dc8d4a2bc9b546e63e52e84b7cad5ce 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/12] 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 d0ef7ba62..73e903927 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.11.0
|
||||
|
|
@ -1,187 +0,0 @@
|
|||
From f5660f60455d2a86fd78d5a8949a31864233faf8 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/12] 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.11.0
|
||||
|
|
@ -1,185 +0,0 @@
|
|||
From 1dab8b58ff051d529fd3fd74caf6016e51b10ae3 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/12] 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.11.0
|
||||
|
|
@ -1,511 +0,0 @@
|
|||
From 0445b9734e02856a66cc7925a6816f26fedc822d 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/12] 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 | 10 ++
|
||||
modutils/depmod.c | 281 ++++++++++++++++++++++++++++++++++++++++++----------
|
||||
modutils/modprobe.c | 15 ---
|
||||
modutils/modutils.c | 27 ++++-
|
||||
modutils/modutils.h | 15 +++
|
||||
5 files changed, 281 insertions(+), 67 deletions(-)
|
||||
|
||||
diff --git a/modutils/Config.src b/modutils/Config.src
|
||||
index 4227f356a..6680044fc 100644
|
||||
--- a/modutils/Config.src
|
||||
+++ b/modutils/Config.src
|
||||
@@ -118,6 +118,16 @@ 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
|
||||
+ select PLATFORM_LINUX
|
||||
+ 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 for module.symbols file"
|
||||
default y
|
||||
diff --git a/modutils/depmod.c b/modutils/depmod.c
|
||||
index b9347027e..e3cea18c1 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.
|
||||
@@ -25,6 +25,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
|
||||
@@ -52,18 +70,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_")
|
||||
) {
|
||||
@@ -73,9 +85,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);
|
||||
|
||||
@@ -107,12 +120,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"
|
||||
@@ -166,6 +173,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)
|
||||
{
|
||||
@@ -177,6 +347,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;
|
||||
|
||||
@@ -209,53 +381,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 d404ef92f..72f449978 100644
|
||||
--- a/modutils/modprobe.c
|
||||
+++ b/modutils/modprobe.c
|
||||
@@ -189,21 +189,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 d36caaf68..aecfc2acb 100644
|
||||
--- a/modutils/modutils.c
|
||||
+++ b/modutils/modutils.c
|
||||
@@ -70,6 +70,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) {
|
||||
@@ -81,7 +96,17 @@ void FAST_FUNC replace(char *s, char what, char with)
|
||||
|
||||
char* FAST_FUNC replace_underscores(char *s)
|
||||
{
|
||||
- replace(s, '-', '_');
|
||||
+ int i;
|
||||
+ for (i = 0; s[i]; i++) {
|
||||
+ switch (s[i]) {
|
||||
+ case '-':
|
||||
+ s[i] = '_';
|
||||
+ break;
|
||||
+ case '[':
|
||||
+ i += strcspn(&s[i], "]");
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
return s;
|
||||
}
|
||||
|
||||
diff --git a/modutils/modutils.h b/modutils/modutils.h
|
||||
index 2cbd1448a..dd6f173f3 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,6 +61,7 @@ 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;
|
||||
--
|
||||
2.11.0
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
From 49cc996bd0c049c37e98506409c2e3ec30790bf0 Mon Sep 17 00:00:00 2001
|
||||
From: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
|
||||
Date: Thu, 5 Nov 2015 16:27:34 +0200
|
||||
Subject: [PATCH 08/12] login: move check_securetty to libbb
|
||||
|
||||
---
|
||||
include/libbb.h | 1 +
|
||||
libbb/Kbuild.src | 1 +
|
||||
libbb/securetty.c | 27 +++++++++++++++++++++++++++
|
||||
loginutils/login.c | 19 -------------------
|
||||
4 files changed, 29 insertions(+), 19 deletions(-)
|
||||
create mode 100644 libbb/securetty.c
|
||||
|
||||
diff --git a/include/libbb.h b/include/libbb.h
|
||||
index abdc8c2b8..38d6d0b1e 100644
|
||||
--- a/include/libbb.h
|
||||
+++ b/include/libbb.h
|
||||
@@ -1390,6 +1390,7 @@ extern void selinux_or_die(void) FAST_FUNC;
|
||||
#define SETUP_ENV_NO_CHDIR (1 << 4)
|
||||
void setup_environment(const char *shell, int flags, const struct passwd *pw) FAST_FUNC;
|
||||
void nuke_str(char *str) FAST_FUNC;
|
||||
+int check_securetty(const char *short_tty);
|
||||
int check_password(const struct passwd *pw, const char *plaintext) FAST_FUNC;
|
||||
int ask_and_check_password_extended(const struct passwd *pw, int timeout, const char *prompt) FAST_FUNC;
|
||||
int ask_and_check_password(const struct passwd *pw) FAST_FUNC;
|
||||
diff --git a/libbb/Kbuild.src b/libbb/Kbuild.src
|
||||
index e426f3c7e..84f3ff477 100644
|
||||
--- a/libbb/Kbuild.src
|
||||
+++ b/libbb/Kbuild.src
|
||||
@@ -83,6 +83,7 @@ lib-y += safe_gethostname.o
|
||||
lib-y += safe_poll.o
|
||||
lib-y += safe_strncpy.o
|
||||
lib-y += safe_write.o
|
||||
+lib-y += securetty.o
|
||||
lib-y += setup_environment.o
|
||||
lib-y += signals.o
|
||||
lib-y += simplify_path.o
|
||||
diff --git a/libbb/securetty.c b/libbb/securetty.c
|
||||
new file mode 100644
|
||||
index 000000000..95edbc944
|
||||
--- /dev/null
|
||||
+++ b/libbb/securetty.c
|
||||
@@ -0,0 +1,27 @@
|
||||
+/* vi: set sw=4 ts=4: */
|
||||
+/*
|
||||
+ * /etc/securetty checking.
|
||||
+ *
|
||||
+ * Licensed under GPLv2, see file LICENSE in this source tree.
|
||||
+ */
|
||||
+
|
||||
+#include "libbb.h"
|
||||
+
|
||||
+#if ENABLE_FEATURE_SECURETTY && !ENABLE_PAM
|
||||
+int check_securetty(const char *short_tty)
|
||||
+{
|
||||
+ char *buf = (char*)"/etc/securetty"; /* any non-NULL is ok */
|
||||
+ parser_t *parser = config_open2("/etc/securetty", fopen_for_read);
|
||||
+ while (config_read(parser, &buf, 1, 1, "# \t", PARSE_NORMAL)) {
|
||||
+ if (strcmp(buf, short_tty) == 0)
|
||||
+ break;
|
||||
+ buf = NULL;
|
||||
+ }
|
||||
+ config_close(parser);
|
||||
+ /* buf != NULL here if config file was not found, empty
|
||||
+ * or line was found which equals short_tty */
|
||||
+ return buf != NULL;
|
||||
+}
|
||||
+#else
|
||||
+ALWAYS_INLINE int check_securetty(const char *short_tty UNUSED_PARAM) { return 1; }
|
||||
+#endif
|
||||
diff --git a/loginutils/login.c b/loginutils/login.c
|
||||
index 52abc1886..30aa63aee 100644
|
||||
--- a/loginutils/login.c
|
||||
+++ b/loginutils/login.c
|
||||
@@ -173,25 +173,6 @@ static void die_if_nologin(void)
|
||||
# define die_if_nologin() ((void)0)
|
||||
#endif
|
||||
|
||||
-#if ENABLE_FEATURE_SECURETTY && !ENABLE_PAM
|
||||
-static int check_securetty(const char *short_tty)
|
||||
-{
|
||||
- char *buf = (char*)"/etc/securetty"; /* any non-NULL is ok */
|
||||
- parser_t *parser = config_open2("/etc/securetty", fopen_for_read);
|
||||
- while (config_read(parser, &buf, 1, 1, "# \t", PARSE_NORMAL)) {
|
||||
- if (strcmp(buf, short_tty) == 0)
|
||||
- break;
|
||||
- buf = NULL;
|
||||
- }
|
||||
- config_close(parser);
|
||||
- /* buf != NULL here if config file was not found, empty
|
||||
- * or line was found which equals short_tty */
|
||||
- return buf != NULL;
|
||||
-}
|
||||
-#else
|
||||
-static ALWAYS_INLINE int check_securetty(const char *short_tty UNUSED_PARAM) { return 1; }
|
||||
-#endif
|
||||
-
|
||||
#if ENABLE_SELINUX
|
||||
static void initselinux(char *username, char *full_tty,
|
||||
security_context_t *user_sid)
|
||||
--
|
||||
2.11.0
|
||||
|
|
@ -1,70 +0,0 @@
|
|||
From 7d2e6a0a89ba11a98ce665e307d7acf86b5f00b6 Mon Sep 17 00:00:00 2001
|
||||
From: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
|
||||
Date: Thu, 5 Nov 2015 16:27:35 +0200
|
||||
Subject: [PATCH 09/12] libbb: allow_blank argument for
|
||||
ask_and_check_password_extended()
|
||||
|
||||
---
|
||||
include/libbb.h | 2 +-
|
||||
libbb/correct_password.c | 6 +++---
|
||||
loginutils/sulogin.c | 2 +-
|
||||
3 files changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/include/libbb.h b/include/libbb.h
|
||||
index 38d6d0b1e..f0ddce94f 100644
|
||||
--- a/include/libbb.h
|
||||
+++ b/include/libbb.h
|
||||
@@ -1392,7 +1392,7 @@ void setup_environment(const char *shell, int flags, const struct passwd *pw) FA
|
||||
void nuke_str(char *str) FAST_FUNC;
|
||||
int check_securetty(const char *short_tty);
|
||||
int check_password(const struct passwd *pw, const char *plaintext) FAST_FUNC;
|
||||
-int ask_and_check_password_extended(const struct passwd *pw, int timeout, const char *prompt) FAST_FUNC;
|
||||
+int ask_and_check_password_extended(const struct passwd *pw, int timeout, int allow_blank, const char *prompt) FAST_FUNC;
|
||||
int ask_and_check_password(const struct passwd *pw) FAST_FUNC;
|
||||
/* Returns a malloced string */
|
||||
#if !ENABLE_USE_BB_CRYPT
|
||||
diff --git a/libbb/correct_password.c b/libbb/correct_password.c
|
||||
index 513c93028..57cd2b890 100644
|
||||
--- a/libbb/correct_password.c
|
||||
+++ b/libbb/correct_password.c
|
||||
@@ -96,7 +96,7 @@ int FAST_FUNC check_password(const struct passwd *pw, const char *plaintext)
|
||||
* NULL pw means "just fake it for login with bad username"
|
||||
*/
|
||||
int FAST_FUNC ask_and_check_password_extended(const struct passwd *pw,
|
||||
- int timeout, const char *prompt)
|
||||
+ int timeout, int allow_blank, const char *prompt)
|
||||
{
|
||||
IF_FEATURE_SHADOWPASSWDS(char buffer[SHADOW_BUFSIZE];)
|
||||
char *plaintext;
|
||||
@@ -105,7 +105,7 @@ int FAST_FUNC ask_and_check_password_extended(const struct passwd *pw,
|
||||
|
||||
pw_pass = get_passwd(pw, buffer);
|
||||
if (!pw_pass[0]) /* empty password field? */
|
||||
- return 1;
|
||||
+ return allow_blank;
|
||||
|
||||
plaintext = bb_ask(STDIN_FILENO, timeout, prompt);
|
||||
if (!plaintext) {
|
||||
@@ -120,5 +120,5 @@ int FAST_FUNC ask_and_check_password_extended(const struct passwd *pw,
|
||||
|
||||
int FAST_FUNC ask_and_check_password(const struct passwd *pw)
|
||||
{
|
||||
- return ask_and_check_password_extended(pw, 0, "Password: ");
|
||||
+ return ask_and_check_password_extended(pw, 0, 1, "Password: ");
|
||||
}
|
||||
diff --git a/loginutils/sulogin.c b/loginutils/sulogin.c
|
||||
index 2e32e2bbd..d2ddc6afa 100644
|
||||
--- a/loginutils/sulogin.c
|
||||
+++ b/loginutils/sulogin.c
|
||||
@@ -62,7 +62,7 @@ int sulogin_main(int argc UNUSED_PARAM, char **argv)
|
||||
while (1) {
|
||||
int r;
|
||||
|
||||
- r = ask_and_check_password_extended(pwd, timeout,
|
||||
+ r = ask_and_check_password_extended(pwd, timeout, 1,
|
||||
"Give root password for system maintenance\n"
|
||||
"(or type Control-D for normal startup):"
|
||||
);
|
||||
--
|
||||
2.11.0
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
From d9c09138d91566af49ef8179d9995c84294e2486 Mon Sep 17 00:00:00 2001
|
||||
From: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
|
||||
Date: Thu, 5 Nov 2015 16:27:36 +0200
|
||||
Subject: [PATCH 10/12] su: FEATURE_SU_NULLOK_SECURE
|
||||
|
||||
When this feature is enabled, blank passwords are not accepted by su
|
||||
unless the user is on a secure TTY defined in /etc/securetty. This
|
||||
resembles the default PAM configuration of some Linux distros which
|
||||
specify the nullok_secure option for pam_unix.so.
|
||||
---
|
||||
loginutils/su.c | 18 +++++++++++++-----
|
||||
1 file changed, 13 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/loginutils/su.c b/loginutils/su.c
|
||||
index 24ffbde86..086445243 100644
|
||||
--- a/loginutils/su.c
|
||||
+++ b/loginutils/su.c
|
||||
@@ -24,6 +24,11 @@
|
||||
//config: bool "Enable su to check user's shell to be listed in /etc/shells"
|
||||
//config: depends on SU
|
||||
//config: default y
|
||||
+//config:config FEATURE_SU_NULLOK_SECURE
|
||||
+//config: bool "Disallow blank passwords from TTYs other than specified in /etc/securetty"
|
||||
+//config: depends on SU
|
||||
+//config: default n
|
||||
+
|
||||
|
||||
//applet:/* Needs to be run by root or be suid root - needs to change uid and gid: */
|
||||
//applet:IF_SU(APPLET(su, BB_DIR_BIN, BB_SUID_REQUIRE))
|
||||
@@ -76,6 +81,7 @@ int su_main(int argc UNUSED_PARAM, char **argv)
|
||||
struct passwd *pw;
|
||||
uid_t cur_uid = getuid();
|
||||
const char *tty;
|
||||
+ int allow_blank = 1;
|
||||
#if ENABLE_FEATURE_UTMP
|
||||
char user_buf[64];
|
||||
#endif
|
||||
@@ -100,6 +106,12 @@ int su_main(int argc UNUSED_PARAM, char **argv)
|
||||
argv++;
|
||||
}
|
||||
|
||||
+ tty = xmalloc_ttyname(STDIN_FILENO);
|
||||
+ if (!tty) tty = "none";
|
||||
+ tty = skip_dev_pfx(tty);
|
||||
+
|
||||
+ if (ENABLE_FEATURE_SU_NULLOK_SECURE) allow_blank = check_securetty(tty);
|
||||
+
|
||||
if (ENABLE_FEATURE_SU_SYSLOG) {
|
||||
/* The utmp entry (via getlogin) is probably the best way to
|
||||
* identify the user, especially if someone su's from a su-shell.
|
||||
@@ -113,16 +125,12 @@ int su_main(int argc UNUSED_PARAM, char **argv)
|
||||
pw = getpwuid(cur_uid);
|
||||
old_user = pw ? xstrdup(pw->pw_name) : "";
|
||||
}
|
||||
- tty = xmalloc_ttyname(2);
|
||||
- if (!tty) {
|
||||
- tty = "none";
|
||||
- }
|
||||
openlog(applet_name, 0, LOG_AUTH);
|
||||
}
|
||||
|
||||
pw = xgetpwnam(opt_username);
|
||||
|
||||
- if (cur_uid == 0 || ask_and_check_password(pw) > 0) {
|
||||
+ if (cur_uid == 0 || ask_and_check_password_extended(pw, 0, allow_blank, "Password: ") > 0) {
|
||||
if (ENABLE_FEATURE_SU_SYSLOG)
|
||||
syslog(LOG_NOTICE, "%c %s %s:%s",
|
||||
'+', tty, old_user, opt_username);
|
||||
--
|
||||
2.11.0
|
||||
|
|
@ -1,205 +0,0 @@
|
|||
From 838188511cb2085d8980956b270cc68ed9911102 Mon Sep 17 00:00:00 2001
|
||||
From: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
|
||||
Date: Thu, 4 Aug 2016 12:26:56 +0200
|
||||
Subject: [PATCH 11/12] ntpd: postpone hostname resolution if fails on startup
|
||||
|
||||
Signed-off-by: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
|
||||
---
|
||||
networking/ntpd.c | 130 +++++++++++++++++++++++++++---------------------------
|
||||
1 file changed, 64 insertions(+), 66 deletions(-)
|
||||
|
||||
diff --git a/networking/ntpd.c b/networking/ntpd.c
|
||||
index b7fa5dce9..c6d07adac 100644
|
||||
--- a/networking/ntpd.c
|
||||
+++ b/networking/ntpd.c
|
||||
@@ -155,6 +155,7 @@
|
||||
#define RETRY_INTERVAL 32 /* on send/recv error, retry in N secs (need to be power of 2) */
|
||||
#define NOREPLY_INTERVAL 512 /* sent, but got no reply: cap next query by this many seconds */
|
||||
#define RESPONSE_INTERVAL 16 /* wait for reply up to N secs */
|
||||
+#define HOSTNAME_INTERVAL 4 /* hostname lookup failed. Wait N secs for next try */
|
||||
|
||||
/* Step threshold (sec). std ntpd uses 0.128.
|
||||
*/
|
||||
@@ -293,6 +294,7 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
len_and_sockaddr *p_lsa;
|
||||
+ char *p_hostname;
|
||||
char *p_dotted;
|
||||
int p_fd;
|
||||
int datapoint_idx;
|
||||
@@ -318,7 +320,6 @@ typedef struct {
|
||||
datapoint_t filter_datapoint[NUM_DATAPOINTS];
|
||||
/* last sent packet: */
|
||||
msg_t p_xmt_msg;
|
||||
- char p_hostname[1];
|
||||
} peer_t;
|
||||
|
||||
|
||||
@@ -791,27 +792,17 @@ reset_peer_stats(peer_t *p, double offset)
|
||||
}
|
||||
|
||||
static void
|
||||
-resolve_peer_hostname(peer_t *p, int loop_on_fail)
|
||||
-{
|
||||
- len_and_sockaddr *lsa;
|
||||
-
|
||||
- again:
|
||||
- lsa = host2sockaddr(p->p_hostname, 123);
|
||||
- if (!lsa) {
|
||||
- /* error message already emitted by host2sockaddr() */
|
||||
- if (!loop_on_fail)
|
||||
- return;
|
||||
-//FIXME: do this to avoid infinite looping on typo in a hostname?
|
||||
-//well... in which case, what is a good value for loop_on_fail?
|
||||
- //if (--loop_on_fail == 0)
|
||||
- // xfunc_die();
|
||||
- sleep(5);
|
||||
- goto again;
|
||||
+resolve_peer_hostname(peer_t *p) {
|
||||
+ len_and_sockaddr *lsa = host2sockaddr(p->p_hostname, 123);
|
||||
+ if (lsa) {
|
||||
+ if (p->p_lsa) {
|
||||
+ free(p->p_lsa);
|
||||
+ free(p->p_dotted);
|
||||
+ }
|
||||
+ p->p_lsa = lsa;
|
||||
+ p->p_dotted = xmalloc_sockaddr2dotted_noport(&lsa->u.sa);
|
||||
}
|
||||
- free(p->p_lsa);
|
||||
- free(p->p_dotted);
|
||||
- p->p_lsa = lsa;
|
||||
- p->p_dotted = xmalloc_sockaddr2dotted_noport(&lsa->u.sa);
|
||||
+ set_next(p, lsa ? 0 : HOSTNAME_INTERVAL);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -820,28 +811,29 @@ add_peers(const char *s)
|
||||
llist_t *item;
|
||||
peer_t *p;
|
||||
|
||||
- p = xzalloc(sizeof(*p) + strlen(s));
|
||||
- strcpy(p->p_hostname, s);
|
||||
- resolve_peer_hostname(p, /*loop_on_fail=*/ 1);
|
||||
+ p = xzalloc(sizeof(*p));
|
||||
+ p->p_hostname = xstrdup(s);
|
||||
+ resolve_peer_hostname(p);
|
||||
|
||||
/* Names like N.<country2chars>.pool.ntp.org are randomly resolved
|
||||
* to a pool of machines. Sometimes different N's resolve to the same IP.
|
||||
* It is not useful to have two peers with same IP. We skip duplicates.
|
||||
*/
|
||||
- for (item = G.ntp_peers; item != NULL; item = item->link) {
|
||||
- peer_t *pp = (peer_t *) item->data;
|
||||
- if (strcmp(p->p_dotted, pp->p_dotted) == 0) {
|
||||
- bb_error_msg("duplicate peer %s (%s)", s, p->p_dotted);
|
||||
- free(p->p_lsa);
|
||||
- free(p->p_dotted);
|
||||
- free(p);
|
||||
- return;
|
||||
+ if (p->p_lsa)
|
||||
+ for (item = G.ntp_peers; item != NULL; item = item->link) {
|
||||
+ peer_t *pp = (peer_t *) item->data;
|
||||
+ if (pp->p_lsa && strcmp(p->p_dotted, pp->p_dotted) == 0) {
|
||||
+ bb_error_msg("duplicate peer %s (%s)", s, p->p_dotted);
|
||||
+ free(p->p_hostname);
|
||||
+ free(p->p_lsa);
|
||||
+ free(p->p_dotted);
|
||||
+ free(p);
|
||||
+ return;
|
||||
+ }
|
||||
}
|
||||
- }
|
||||
|
||||
p->p_fd = -1;
|
||||
p->p_xmt_msg.m_status = MODE_CLIENT | (NTP_VERSION << 3);
|
||||
- p->next_action_time = G.cur_time; /* = set_next(p, 0); */
|
||||
reset_peer_stats(p, STEP_THRESHOLD);
|
||||
|
||||
llist_add_to(&G.ntp_peers, p);
|
||||
@@ -2378,44 +2370,50 @@ int ntpd_main(int argc UNUSED_PARAM, char **argv)
|
||||
for (item = G.ntp_peers; item != NULL; item = item->link) {
|
||||
peer_t *p = (peer_t *) item->data;
|
||||
|
||||
- if (p->next_action_time <= G.cur_time) {
|
||||
- if (p->p_fd == -1) {
|
||||
- /* Time to send new req */
|
||||
- if (--cnt == 0) {
|
||||
- VERB4 bb_error_msg("disabling burst mode");
|
||||
- G.polladj_count = 0;
|
||||
- G.poll_exp = MINPOLL;
|
||||
+ if (p->p_lsa) {
|
||||
+
|
||||
+ if (p->next_action_time <= G.cur_time) {
|
||||
+ if (p->p_fd == -1) {
|
||||
+ /* Time to send new req */
|
||||
+ if (--cnt == 0) {
|
||||
+ VERB4 bb_error_msg("disabling burst mode");
|
||||
+ G.polladj_count = 0;
|
||||
+ G.poll_exp = MINPOLL;
|
||||
+ }
|
||||
+ send_query_to_peer(p);
|
||||
+ } else {
|
||||
+ /* Timed out waiting for reply */
|
||||
+ close(p->p_fd);
|
||||
+ p->p_fd = -1;
|
||||
+ /* If poll interval is small, increase it */
|
||||
+ if (G.poll_exp < BIGPOLL)
|
||||
+ adjust_poll(MINPOLL);
|
||||
+ timeout = poll_interval(NOREPLY_INTERVAL);
|
||||
+ bb_error_msg("timed out waiting for %s, reach 0x%02x, next query in %us",
|
||||
+ p->p_dotted, p->reachable_bits, timeout);
|
||||
+
|
||||
+ /* What if don't see it because it changed its IP? */
|
||||
+ if (p->reachable_bits == 0)
|
||||
+ resolve_peer_hostname(p);
|
||||
+
|
||||
+ set_next(p, timeout);
|
||||
}
|
||||
- send_query_to_peer(p);
|
||||
- } else {
|
||||
- /* Timed out waiting for reply */
|
||||
- close(p->p_fd);
|
||||
- p->p_fd = -1;
|
||||
- /* If poll interval is small, increase it */
|
||||
- if (G.poll_exp < BIGPOLL)
|
||||
- adjust_poll(MINPOLL);
|
||||
- timeout = poll_interval(NOREPLY_INTERVAL);
|
||||
- bb_error_msg("timed out waiting for %s, reach 0x%02x, next query in %us",
|
||||
- p->p_dotted, p->reachable_bits, timeout);
|
||||
-
|
||||
- /* What if don't see it because it changed its IP? */
|
||||
- if (p->reachable_bits == 0)
|
||||
- resolve_peer_hostname(p, /*loop_on_fail=*/ 0);
|
||||
-
|
||||
- set_next(p, timeout);
|
||||
}
|
||||
- }
|
||||
+
|
||||
+ if (p->p_fd >= 0) {
|
||||
+ /* Wait for reply from this peer */
|
||||
+ pfd[i].fd = p->p_fd;
|
||||
+ pfd[i].events = POLLIN;
|
||||
+ idx2peer[i] = p;
|
||||
+ i++;
|
||||
+ }
|
||||
+
|
||||
+ } else
|
||||
+ resolve_peer_hostname(p);
|
||||
|
||||
if (p->next_action_time < nextaction)
|
||||
nextaction = p->next_action_time;
|
||||
|
||||
- if (p->p_fd >= 0) {
|
||||
- /* Wait for reply from this peer */
|
||||
- pfd[i].fd = p->p_fd;
|
||||
- pfd[i].events = POLLIN;
|
||||
- idx2peer[i] = p;
|
||||
- i++;
|
||||
- }
|
||||
}
|
||||
|
||||
timeout = nextaction - G.cur_time;
|
||||
--
|
||||
2.11.0
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
From 56c14ec7f75a68c191f2fc210915108f428e849c Mon Sep 17 00:00:00 2001
|
||||
From: Natanael Copa <ncopa@alpinelinux.org>
|
||||
Date: Fri, 25 Jul 2014 15:28:33 +0200
|
||||
Subject: [PATCH 12/12] 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 75229ad8c..6266bde0d 100644
|
||||
--- a/editors/diff.c
|
||||
+++ b/editors/diff.c
|
||||
@@ -117,6 +117,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"
|
||||
@@ -158,6 +161,7 @@ enum { /* Commandline flags */
|
||||
FLAG_p, /* not implemented */
|
||||
FLAG_B,
|
||||
FLAG_E, /* not implemented */
|
||||
+ FLAG_no_deref,
|
||||
};
|
||||
#define FLAG(x) (1 << FLAG_##x)
|
||||
|
||||
@@ -872,7 +876,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.
|
||||
@@ -969,6 +974,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.11.0
|
||||
|
|
@ -1,91 +0,0 @@
|
|||
From e139ae307e4fd9eb3b86a6fc2e97b4e212925199 Mon Sep 17 00:00:00 2001
|
||||
From: Denys Vlasenko <vda.linux@googlemail.com>
|
||||
Date: Wed, 12 Apr 2017 21:02:33 +0200
|
||||
Subject: [PATCH 13/14] ash: make shellexec capable of using separate argv[0]
|
||||
and filename to exec
|
||||
|
||||
function old new delta
|
||||
execcmd 71 78 +7
|
||||
shellexec 221 224 +3
|
||||
evalcommand 1158 1161 +3
|
||||
------------------------------------------------------------------------------
|
||||
(add/remove: 0/0 grow/shrink: 3/0 up/down: 13/0) Total: 13 bytes
|
||||
|
||||
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
||||
---
|
||||
shell/ash.c | 21 ++++++++++-----------
|
||||
1 file changed, 10 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/shell/ash.c b/shell/ash.c
|
||||
index 983f7b1..044f166 100644
|
||||
--- a/shell/ash.c
|
||||
+++ b/shell/ash.c
|
||||
@@ -7744,9 +7744,8 @@ tryexec(IF_FEATURE_SH_STANDALONE(int applet_no,) char *cmd, char **argv, char **
|
||||
* have to change the find_command routine as well.
|
||||
* argv[-1] must exist and be writable! See tryexec() for why.
|
||||
*/
|
||||
-static void shellexec(char **, const char *, int) NORETURN;
|
||||
-static void
|
||||
-shellexec(char **argv, const char *path, int idx)
|
||||
+static void shellexec(char *prog, char **argv, const char *path, int idx) NORETURN;
|
||||
+static void shellexec(char *prog, char **argv, const char *path, int idx)
|
||||
{
|
||||
char *cmdname;
|
||||
int e;
|
||||
@@ -7755,12 +7754,12 @@ shellexec(char **argv, const char *path, int idx)
|
||||
int applet_no = -1; /* used only by FEATURE_SH_STANDALONE */
|
||||
|
||||
envp = listvars(VEXPORT, VUNSET, /*end:*/ NULL);
|
||||
- if (strchr(argv[0], '/') != NULL
|
||||
+ if (strchr(prog, '/') != NULL
|
||||
#if ENABLE_FEATURE_SH_STANDALONE
|
||||
- || (applet_no = find_applet_by_name(argv[0])) >= 0
|
||||
+ || (applet_no = find_applet_by_name(prog)) >= 0
|
||||
#endif
|
||||
) {
|
||||
- tryexec(IF_FEATURE_SH_STANDALONE(applet_no,) argv[0], argv, envp);
|
||||
+ tryexec(IF_FEATURE_SH_STANDALONE(applet_no,) prog, argv, envp);
|
||||
if (applet_no >= 0) {
|
||||
/* We tried execing ourself, but it didn't work.
|
||||
* Maybe /proc/self/exe doesn't exist?
|
||||
@@ -7772,7 +7771,7 @@ shellexec(char **argv, const char *path, int idx)
|
||||
} else {
|
||||
try_PATH:
|
||||
e = ENOENT;
|
||||
- while ((cmdname = path_advance(&path, argv[0])) != NULL) {
|
||||
+ while ((cmdname = path_advance(&path, prog)) != NULL) {
|
||||
if (--idx < 0 && pathopt == NULL) {
|
||||
tryexec(IF_FEATURE_SH_STANDALONE(-1,) cmdname, argv, envp);
|
||||
if (errno != ENOENT && errno != ENOTDIR)
|
||||
@@ -7796,8 +7795,8 @@ shellexec(char **argv, const char *path, int idx)
|
||||
}
|
||||
exitstatus = exerrno;
|
||||
TRACE(("shellexec failed for %s, errno %d, suppress_int %d\n",
|
||||
- argv[0], e, suppress_int));
|
||||
- ash_msg_and_raise(EXEXIT, "%s: %s", argv[0], errmsg(e, "not found"));
|
||||
+ prog, e, suppress_int));
|
||||
+ ash_msg_and_raise(EXEXIT, "%s: %s", prog, errmsg(e, "not found"));
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
@@ -9371,7 +9370,7 @@ execcmd(int argc UNUSED_PARAM, char **argv)
|
||||
/*setsignal(SIGTSTP); - unnecessary because of mflag=0 */
|
||||
/*setsignal(SIGTTOU); - unnecessary because of mflag=0 */
|
||||
|
||||
- shellexec(argv + 1, pathval(), 0);
|
||||
+ shellexec(argv[1], argv + 1, pathval(), 0);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
return 0;
|
||||
@@ -9773,7 +9772,7 @@ evalcommand(union node *cmd, int flags)
|
||||
/* fall through to exec'ing external program */
|
||||
}
|
||||
listsetvar(varlist.list, VEXPORT|VSTACK);
|
||||
- shellexec(argv, path, cmdentry.u.index);
|
||||
+ shellexec(argv[0], argv, path, cmdentry.u.index);
|
||||
/* NOTREACHED */
|
||||
} /* default */
|
||||
case CMDBUILTIN:
|
||||
--
|
||||
2.9.3
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
From 6c149f4d9afaed9edb75c88b784ad900c1f40700 Mon Sep 17 00:00:00 2001
|
||||
From: Denys Vlasenko <vda.linux@googlemail.com>
|
||||
Date: Wed, 12 Apr 2017 21:31:32 +0200
|
||||
Subject: [PATCH 14/14] ash: implement "exec -a ARGV0 CMD ARGV1..."
|
||||
|
||||
function old new delta
|
||||
execcmd 71 112 +41
|
||||
shellexec 221 224 +3
|
||||
evalcommand 1158 1161 +3
|
||||
localcmd 364 366 +2
|
||||
unaliascmd 163 154 -9
|
||||
------------------------------------------------------------------------------
|
||||
(add/remove: 0/0 grow/shrink: 4/1 up/down: 49/-9) Total: 40 bytes
|
||||
|
||||
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
||||
---
|
||||
shell/ash.c | 22 +++++++++++++++-------
|
||||
1 file changed, 15 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/shell/ash.c b/shell/ash.c
|
||||
index 044f166..e170bec 100644
|
||||
--- a/shell/ash.c
|
||||
+++ b/shell/ash.c
|
||||
@@ -3345,11 +3345,9 @@ unaliascmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
|
||||
{
|
||||
int i;
|
||||
|
||||
- while ((i = nextopt("a")) != '\0') {
|
||||
- if (i == 'a') {
|
||||
- rmaliases();
|
||||
- return 0;
|
||||
- }
|
||||
+ while (nextopt("a") != '\0') {
|
||||
+ rmaliases();
|
||||
+ return 0;
|
||||
}
|
||||
for (i = 0; *argptr; argptr++) {
|
||||
if (unalias(*argptr)) {
|
||||
@@ -9354,7 +9352,14 @@ truecmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
|
||||
static int FAST_FUNC
|
||||
execcmd(int argc UNUSED_PARAM, char **argv)
|
||||
{
|
||||
- if (argv[1]) {
|
||||
+ optionarg = NULL;
|
||||
+ while (nextopt("a:") != '\0')
|
||||
+ /* nextopt() sets optionarg to "-a ARGV0" */;
|
||||
+
|
||||
+ argv = argptr;
|
||||
+ if (argv[0]) {
|
||||
+ char *prog;
|
||||
+
|
||||
iflag = 0; /* exit on error */
|
||||
mflag = 0;
|
||||
optschanged();
|
||||
@@ -9370,7 +9375,10 @@ execcmd(int argc UNUSED_PARAM, char **argv)
|
||||
/*setsignal(SIGTSTP); - unnecessary because of mflag=0 */
|
||||
/*setsignal(SIGTTOU); - unnecessary because of mflag=0 */
|
||||
|
||||
- shellexec(argv[1], argv + 1, pathval(), 0);
|
||||
+ prog = argv[0];
|
||||
+ if (optionarg)
|
||||
+ argv[0] = optionarg;
|
||||
+ shellexec(prog, argv, pathval(), 0);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
return 0;
|
||||
--
|
||||
2.9.3
|
||||
|
199
busybox/APKBUILD
199
busybox/APKBUILD
|
@ -1,199 +0,0 @@
|
|||
# Contributor: Łukasz Jendrysik <scadu@yandex.com>
|
||||
# Contributor: Oliver Smith <ollieparanoid@bitmessage.ch>
|
||||
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
|
||||
pkgname=busybox
|
||||
pkgver=1.26.2
|
||||
pkgrel=3
|
||||
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"
|
||||
install="$pkgname.post-install $pkgname-extras.post-install $pkgname.post-upgrade"
|
||||
subpackages="$pkgname-extras $pkgname-static $pkgname-suid"
|
||||
options="suid"
|
||||
_triggerpaths="/bin:/usr/bin:/sbin:/usr/sbin:/lib/modules/*"
|
||||
triggers="busybox.trigger=$_triggerpaths busybox-extras.trigger=$_triggerpaths"
|
||||
source="http://busybox.net/downloads/$pkgname-$pkgver.tar.bz2
|
||||
0001-ash-exec-busybox.static.patch
|
||||
0002-app-location-for-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-login-move-check_securetty-to-libbb.patch
|
||||
0009-libbb-allow_blank-argument-for-ask_and_check_passwor.patch
|
||||
0010-su-FEATURE_SU_NULLOK_SECURE.patch
|
||||
0011-ntpd-postpone-hostname-resolution-if-fails-on-startu.patch
|
||||
0012-diff-add-support-for-no-dereference.patch
|
||||
0013-ash-make-shellexec-capable-of-using-separate-argv-0-.patch
|
||||
0014-ash-implement-exec-a-ARGV0-CMD-ARGV1.patch
|
||||
|
||||
location-for-cpio.patch
|
||||
|
||||
acpid.logrotate
|
||||
busyboxconfig
|
||||
busyboxconfig-extras
|
||||
bbsuid.c
|
||||
dad.if-up
|
||||
nologin.c
|
||||
"
|
||||
|
||||
_sdir="$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() {
|
||||
mkdir -p "$_staticdir" "$_dyndir" "$_dyndir_extras"
|
||||
#patches
|
||||
cd "$_sdir"
|
||||
for i in $source; do
|
||||
local p=${i##*/}
|
||||
case $i in
|
||||
*.patch) msg $p; patch -p1 -i "$srcdir"/$p || return 1;;
|
||||
esac
|
||||
done
|
||||
|
||||
cp "$srcdir"/nologin.c loginutils/
|
||||
}
|
||||
|
||||
build() {
|
||||
# build bbsuid
|
||||
msg "Building bbsuid"
|
||||
${CC:-${CROSS_COMPILE}gcc} ${CPPFLAGS} ${CFLAGS} \
|
||||
${LDFLAGS} "$srcdir"/bbsuid.c -o "$_dyndir"/bbsuid || return 1
|
||||
|
||||
# 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 "$_sdir" O="$PWD" silentoldconfig || return 1
|
||||
make || return 1
|
||||
|
||||
# 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 "$_sdir" O="$PWD" silentoldconfig || return 1
|
||||
make || return 1
|
||||
|
||||
# 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 "$_sdir" O="$PWD" silentoldconfig || return 1
|
||||
make || return 1
|
||||
mv busybox busybox.static
|
||||
}
|
||||
|
||||
# $1: $_dyndir or $_dyndir_extras
|
||||
# $2: $pkgdir or $subpkgdir
|
||||
_package_dynamic() {
|
||||
cd "$1"
|
||||
mkdir -p "$2"/usr/sbin "$2"/usr/bin "$2"/tmp \
|
||||
"$2"/var/cache/misc "$2"/bin "$2"/sbin
|
||||
chmod 1777 "$2"/tmp
|
||||
install -m755 busybox "$2"/bin/busybox || return 1
|
||||
# we need /bin/sh to be able to execute post-install
|
||||
ln -s /bin/busybox "$2"/bin/sh
|
||||
|
||||
#ifupdown needs those dirs to be present
|
||||
mkdir -p \
|
||||
"$2"/etc/network/if-down.d \
|
||||
"$2"/etc/network/if-post-down.d \
|
||||
"$2"/etc/network/if-post-up.d \
|
||||
"$2"/etc/network/if-pre-down.d \
|
||||
"$2"/etc/network/if-pre-up.d \
|
||||
"$2"/etc/network/if-up.d \
|
||||
|| return 1
|
||||
install -m775 "$srcdir"/dad.if-up "$2"/etc/network/if-up.d/dad \
|
||||
|| return 1
|
||||
|
||||
install -Dm644 "$srcdir"/acpid.logrotate \
|
||||
"$2/etc/logrotate.d/acpid" || return 1
|
||||
|
||||
mkdir -p "$2"/var/lib/udhcpd || return 1
|
||||
install -Dm644 "$_sdir"/examples/udhcp/udhcpd.conf \
|
||||
"$2"/etc/udhcpd.conf || return 1
|
||||
cat >"$2"/etc/securetty <<EOF
|
||||
console
|
||||
tty1
|
||||
tty2
|
||||
tty3
|
||||
tty4
|
||||
tty5
|
||||
tty6
|
||||
tty7
|
||||
tty8
|
||||
tty9
|
||||
tty10
|
||||
tty11
|
||||
EOF
|
||||
}
|
||||
|
||||
package() {
|
||||
_package_dynamic "$_dyndir" "$pkgdir"
|
||||
}
|
||||
|
||||
extras() {
|
||||
pkgdesc="More programs enabled in Busybox"
|
||||
provides="busybox=$pkgver"
|
||||
_package_dynamic "$_dyndir_extras" "$subpkgdir"
|
||||
}
|
||||
|
||||
suid() {
|
||||
pkgdesc="suid binaries of Busybox"
|
||||
depends="${pkgname}"
|
||||
|
||||
cd "$_dyndir"
|
||||
mkdir -p "$subpkgdir"/bin
|
||||
install -m4111 bbsuid "$subpkgdir"/bin/bbsuid || return 1
|
||||
}
|
||||
|
||||
static() {
|
||||
pkgdesc="Statically linked Busybox"
|
||||
mkdir -p "$subpkgdir"/bin
|
||||
install -m755 "$_staticdir"/busybox.static \
|
||||
"$subpkgdir"/bin/busybox.static
|
||||
}
|
||||
|
||||
sha512sums="9926d211d0b4f34b513d934d7b111ebbf933c2dc31206bdd80426a62d47d5b1475b70bec5aaa14a26b94a202ab1465d994062a002750a312dcb8167096eb3719 busybox-1.26.2.tar.bz2
|
||||
ed16b7a38d99eb309ed03d3212ffd1c1993e292724665be2aaefcf645c9a37d1b0c5d24308dac7dbb093afde5b700961c55336d67be4f2bb788c85550e5f1de8 0001-ash-exec-busybox.static.patch
|
||||
cd6b0b59ca8006bfc545ba521a92de81be320c0dd3ed0a41d6a60339b73f44c80f1ac36fb05d35a8555fd173167b792f73ae279115d23d59f8f623ae01aed7d1 0002-app-location-for-vi-and-lspci.patch
|
||||
3fef7a3f47ca798859c5cf8d78bc36ed98c4b9f841a3593bca71b9242ca15719bbe9b683437f8ea61b9a5f6c31c9272b7f72dcb6ef6fc2a42fd3219e302113eb 0003-udhcpc-set-default-discover-retries-to-5.patch
|
||||
36d1090b35db49fd81ca5a39f5c5050f3173d628ac5e1b9b1c5873a3d0641942c9ffc5448533baa6c4512f4e539e8eb81d53c526a8f6e41b12f6f7606746793f 0004-ping-make-ping-work-without-root-privileges.patch
|
||||
6fc8fd411daec7989632b448ff73cbac05d8e4c497167f24c0b2a55517449f9c89fcc0131fa64973f163f0d5d0c5ed75613682b95b0f11900d340366693acf2a 0005-fbsplash-support-console-switching.patch
|
||||
7b6300130ca72b6842283b696c5138ac119b7b79d926ef336395246549b48a0f9c7c97c4708dfc45192d90898da3cad5b9bfe309072751615c012c8fcccfbb42 0006-fbsplash-support-image-and-bar-alignment-and-positio.patch
|
||||
11529fe845bbd4094dd57f99c8150aefeed69822d04bc0692975ea4f70c1691698d0b76d7522741eca9e45e8baaa877e55aed3ef21809bbaeecf67be7049bf70 0007-depmod-support-generating-kmod-binary-index-files.patch
|
||||
29589a224a432363620fa1b56c605ca93e39c879d263087f58c531aa4331ca366baa531b7464c41a8fdee96e7750b155e5e00f2bb0aeaa8da50d2cae01eab4f4 0008-login-move-check_securetty-to-libbb.patch
|
||||
fc291167b2e026166e283d98d2d61cb3c9701e5e83c09062692d0c5a77f3b838ba73065706461095039f9adcbd9a7e4ae60a8b578986d0499caa33789fea3050 0009-libbb-allow_blank-argument-for-ask_and_check_passwor.patch
|
||||
f82caa1dc4395f266b024a7face267a916a80ead95f3d392b10fd397d0fdf62703e3078357bc71962616d6531ea913aef80e1a7cdf8180bca70e723c7d331238 0010-su-FEATURE_SU_NULLOK_SECURE.patch
|
||||
16b513b34b3bf16002f14566aae66aab986403cb7a0f416c27264b739706bbd624a99fd37d5b56ff6efe623f3cc48aef3e8fe51c4ae2e94eda3fe9e8e618e3a1 0011-ntpd-postpone-hostname-resolution-if-fails-on-startu.patch
|
||||
361959788bc11b7f20d4029bb0f561759d270983b09c44fe2a01817378c4eb1c98cd8ef73e7ef8c168b7540170f58ddb36b9e4f80a97565f3fe3ba85b593a471 0012-diff-add-support-for-no-dereference.patch
|
||||
bf3e7c400e718fbc19fda19d7304ed938e5c59f45d5d1ba6eafd8f62a984d40419dbefd9f6840ac7f220d00abfae67e8f31be78b4c2e25310b265bca8beb91a2 0013-ash-make-shellexec-capable-of-using-separate-argv-0-.patch
|
||||
cb7aa4d5d22596bc8c6510cb653599dd8cf4c3a5312e93adfc6411d811376db2ad3b506a111322f46aa9929a5337e22a169da4ea250fd4b39e703adbc8792a2d 0014-ash-implement-exec-a-ARGV0-CMD-ARGV1.patch
|
||||
f26e090f5de0096ba5c4d46989ebe0ab5fa64c8bf54cd37ddec302fddfde23eac914858d86cc52bf3b5780a8e81ea2612ef6e713df2828e52c606f86a6816f39 location-for-cpio.patch
|
||||
a9b1403c844c51934637215307dd9e2adb9458921047acff0d86dcf229b6e0027f4b2c6cdaa25a58407aad9d098fb5685d58eb5ff8d2aa3de4912cdea21fe54c acpid.logrotate
|
||||
e54495f0c7473d77752a0d3856a7d3213bdcd81c716195bf6812556a24a152c22ed1858abb2384ad0b22eba73304894e6e26695f23df0ef13f81eedefa95b91e busyboxconfig
|
||||
db820fbd0438453604e8f73d62c782ffa75ccfff151ee084ffaeee13b98b7370958c7bd03376836903751a6662dc8531f96addd539423858c2475299eca2f037 busyboxconfig-extras
|
||||
c1dd56509277c59751907a27f067f1622191ddfd498acfe390d83136d36a41f2bdfc2fd4daf35af77219a66fb00fea20483f34112afd5df2ccd9f36ab548e66f bbsuid.c
|
||||
a1127c8a384294135e11500fde7ead33b73d24b11c21911b08447a4c4ef71d7a9965d6466f60f2da64e3b877213b0a3e924a5add3c5333ee3ecde8c2a91c5e02 dad.if-up
|
||||
4e7c291a70e879b74c0fc07c54a73ef50537d8be68fee6b2d409425c07afd2d67f9b6afcd8c33a7971014913cc5de85e45079681c9e77200c6cc2f34acfba6d2 nologin.c"
|
|
@ -1,5 +0,0 @@
|
|||
This aports builds `busybox-extras` with more programs enabled (most
|
||||
importantly: `telnetd`, which is required for postmarketOS). It is getting
|
||||
upstreamed here:
|
||||
|
||||
https://github.com/alpinelinux/aports/pull/1092
|
|
@ -1,8 +0,0 @@
|
|||
/var/log/acpid.log {
|
||||
missingok
|
||||
notifempty
|
||||
sharedscripts
|
||||
postrotate
|
||||
/etc/init.d/acpid --ifstarted restart || true
|
||||
endscript
|
||||
}
|
106
busybox/bbsuid.c
106
busybox/bbsuid.c
|
@ -1,106 +0,0 @@
|
|||
/*
|
||||
* 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",
|
||||
"/usr/bin/crontab",
|
||||
"/usr/bin/passwd",
|
||||
"/usr/bin/su",
|
||||
"/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;
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Uninstall note
|
||||
echo "-> NOTE: To uninstall busybox-extras properly, do this:"
|
||||
echo " # apk del busybox-extras"
|
||||
echo " # apk add /var/cache/apk/busybox-1.26.2-r3...apk # pick latest"
|
||||
echo " # apk add busybox"
|
||||
|
||||
# We need the symlinks early
|
||||
exec /bin/busybox --install -s
|
|
@ -1 +0,0 @@
|
|||
busybox.trigger
|
|
@ -1,20 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Remove links from busybox-extras (see also: busybox.post-upgrade)
|
||||
for link in \
|
||||
/usr/bin/ftpget \
|
||||
/usr/bin/ftpput \
|
||||
/usr/bin/telnet \
|
||||
/usr/bin/tftp \
|
||||
/usr/sbin/ftpd \
|
||||
/usr/sbin/httpd \
|
||||
/usr/sbin/telnetd \
|
||||
/usr/sbin/tftpd \
|
||||
; do
|
||||
if [ -L "$link" ] && [ "$(readlink $link)" = "/bin/busybox" ]; then
|
||||
rm "$link"
|
||||
fi
|
||||
done
|
||||
|
||||
# We need the symlinks early
|
||||
exec /bin/busybox --install -s
|
|
@ -1,31 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Remove links, that have been relocated (see also: busybox.post-install)
|
||||
for link in \
|
||||
/usr/bin/ftpget \
|
||||
/usr/bin/ftpput \
|
||||
/usr/bin/telnet \
|
||||
/usr/bin/tftp \
|
||||
/usr/sbin/ftpd \
|
||||
/usr/sbin/httpd \
|
||||
/usr/sbin/telnetd \
|
||||
/usr/sbin/tftpd \
|
||||
; do
|
||||
if [ -L "$link" ] && [ "$(readlink $link)" = "/bin/busybox" ]; then
|
||||
rm "$link"
|
||||
echo "-> $(basename $link) is now in busybox-extras"
|
||||
fi
|
||||
done
|
||||
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
|
||||
|
||||
# We need the symlinks early
|
||||
exec /bin/busybox --install -s
|
|
@ -1,19 +0,0 @@
|
|||
#!/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
|
||||
/bin/busybox --install -s
|
||||
fi
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,8 +0,0 @@
|
|||
#!/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
|
|
@ -1,13 +0,0 @@
|
|||
diff --git a/archival/cpio.c b/archival/cpio.c
|
||||
index 540218cb2..369bf19a7 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
|
|
@ -1,38 +0,0 @@
|
|||
/* 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;
|
||||
}
|
||||
|
|
@ -1,37 +1,30 @@
|
|||
pkgname=heimdall
|
||||
pkgver=1.4.1
|
||||
pkgrel=4
|
||||
pkgver=1.4.2
|
||||
pkgrel=1
|
||||
pkgdesc="Flasher for Samsung Galaxy S devices"
|
||||
url="https://github.com/Benjamin-Dobell/Heimdall"
|
||||
arch="all"
|
||||
license="MIT"
|
||||
depends=""
|
||||
makedepends="libusb-dev"
|
||||
makedepends="libusb-dev cmake"
|
||||
subpackages=""
|
||||
source="$pkgname-$pkgver.tar.gz::https://github.com/Benjamin-Dobell/Heimdall/archive/v${pkgver}.tar.gz
|
||||
heimdall_flash_kernel.sh heimdall_wait_for_device.sh"
|
||||
options="!check"
|
||||
|
||||
_builddir="$srcdir"/Heimdall-$pkgver
|
||||
builddir="$srcdir"/Heimdall-$pkgver
|
||||
build() {
|
||||
cd $_builddir
|
||||
cd libpit/
|
||||
./configure --prefix=/usr
|
||||
make || return 1
|
||||
|
||||
cd ../heimdall/
|
||||
./configure --prefix=/usr
|
||||
make || return 1
|
||||
cd "$builddir"
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DDISABLE_FRONTEND=ON .
|
||||
make
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "$_builddir/heimdall"
|
||||
make PREFIX=/usr DESTDIR="$pkgdir/" install || return 1
|
||||
for i in heimdall_flash_kernel.sh heimdall_wait_for_device.sh; do
|
||||
install -Dm755 "$srcdir"/"$i" "$pkgdir"/usr/bin/"$i"
|
||||
for i in "$builddir"/bin/heimdall heimdall_flash_kernel.sh heimdall_wait_for_device.sh; do
|
||||
install -Dm755 "$i" "$pkgdir"/usr/bin/"$(basename "$i")"
|
||||
done
|
||||
}
|
||||
|
||||
sha512sums="2f1f49b0ad7bd5f4359893359b26024fe0cce84afed3878e42d902eb4dee487a44e351247d57e4af143ad728abd6c664df688246fcf7b96b9f3841cd16594296 heimdall-1.4.1.tar.gz
|
||||
sha512sums="c554662f9ccb763a8e9867a0c563618879d2533af985d44db3c237d3ee51add44c1681d13b1a83b72b30ba6e5b32d7c2f9c02b31114c67c5fbe01cbb010acfe7 heimdall-1.4.2.tar.gz
|
||||
a75677d4c5559bf8233a48d1b38bf91e4125717a85e1ea6d283d2d1e052c2a96228818a71f8b90adbda049b6d5b5065f7265ffc2e05cafd2ce9717bfc8ac8716 heimdall_flash_kernel.sh
|
||||
45e742bb3a8c8d0bc6806a4e9f860b04f255cad72a8602c04759178284c66e0a90d3ea22249b5fa69de1dd1d6ecd6221adaa63d611aa20d2a54aa20868e86a9f heimdall_wait_for_device.sh"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/sh
|
||||
IP=192.168.2.15
|
||||
IP=172.16.42.1
|
||||
TELNET_PORT=24
|
||||
|
||||
telnetd -b "${IP}:${TELNET_PORT}" -l /bin/sh
|
||||
|
|
|
@ -18,4 +18,4 @@ package() {
|
|||
install -Dm644 "$srcdir"/20-usb-shell.sh \
|
||||
"$pkgdir"/etc/postmarketos-mkinitfs/hooks/
|
||||
}
|
||||
sha512sums="0e8631d66131368ace5650afcb29abc718e0dd2d62aac49655b5e9ecd24ca3ceb1e0d51c51f38440e6ef44c88e03921bfc70fff8712201fae1f96456068480e4 20-usb-shell.sh"
|
||||
sha512sums="7154ded57cba1ff76fb8be9bd773ccdb4cd70c588ef763469d7e2fc9796fba13e5624480669b528138c1c5ebfc1a7927dcb80b850e72308b89736d9baee9c231 20-usb-shell.sh"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/sh
|
||||
IP=192.168.2.15
|
||||
IP=172.16.42.1
|
||||
TELNET_PORT=23
|
||||
|
||||
usb_setup_android() {
|
||||
|
@ -23,8 +23,8 @@ dhcpcd_start()
|
|||
|
||||
# create /etc/udhcpd.conf
|
||||
{
|
||||
echo "start 192.168.2.20"
|
||||
echo "end 192.168.2.90"
|
||||
echo "start 172.16.42.2"
|
||||
echo "end 172.16.42.254"
|
||||
echo "lease_file /var/udhcpd.leases"
|
||||
echo "interface $INTERFACE"
|
||||
echo "option subnet 255.255.255.0"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
pkgname=postmarketos-mkinitfs
|
||||
pkgver=0.0.5
|
||||
pkgrel=1
|
||||
pkgdesc="Tool to generate initramfs images for postmarketos"
|
||||
pkgrel=3
|
||||
pkgdesc="Tool to generate initramfs images for postmarketOS"
|
||||
url="https://github.com/postmarketOS"
|
||||
# multipath-tools: kpartx
|
||||
depends="busybox-extras lddtree cryptsetup kmod multipath-tools"
|
||||
|
@ -27,9 +27,9 @@ package() {
|
|||
install -Dm644 "$srcdir/10-usb-unlock.sh" \
|
||||
"$pkgdir/etc/postmarketos-mkinitfs/hooks/"
|
||||
}
|
||||
sha512sums="ec45d62b2c064dc5cb209871a2665f84cc47092e87ce0b535967f79c1a65b956fbec41f91b4b6d1fbc8f974d8c7a50915bcb551a275be61dda69c45e43c1fa69 init.sh.in
|
||||
sha512sums="2f45dee1ad9ef75166d614774e0ee2a6856950990c063bce7d0e98ed27599d2f8040c6118a9381aab4a69c79f96a30eb044b6b29ef2afb2a9374bac5f5a398da init.sh.in
|
||||
3ebc5fa2220a8da920ebca67f14c38b0c296eafdbcf312997b442a020d1683bd622a42a946a61b4d80cbecf28853c915480e26ffe59eda57769855303b67bbdf init_functions.sh
|
||||
b100af464cae8b4fb178201ff9cc99733a081ae5d6308bfdf10262c75031390206a59e1b6e5b55a494f9f7a9bdd95a85955c05fdbcf0929e6a05f30443987b54 mkinitfs.sh
|
||||
330cd7dd31d7685f732a4c3dc2720aba33e467a5b76ccf2304bcf5663cffcbc469443152b64c684e1025121f0e429aabe5c24b73278feb0cc2296c19a4552103 10-usb-unlock.sh
|
||||
b8562b2e944971a7b9849b9d463aaee417595f2c56f16cfb252535acf0b48c026372b0b49a53bdd5d9dc29312f05d3f3d3ee444d64401f0c2e13bc2132efb63e splash1.ppm.gz
|
||||
dd1eb11263c2bcfdb3be49c8e3c0afad83a8b343df2daa617b912b8d90267519afa429010e5f727a94301faa605b9727531919c08198f6f580b84ce86763a5f5 mkinitfs.sh
|
||||
82f0b9927bfef919c6561d67283a0e77c36ef8f8d11000a6153b52e39731ceaa65b9a34c682e737881dc676cc8bfc97dfbbfdeb2ca03594b8f9beef9e49a754d 10-usb-unlock.sh
|
||||
35a8eabad947347afec7e3f5860d31ab9e3534972c0960ccf553c7e1cc9262316bfdddb8d61d3588db1ee2261077597617806080b9956798b3e5088d6f9b596b splash1.ppm.gz
|
||||
bf11d8b3a50db984cfbb2cafe6687de327242c1f6f56c6fdd02ca579b05213f9c886aa1c0527530fdec21b16e65e68962e40a600c4ce155819df2f610b435087 splash2.ppm.gz"
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
|
||||
/bin/busybox --install -s
|
||||
/bin/busybox-extras --install -s
|
||||
|
||||
# kernel modules
|
||||
modprobe -a @MODULES@
|
||||
|
|
|
@ -100,7 +100,7 @@ get_modules()
|
|||
# Get the paths to all binaries and their dependencies
|
||||
get_binaries()
|
||||
{
|
||||
BINARIES="/bin/busybox /sbin/cryptsetup /usr/sbin/telnetd /sbin/kpartx"
|
||||
BINARIES="/bin/busybox /bin/busybox-extras /sbin/cryptsetup /usr/sbin/telnetd /sbin/kpartx"
|
||||
lddtree -l $BINARIES | sort -u
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
Loading…
Reference in a new issue