diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2009-07-23 18:24:11 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2009-07-23 18:24:11 +0000 |
commit | 2d2ddf507bf1ae2f4cc595b23b8e018398cbe8dd (patch) | |
tree | a63d3b3b1c89018b5419358eed5c2bb0acf1cd92 /main/openrc | |
parent | e374901731eb35599bd6735de4dd38560e3a79b8 (diff) | |
download | aports-2d2ddf507bf1ae2f4cc595b23b8e018398cbe8dd.tar.bz2 aports-2d2ddf507bf1ae2f4cc595b23b8e018398cbe8dd.tar.xz |
move core/* to main/
added maintainer to several packages as well
Diffstat (limited to 'main/openrc')
-rw-r--r-- | main/openrc/APKBUILD | 56 | ||||
-rw-r--r-- | main/openrc/hostname.initd | 18 | ||||
-rw-r--r-- | main/openrc/hwdrivers.initd | 27 | ||||
-rw-r--r-- | main/openrc/keymaps.initd | 20 | ||||
-rw-r--r-- | main/openrc/modloop.initd | 87 | ||||
-rw-r--r-- | main/openrc/modules.initd | 23 | ||||
-rw-r--r-- | main/openrc/networking.initd | 28 | ||||
-rw-r--r-- | main/openrc/openrc-0.4.3-mkmntdirs.patch | 11 | ||||
-rw-r--r-- | main/openrc/openrc-hwclock.patch | 13 | ||||
-rw-r--r-- | main/openrc/openrc.post-install | 35 | ||||
-rw-r--r-- | main/openrc/openrc.post-upgrade | 9 |
11 files changed, 327 insertions, 0 deletions
diff --git a/main/openrc/APKBUILD b/main/openrc/APKBUILD new file mode 100644 index 000000000..415f24a58 --- /dev/null +++ b/main/openrc/APKBUILD @@ -0,0 +1,56 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=openrc +pkgver=0.5.0 +pkgrel=6 +pkgdesc="OpenRC manages the services, startup and shutdown of a host" +url="http://roy.marples.name/openrc" +license='BSD-2' +depends="" +subpackages="$pkgname-doc $pkgname-dev" +install="$pkgname.post-install $pkgname.post-upgrade" +source="http://roy.marples.name/downloads/$pkgname/$pkgname-$pkgver.tar.bz2 + openrc-0.4.3-mkmntdirs.patch + openrc-hwclock.patch + hostname.initd + hwdrivers.initd + keymaps.initd + modules.initd + modloop.initd + networking.initd + $install + " + +build() { + cd "$srcdir/$pkgname-$pkgver" + for i in ../*.patch; do + msg "Applying $i..." + patch -p1 < $i || return 1 + done + + make + make DESTDIR="$pkgdir/" install + + # we cannot have anything turned on by default + rm -f "$pkgdir"/etc/runlevels/*/* + + #rm -f "$pkgdir"/lib/rc/net/* "$pkgdir"/etc/init.d/net.lo + + # we override some of the scripts + for i in ../*.initd; do + j=${i##*/} + install -Dm755 $i "$pkgdir"/etc/init.d/${j%.initd} + done + +} + +md5sums="9ec7f8425e12abbbd0f7a962aae3fa3c openrc-0.5.0.tar.bz2 +8c2c1c2ee0509b63966b7187a2079f4b openrc-0.4.3-mkmntdirs.patch +f462c976b04cfbb35b2335be15eee7f6 openrc-hwclock.patch +c32e15b0858eef708497e7ee6355a055 hostname.initd +b1e64885f301166df30be3e3cf5338ff hwdrivers.initd +33ca3e558c42cdd17adccbc7807298f7 keymaps.initd +098a1f16812f56fcb56eb6b6f0fa31f6 modules.initd +c77cb4a67aa7ef40dfb12dd1ff5bf5e2 modloop.initd +747168eee535e845179eaef5a3fcb334 networking.initd +71d823acc9935a8ac82649a94b5bc0b9 openrc.post-install +393ff61bc0bf2c07f9af81795554c584 openrc.post-upgrade" diff --git a/main/openrc/hostname.initd b/main/openrc/hostname.initd new file mode 100644 index 000000000..995e4b95d --- /dev/null +++ b/main/openrc/hostname.initd @@ -0,0 +1,18 @@ +#!/sbin/runscript + +description="Sets the hostname of the machine." + +depend() { + keyword noprefix +} + +start() { + if [ -f /etc/hostname ] ; then + opts="-F /etc/hostname" + else + opts="localhost" + fi + ebegin "Setting hostname" + hostname $opts + eend $? +} diff --git a/main/openrc/hwdrivers.initd b/main/openrc/hwdrivers.initd new file mode 100644 index 000000000..3d0ebf12b --- /dev/null +++ b/main/openrc/hwdrivers.initd @@ -0,0 +1,27 @@ +#!/sbin/runscript + +depend() { + need sysfs dev + before checkfs fsck + after modloop + keyword novserver +} + +# Load hardware drivers +start() { + # check for boot option "nocoldplug" + if get_bootparam noautodetect; then + ewarn "Autodetection of hardware disabled from boot cmdline" + return 0 + fi + + + ebegin "Loading hardware drivers" + find /sys -name modalias | xargs sort -u \ + | xargs modprobe -a 2> /dev/null + # we run it twice so we detect all devices + find /sys -name modalias | xargs sort -u \ + | xargs modprobe -a 2> /dev/null + eend 0 +} + diff --git a/main/openrc/keymaps.initd b/main/openrc/keymaps.initd new file mode 100644 index 000000000..8ee019c69 --- /dev/null +++ b/main/openrc/keymaps.initd @@ -0,0 +1,20 @@ +#!/sbin/runscript + +description="Applies a keymap for the consoles." + +depend() +{ + need localmount + keyword noopenvz noprefix nouml novserver noxenu +} + +start() { + [ -z "$KEYMAP" ] && return + ebegin "Setting keymap" + zcat "$KEYMAP" | loadkmap + eend $? +} + +stop() { + return +} diff --git a/main/openrc/modloop.initd b/main/openrc/modloop.initd new file mode 100644 index 000000000..c32e1f49f --- /dev/null +++ b/main/openrc/modloop.initd @@ -0,0 +1,87 @@ +#!/sbin/runscript + +# script that will mount image with modules + +depend() { + need dev + before checkfs fsck hwdrivers modules hwclock + keyword novserver +} + +# read kernel options +init_KOPT() { + eval set -- $(cat /proc/cmdline 2>/dev/null) + while [ $# -gt 0 ]; do + case "$1" in + *=*) eval "KOPT_${1%%=*}='${1#*=}'" ;; + *) eval "KOPT_$(echo $1 | sed 's: :_:g')=yes" ;; + esac + shift + done +} + +find_mnt() { + local dev="$1" + local fsfile="$2" + awk "\$ == \"$dev\" {print \$2}\"" "$fsfile" 2>/dev/null +} + +# initialies: alpine_dev, alpine_mnt, alpine_fs, alpine_mounted +find_media() { + init_KOPT + alpine_mounted= + alpine_dev=${KOPT_alpine_dev%%:*} + alpine_fs=${KOPT_alpine_dev#*:} + [ "$alpine_fs" = "$KOPT_alpine_dev" ] && unset alpine_fs + # first we check if alpine_dev is mounted and use this + alpine_mnt=$(find_mnt /dev/$alpine_dev /proc/mounts) + if [ -z "$alpine_mnt" ]; then + # then we check fstab + alpine_mnt=$(find_mnt /dev/$alpine_dev /etc/fstab) + else + alpine_mounted=yes + fi + # finally we fallback to /media/<devicename> + [ -z "$alpine_mnt" ] && alpine_mnt=/media/$alpine_dev +} + +start() { + local modloop mount_opts + find_media + if [ -z "$alpine_dev" ] ; then + ebegin "Skipping mount module loopback (specify with alpine_dev)" + eend 0 + return 0 + fi + + modloop=${KOPT_modloop:-$KOPT_BOOT_IMAGE.cmg} + [ -n "$alpine_fs" ] && mount_opts="-t $alpine_fs" + + ebegin "Mounting loopback device for kernel modules" + if [ -z "$alpine_mounted" ]; then + mount $mount_opts /dev/$alpine_dev $alpine_mnt 2>/dev/null + fi + mkdir -p /.modloop /lib + + mount -o loop,ro -t cramfs $alpine_mnt/$modloop /.modloop &&\ + rm -rf /lib/modules &&\ + ln -sf /.modloop/modules /lib/ + eend $? || return 1 + + # copy firmware if there are any + if [ -d $alpine_mnt/firmware ]; then + ebegin "Copying firmware from $alpine_mnt/firmware" + cp -R -a $alpine_mnt/firmware /lib/ + eend $? + fi +} + +stop() { + find_media + [ -z "$alpine_dev" ] && return 0 + ebegin "Unmounting loopback device for kernel modules" + umount -d /.modloop &&\ + umount $alpine_mnt 2>/dev/null + eend $? +} + diff --git a/main/openrc/modules.initd b/main/openrc/modules.initd new file mode 100644 index 000000000..ef7d1f15f --- /dev/null +++ b/main/openrc/modules.initd @@ -0,0 +1,23 @@ +#!/sbin/runscript + +description="Loads a user defined list of kernel modules." + +depend() +{ + before hwclock hwdrivers + keyword noopenvz noprefix novserver +} + + +start() { + if [ -f /etc/modules ] ; then + ebegin "Loading modules" + sed 's/\#.*//g' < /etc/modules | + while read module args + do + modprobe -q $module $args + done + eend $? + fi +} + diff --git a/main/openrc/networking.initd b/main/openrc/networking.initd new file mode 100644 index 000000000..2269e6f04 --- /dev/null +++ b/main/openrc/networking.initd @@ -0,0 +1,28 @@ +#!/sbin/runscript + +# note that the spoofprotect, syncoockies and ip_forward options are set in +# /etc/sysctl.conf +depend() { + after bootmisc + provide net + keyword nojail noprefix novserver +} + +start() { + ebegin "Configuring network interfaces" + ifup -a >/dev/null 2>&1 + eend $? +} + +stop() { + ebegin "Deconfiguring network interfaces" + ifdown -a >/dev/null 2>&1 + eend $? +} + +restart() { + ebegin "Reconfiguring network interfaces" + ifdown -a >/dev/null 2>&1 && ifup -a >/dev/null 2>&1 + eend $? +} + diff --git a/main/openrc/openrc-0.4.3-mkmntdirs.patch b/main/openrc/openrc-0.4.3-mkmntdirs.patch new file mode 100644 index 000000000..01512ad7c --- /dev/null +++ b/main/openrc/openrc-0.4.3-mkmntdirs.patch @@ -0,0 +1,11 @@ +diff -ru openrc-0.4.3.orig/init.d/localmount.in openrc-0.4.3/init.d/localmount.in +--- openrc-0.4.3.orig/init.d/localmount.in 2009-04-19 14:24:11.000000000 +0000 ++++ openrc-0.4.3/init.d/localmount.in 2009-04-19 14:25:06.000000000 +0000 +@@ -13,6 +13,7 @@ + + start() + { ++ [ -x /sbin/mkmntdirs ] && mkmntdirs + # Mount local filesystems in /etc/fstab. + local types="noproc" x= + for x in ${net_fs_list}; do diff --git a/main/openrc/openrc-hwclock.patch b/main/openrc/openrc-hwclock.patch new file mode 100644 index 000000000..593e9ba82 --- /dev/null +++ b/main/openrc/openrc-hwclock.patch @@ -0,0 +1,13 @@ +Index: hwclock.in +=================================================================== +--- a/init.d/hwclock.in (revision 1571) ++++ b/niit.d/hwclock.in (working copy) +@@ -118,7 +118,7 @@ + + if ! yesno $clock_adjfile; then + # Some implementations don't handle adjustments +- if LC_ALL=C hwclock --help | grep -q "\-\-noadjfile"; then ++ if LC_ALL=C hwclock --help 2>&1 | grep -q "\-\-noadjfile"; then + utc_cmd="$utc_cmd --noadjfile" + fi + fi diff --git a/main/openrc/openrc.post-install b/main/openrc/openrc.post-install new file mode 100644 index 000000000..1d0201d3a --- /dev/null +++ b/main/openrc/openrc.post-install @@ -0,0 +1,35 @@ +#!/bin/sh + +rc_update() { + local svc="$1" + local level="$2" + mkdir -p /etc/runlevels/$level + ln -sf /etc/init.d/$svc /etc/runlevels/$level +} + +if [ ! -d etc/rcS.d ] && [ ! -d etc/rcL.d ]; then + exit 0 +fi + +for i in etc/rc[SL].d/*; do + [ -L "$i" ] || continue + oldsvc=${i##*/S[0-9][0-9]} + # some services are renamed + case "$oldsvc" in + modutils) svc=modules;; + procps) svc=sysctl;; + bootmisc.sh) svc=bootmisc;; + keymap) svc=keymaps;; + *) svc=$oldsvc;; + esac + + # add the service to correct "runlevel" + case "$svc" in + hwclock|modules|sysctl|hostname|keymaps|syslog|bootmisc) + rc_update $svc boot;; + *) rc_update $svc default;; + esac + + rm $i +done + diff --git a/main/openrc/openrc.post-upgrade b/main/openrc/openrc.post-upgrade new file mode 100644 index 000000000..b09f2f240 --- /dev/null +++ b/main/openrc/openrc.post-upgrade @@ -0,0 +1,9 @@ +#!/bin/sh + +# in 0.5.x the state dir moved from /lib/rc/init.d to /libexec/rc/init.d + +[ -d /lib/rc/init.d ] || exit 0 + +mv /lib/rc/init.d/* /libexec/rc/init.d/ +rmdir /lib/rc/init.d +exit 0 |