aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/busybox-initscripts/APKBUILD26
-rw-r--r--core/busybox-initscripts/dvbdev18
-rw-r--r--core/busybox-initscripts/ide_links23
-rw-r--r--core/busybox-initscripts/klogd.confd1
-rw-r--r--core/busybox-initscripts/klogd.initd20
-rw-r--r--core/busybox-initscripts/mdev.conf100
-rw-r--r--core/busybox-initscripts/syslog.confd1
-rw-r--r--core/busybox-initscripts/syslog.initd7
-rw-r--r--core/busybox-initscripts/usbdev62
-rw-r--r--core/busybox-initscripts/usbdisk_link34
10 files changed, 279 insertions, 13 deletions
diff --git a/core/busybox-initscripts/APKBUILD b/core/busybox-initscripts/APKBUILD
index 2d8557ba4f..10a1458476 100644
--- a/core/busybox-initscripts/APKBUILD
+++ b/core/busybox-initscripts/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=busybox-initscripts
pkgver=2.0
-pkgrel=0
+pkgrel=1
pkgdesc="Init scripts for busybox daemons"
url="http://git.alpinelinux.org/cgit/aports/tree/core/busybox-initscripts"
license="GPL-2"
@@ -10,33 +10,43 @@ depends="busybox"
makedepends=
install=
subpackages=
-source="cron.initd dnsd.initd httpd.initd inetd.initd mdev-mount.initd
- mdev.initd rdate.initd syslog.initd watchdog.initd
- cron.confd rdate.confd syslog.confd watchdog.confd"
+source="cron.initd dnsd.initd httpd.initd inetd.initd klogd.initd
+ mdev-mount.initd mdev.initd rdate.initd syslog.initd watchdog.initd
+ cron.confd klogd.confd rdate.confd syslog.confd watchdog.confd
+ mdev.conf dvbdev ide_links usbdev usbdisk_link"
build() {
local i
cd "$srcdir"
- mkdir -p "$pkgdir"/etc/conf.d "$pkgdir"/etc/init.d
+ mkdir -p "$pkgdir"/etc/conf.d "$pkgdir"/etc/init.d "$pkgdir"/lib/mdev
for i in *.initd; do
install -m755 "$srcdir"/$i "$pkgdir"/etc/init.d/${i%.*} || return 1
done
for i in *.confd; do
install -m644 "$srcdir"/$i "$pkgdir"/etc/conf.d/${i%.*} || return 1
done
+ install -m644 mdev.conf "$pkgdir"/etc
+ install -m755 dvbdev ide_links usbdev usbdisk_link "$pkgdir"/lib/mdev/
}
md5sums="45b4ca78fad54f56018b9a2e9358dc68 cron.initd
3af526f4de1a607f7932a15f7c8e8eb1 dnsd.initd
f7daf05f9984aa398fdbd3fe02e82678 httpd.initd
dad8e381142dfb42483de324aff4cf28 inetd.initd
+e22077bfe7b8b0fe7c06cfe208e68dca klogd.initd
823308d5691bd6ece04a040b23925d40 mdev-mount.initd
ef3e93fe17964dd600364b1340654b5b mdev.initd
533288e7df1fdfc029b1048b8e6c770f rdate.initd
-b1bd58e5580d6d2bd88bd6cfb0ae8876 syslog.initd
+b5b23dd06cea120bd8d850b54bca0b59 syslog.initd
254186e513ff9fb9ede6a2e92257b247 watchdog.initd
8ddb8d040c9c7a32c63039a2c80ff496 cron.confd
+60bc14cc3163d76f41bcc93dc0f9984b klogd.confd
22adbf155ffc4595206ded6daad07812 rdate.confd
-69d83e8af870c419847b81bee1ccd2d9 syslog.confd
-0bb55dde32f5e119111fa4938daaef3d watchdog.confd"
+77fb31a75511247bf4e3430565a276bc syslog.confd
+0bb55dde32f5e119111fa4938daaef3d watchdog.confd
+022b670c549e402573797cc72fa12032 mdev.conf
+ad1556961294e4aa2abca6be52138b7c dvbdev
+5c8725b4cbdeda23b00f08124a0d20bf ide_links
+1acfd58dfd1cf324c90ca3a3be519510 usbdev
+30b0c85956b6701caf55309a17e537f6 usbdisk_link"
diff --git a/core/busybox-initscripts/dvbdev b/core/busybox-initscripts/dvbdev
new file mode 100644
index 0000000000..f0186c176c
--- /dev/null
+++ b/core/busybox-initscripts/dvbdev
@@ -0,0 +1,18 @@
+#!/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
diff --git a/core/busybox-initscripts/ide_links b/core/busybox-initscripts/ide_links
new file mode 100644
index 0000000000..be0c95aa9c
--- /dev/null
+++ b/core/busybox-initscripts/ide_links
@@ -0,0 +1,23 @@
+#!/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"
+
diff --git a/core/busybox-initscripts/klogd.confd b/core/busybox-initscripts/klogd.confd
new file mode 100644
index 0000000000..100deedaac
--- /dev/null
+++ b/core/busybox-initscripts/klogd.confd
@@ -0,0 +1 @@
+KLOGD_OPTS=""
diff --git a/core/busybox-initscripts/klogd.initd b/core/busybox-initscripts/klogd.initd
new file mode 100644
index 0000000000..5cf7e6fd16
--- /dev/null
+++ b/core/busybox-initscripts/klogd.initd
@@ -0,0 +1,20 @@
+#!/sbin/runscript
+
+depend() {
+ need clock hostname
+ provide logger
+ keyword novserver
+}
+
+start() {
+ ebegin "Starting busybox kernel logging"
+ start-stop-daemon --start --exec /sbin/klogd -- ${KLOGD_OPTS}
+ eend $?
+}
+
+stop () {
+ ebegin "Stopping busybox kernel logging"
+ start-stop-daemon --stop --exec /sbin/klogd
+ eend $?
+}
+
diff --git a/core/busybox-initscripts/mdev.conf b/core/busybox-initscripts/mdev.conf
new file mode 100644
index 0000000000..6ee65a20e5
--- /dev/null
+++ b/core/busybox-initscripts/mdev.conf
@@ -0,0 +1,100 @@
+#
+# This is a sample mdev.conf.
+#
+
+# Devices:
+# Syntax: %s %d:%d %s
+# devices user:group mode
+
+# null does already exist; therefore ownership has to be changed with command
+null root:root 0666 @chmod 666 $MDEV
+zero root:root 0666
+grsec root:root 0660
+full root:root 0666
+
+random root:root 0666
+urandom root:root 0444
+hwrandom root:root 0660
+
+# console does already exist; therefore ownership has to be changed with command
+console root:tty 0600 @chmod 600 $MDEV && mkdir -p vc && ln -sf ../$MDEV vc/0
+fd0 root:floppy 0660
+kmem root:root 0640
+mem root:root 0640
+port root:root 0640
+ptmx root:tty 0666
+
+# ram.*
+ram([0-9]*) root:disk 0660 >rd/%1
+loop([0-9]+) root:disk 0660 >loop/
+sd[a-z].* root:disk 0660 */lib/mdev/usbdisk_link
+hd[a-z][0-9]* root:disk 0660 */lib/mdev/ide_links
+md[0-9] root:disk 0660
+
+tty root:tty 0666
+tty[0-9] root:root 0600
+tty[0-9][0-9] root:tty 0660
+ttyS[0-9]* root:uucp 0660
+pty.* root:tty 0660
+vcs[0-9]* root:tty 0660
+vcsa[0-9]* root:tty 0660
+
+
+ttyLTM[0-9] root:dialout 0660 @ln -sf $MDEV modem
+ttySHSF[0-9] root:dialout 0660 @ln -sf $MDEV modem
+slamr root:dialout 0660 @ln -sf $MDEV slamr0
+slusb root:dialout 0660 @ln -sf $MDEV slusb0
+fuse root:root 0666
+
+# dri device
+card[0-9] root:video 0660 =dri/
+
+# alsa sound devices and audio stuff
+pcm.* root:audio 0660 =snd/
+control.* root:audio 0660 =snd/
+midi.* root:audio 0660 =snd/
+seq root:audio 0660 =snd/
+timer root:audio 0660 =snd/
+
+adsp root:audio 0660 >sound/
+audio root:audio 0660 >sound/
+dsp root:audio 0660 >sound/
+mixer root:audio 0660 >sound/
+sequencer.* root:audio 0660 >sound/
+
+# misc stuff
+agpgart root:root 0660 >misc/
+psaux root:root 0660 >misc/
+rtc root:root 0664 >misc/
+
+# input stuff
+event[0-9]+ root:root 0640 =input/
+mice root:root 0640 =input/
+mouse[0-9] root:root 0640 =input/
+ts[0-9] root:root 0600 =input/
+
+# v4l stuff
+vbi[0-9] root:video 0660 >v4l/
+video[0-9] root:video 0660 >v4l/
+
+# dvb stuff
+dvb.* root:video 0660 */lib/mdev/dvbdev
+
+# load drivers for usb devices
+usbdev[0-9].[0-9] root:root 0660 */lib/mdev/usbdev
+usbdev[0-9].[0-9]_.* root:root 0660
+
+# net devices
+tun[0-9]* root:root 0600 =net/
+tap[0-9]* root:root 0600 =net/
+
+# zaptel devices
+zap(.*) root:dialout 0660 =zap/%1
+dahdi!(.*) root:dialout 0660 =dahdi/%1
+
+# raid controllers
+cciss!(.*) root:disk 0660 =cciss/%1
+ida!(.*) root:disk 0660 =ida/%1
+rd!(.*) root:disk 0660 =rd/%1
+
+sr[0-9] root:cdrom 0660 >cdrom
diff --git a/core/busybox-initscripts/syslog.confd b/core/busybox-initscripts/syslog.confd
index 14c39c7690..5f23b819d5 100644
--- a/core/busybox-initscripts/syslog.confd
+++ b/core/busybox-initscripts/syslog.confd
@@ -1,2 +1 @@
SYSLOGD_OPTS=""
-KLOGD_OPTS=""
diff --git a/core/busybox-initscripts/syslog.initd b/core/busybox-initscripts/syslog.initd
index 63ef5fc69f..390cd6def3 100644
--- a/core/busybox-initscripts/syslog.initd
+++ b/core/busybox-initscripts/syslog.initd
@@ -1,20 +1,19 @@
#!/sbin/runscript
depend() {
+ need clock hostname klogd
provide logger
}
start() {
ebegin "Starting busybox system logging"
- start-stop-daemon --start --exec /usr/sbin/klogd -- ${KLOGD_OPTS}
- start-stop-daemon --start --exec /usr/sbin/syslogd -- ${SYSLOGD_OPTS}
+ start-stop-daemon --start --exec /sbin/syslogd -- ${SYSLOGD_OPTS}
eend $?
}
stop () {
ebegin "Stopping busybox system logging"
- start-stop-daemon --stop --exec /usr/sbin/klogd
- start-stop-daemon --stop --exec /usr/sbin/syslogd
+ start-stop-daemon --stop --exec /sbin/syslogd
eend $?
}
diff --git a/core/busybox-initscripts/usbdev b/core/busybox-initscripts/usbdev
new file mode 100644
index 0000000000..b1aff296cd
--- /dev/null
+++ b/core/busybox-initscripts/usbdev
@@ -0,0 +1,62 @@
+#!/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
+local USB_PATH=$(echo $MDEV | sed -e 's/usbdev\([0-9]\).[0-9]/usb\1/')
+USB_PATH=$(find /sys/devices -type d -name "$USB_PATH")
+local USB_DEV_DIR=$(echo $MDEV | sed -e 's/usbdev\([0-9]\).\([0-9]\)/\1-\2/')
+
+# dir names in /dev
+local BUS=$(add_zeros $(echo $MDEV | sed -e 's/^usbdev\([0-9]\).[0-9]/\1/'))
+local 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
diff --git a/core/busybox-initscripts/usbdisk_link b/core/busybox-initscripts/usbdisk_link
new file mode 100644
index 0000000000..750242bb5c
--- /dev/null
+++ b/core/busybox-initscripts/usbdisk_link
@@ -0,0 +1,34 @@
+#!/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
+