diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2010-07-14 14:06:40 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2010-07-14 14:06:40 +0000 |
commit | 3860ada6cdc107477a4de9bbc2b92d73495b66e8 (patch) | |
tree | 9a3b758f241af384d5d9827a79efcd3f8ed0343b /main/busybox | |
parent | 516dc9e7e44fe69608958956ce8a2b69aed38ff1 (diff) | |
download | aports-3860ada6cdc107477a4de9bbc2b92d73495b66e8.tar.bz2 aports-3860ada6cdc107477a4de9bbc2b92d73495b66e8.tar.xz |
main/busybox: upgrade to 1.17.0 + patches
Diffstat (limited to 'main/busybox')
-rw-r--r-- | main/busybox/APKBUILD | 32 | ||||
-rw-r--r-- | main/busybox/busyboxconfig | 113 | ||||
-rw-r--r-- | main/busybox/diff.patch | 83 | ||||
-rw-r--r-- | main/busybox/flock-bb.patch | 183 |
4 files changed, 98 insertions, 313 deletions
diff --git a/main/busybox/APKBUILD b/main/busybox/APKBUILD index 9ec44618a3..a8ace8d51f 100644 --- a/main/busybox/APKBUILD +++ b/main/busybox/APKBUILD @@ -1,7 +1,7 @@ # Maintainer: Natanael Copa <ncopa@alpinelinux.org> pkgname=busybox -pkgver=1.16.2 -pkgrel=2 +pkgver=1.17.0 +pkgrel=0 pkgdesc="Size optimized toolbox of many common UNIX utilities" url=http://busybox.net license="GPL-2" @@ -11,8 +11,13 @@ subpackages="$pkgname-static" triggers="busybox.trigger:/bin /usr/bin /sbin /usr/sbin /lib/modules/*" source="http://busybox.net/downloads/$pkgname-$pkgver.tar.bz2 $pkgname-1.11.1-bb.patch - diff.patch - flock-bb.patch + http://busybox.net/downloads/fixes-1.17.0/busybox-1.17.0-acpid.patch + http://busybox.net/downloads/fixes-1.17.0/busybox-1.17.0-build_system.patch + http://busybox.net/downloads/fixes-1.17.0/busybox-1.17.0-diff.patch + http://busybox.net/downloads/fixes-1.17.0/busybox-1.17.0-mktemp.patch + http://busybox.net/downloads/fixes-1.17.0/busybox-1.17.0-modprobe-l.patch + http://busybox.net/downloads/fixes-1.17.0/busybox-1.17.0-volumeid.patch + http://busybox.net/downloads/fixes-1.17.0/busybox-1.17.0-wget.patch busyboxconfig" _builddir="$srcdir"/$pkgname-$pkgver @@ -28,9 +33,9 @@ prepare() { fi done - sed -i -e 's/(ip, _BB_DIR_BIN/(ip, _BB_DIR_SBIN/' \ - -e 's/(vi, _BB_DIR_BIN/(vi, _BB_DIR_USR_BIN/' \ - include/applets.h || return 1 +# sed -i -e 's/(ip, _BB_DIR_BIN/(ip, _BB_DIR_SBIN/' \ +# -e 's/(vi, _BB_DIR_BIN/(vi, _BB_DIR_USR_BIN/' \ +# include/applets.h || return 1 } build() { @@ -68,8 +73,13 @@ static() { } -md5sums="2ba980f720a5bdce4ec05423519acc35 busybox-1.16.2.tar.bz2 +md5sums="2908d1d1ca83ff12bc0b05f0d2a3335c busybox-1.17.0.tar.bz2 4c0f3b486eaa0674961b7ddcd0c60a9b busybox-1.11.1-bb.patch -5ce533f9727761c31de5b5f9df568f2f diff.patch -20d9beea7d0c0aaca14553a8f98fee12 flock-bb.patch -4bc85af9dd659cbb83c9a819b3481a47 busyboxconfig" +0cf814dbe1f62c8c8e891697c896952d busybox-1.17.0-acpid.patch +ea127206741f9785dd2e8fcce2c32ad8 busybox-1.17.0-build_system.patch +094cde9990b5c6b02e631c08c91a5b30 busybox-1.17.0-diff.patch +2f4c29e5fbd3c9527da9ecbd9e9e699f busybox-1.17.0-mktemp.patch +b159ecc8954369ec3d2320212c075a69 busybox-1.17.0-modprobe-l.patch +97cccda27dbf4181ca32a58f5d61e5a9 busybox-1.17.0-volumeid.patch +aecc8dcaff560e1334d2788d588f6ea5 busybox-1.17.0-wget.patch +2db136224b6d4869b0744ef2d27c14e1 busyboxconfig" diff --git a/main/busybox/busyboxconfig b/main/busybox/busyboxconfig index da18f038b4..725e88247f 100644 --- a/main/busybox/busyboxconfig +++ b/main/busybox/busyboxconfig @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit -# Busybox version: 1.16.0 -# Tue Mar 16 12:28:25 2010 +# Busybox version: 1.17.0 +# Tue Jul 13 11:18:29 2010 # CONFIG_HAVE_DOT_CONFIG=y @@ -24,11 +24,21 @@ CONFIG_FEATURE_VERBOSE_USAGE=y CONFIG_FEATURE_COMPRESS_USAGE=y CONFIG_FEATURE_INSTALLER=y # CONFIG_LOCALE_SUPPORT is not set -CONFIG_FEATURE_ASSUME_UNICODE=y +CONFIG_UNICODE_SUPPORT=y +# CONFIG_UNICODE_USING_LOCALE is not set CONFIG_FEATURE_CHECK_UNICODE_IN_ENV=y +CONFIG_SUBST_WCHAR=63 +CONFIG_LAST_SUPPORTED_WCHAR=767 +# CONFIG_UNICODE_COMBINING_WCHARS is not set +# CONFIG_UNICODE_WIDE_WCHARS is not set +# CONFIG_UNICODE_BIDI_SUPPORT is not set +# CONFIG_UNICODE_NEUTRAL_TABLE is not set +# CONFIG_UNICODE_PRESERVE_BROKEN is not set CONFIG_LONG_OPTS=y CONFIG_FEATURE_DEVPTS=y # CONFIG_FEATURE_CLEAN_UP is not set +CONFIG_FEATURE_UTMP=y +CONFIG_FEATURE_WTMP=y CONFIG_FEATURE_PIDFILE=y CONFIG_FEATURE_SUID=y # CONFIG_FEATURE_SUID_CONFIG is not set @@ -42,8 +52,8 @@ CONFIG_FEATURE_SYSLOG=y # # Build Options # -# CONFIG_STATIC is not set -CONFIG_PIE=y +CONFIG_STATIC=y +# CONFIG_PIE is not set # CONFIG_NOMMU is not set # CONFIG_BUILD_LIBBUSYBOX is not set # CONFIG_FEATURE_INDIVIDUAL is not set @@ -105,12 +115,14 @@ CONFIG_FEATURE_HWIB=y # # Archival Utilities # +# CONFIG_FEATURE_SEAMLESS_XZ is not set CONFIG_FEATURE_SEAMLESS_LZMA=y CONFIG_FEATURE_SEAMLESS_BZ2=y CONFIG_FEATURE_SEAMLESS_GZ=y CONFIG_FEATURE_SEAMLESS_Z=y # CONFIG_AR is not set # CONFIG_FEATURE_AR_LONG_FILENAMES is not set +# CONFIG_FEATURE_AR_CREATE is not set CONFIG_BUNZIP2=y CONFIG_BZIP2=y CONFIG_CPIO=y @@ -124,7 +136,7 @@ CONFIG_GZIP=y # CONFIG_FEATURE_GZIP_LONG_OPTIONS is not set CONFIG_LZOP=y # CONFIG_LZOP_COMPR_HIGH is not set -CONFIG_RPM2CPIO=y +# CONFIG_RPM2CPIO is not set # CONFIG_RPM is not set CONFIG_TAR=y CONFIG_FEATURE_TAR_CREATE=y @@ -134,19 +146,33 @@ CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY=y CONFIG_FEATURE_TAR_OLDSUN_COMPATIBILITY=y CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y CONFIG_FEATURE_TAR_LONG_OPTIONS=y +# CONFIG_FEATURE_TAR_TO_COMMAND is not set CONFIG_FEATURE_TAR_UNAME_GNAME=y CONFIG_FEATURE_TAR_NOPRESERVE_TIME=y -CONFIG_UNCOMPRESS=y +# CONFIG_FEATURE_TAR_SELINUX is not set +# CONFIG_UNCOMPRESS is not set CONFIG_UNLZMA=y CONFIG_FEATURE_LZMA_FAST=y +CONFIG_LZMA=y +# CONFIG_UNXZ is not set +# CONFIG_XZ is not set CONFIG_UNZIP=y # # Coreutils # CONFIG_BASENAME=y -CONFIG_CAL=y CONFIG_CAT=y +CONFIG_DATE=y +CONFIG_FEATURE_DATE_ISOFMT=y +# CONFIG_FEATURE_DATE_NANO is not set +CONFIG_FEATURE_DATE_COMPAT=y +CONFIG_TEST=y +CONFIG_FEATURE_TEST_64=y +CONFIG_TR=y +CONFIG_FEATURE_TR_CLASSES=y +CONFIG_FEATURE_TR_EQUIV=y +CONFIG_CAL=y CONFIG_CATV=y CONFIG_CHGRP=y CONFIG_CHMOD=y @@ -158,9 +184,6 @@ CONFIG_COMM=y CONFIG_CP=y CONFIG_FEATURE_CP_LONG_OPTIONS=y CONFIG_CUT=y -CONFIG_DATE=y -CONFIG_FEATURE_DATE_ISOFMT=y -CONFIG_FEATURE_DATE_COMPAT=y CONFIG_DD=y CONFIG_FEATURE_DD_SIGNAL_HANDLING=y # CONFIG_FEATURE_DD_THIRD_STATUS_LINE is not set @@ -241,12 +264,7 @@ CONFIG_TAIL=y CONFIG_FEATURE_FANCY_TAIL=y CONFIG_TEE=y CONFIG_FEATURE_TEE_USE_BLOCK_IO=y -CONFIG_TEST=y -CONFIG_FEATURE_TEST_64=y CONFIG_TOUCH=y -CONFIG_TR=y -CONFIG_FEATURE_TR_CLASSES=y -CONFIG_FEATURE_TR_EQUIV=y CONFIG_TRUE=y CONFIG_TTY=y CONFIG_UNAME=y @@ -286,11 +304,12 @@ CONFIG_FEATURE_MD5_SHA1_SUM_CHECK=y # Console Utilities # CONFIG_CHVT=y +# CONFIG_FGCONSOLE is not set CONFIG_CLEAR=y CONFIG_DEALLOCVT=y CONFIG_DUMPKMAP=y CONFIG_KBD_MODE=y -CONFIG_LOADFONT=y +# CONFIG_LOADFONT is not set CONFIG_LOADKMAP=y CONFIG_OPENVT=y CONFIG_RESET=y @@ -304,6 +323,8 @@ CONFIG_DEFAULT_SETFONT_DIR="" CONFIG_SETKEYCODES=y CONFIG_SETLOGCONS=y CONFIG_SHOWKEY=y +# CONFIG_FEATURE_LOADFONT_PSF2 is not set +# CONFIG_FEATURE_LOADFONT_RAW is not set # # Debian Utilities @@ -342,6 +363,7 @@ CONFIG_FEATURE_VI_READONLY=y CONFIG_FEATURE_VI_SETOPTS=y CONFIG_FEATURE_VI_SET=y CONFIG_FEATURE_VI_WIN_RESIZE=y +CONFIG_FEATURE_VI_ASK_TERMINAL=y CONFIG_FEATURE_VI_OPTIMIZE_CURSOR=y CONFIG_FEATURE_ALLOW_EXEC=y @@ -384,6 +406,9 @@ CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y # # Init Utilities # +# CONFIG_BOOTCHARTD is not set +# CONFIG_FEATURE_BOOTCHARTD_BLOATED_HEADER is not set +# CONFIG_FEATURE_BOOTCHARTD_CONFIG_FILE is not set CONFIG_INIT=y CONFIG_FEATURE_USE_INITTAB=y CONFIG_FEATURE_KILL_REMOVED=y @@ -418,8 +443,6 @@ CONFIG_FIRST_SYSTEM_ID=100 CONFIG_LAST_SYSTEM_ID=999 CONFIG_DELUSER=y CONFIG_GETTY=y -CONFIG_FEATURE_UTMP=y -CONFIG_FEATURE_WTMP=y CONFIG_LOGIN=y # CONFIG_PAM is not set CONFIG_LOGIN_SCRIPTS=y @@ -441,10 +464,12 @@ CONFIG_VLOCK=y # CONFIG_CHATTR is not set CONFIG_FSCK=y # CONFIG_LSATTR is not set +# CONFIG_TUNE2FS is not set # # Linux Module Utilities # +CONFIG_MODINFO=y # CONFIG_MODPROBE_SMALL is not set # CONFIG_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE is not set # CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED is not set @@ -475,6 +500,7 @@ CONFIG_DEFAULT_DEPMOD_FILE="modules.dep" # # Linux System Utilities # +CONFIG_REV=y CONFIG_ACPID=y CONFIG_FEATURE_ACPID_COMPAT=y CONFIG_BLKID=y @@ -559,7 +585,7 @@ CONFIG_READPROFILE=y # CONFIG_RTCWAKE is not set # CONFIG_SCRIPT is not set # CONFIG_SCRIPTREPLAY is not set -CONFIG_SETARCH=y +# CONFIG_SETARCH is not set CONFIG_SWAPONOFF=y CONFIG_FEATURE_SWAPON_PRI=y CONFIG_SWITCH_ROOT=y @@ -570,11 +596,15 @@ CONFIG_FEATURE_UMOUNT_ALL=y # Common options for mount/umount # CONFIG_FEATURE_MOUNT_LOOP=y +CONFIG_FEATURE_MOUNT_LOOP_CREATE=y # CONFIG_FEATURE_MTAB_SUPPORT is not set # # Miscellaneous Utilities # +CONFIG_CONSPY=y +# CONFIG_UBIATTACH is not set +# CONFIG_UBIDETACH is not set CONFIG_ADJTIMEX=y CONFIG_BBCONFIG=y CONFIG_BEEP=y @@ -606,8 +636,8 @@ CONFIG_EJECT=y CONFIG_FEATURE_EJECT_SCSI=y CONFIG_FBSPLASH=y # CONFIG_FLASHCP is not set -CONFIG_FLASH_LOCK=y -CONFIG_FLASH_UNLOCK=y +# CONFIG_FLASH_LOCK is not set +# CONFIG_FLASH_UNLOCK is not set # CONFIG_FLASH_ERASEALL is not set CONFIG_IONICE=y CONFIG_INOTIFYD=y @@ -636,11 +666,12 @@ CONFIG_FEATURE_LESS_LINENUMS=y # CONFIG_MAN is not set CONFIG_MICROCOM=y CONFIG_MOUNTPOINT=y -CONFIG_MT=y +# CONFIG_MT is not set CONFIG_RAIDAUTORUN=y CONFIG_READAHEAD=y -CONFIG_RUNLEVEL=y -CONFIG_RX=y +CONFIG_RFKILL=y +# CONFIG_RUNLEVEL is not set +# CONFIG_RX is not set CONFIG_SETSID=y CONFIG_STRINGS=y # CONFIG_TASKSET is not set @@ -655,6 +686,10 @@ CONFIG_WATCHDOG=y # # Networking Utilities # +CONFIG_NC=y +CONFIG_NC_SERVER=y +CONFIG_NC_EXTRA=y +CONFIG_NC_110_COMPAT=y CONFIG_FEATURE_IPV6=y # CONFIG_FEATURE_UNIX_LOCAL is not set CONFIG_FEATURE_PREFER_IPV4_ADDRESS=y @@ -728,9 +763,6 @@ CONFIG_FEATURE_IPCALC_FANCY=y # CONFIG_FEATURE_IPCALC_LONG_OPTIONS is not set CONFIG_NAMEIF=y CONFIG_FEATURE_NAMEIF_EXTENDED=y -CONFIG_NC=y -CONFIG_NC_SERVER=y -CONFIG_NC_EXTRA=y CONFIG_NETSTAT=y CONFIG_FEATURE_NETSTAT_WIDE=y CONFIG_FEATURE_NETSTAT_PRG=y @@ -743,6 +775,7 @@ CONFIG_FEATURE_FANCY_PING=y CONFIG_PSCAN=y CONFIG_ROUTE=y CONFIG_SLATTACH=y +# CONFIG_TCPSVD is not set CONFIG_TELNET=y CONFIG_FEATURE_TELNET_TTYPE=y CONFIG_FEATURE_TELNET_AUTOLOGIN=y @@ -751,6 +784,10 @@ CONFIG_FEATURE_TELNET_AUTOLOGIN=y # CONFIG_FEATURE_TELNETD_INETD_WAIT is not set CONFIG_TFTP=y # CONFIG_TFTPD is not set + +# +# Common options for tftp/tftpd +# CONFIG_FEATURE_TFTP_GET=y CONFIG_FEATURE_TFTP_PUT=y CONFIG_FEATURE_TFTP_BLOCKSIZE=y @@ -761,6 +798,8 @@ CONFIG_TRACEROUTE=y CONFIG_FEATURE_TRACEROUTE_VERBOSE=y CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE=y CONFIG_FEATURE_TRACEROUTE_USE_ICMP=y +CONFIG_TUNCTL=y +CONFIG_FEATURE_TUNCTL_UG=y # CONFIG_UDHCPD is not set # CONFIG_DHCPRELAY is not set # CONFIG_DUMPLEASES is not set @@ -774,16 +813,13 @@ CONFIG_FEATURE_UDHCP_RFC3397=y CONFIG_UDHCPC_DEFAULT_SCRIPT="/usr/share/udhcpc/default.script" CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=80 CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="-R -n" +# CONFIG_UDPSVD is not set CONFIG_VCONFIG=y CONFIG_WGET=y CONFIG_FEATURE_WGET_STATUSBAR=y CONFIG_FEATURE_WGET_AUTHENTICATION=y # CONFIG_FEATURE_WGET_LONG_OPTIONS is not set -CONFIG_ZCIP=y -# CONFIG_TCPSVD is not set -CONFIG_TUNCTL=y -CONFIG_FEATURE_TUNCTL_UG=y -# CONFIG_UDPSVD is not set +# CONFIG_ZCIP is not set # # Print Utilities @@ -806,6 +842,7 @@ CONFIG_SENDMAIL=y # # Process Utilities # +CONFIG_SMEMCAP=y CONFIG_FREE=y CONFIG_FUSER=y CONFIG_KILL=y @@ -868,9 +905,6 @@ CONFIG_SV_DEFAULT_SERVICE_DIR="" # # Shells # -CONFIG_FEATURE_SH_IS_ASH=y -# CONFIG_FEATURE_SH_IS_HUSH is not set -# CONFIG_FEATURE_SH_IS_NONE is not set CONFIG_ASH=y CONFIG_ASH_BASH_COMPAT=y CONFIG_ASH_JOB_CONTROL=y @@ -897,6 +931,12 @@ CONFIG_ASH_EXPAND_PRMT=y # CONFIG_HUSH_LOCAL is not set # CONFIG_HUSH_EXPORT_N is not set # CONFIG_HUSH_RANDOM_SUPPORT is not set +CONFIG_FEATURE_SH_IS_ASH=y +# CONFIG_FEATURE_SH_IS_HUSH is not set +# CONFIG_FEATURE_SH_IS_NONE is not set +# CONFIG_FEATURE_BASH_IS_ASH is not set +# CONFIG_FEATURE_BASH_IS_HUSH is not set +CONFIG_FEATURE_BASH_IS_NONE=y # CONFIG_LASH is not set # CONFIG_MSH is not set CONFIG_SH_MATH_SUPPORT=y @@ -913,6 +953,7 @@ CONFIG_SYSLOGD=y CONFIG_FEATURE_ROTATE_LOGFILE=y CONFIG_FEATURE_REMOTE_LOG=y CONFIG_FEATURE_SYSLOGD_DUP=y +CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=256 CONFIG_FEATURE_IPC_SYSLOG=y CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=16 CONFIG_LOGREAD=y diff --git a/main/busybox/diff.patch b/main/busybox/diff.patch deleted file mode 100644 index 702c66ca29..0000000000 --- a/main/busybox/diff.patch +++ /dev/null @@ -1,83 +0,0 @@ -commit 61f5f7823c4f217dd9bad2f1df547f81b9338c76 -Author: Matheus Izvekov <mizvekov@gmail.com> -Date: Fri Jul 9 19:40:00 2010 +0200 - - diff: fix "diff dir1 dir2/". Closes bug 2203 - - Signed-off-by: Matheus Izvekov <mizvekov@gmail.com> - Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com> - -diff --git a/editors/diff.c b/editors/diff.c -index 07594e8..8d91b83 100644 ---- a/editors/diff.c -+++ b/editors/diff.c -@@ -760,9 +760,11 @@ static int FAST_FUNC add_to_dirlist(const char *filename, - void *userdata, int depth UNUSED_PARAM) - { - struct dlist *const l = userdata; -+ const char *file = filename + l->len; - l->dl = xrealloc_vector(l->dl, 6, l->e); -- /* + 1 skips "/" after dirname */ -- l->dl[l->e] = xstrdup(filename + l->len + 1); -+ while(*file == '/') -+ file++; -+ l->dl[l->e] = xstrdup(file); - l->e++; - return TRUE; - } -diff --git a/testsuite/diff.tests b/testsuite/diff.tests -index 06d5a4f..27a4b33 100755 ---- a/testsuite/diff.tests -+++ b/testsuite/diff.tests -@@ -4,7 +4,7 @@ - - . ./testing.sh - --# testing "test name" "options" "expected result" "file input" "stdin" -+# testing "test name" "commands" "expected result" "file input" "stdin" - - # diff outputs date/time in the header, which should not be analysed - # NB: sed has tab character in s command! -@@ -100,9 +100,11 @@ testing "diff always takes context from old file" \ - "abc\na c\ndef\n" \ - "a c\n" - --# testing "test name" "options" "expected result" "file input" "stdin" -+# testing "test name" "commands" "expected result" "file input" "stdin" - -+# clean up - rm -rf diff1 diff2 -+ - mkdir diff1 diff2 diff2/subdir - echo qwe >diff1/- - echo asd >diff2/subdir/- -@@ -187,4 +189,29 @@ SKIP= - # clean up - rm -rf diff1 diff2 - -+# NOT using directory structure from prev test... -+mkdir diff1 diff2 -+echo qwe >diff1/- -+echo rty >diff2/- -+optional FEATURE_DIFF_DIR -+testing "diff diff1 diff2/" \ -+ "diff -ur diff1 diff2/ | $TRIM_TAB; diff -ur .///diff1 diff2//// | $TRIM_TAB" \ -+"\ -+--- diff1/- -++++ diff2/- -+@@ -1 +1 @@ -+-qwe -++rty -+--- .///diff1/- -++++ diff2////- -+@@ -1 +1 @@ -+-qwe -++rty -+" \ -+ "" "" -+SKIP= -+ -+# clean up -+rm -rf diff1 diff2 -+ - exit $FAILCOUNT diff --git a/main/busybox/flock-bb.patch b/main/busybox/flock-bb.patch deleted file mode 100644 index d97fbfcca2..0000000000 --- a/main/busybox/flock-bb.patch +++ /dev/null @@ -1,183 +0,0 @@ -From: Timo Teras <timo.teras@iki.fi> -To: busybox@busybox.net -Subject: [PATCH] flock: new applet -Date: Tue, 16 Mar 2010 14:14:22 +0200 -Message-Id: <1268741663-8790-1-git-send-email-timo.teras@iki.fi> -X-Mailer: git-send-email 1.6.3.3 - -An utility to manage file locks from scripts. - -Signed-off-by: Timo Teras <timo.teras@iki.fi> ---- - include/applets.h | 1 + - include/usage.h | 11 ++++++ - util-linux/Config.in | 6 +++ - util-linux/Kbuild | 1 + - util-linux/flock.c | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++ - 5 files changed, 112 insertions(+), 0 deletions(-) - create mode 100644 util-linux/flock.c - -diff --git a/include/applets.h b/include/applets.h -index 2d784bd..83c1792 100644 ---- a/include/applets.h -+++ b/include/applets.h -@@ -161,6 +161,7 @@ IF_FLASH_ERASEALL(APPLET(flash_eraseall, _BB_DIR_USR_SBIN, _BB_SUID_DROP)) - IF_FLASH_LOCK(APPLET_ODDNAME(flash_lock, flash_lock_unlock, _BB_DIR_USR_SBIN, _BB_SUID_DROP, flash_lock)) - IF_FLASH_UNLOCK(APPLET_ODDNAME(flash_unlock, flash_lock_unlock, _BB_DIR_USR_SBIN, _BB_SUID_DROP, flash_unlock)) - IF_FLASHCP(APPLET(flashcp, _BB_DIR_USR_SBIN, _BB_SUID_DROP)) -+IF_FLOCK(APPLET(flock, _BB_DIR_USR_BIN, _BB_SUID_DROP)) - IF_FOLD(APPLET(fold, _BB_DIR_USR_BIN, _BB_SUID_DROP)) - IF_FREE(APPLET(free, _BB_DIR_USR_BIN, _BB_SUID_DROP)) - IF_FREERAMDISK(APPLET(freeramdisk, _BB_DIR_SBIN, _BB_SUID_DROP)) -diff --git a/include/usage.h b/include/usage.h -index f4259a1..cbf6bef 100644 ---- a/include/usage.h -+++ b/include/usage.h -@@ -1312,6 +1312,17 @@ - "\nOptions:" \ - "\n -v Verbose" \ - -+#define flock_trivial_usage \ -+ "[-sxun] [fd# | FILE] [-c] command" -+#define flock_full_usage "\n\n" \ -+ "Manage file locks from scripts\n" \ -+ "\nOptions:" \ -+ "\n -s Get a shared lock" \ -+ "\n -x Get an exclusive lock" \ -+ "\n -u Remove a lock (from fd#)" \ -+ "\n -n Fail rather than wait" \ -+ "\n -c Command to run" \ -+ - #define fold_trivial_usage \ - "[-bs] [-w WIDTH] [FILE]..." - #define fold_full_usage "\n\n" \ -diff --git a/util-linux/Config.in b/util-linux/Config.in -index f04511b..d0d8df3 100644 ---- a/util-linux/Config.in -+++ b/util-linux/Config.in -@@ -191,6 +191,12 @@ config FINDFS - WARNING: - With all submodules selected, it will add ~8k to busybox. - -+config FLOCK -+ bool "flock" -+ default y -+ help -+ Manage locks from shell scripts -+ - config FREERAMDISK - bool "freeramdisk" - default n -diff --git a/util-linux/Kbuild b/util-linux/Kbuild -index 72a2ef1..99e3efe 100644 ---- a/util-linux/Kbuild -+++ b/util-linux/Kbuild -@@ -13,6 +13,7 @@ lib-$(CONFIG_FDFLUSH) += freeramdisk.o - lib-$(CONFIG_FDFORMAT) += fdformat.o - lib-$(CONFIG_FDISK) += fdisk.o - lib-$(CONFIG_FINDFS) += findfs.o -+lib-$(CONFIG_FLOCK) += flock.o - lib-$(CONFIG_FREERAMDISK) += freeramdisk.o - lib-$(CONFIG_FSCK_MINIX) += fsck_minix.o - lib-$(CONFIG_GETOPT) += getopt.o -diff --git a/util-linux/flock.c b/util-linux/flock.c -new file mode 100644 -index 0000000..e9a22d5 ---- /dev/null -+++ b/util-linux/flock.c -@@ -0,0 +1,93 @@ -+/* -+ * Copyright (C) 2010 Timo Teras <timo.teras@iki.fi> -+ * -+ * This is free software, licensed under the GNU General Public License v2. -+ */ -+#include <sys/types.h> -+#include <sys/file.h> -+#include <sys/stat.h> -+#include <signal.h> -+#include <fcntl.h> -+#include <unistd.h> -+#include <stdio.h> -+#include "busybox.h" -+ -+int flock_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; -+int flock_main(int argc, char **argv) -+{ -+ char *command = NULL; -+ int mode, opt, fd, status = 0; -+ enum { -+ OPT_s = (1 << 0), -+ OPT_x = (1 << 1), -+ OPT_u = (1 << 2), -+ OPT_n = (1 << 3), -+ OPT_c = (1 << 4), -+ }; -+ -+#if ENABLE_LONG_OPTS -+ static const char getopt_longopts[] ALIGN1 = -+ "shared\0" No_argument "s" -+ "exclusive\0" No_argument "x" -+ "unblock\0" No_argument "u" -+ "nonblock\0" No_argument "n" -+ "command\0" Required_argument "c" -+ ; -+ applet_long_options = getopt_longopts; -+#endif -+ -+ opt = getopt32(argv, "sxunc:", &command); -+ argv += optind; -+ argc -= optind; -+ -+ if (argv[0] == NULL) -+ bb_show_usage(); -+ -+ if (command != NULL || argc > 1) { -+ fd = open(argv[0], O_RDONLY|O_NOCTTY|O_CREAT, 0666); -+ if (fd < 0 && errno == EISDIR) -+ fd = open(argv[0], O_RDONLY|O_NOCTTY); -+ } else { -+ fd = atoi(argv[0]); -+ } -+ if (fd < 0) -+ bb_perror_msg_and_die("cannot open: '%s'", argv[0]); -+ -+ argv++; -+ if (command == NULL) -+ command = argv[0]; -+ -+ if (opt & OPT_u) -+ mode = LOCK_UN; -+ else if (opt & OPT_s) -+ mode = LOCK_SH; -+ else -+ mode = LOCK_EX; -+ -+ if (opt & OPT_n) -+ mode |= LOCK_NB; -+ -+ if (flock(fd, mode) && errno == EWOULDBLOCK) -+ return 1; -+ -+ if (command != NULL) { -+ pid_t pid; -+ -+ pid = fork(); -+ if (pid < 0) -+ bb_perror_msg_and_die("fork failed"); -+ if (pid == 0) { -+ execvp(command, argv); -+ exit(1); -+ } -+ waitpid(pid, &status, 0); -+ if (WIFEXITED(status)) -+ status = WEXITSTATUS(status); -+ else if (WIFSIGNALED(status)) -+ status = WTERMSIG(status) + 128; -+ else -+ status = 1; -+ } -+ -+ return status; -+} --- -1.6.3.3 |