mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-15 00:46:58 +02:00
feat(sys-apps/busybox) delete ebuilds
We are using the ebuilds in coreos-overlay/sys-apps/busybox instead already, so this one is just duplicated for no reason.
This commit is contained in:
parent
20ecb6b6b4
commit
23f9640417
@ -1 +0,0 @@
|
|||||||
DIST busybox-1.20.1.tar.bz2 2190170 RMD160 41a63b8a3d2927086886b43d61a739744fce72c3 SHA1 8877502e3399dd6cb8ab333cdf6c43264f1da313 SHA256 3e515d8abefd8583ebabffdcfccecb3b8deacf2cef7c69ab1d8755a012ec68c9
|
|
@ -1,307 +0,0 @@
|
|||||||
# Copyright 1999-2012 Gentoo Foundation
|
|
||||||
# Distributed under the terms of the GNU General Public License v2
|
|
||||||
# $Header: /var/cvsroot/gentoo-x86/sys-apps/busybox/busybox-1.20.1.ebuild,v 1.2 2012/06/05 20:35:58 ranger Exp $
|
|
||||||
|
|
||||||
EAPI="4"
|
|
||||||
inherit eutils flag-o-matic savedconfig toolchain-funcs multilib
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
# BUSYBOX ALTERNATE CONFIG MINI-HOWTO
|
|
||||||
#
|
|
||||||
# Busybox can be modified in many different ways. Here's a few ways to do it:
|
|
||||||
#
|
|
||||||
# (1) Emerge busybox with FEATURES=keepwork so the work directory won't
|
|
||||||
# get erased afterwards. Add a definition like ROOT=/my/root/path to the
|
|
||||||
# start of the line if you're installing to somewhere else than the root
|
|
||||||
# directory. This command will save the default configuration to
|
|
||||||
# ${PORTAGE_CONFIGROOT} (or ${ROOT} if ${PORTAGE_CONFIGROOT} is not
|
|
||||||
# defined), and it will tell you that it has done this. Note the location
|
|
||||||
# where the config file was saved.
|
|
||||||
#
|
|
||||||
# FEATURES=keepwork USE=savedconfig emerge busybox
|
|
||||||
#
|
|
||||||
# (2) Go to the work directory and change the configuration of busybox using its
|
|
||||||
# menuconfig feature.
|
|
||||||
#
|
|
||||||
# cd /var/tmp/portage/busybox*/work/busybox-*
|
|
||||||
# make menuconfig
|
|
||||||
#
|
|
||||||
# (3) Save your configuration to the default location and copy it to the
|
|
||||||
# one of the locations listed in /usr/portage/eclass/savedconfig.eclass
|
|
||||||
#
|
|
||||||
# (4) Emerge busybox with USE=savedconfig to use the configuration file you
|
|
||||||
# just generated.
|
|
||||||
#
|
|
||||||
################################################################################
|
|
||||||
#
|
|
||||||
# (1) Alternatively skip the above steps and simply emerge busybox without
|
|
||||||
# USE=savedconfig.
|
|
||||||
#
|
|
||||||
# (2) Edit the file it saves by hand. ${ROOT}"/etc/portage/savedconfig/${CATEGORY}/${PF}
|
|
||||||
#
|
|
||||||
# (3) Remerge busybox as using USE=savedconfig.
|
|
||||||
#
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
DESCRIPTION="Utilities for rescue and embedded systems"
|
|
||||||
HOMEPAGE="http://www.busybox.net/"
|
|
||||||
if [[ ${PV} == "9999" ]] ; then
|
|
||||||
MY_P=${PN}
|
|
||||||
EGIT_REPO_URI="git://busybox.net/busybox.git"
|
|
||||||
inherit git-2
|
|
||||||
else
|
|
||||||
MY_P=${PN}-${PV/_/-}
|
|
||||||
SRC_URI="http://www.busybox.net/downloads/${MY_P}.tar.bz2"
|
|
||||||
KEYWORDS="~alpha amd64 arm ~hppa ~ia64 ~m68k ~mips ~ppc ppc64 ~s390 ~sh ~sparc x86 ~amd64-linux ~x86-linux"
|
|
||||||
fi
|
|
||||||
|
|
||||||
LICENSE="GPL-2"
|
|
||||||
SLOT="0"
|
|
||||||
IUSE="ipv6 livecd make-symlinks math mdev -pam selinux sep-usr static"
|
|
||||||
RESTRICT="test"
|
|
||||||
|
|
||||||
RDEPEND="selinux? ( sys-libs/libselinux )
|
|
||||||
pam? ( sys-libs/pam )"
|
|
||||||
DEPEND="${RDEPEND}
|
|
||||||
>=sys-kernel/linux-headers-2.6.39"
|
|
||||||
|
|
||||||
S=${WORKDIR}/${MY_P}
|
|
||||||
|
|
||||||
busybox_config_option() {
|
|
||||||
case $1 in
|
|
||||||
y) sed -i -e "s:.*\<CONFIG_$2\>.*set:CONFIG_$2=y:g" .config;;
|
|
||||||
n) sed -i -e "s:CONFIG_$2=y:# CONFIG_$2 is not set:g" .config;;
|
|
||||||
*) use $1 \
|
|
||||||
&& busybox_config_option y $2 \
|
|
||||||
|| busybox_config_option n $2
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
einfo $(grep "CONFIG_$2[= ]" .config || echo Could not find CONFIG_$2 ...)
|
|
||||||
}
|
|
||||||
|
|
||||||
src_prepare() {
|
|
||||||
unset KBUILD_OUTPUT #88088
|
|
||||||
append-flags -fno-strict-aliasing #310413
|
|
||||||
use ppc64 && append-flags -mminimal-toc #130943
|
|
||||||
|
|
||||||
# patches go here!
|
|
||||||
epatch "${FILESDIR}"/${PN}-1.19.0-bb.patch
|
|
||||||
#epatch "${FILESDIR}"/${P}-*.patch
|
|
||||||
cp "${FILESDIR}"/ginit.c init/ || die
|
|
||||||
|
|
||||||
# flag cleanup
|
|
||||||
sed -i -r \
|
|
||||||
-e 's:[[:space:]]?-(Werror|Os|falign-(functions|jumps|loops|labels)=1|fomit-frame-pointer)\>::g' \
|
|
||||||
Makefile.flags || die
|
|
||||||
#sed -i '/bbsh/s:^//::' include/applets.h
|
|
||||||
sed -i '/^#error Aborting compilation./d' applets/applets.c || die
|
|
||||||
use elibc_glibc && sed -i 's:-Wl,--gc-sections::' Makefile
|
|
||||||
sed -i \
|
|
||||||
-e "/^CROSS_COMPILE/s:=.*:= ${CHOST}-:" \
|
|
||||||
-e "/^AR\>/s:=.*:= $(tc-getAR):" \
|
|
||||||
-e "/^CC\>/s:=.*:= $(tc-getCC):" \
|
|
||||||
-e "/^HOSTCC/s:=.*:= $(tc-getBUILD_CC):" \
|
|
||||||
Makefile || die
|
|
||||||
sed -i \
|
|
||||||
-e 's:-static-libgcc::' \
|
|
||||||
Makefile.flags || die
|
|
||||||
}
|
|
||||||
|
|
||||||
src_configure() {
|
|
||||||
# check for a busybox config before making one of our own.
|
|
||||||
# if one exist lets return and use it.
|
|
||||||
|
|
||||||
restore_config .config
|
|
||||||
if [ -f .config ]; then
|
|
||||||
yes "" | emake -j1 oldconfig > /dev/null
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
ewarn "Could not locate user configfile, so we will save a default one"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# setup the config file
|
|
||||||
emake -j1 allyesconfig > /dev/null
|
|
||||||
# nommu forces a bunch of things off which we want on #387555
|
|
||||||
busybox_config_option n NOMMU
|
|
||||||
sed -i '/^#/d' .config
|
|
||||||
yes "" | emake -j1 oldconfig >/dev/null
|
|
||||||
|
|
||||||
# now turn off stuff we really don't want
|
|
||||||
busybox_config_option n DMALLOC
|
|
||||||
busybox_config_option n FEATURE_SUID_CONFIG
|
|
||||||
busybox_config_option n BUILD_AT_ONCE
|
|
||||||
busybox_config_option n BUILD_LIBBUSYBOX
|
|
||||||
busybox_config_option n MONOTONIC_SYSCALL
|
|
||||||
busybox_config_option n WERROR
|
|
||||||
|
|
||||||
# If these are not set and we are using a uclibc/busybox setup
|
|
||||||
# all calls to system() will fail.
|
|
||||||
busybox_config_option y ASH
|
|
||||||
busybox_config_option n HUSH
|
|
||||||
|
|
||||||
# disable ipv6 applets
|
|
||||||
if ! use ipv6; then
|
|
||||||
busybox_config_option n FEATURE_IPV6
|
|
||||||
busybox_config_option n TRACEROUTE6
|
|
||||||
busybox_config_option n PING6
|
|
||||||
fi
|
|
||||||
|
|
||||||
if use static && use pam ; then
|
|
||||||
ewarn "You cannot have USE='static pam'. Assuming static is more important."
|
|
||||||
fi
|
|
||||||
use static \
|
|
||||||
&& busybox_config_option n PAM \
|
|
||||||
|| busybox_config_option pam PAM
|
|
||||||
busybox_config_option static STATIC
|
|
||||||
busybox_config_option math FEATURE_AWK_LIBM
|
|
||||||
|
|
||||||
# all the debug options are compiler related, so punt them
|
|
||||||
busybox_config_option n DEBUG
|
|
||||||
busybox_config_option y NO_DEBUG_LIB
|
|
||||||
busybox_config_option n DMALLOC
|
|
||||||
busybox_config_option n EFENCE
|
|
||||||
|
|
||||||
busybox_config_option selinux SELINUX
|
|
||||||
|
|
||||||
# this opt only controls mounting with <linux-2.6.23
|
|
||||||
busybox_config_option n FEATURE_MOUNT_NFS
|
|
||||||
|
|
||||||
# default a bunch of uncommon options to off
|
|
||||||
local opt
|
|
||||||
for opt in \
|
|
||||||
ADD_SHELL \
|
|
||||||
BEEP BOOTCHARTD \
|
|
||||||
CRONTAB \
|
|
||||||
DC DEVFSD DNSD DPKG{,_DEB} \
|
|
||||||
FAKEIDENTD FBSPLASH FOLD FSCK_MINIX FTP{GET,PUT} \
|
|
||||||
FEATURE_DEVFS \
|
|
||||||
HOSTID HUSH \
|
|
||||||
INETD INOTIFYD IPCALC \
|
|
||||||
LOCALE_SUPPORT LOGNAME LPD \
|
|
||||||
MAKEMIME MKFS_MINIX MSH \
|
|
||||||
OD \
|
|
||||||
RDEV READPROFILE REFORMIME REMOVE_SHELL RFKILL RUN_PARTS RUNSV{,DIR} \
|
|
||||||
SLATTACH SMEMCAP SULOGIN SV{,LOGD} \
|
|
||||||
TASKSET TCPSVD \
|
|
||||||
RPM RPM2CPIO \
|
|
||||||
UDPSVD UUDECODE UUENCODE
|
|
||||||
do
|
|
||||||
busybox_config_option n ${opt}
|
|
||||||
done
|
|
||||||
|
|
||||||
emake -j1 oldconfig > /dev/null
|
|
||||||
}
|
|
||||||
|
|
||||||
src_compile() {
|
|
||||||
unset KBUILD_OUTPUT #88088
|
|
||||||
export SKIP_STRIP=y
|
|
||||||
|
|
||||||
emake V=1 busybox
|
|
||||||
if ! use static ; then
|
|
||||||
cp .config{,.bak}
|
|
||||||
mv busybox_unstripped{,.bak}
|
|
||||||
use pam && busybox_config_option n PAM
|
|
||||||
emake CONFIG_STATIC=y busybox
|
|
||||||
mv busybox_unstripped bb
|
|
||||||
mv busybox_unstripped{.bak,}
|
|
||||||
mv .config{.bak,}
|
|
||||||
else
|
|
||||||
# keeps src_install simpler
|
|
||||||
ln busybox_unstripped bb
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
src_install() {
|
|
||||||
unset KBUILD_OUTPUT #88088
|
|
||||||
save_config .config
|
|
||||||
|
|
||||||
into /
|
|
||||||
dodir /bin
|
|
||||||
if use sep-usr ; then
|
|
||||||
# install /ginit to take care of mounting stuff
|
|
||||||
exeinto /
|
|
||||||
newexe bb ginit
|
|
||||||
dosym /ginit /bin/bb
|
|
||||||
if use static ; then
|
|
||||||
dosym bb /bin/busybox
|
|
||||||
else
|
|
||||||
newbin busybox_unstripped busybox
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
newbin busybox_unstripped busybox
|
|
||||||
if use static ; then
|
|
||||||
dosym busybox /bin/bb
|
|
||||||
else
|
|
||||||
dobin bb
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if use mdev ; then
|
|
||||||
dodir /$(get_libdir)/mdev/
|
|
||||||
use make-symlinks || dosym /bin/bb /sbin/mdev
|
|
||||||
cp "${S}"/examples/mdev_fat.conf "${ED}"/etc/mdev.conf
|
|
||||||
|
|
||||||
exeinto /$(get_libdir)/mdev/
|
|
||||||
doexe "${FILESDIR}"/mdev/*
|
|
||||||
|
|
||||||
newinitd "${FILESDIR}"/mdev.rc.1 mdev
|
|
||||||
fi
|
|
||||||
if use livecd ; then
|
|
||||||
dosym busybox /bin/vi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# bundle up the symlink files for use later
|
|
||||||
emake DESTDIR="${ED}" install
|
|
||||||
rm _install/bin/busybox
|
|
||||||
tar cf busybox-links.tar -C _install . || : #;die
|
|
||||||
insinto /usr/share/${PN}
|
|
||||||
use make-symlinks && doins busybox-links.tar
|
|
||||||
|
|
||||||
dodoc AUTHORS README TODO
|
|
||||||
|
|
||||||
cd docs
|
|
||||||
docinto txt
|
|
||||||
dodoc *.txt
|
|
||||||
docinto pod
|
|
||||||
dodoc *.pod
|
|
||||||
dohtml *.html
|
|
||||||
|
|
||||||
cd ../examples
|
|
||||||
docinto examples
|
|
||||||
dodoc inittab depmod.pl *.conf *.script undeb unrpm
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_preinst() {
|
|
||||||
if use make-symlinks && [[ ! ${VERY_BRAVE_OR_VERY_DUMB} == "yes" ]] && [[ ${ROOT} == "/" ]] ; then
|
|
||||||
ewarn "setting USE=make-symlinks and emerging to / is very dangerous."
|
|
||||||
ewarn "it WILL overwrite lots of system programs like: ls bash awk grep (bug 60805 for full list)."
|
|
||||||
ewarn "If you are creating a binary only and not merging this is probably ok."
|
|
||||||
ewarn "set env VERY_BRAVE_OR_VERY_DUMB=yes if this is really what you want."
|
|
||||||
die "silly options will destroy your system"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if use make-symlinks ; then
|
|
||||||
mv "${ED}"/usr/share/${PN}/busybox-links.tar "${T}"/ || die
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_postinst() {
|
|
||||||
savedconfig_pkg_postinst
|
|
||||||
|
|
||||||
if use make-symlinks ; then
|
|
||||||
cd "${T}" || die
|
|
||||||
mkdir _install
|
|
||||||
tar xf busybox-links.tar -C _install || die
|
|
||||||
cp -vpPR _install/* "${ROOT}"/ || die "copying links for ${x} failed"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if use sep-usr ; then
|
|
||||||
elog "In order to use the sep-usr support, you have to update your"
|
|
||||||
elog "kernel command line. Add the option:"
|
|
||||||
elog " init=/ginit"
|
|
||||||
elog "To launch a different init than /sbin/init, use:"
|
|
||||||
elog " init=/ginit /sbin/yourinit"
|
|
||||||
elog "To get a rescue shell, you may boot with:"
|
|
||||||
elog " init=/ginit bb"
|
|
||||||
fi
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
--- a/shell/ash.c
|
|
||||||
+++ b/shell/ash.c
|
|
||||||
@@ -75,6 +75,8 @@
|
|
||||||
//applet:IF_ASH(APPLET(ash, BB_DIR_BIN, BB_SUID_DROP))
|
|
||||||
//applet:IF_FEATURE_SH_IS_ASH(APPLET_ODDNAME(sh, ash, BB_DIR_BIN, BB_SUID_DROP, sh))
|
|
||||||
//applet:IF_FEATURE_BASH_IS_ASH(APPLET_ODDNAME(bash, ash, BB_DIR_BIN, BB_SUID_DROP, bash))
|
|
||||||
+//applet:IF_ASH(APPLET_ODDNAME(bb, ash, BB_DIR_BIN, BB_SUID_DROP, ash))
|
|
||||||
+//applet:IF_ASH(APPLET_ODDNAME(bbsh, ash, BB_DIR_BIN, BB_SUID_DROP, ash))
|
|
||||||
|
|
||||||
//kbuild:lib-$(CONFIG_ASH) += ash.o ash_ptr_hack.o shell_common.o
|
|
||||||
//kbuild:lib-$(CONFIG_ASH_RANDOM_SUPPORT) += random.o
|
|
||||||
--- a/shell/ash.c
|
|
||||||
+++ b/shell/ash.c
|
|
||||||
@@ -7255,6 +7255,8 @@
|
|
||||||
}
|
|
||||||
/* 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 */
|
|
||||||
}
|
|
@ -1,124 +0,0 @@
|
|||||||
/*
|
|
||||||
* simple init to bootstrap sep-/usr
|
|
||||||
*
|
|
||||||
* Copyright (C) 2012 Mike Frysinger <vapier@gentoo.org>
|
|
||||||
*
|
|
||||||
* Licensed under GPLv2 or later
|
|
||||||
*/
|
|
||||||
|
|
||||||
//applet:IF_INIT(APPLET(ginit, BB_DIR_SBIN, BB_SUID_DROP))
|
|
||||||
|
|
||||||
//kbuild:lib-$(CONFIG_GINIT) += ginit.o
|
|
||||||
|
|
||||||
//config:config GINIT
|
|
||||||
//config: bool "ginit"
|
|
||||||
//config: default y
|
|
||||||
//config: select MKDIR
|
|
||||||
//config: select MDEV
|
|
||||||
//config: select MOUNT
|
|
||||||
//config: select MOUNTPOINT
|
|
||||||
//config: help
|
|
||||||
//config: sep-/usr bootstrapper
|
|
||||||
|
|
||||||
//usage:#define ginit_trivial_usage NOUSAGE_STR
|
|
||||||
//usage:#define ginit_full_usage ""
|
|
||||||
|
|
||||||
#include "libbb.h"
|
|
||||||
|
|
||||||
#define eprintf(fmt, args...) printf("%s" fmt, "sep-usr init: ", ## args)
|
|
||||||
|
|
||||||
static void process_args(char **args)
|
|
||||||
{
|
|
||||||
size_t i;
|
|
||||||
|
|
||||||
eprintf("running: ");
|
|
||||||
for (i = 0; args[i]; ++i) {
|
|
||||||
/* String needs to be writable, so dupe it */
|
|
||||||
args[i] = xstrdup(args[i]);
|
|
||||||
printf("'%s' ", args[i]);
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
int ginit_main(int argc UNUSED_PARAM, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
|
||||||
int ginit_main(int argc UNUSED_PARAM, char **argv)
|
|
||||||
{
|
|
||||||
FILE *mntlist;
|
|
||||||
bool ismnted_dev, ismnted_sys, ismnted_usr;
|
|
||||||
struct mntent *mntent;
|
|
||||||
|
|
||||||
/*
|
|
||||||
int fd = open("/dev/console", O_RDWR);
|
|
||||||
if (fd >= 0) {
|
|
||||||
dup2(fd, 0);
|
|
||||||
dup2(fd, 1);
|
|
||||||
dup2(fd, 2);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* If given an argv[] with an applet name, run it instead.
|
|
||||||
* Makes recovering simple by doing: init=/ginit bb
|
|
||||||
*/
|
|
||||||
if (argv[1] && argv[1][0] != '/') {
|
|
||||||
eprintf("running user requested applet %s\n", argv[1]);
|
|
||||||
return spawn_and_wait(argv+1);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define saw(argv...) \
|
|
||||||
({ \
|
|
||||||
static const char *args[] = { argv, NULL }; \
|
|
||||||
/* These casts are fine -- see process_args for mem setup */ \
|
|
||||||
process_args((void *)args); \
|
|
||||||
spawn_and_wait((void *)args); \
|
|
||||||
})
|
|
||||||
|
|
||||||
/* First setup basic /dev */
|
|
||||||
if (saw("mountpoint", "-q", "/dev") != 0) {
|
|
||||||
/* Try /etc/fstab */
|
|
||||||
if (saw("mount", "-n", "/dev"))
|
|
||||||
/* Then devtmpfs */
|
|
||||||
if (saw("mount", "-n", "-t", "devtmpfs", "devtmpfs", "/dev"))
|
|
||||||
/* Finally normal tmpfs */
|
|
||||||
saw("mount", "-n", "-t", "tmpfs", "dev", "/dev");
|
|
||||||
} else {
|
|
||||||
eprintf("%s appears to be mounted; skipping its setup\n", "/dev");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If /dev is empty (e.g. tmpfs), run mdev to seed things */
|
|
||||||
if (access("/dev/console", F_OK) != 0) {
|
|
||||||
if (saw("mountpoint", "-q", "/sys") != 0) {
|
|
||||||
if (saw("mount", "-n", "/sys"))
|
|
||||||
saw("mount", "-n", "-t", "sysfs", "sysfs", "/sys");
|
|
||||||
} else {
|
|
||||||
eprintf("%s appears to be mounted; skipping its setup\n", "/sys");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Mount /proc as mdev will fork+exec /proc/self/exe */
|
|
||||||
if (saw("mountpoint", "-q", "/proc") != 0) {
|
|
||||||
/* Try /etc/fstab */
|
|
||||||
if (saw("mount", "-n", "/proc"))
|
|
||||||
saw("mount", "-n", "-t", "proc", "proc", "/proc");
|
|
||||||
}
|
|
||||||
|
|
||||||
saw("mdev", "-s");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Then seed the stuff we care about */
|
|
||||||
saw("mkdir", "-p", "/dev/pts", "/dev/shm");
|
|
||||||
|
|
||||||
/* Then mount /usr */
|
|
||||||
if (saw("mountpoint", "-q", "/usr") != 0) {
|
|
||||||
saw("mount", "-n", "/usr", "-o", "ro");
|
|
||||||
} else {
|
|
||||||
eprintf("%s appears to be mounted; skipping its setup\n", "/usr");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Now that we're all done, exec the real init */
|
|
||||||
if (!argv[1]) {
|
|
||||||
argv[0] = (void *)"/sbin/init";
|
|
||||||
argv[1] = NULL;
|
|
||||||
} else
|
|
||||||
++argv;
|
|
||||||
process_args(argv);
|
|
||||||
return execv(argv[0], argv);
|
|
||||||
}
|
|
@ -1,98 +0,0 @@
|
|||||||
#!/sbin/runscript
|
|
||||||
# Copyright 1999-2011 Gentoo Foundation
|
|
||||||
# Distributed under the terms of the GNU General Public License v2
|
|
||||||
# $Header: /var/cvsroot/gentoo-x86/sys-apps/busybox/files/mdev.rc.1,v 1.1 2011/09/17 03:46:33 vapier Exp $
|
|
||||||
|
|
||||||
depend()
|
|
||||||
{
|
|
||||||
provide dev
|
|
||||||
need sysfs
|
|
||||||
}
|
|
||||||
|
|
||||||
find_mdev()
|
|
||||||
{
|
|
||||||
if [ -x /sbin/mdev ] ; then
|
|
||||||
echo "/sbin/mdev"
|
|
||||||
else
|
|
||||||
echo "/bin/busybox mdev"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
populate_mdev()
|
|
||||||
{
|
|
||||||
# populate /dev with devices already found by the kernel
|
|
||||||
|
|
||||||
if get_bootparam "nocoldplug" ; then
|
|
||||||
RC_COLDPLUG="no"
|
|
||||||
ewarn "Skipping mdev coldplug as requested in kernel cmdline"
|
|
||||||
fi
|
|
||||||
|
|
||||||
ebegin "Populating /dev with existing devices with mdev -s"
|
|
||||||
$(find_mdev) -s
|
|
||||||
eend $?
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
seed_dev()
|
|
||||||
{
|
|
||||||
# Seed /dev with some things that we know we need
|
|
||||||
|
|
||||||
# creating /dev/console and /dev/tty1 to be able to write
|
|
||||||
# to $CONSOLE with/without bootsplash before mdev creates it
|
|
||||||
[ -c /dev/console ] || mknod /dev/console c 5 1
|
|
||||||
[ -c /dev/tty1 ] || mknod /dev/tty1 c 4 1
|
|
||||||
|
|
||||||
# udevd will dup its stdin/stdout/stderr to /dev/null
|
|
||||||
# and we do not want a file which gets buffered in ram
|
|
||||||
[ -c /dev/null ] || mknod /dev/null c 1 3
|
|
||||||
|
|
||||||
# copy over any persistant things
|
|
||||||
if [ -d /lib/mdev/devices ] ; then
|
|
||||||
cp -RPp /lib/mdev/devices/* /dev 2>/dev/null
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Not provided by sysfs but needed
|
|
||||||
ln -snf /proc/self/fd /dev/fd
|
|
||||||
ln -snf fd/0 /dev/stdin
|
|
||||||
ln -snf fd/1 /dev/stdout
|
|
||||||
ln -snf fd/2 /dev/stderr
|
|
||||||
[ -e /proc/kcore ] && ln -snf /proc/kcore /dev/core
|
|
||||||
|
|
||||||
# Create problematic directories
|
|
||||||
mkdir -p /dev/pts /dev/shm
|
|
||||||
}
|
|
||||||
|
|
||||||
mount_it()
|
|
||||||
{
|
|
||||||
if fstabinfo --quiet /dev ; then
|
|
||||||
mount -n /dev
|
|
||||||
else
|
|
||||||
# Some devices require exec, Bug #92921
|
|
||||||
mount -n -t tmpfs -o "exec,nosuid,mode=0755,size=10M" mdev /dev
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
start()
|
|
||||||
{
|
|
||||||
# Setup temporary storage for /dev
|
|
||||||
ebegin "Mounting /dev for mdev"
|
|
||||||
mount_it
|
|
||||||
eend $?
|
|
||||||
|
|
||||||
# Create a file so that our rc system knows it's still in sysinit.
|
|
||||||
# Existance means init scripts will not directly run.
|
|
||||||
# rc will remove the file when done with sysinit.
|
|
||||||
touch /dev/.rcsysinit
|
|
||||||
|
|
||||||
seed_dev
|
|
||||||
|
|
||||||
# Setup hotplugging (if possible)
|
|
||||||
if [ -e /proc/sys/kernel/hotplug ] ; then
|
|
||||||
ebegin "Setting up mdev as hotplug agent"
|
|
||||||
echo $(find_mdev) > /proc/sys/kernel/hotplug
|
|
||||||
eend 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
populate_mdev
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# MDEV=dvb0.demux1 -> ADAPTER=dvb0 -> N=0
|
|
||||||
ADAPTER=${MDEV%.*}
|
|
||||||
N=${ADAPTER#dvb}
|
|
||||||
# MDEV=dvb0.demux1 -> DEVB_DEV=demux1
|
|
||||||
DVB_DEV=${MDEV#*.}
|
|
||||||
|
|
||||||
case "$ACTION" in
|
|
||||||
add|"")
|
|
||||||
mkdir -p dvb/adapter${N}
|
|
||||||
mv ${MDEV} dvb/adapter${N}/${DVB_DEV}
|
|
||||||
;;
|
|
||||||
remove)
|
|
||||||
rm -f dvb/adapter${N}/${DVB_DEV}
|
|
||||||
rmdir dvb/adapter${N} 2>/dev/null
|
|
||||||
rmdir dvb/ 2>/dev/null
|
|
||||||
esac
|
|
@ -1,23 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
[ -f /proc/ide/$MDEV/media ] || exit
|
|
||||||
|
|
||||||
media=`cat /proc/ide/$MDEV/media`
|
|
||||||
for i in $media $media[0-9]* ; do
|
|
||||||
if [ "`readlink $i 2>/dev/null`" = $MDEV ] ; then
|
|
||||||
LINK=$i
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# link exist, remove if necessary and exit
|
|
||||||
if [ "$LINK" ] ; then
|
|
||||||
[ "$ACTION" = remove ] && rm $LINK
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
# create a link
|
|
||||||
num=`ls $media[0-9]* 2>/dev/null | wc -l`
|
|
||||||
ln -sf $MDEV "$media`echo $num`"
|
|
||||||
[ -e "$media" ] || ln -sf $MDEV "$media"
|
|
||||||
|
|
@ -1,62 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# script is buggy; until patched just do exit 0
|
|
||||||
#exit 0
|
|
||||||
|
|
||||||
# add zeros to device or bus
|
|
||||||
add_zeros () {
|
|
||||||
case "$(echo $1 | wc -L)" in
|
|
||||||
1) echo "00$1" ;;
|
|
||||||
2) echo "0$1" ;;
|
|
||||||
*) echo "$1"
|
|
||||||
esac
|
|
||||||
exit 0
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# bus and device dirs in /sys
|
|
||||||
USB_PATH=$(echo $MDEV | sed -e 's/usbdev\([0-9]\).[0-9]/usb\1/')
|
|
||||||
USB_PATH=$(find /sys/devices -type d -name "$USB_PATH")
|
|
||||||
USB_DEV_DIR=$(echo $MDEV | sed -e 's/usbdev\([0-9]\).\([0-9]\)/\1-\2/')
|
|
||||||
|
|
||||||
# dir names in /dev
|
|
||||||
BUS=$(add_zeros $(echo $MDEV | sed -e 's/^usbdev\([0-9]\).[0-9]/\1/'))
|
|
||||||
USB_DEV=$(add_zeros $(echo $MDEV | sed -e 's/^usbdev[0-9].\([0-9]\)/\1/'))
|
|
||||||
|
|
||||||
|
|
||||||
# try to load the proper driver for usb devices
|
|
||||||
case "$ACTION" in
|
|
||||||
add|"")
|
|
||||||
# load usb bus driver
|
|
||||||
for i in $USB_PATH/*/modalias ; do
|
|
||||||
modprobe `cat $i` 2>/dev/null
|
|
||||||
done
|
|
||||||
# load usb device driver if existent
|
|
||||||
if [ -d $USB_PATH/$USB_DEV_DIR ]; then
|
|
||||||
for i in $USB_PATH/$USB_DEV_DIR/*/modalias ; do
|
|
||||||
modprobe `cat $i` 2>/dev/null
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
# move usb device file
|
|
||||||
mkdir -p bus/usb/$BUS
|
|
||||||
mv $MDEV bus/usb/$BUS/$USB_DEV
|
|
||||||
;;
|
|
||||||
remove)
|
|
||||||
# unload device driver, if device dir is existent
|
|
||||||
if [ -d $USB_PATH/$USB_DEV_DIR ]; then
|
|
||||||
for i in $USB_PATH/$USB_DEV_DIR/*/modalias ; do
|
|
||||||
modprobe -r `cat $i` 2>/dev/null
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
# unload usb bus driver. Does this make sense?
|
|
||||||
# what happens, if two usb devices are plugged in
|
|
||||||
# and one is removed?
|
|
||||||
for i in $USB_PATH/*/modalias ; do
|
|
||||||
modprobe -r `cat $i` 2>/dev/null
|
|
||||||
done
|
|
||||||
# remove device file and possible empty dirs
|
|
||||||
rm -f bus/usb/$BUS/$USB_DEV
|
|
||||||
rmdir bus/usb/$BUS/ 2>/dev/null
|
|
||||||
rmdir bus/usb/ 2>/dev/null
|
|
||||||
rmdir bus/ 2>/dev/null
|
|
||||||
esac
|
|
@ -1,34 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# NOTE: since mdev -s only provide $MDEV, don't depend on any hotplug vars.
|
|
||||||
|
|
||||||
current=$(readlink usbdisk)
|
|
||||||
|
|
||||||
if [ "$current" = "$MDEV" ] && [ "$ACTION" = "remove" ]; then
|
|
||||||
rm -f usbdisk usba1
|
|
||||||
fi
|
|
||||||
[ -n "$current" ] && exit
|
|
||||||
|
|
||||||
if [ -e /sys/block/$MDEV ]; then
|
|
||||||
SYSDEV=$(readlink -f /sys/block/$MDEV/device)
|
|
||||||
# if /sys device path contains '/usb[0-9]' then we assume its usb
|
|
||||||
# also, if its an usb without partitions we require FAT
|
|
||||||
if [ "${SYSDEV##*/usb[0-9]}" != "$SYSDEV" ]; then
|
|
||||||
# do not create link if there is not FAT
|
|
||||||
dd if=/dev/$MDEV bs=512 count=1 2>/dev/null | strings | grep FAT >/dev/null || exit 0
|
|
||||||
|
|
||||||
ln -sf $MDEV usbdisk
|
|
||||||
# keep this for compat. people have it in fstab
|
|
||||||
ln -sf $MDEV usba1
|
|
||||||
fi
|
|
||||||
|
|
||||||
elif [ -e /sys/block/*/$MDEV ] ; then
|
|
||||||
PARENT=$(dirname /sys/block/*/$MDEV)
|
|
||||||
SYSDEV=$(readlink -f $PARENT/device)
|
|
||||||
if [ "${SYSDEV##*/usb[0-9]}" != "$SYSDEV" ]; then
|
|
||||||
ln -sf $MDEV usbdisk
|
|
||||||
# keep this for compat. people have it in fstab
|
|
||||||
ln -sf $MDEV usba1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user