aboutsummaryrefslogtreecommitdiffstats
path: root/package/utils/busybox
diff options
context:
space:
mode:
authorMagnus Kroken <mkroken@gmail.com>2017-01-15 02:21:40 +0100
committerFelix Fietkau <nbd@nbd.name>2017-01-29 14:09:36 +0100
commit5d2a9d2a3a21bd360cc0956bd31335e7e3396d1d (patch)
tree930029901342683e59734167e65d15de2a6831ee /package/utils/busybox
parente5a0eb2af56c2439801dec5988c0d64978698922 (diff)
downloadupstream-5d2a9d2a3a21bd360cc0956bd31335e7e3396d1d.tar.gz
upstream-5d2a9d2a3a21bd360cc0956bd31335e7e3396d1d.tar.bz2
upstream-5d2a9d2a3a21bd360cc0956bd31335e7e3396d1d.zip
busybox: convert netmsg and lock applet to "new style" applet definition
The "new style" busybox applet approach moves all config and build definitions related to an applet to its .c file. This makes the patches easier to maintain, as they only add new files to the busybox build directory, without modifying BusyBox files. Signed-off-by: Magnus Kroken <mkroken@gmail.com> Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
Diffstat (limited to 'package/utils/busybox')
-rw-r--r--package/utils/busybox/patches/210-add_netmsg_util.patch54
-rw-r--r--package/utils/busybox/patches/220-add_lock_util.patch54
2 files changed, 30 insertions, 78 deletions
diff --git a/package/utils/busybox/patches/210-add_netmsg_util.patch b/package/utils/busybox/patches/210-add_netmsg_util.patch
index 2382698d0f..d7b2ae7c4b 100644
--- a/package/utils/busybox/patches/210-add_netmsg_util.patch
+++ b/package/utils/busybox/patches/210-add_netmsg_util.patch
@@ -1,46 +1,25 @@
---- a/include/applets.src.h
-+++ b/include/applets.src.h
-@@ -229,6 +229,7 @@ IF_MT(APPLET(mt, BB_DIR_BIN, BB_SUID_DRO
- IF_MV(APPLET(mv, BB_DIR_BIN, BB_SUID_DROP))
- IF_NAMEIF(APPLET(nameif, BB_DIR_SBIN, BB_SUID_DROP))
- IF_NC(APPLET(nc, BB_DIR_USR_BIN, BB_SUID_DROP))
-+IF_NETMSG(APPLET(netmsg, BB_DIR_BIN, BB_SUID_REQUIRE))
- IF_NETSTAT(APPLET(netstat, BB_DIR_BIN, BB_SUID_DROP))
- IF_NICE(APPLET(nice, BB_DIR_BIN, BB_SUID_DROP))
- IF_NOHUP(APPLET(nohup, BB_DIR_USR_BIN, BB_SUID_DROP))
---- a/networking/Config.src
-+++ b/networking/Config.src
-@@ -639,6 +639,12 @@ config FEATURE_IPCALC_LONG_OPTIONS
- help
- Support long options for the ipcalc applet.
-
-+config NETMSG
-+ bool "netmsg"
-+ default n
-+ help
-+ simple program for sending udp broadcast messages
-+
- config NETSTAT
- bool "netstat"
- default y
---- a/networking/Kbuild.src
-+++ b/networking/Kbuild.src
-@@ -27,6 +27,7 @@ lib-$(CONFIG_IP) += ip.o
- lib-$(CONFIG_IPCALC) += ipcalc.o
- lib-$(CONFIG_NAMEIF) += nameif.o
- lib-$(CONFIG_NC) += nc.o
-+lib-$(CONFIG_NETMSG) += netmsg.o
- lib-$(CONFIG_NETSTAT) += netstat.o
- lib-$(CONFIG_NSLOOKUP) += nslookup.o
- lib-$(CONFIG_NTPD) += ntpd.o
--- /dev/null
+++ b/networking/netmsg.c
-@@ -0,0 +1,65 @@
+@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2006 Felix Fietkau <nbd@nbd.name>
+ *
+ * This is free software, licensed under the GNU General Public License v2.
+ */
++
++//config:config NETMSG
++//config: bool "netmsg"
++//config: default n
++//config: help
++//config: simple program for sending udp broadcast messages
++
++//applet:IF_NETMSG(APPLET(netmsg, BB_DIR_BIN, BB_SUID_REQUIRE))
++
++//kbuild:lib-$(CONFIG_NETMSG) += netmsg.o
++
++//usage:#define netmsg_trivial_usage NOUSAGE_STR
++//usage:#define netmsg_full_usage ""
++
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
@@ -50,9 +29,6 @@
+#include <string.h>
+#include "busybox.h"
+
-+//usage:#define netmsg_trivial_usage NOUSAGE_STR
-+//usage:#define netmsg_full_usage ""
-+
+#ifndef CONFIG_NETMSG
+int main(int argc, char **argv)
+#else
diff --git a/package/utils/busybox/patches/220-add_lock_util.patch b/package/utils/busybox/patches/220-add_lock_util.patch
index c60f5db392..4e46b74f0e 100644
--- a/package/utils/busybox/patches/220-add_lock_util.patch
+++ b/package/utils/busybox/patches/220-add_lock_util.patch
@@ -1,46 +1,25 @@
---- a/include/applets.src.h
-+++ b/include/applets.src.h
-@@ -196,6 +196,7 @@ IF_LN(APPLET_NOEXEC(ln, ln, BB_DIR_BIN,
- IF_LOAD_POLICY(APPLET(load_policy, BB_DIR_USR_SBIN, BB_SUID_DROP))
- IF_LOADFONT(APPLET(loadfont, BB_DIR_USR_SBIN, BB_SUID_DROP))
- IF_LOADKMAP(APPLET(loadkmap, BB_DIR_SBIN, BB_SUID_DROP))
-+IF_LOCK(APPLET(lock, BB_DIR_BIN, BB_SUID_DROP))
- IF_LOGNAME(APPLET_NOFORK(logname, logname, BB_DIR_USR_BIN, BB_SUID_DROP, logname))
- IF_LOSETUP(APPLET(losetup, BB_DIR_SBIN, BB_SUID_DROP))
- IF_LS(APPLET_NOEXEC(ls, ls, BB_DIR_BIN, BB_SUID_DROP, ls))
---- a/miscutils/Config.src
-+++ b/miscutils/Config.src
-@@ -375,6 +375,12 @@ config FEATURE_HDPARM_HDIO_GETSET_DMA
- help
- Enables the 'hdparm -d' option to get/set using_dma flag.
-
-+config LOCK
-+ bool "lock"
-+ default n
-+ help
-+ Small utility for using locks in scripts
-+
- config MAKEDEVS
- bool "makedevs"
- default y
---- a/miscutils/Kbuild.src
-+++ b/miscutils/Kbuild.src
-@@ -33,6 +33,7 @@ lib-$(CONFIG_LAST) += last.o
- endif
-
- lib-$(CONFIG_LESS) += less.o
-+lib-$(CONFIG_LOCK) += lock.o
- lib-$(CONFIG_MAKEDEVS) += makedevs.o
- lib-$(CONFIG_MAN) += man.o
- lib-$(CONFIG_MICROCOM) += microcom.o
--- /dev/null
+++ b/miscutils/lock.c
-@@ -0,0 +1,144 @@
+@@ -0,0 +1,155 @@
+/*
+ * Copyright (C) 2006 Felix Fietkau <nbd@nbd.name>
+ *
+ * This is free software, licensed under the GNU General Public License v2.
+ */
++
++//config:config LOCK
++//config: bool "lock"
++//config: default n
++//config: help
++//config: Small utility for using locks in scripts
++
++//applet:IF_LOCK(APPLET(lock, BB_DIR_BIN, BB_SUID_DROP))
++
++//kbuild:lib-$(CONFIG_LOCK) += lock.o
++
++//usage:#define lock_trivial_usage NOUSAGE_STR
++//usage:#define lock_full_usage ""
++
+#include <sys/types.h>
+#include <sys/file.h>
+#include <sys/stat.h>
@@ -50,9 +29,6 @@
+#include <stdio.h>
+#include "busybox.h"
+
-+//usage:#define lock_trivial_usage NOUSAGE_STR
-+//usage:#define lock_full_usage ""
-+
+static int unlock = 0;
+static int shared = 0;
+static int waitonly = 0;