summaryrefslogtreecommitdiffstats
path: root/init.d
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-04-16 14:50:24 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-04-16 14:50:24 +0000
commit978ba91d43a7e6785f870f975c7c682d51819568 (patch)
tree78e00e8b01d91c1b0dac6921393d83c3e2e53867 /init.d
parent6cffbd4109d3f2f171a492f575447874fd85e5bc (diff)
downloadalpine-baselayout-978ba91d43a7e6785f870f975c7c682d51819568.tar.bz2
alpine-baselayout-978ba91d43a7e6785f870f975c7c682d51819568.tar.xz
remove misc init.d scripts that are provided by openrc
Diffstat (limited to 'init.d')
-rwxr-xr-xinit.d/checkroot.sh46
-rwxr-xr-xinit.d/hostname9
-rwxr-xr-xinit.d/hwclock98
-rw-r--r--init.d/keymap13
-rwxr-xr-xinit.d/localinit31
-rwxr-xr-xinit.d/localmount83
-rwxr-xr-xinit.d/modutils16
-rwxr-xr-xinit.d/procps10
-rwxr-xr-xinit.d/rcK10
-rwxr-xr-xinit.d/rcL18
-rwxr-xr-xinit.d/rcS54
-rwxr-xr-xinit.d/runtimes305
-rwxr-xr-xinit.d/swap14
13 files changed, 0 insertions, 707 deletions
diff --git a/init.d/checkroot.sh b/init.d/checkroot.sh
deleted file mode 100755
index 94fc7ff..0000000
--- a/init.d/checkroot.sh
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/sh
-
-rootmode=rw
-rootopts=rw
-rootcheck=yes
-udevfs=
-
-# read the fstab
-sed 's/#.*//' /etc/fstab | while read fs mnt type opts dump pass junk
-do
- [ "$type" = udevfs ] && udefs="$fs"
- [ "$mnt" != / ] && continue
- rootopts="$opts"
- [ "$pass" = 0 -o "$pass" = "" ] && rootcheck=no
- case "$opts" in
- ro|ro,*|*,ro|*,ro,*)
- rootmode=ro
- ;;
- esac
-done
-
-if [ "$rootcheck" = yes ] ; then
- if grep "^$fs" /proc/mounts ; then
- echo "$fs is mounted. Something is wrong. Please fix and reboot."
- echo "sorry newbies..."
- echo
- echo "CONTROL-D will exit from this shell and reboot the system."
- echo
- /sbin/sulogin $CONSOLE
- reboot -f
- elif ! fsck -C "$fs" ; then
- echo "fsck failed. Please repair manually and reboot. Please note"
- echo "that the root file system is currently mounted read-only. To"
- echo "remount it read-write:"
- echo
- echo " # mount -n -o remount,rw /"
- echo
- echo "CONTROL-D will exit from this shell and REBOOT the system."
- echo
- /sbin/sulogin $CONSOLE
- reboot -f
- fi
-fi
-
-mount -o remount,$rootmode /
-
diff --git a/init.d/hostname b/init.d/hostname
deleted file mode 100755
index 5ce489c..0000000
--- a/init.d/hostname
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/sbin/runscript
-
-start() {
- if [ -f /etc/hostname ] ; then
- ebegin "Setting hostname"
- hostname -F /etc/hostname
- eend $?
- fi
-}
diff --git a/init.d/hwclock b/init.d/hwclock
deleted file mode 100755
index 4ed9bb9..0000000
--- a/init.d/hwclock
+++ /dev/null
@@ -1,98 +0,0 @@
-#!/sbin/runscript
-# Copyright 2007-2008 Roy Marples <roy@marples.name>
-# All rights reserved. Released under the 2-clause BSD license.
-
-extra_commands="save show"
-
-description="Sets the local clock to UTC or Local Time."
-description_save="Saves the current time in the BIOS."
-description_show="Displays the current time in the BIOS."
-
-clock_args=${clock_args:-${CLOCK_OPTS}}
-clock_systohc=${clock_systohc:-${CLOCK_SYSTOHC}}
-
-clock=${clock:-${CLOCK:-UTC}}
-if [ "${clock}" = "UTC" ]; then
- utc="UTC"
- utc_cmd="--utc"
-else
- utc="Local Time"
- utc_cmd="--localtime"
-fi
-
-setupopts()
-{
- case "${utc}" in
- UTC|Local" "Time);;
- *) unset utc_cmd;;
- esac
-}
-
-# hwclock doesn't always return non zero on error
-_hwclock()
-{
- local err="$(hwclock "$@" 2>&1 >/dev/null)"
-
- [ -z "${err}" ] && return 0
- echo "${err}" >&2
- return 1
-}
-
-start()
-{
- local retval=0 errstr=""
- setupopts
-
- if [ -z "${utc_cmd}" ]; then
- ewarn "Not setting clock for ${utc} system"
- return 0
- fi
-
- ebegin "Setting system clock using the hardware clock [${utc}]"
- if [ -e /proc/modules -a ! -e /dev/rtc ]; then
- modprobe -q rtc || modprobe -q genrtc
- fi
-
- # If setting UTC, don't bother to run hwclock when first booting
- # as that's the default
- if [ "${PREVLEVEL}" != "N" -o \
- "${utc_cmd}" != "--utc" -o \
- -n "${clock_args}" ];
- then
- _hwclock --hctosys ${utc_cmd} ${clock_args}
- retval=$((${retval} + $?))
- fi
-
- eend ${retval} "Failed to set the system clock"
-
- return 0
-}
-
-stop()
-{
- yesno ${clock_systohc} || return 0
-
- local retval=0 errstr=""
- setupopts
-
- [ -z "${utc_cmd}" ] && return 0
-
- ebegin "Setting hardware clock using the system clock" "[${utc}]"
-
- _hwclock --systohc ${utc_cmd} ${clock_args}
- retval=$?
-
- eend ${retval} "Failed to sync clocks"
-}
-
-save()
-{
- clock_systohc="yes"
- stop
-}
-
-show()
-{
- setupopts
- hwclock --show "${utc_cmd}" ${clock_args}
-}
diff --git a/init.d/keymap b/init.d/keymap
deleted file mode 100644
index 7524d53..0000000
--- a/init.d/keymap
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/sbin/runscript
-
-
-start() {
- [ -z "$KEYMAP" ] && return
- ebegin "Setting keymap"
- zcat "$KEYMAP" | loadkmap
- eend $?
-}
-
-stop() {
- return
-}
diff --git a/init.d/localinit b/init.d/localinit
deleted file mode 100755
index 030a0fc..0000000
--- a/init.d/localinit
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/sbin/runscript
-
-mount_once() {
- if mount | grep $1 >/dev/null 2>&1 ; then
- NOUMOUNT=$1
- else
- mount $1 >/dev/null 2>&1
- fi
-}
-
-umount_once() {
- [ "$NOUMOUNT" != "$1" ] && umount "$1" 2>/dev/null
-}
-
-start() {
- for media in $MOUNTS ; do
- m="/media/$media"
- mount_once $m
- if [ -e $m/localinit ] ; then
- ebegin "Running localinit from $media"
- $m/localinit
- retcode=$?
- umount_once $m
- eend $retcode
- exit
- fi
- sleep 1
- umount_once $m
- done
-}
-
diff --git a/init.d/localmount b/init.d/localmount
deleted file mode 100755
index 622e2e0..0000000
--- a/init.d/localmount
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/sbin/runscript
-
-: ${NET_FS_LIST:="afs cifs coda davfs fuse gfs ncpfs nfs nfs4 ocfs2 shfs smbfs"}
-: ${NO_UNMOUNT:="/dev/shm /dev/pts /dev /sys /proc /"}
-
-start() {
- local types="noprocfs" i=
- for i in ${NET_FS_LIST}; do
- types="$types,$i"
- done
-
- # create mount points from fstab
- mkmntdirs /etc/fstab
-
- ebegin "Mounting local file systems"
- mount -at "$types"
- eend $? "Some local filesystems failed to mount"
-
- if [ ! -d /proc/bus/usb ]; then
- modprobe usbcore &>/dev/null
- fi
-
- if [ -e /proc/filesystems ] ; then
- if [ -d /proc/bus/usb -a ! -e /proc/bus/usb/devices ] ; then
- local usbfs=$(grep -ow usbfs /proc/filesystems)
-
- if [ -n "${usbfs}" ] ; then
- ebegin "Mounting USB device filesystem"
- local gid=$(getent group usb | cut -d: -f3)
- mount -t ${usbfs} \
- -o ${gid:+devmode=0664,devgid=${gid},}noexec,nosuid \
- usbfs /proc/bus/usb
- eend $?
- fi
- fi
-
- if [ -d /proc/fs/nfsd ] ; then
- if grep -qs nfsd /proc/filesystems ; then
- ebegin "Mounting nfsd filesystem"
- mount -t nfsd -o nodev,noexec,nosuid nfsd /proc/fs/nfsd
- eend $?
- fi
- fi
- fi
-}
-
-reverse_mounts() {
- local rev=
- while read line ; do
- rev="$line\n$rev"
- done < /proc/mounts
-}
-
-unmountable() {
- local i=
- for i in $NO_UNMOUNT ; do
- [ "$i" = "$1" ] && return 1
- done
- for i in $NET_FS_LIST ; do
- [ "$i" = "$2" ] && return 1
- done
- return 0
-}
-
-stop() {
- local rev= dev= mnt= rc=0 fs=
- ebegin "Unmounting filesystems"
- sync ; sync
-
- while read line ; do
- rev="$line\n$rev"
- done < /proc/mounts
-
- echo -e "$rev" | grep -v '^$' | while read dev mnt fs ; do
- if unmountable $mnt $fs ; then
- umount -r "$mnt"
- rc=$(($rc + $?))
- fi
- done
-
- eend $rc
-}
-
diff --git a/init.d/modutils b/init.d/modutils
deleted file mode 100755
index 673e06e..0000000
--- a/init.d/modutils
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/sbin/runscript
-
-PATH="/sbin:/bin:/usr/bin:/usr/bin"
-
-start() {
- if [ -f /etc/modules ] ; then
- sed 's/\#.*//g' < /etc/modules |
- while read module args
- do
- ebegin "Loading $module"
- modprobe -q $module $args
- eend $?
- done
- fi
-}
-
diff --git a/init.d/procps b/init.d/procps
deleted file mode 100755
index 0a8bd8f..0000000
--- a/init.d/procps
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/sbin/runscript
-
-start() {
- if [ -r /etc/sysctl.conf ] ; then
- ebegin "Setting kernel variables"
- /sbin/sysctl -p /etc/sysctl.conf >/dev/null
- eend $?
- fi
-}
-
diff --git a/init.d/rcK b/init.d/rcK
deleted file mode 100755
index 5a22f41..0000000
--- a/init.d/rcK
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
-
-echo ""
-for i in `for j in /etc/rcK.d/K* ; do echo $j ; done | sort -r` ; do
- [ -f $i ] && $i stop
-done
-exit 0
-
diff --git a/init.d/rcL b/init.d/rcL
deleted file mode 100755
index f144b67..0000000
--- a/init.d/rcL
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/busybox sh
-
-export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
-
-for i in `seq 0 9` ; do
- # first stopp all the K?? scripts in this level
- for j in /etc/rcL.d/K$i[0-9]* ; do
- [ -f $j ] && $j stop
- done
- # start all S?? scripts in this level
- for j in /etc/rcL.d/S$i[0-9]* ; do
- [ -f $j ] && $j start
- done
-done
-
-cat /proc/uptime >/tmp/boot-time
-exit 0
-
diff --git a/init.d/rcS b/init.d/rcS
deleted file mode 100755
index 51e682c..0000000
--- a/init.d/rcS
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/busybox sh
-
-# we need the proc to be able to install busybox
-/bin/busybox mkdir -p /proc /usr/sbin /sys
-if ! [ -e /proc/uptime ]; then
- /bin/busybox mount -t proc -o noexec,nosuid,nodev proc /proc
-fi
-
-if ! /bin/busybox mount | grep /sys >/dev/null; then
- /bin/busybox mount -t sysfs -o noexec,nosuid,nodev sysfs /sys
-fi
-
-# install busybox links
-/bin/busybox --install -s
-
-[ -f /etc/alpine-release ] && read RELEASE BUILD < /etc/alpine-release
-echo "Starting $RELEASE"
-
-export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
-
-# start an rc script. Look if there are a no<service> in /proc/cmdline
-start_script() {
- local n
- if [ -f $1 ] ; then
- for n in `cat /proc/cmdline`; do
- case $1 in
- S??no$n) return 1;;
- esac
- done
- case $1 in
- *.sh) . $1 start;;
- *) $1 start;;
- esac
- fi
-}
-
-# hide kernel messages
-dmesg -n 1
-
-for i in `cat /proc/cmdline` ;do
- case $i in
- 1|s|single)
- echo "Entering single mode. Type 'exit' to continue booting."
- sh
- ;;
- esac
-done
-
-# Run all /etc/rcS.d scripts
-for j in /etc/rcS.d/S* ; do
- start_script $j
-done
-exit 0
-
diff --git a/init.d/runtimes b/init.d/runtimes
deleted file mode 100755
index 4e3cc11..0000000
--- a/init.d/runtimes
+++ /dev/null
@@ -1,305 +0,0 @@
-#!/sbin/runscript
-
-# The purpose of this script is to load the Alpine runtime modules and the
-# local config that belongs to.
-
-SFIC=`which sfic 2>/dev/null`
-COMMITED_TDB=/var/lib/apk/commited.tdb
-TMP=/tmp/init.d-runtimes
-
-# search for a kernel argument
-get_kopt () {
- for i in `cat /proc/cmdline` ; do
- case $i in
- $1=*) echo $i | sed 's|'$1'=||'
- return 0
- ;;
- esac
- done
- return 1
-}
-
-get_pkg_list() {
- sed 's/\#.*//' $1
-}
-
-preload_users_and_groups() {
- tar -C / -zxf "$1" etc/passwd etc/group 2>/dev/null
-}
-
-# merge the unpacked config
-merge_config() {
- local dev mnt ovl f ovllist ovlfile
- dev=$1
- ovlfile="$2"
- mnt=$(dirname "$2")
- ovl=$(basename "$2")
-
- cp -ar $TMP/* /
-
- # remember to remove leading /
- ovllist=`find $TMP/* | sed "s:^$TMP/::"`
- if [ "$ovllist" ] ; then
- lbu update $ovllist 2>/dev/null
- return 0
- else
- return 1
- fi
-}
-
-find_ovl() {
- local mnt="$1"
- local ovl
- local lines
- # first search kernel cmdline for "pkg_ovl"
- ovl=$( get_kopt pkg_ovl )
- if [ x"$ovl" != x ] ;then
- echo "$ovl"
- return 0
- fi
-
- # look for apkovl's on mounted media
- ovl=$( ls -1 "$mnt"/*.apkovl.tar.gz* 2>/dev/null ) || return 1
- lines=$(echo "$ovl" | wc -l)
-
- if [ $lines -gt 1 ] ; then
- echo "ERROR: More than one apkovl file was found on $(basename $mnt). None will be read." >&2
- exit 1
- fi
- echo "$ovl"
-}
-
-# read ahead so the packages are in cache when installed
-readahead_pkgs() {
- local i pkgs
- for i in $* ; do
- pkgs="$pkgs $APK_PATH_MOUNTED/$i-[0-9]*"
- done
- readahead $pkgs 2>/dev/null &
-}
-
-load_pkgs_from_list() {
- local list="$1"
- local prompt="$2"
- local pkgs dummy
-# apk_fetch -u -q
- pkgs=$( sed 's/\#.*//' "$list" )
- readahead_pkgs $pkgs
- IGNORE_ERRORS=yes apk_add -v $pkgs 2>&1 | roller
-}
-
-load_pkgs() {
- local pkglist mlist pkg pkgs
- local dev=$1
- local mnt=$2
- # get kernel opt pkg_list or use /packages.list
- pkglist=`get_kopt pkg_list`
- # here we should issue a warning in future versions if found on cmdline
- pkglist=${pkglist:-/packages.list}
-
- # aww... we move from /mnt/packages.list to var/lib/apk/world to
- # etc/lbu/packages.list. Hopefully this code can be simplified in
- # future.
- mlist="$mnt/$pkglist"
- wlist="$TMP/var/lib/apk/world"
- plist="$TMP/etc/lbu/packages.list"
-
- [ -f "$plist" ] && wlist="$plist"
- if [ -f "$wlist" ] ; then
- load_pkgs_from_list "$wlist"
- # its re-generated
- rm -rf "$wlist"
- elif [ -f "$mlist" ] ; then
- #ok, we are upgrading...
- local line i
- eeinfo "
-NOTE: Using packages.list from $dev. This file has moved to
-etc/lbu/packages.list and will be included in the apkovl.
-"
- load_pkgs_from_list "$mlist"
- # lets clean up the world file
- echo "# This file was generated by /etc/init.d/runtimes" >/etc/init.d/packages.list
- for i in $(apk_glob '*') ; do
- reqby=$(apk_info -qr $i);
- # only add the packages who has no REQUIRED_BY
- [ -z "$reqby" ] && echo $i
- done | sed 's/-[0-9].*//' >> /etc/lbu/packages.list
- fi
-}
-
-# load packages from mounted media
-load_pkgs_and_config() {
- # params:
- # $1 = device
- # $2 = path to mounted media
- local ovlfile
- local mnt=$2
- local dev=$1
- local dest
-
- cd /
- # look for apk overlays.
- ovlfile=$( find_ovl "$mnt" ) || return 1
-
- mkdir -p "$TMP"
- ebegin "Loading setup from $dev://$(basename $ovlfile)"
- case "$ovlfile" in
- *.apkovl.tar.gz.*)
- local cipher=${ovlfile##*.}
- local count=0
- if ! openssl list-cipher-commands \
- | grep "^$cipher$" > /dev/null; then
- eend 1 "Cipher $cipher is not supported"
- return 1
- fi
- echo ""
- while true ; do
- count=$(( $count + 1 ))
- openssl enc -d -$cipher -in "$ovlfile" \
- | tar -C "$TMP" -zx 2>/dev/null
- if [ $? -eq 0 ]; then
- break
- elif [ $count -ge 3 ]; then
- eend 1
- return
- fi
- done
- ;;
- *)
- # unpack the ovl
- if ! tar -C "$TMP" -zxf "$ovlfile" ; then
- eend $?
- return
- fi
- esac
-
- # copy the passwd file
- [ -f "$TMP/etc/passwd" ] && cp $TMP/etc/passwd /etc
- [ -f "$TMP/etc/group" ] && cp $TMP/etc/group /etc
-
- # install the packages
- load_pkgs $dev $mnt
-
- # copy the config
- merge_config
- eend $?
-
- # clean up
- rm -rf "$TMP"
-}
-
-# find where to install packages from
-set_apk_path() {
- local dev fs mnt pref subdir
- # if pkg_path is not specified as kernel arg, look for the packages
- # on mounted cdrom
- APK_PATH=`get_kopt pkg_path`
- APK_DEV=`get_kopt pkg_dev`
-
- # return if pkg_dev is empty
- if [ x"$APK_DEV" = x ] ; then
- export APK_PATH
- return
- fi
-
- # split dev:fs
- dev=`echo $APK_DEV | cut -d: -f1`
- fs=`echo $APK_DEV | cut -d: -f2`
-
- # find mountpoint in fstab
- mnt=$( awk '/^\/dev\/'$dev'/ { print $2 }' /etc/fstab )
-
- # remove leading '/media/'. we assume the mount is in /media
- prefix=${mnt#/media/}
-
- # if there is no mountpoint in /media, then append one
- if [ x"$prefix" = x"$mnt" ] || [ x"$mnt" = x ] ; then
- prefix=$dev
- echo -e "/dev/$dev\t/media/$prefix\t$fs\tnoauto\t0 0" >> /etc/fstab
- mkdir -p /media/$prefix
- fi
-
- # construct the URI
- subdir=`get_kopt pkg_subdir`
- APK_PATH=$prefix:/${subdir:-/apks}
-
- # read configs if available
- [ -f /etc/apk/apk.conf ] && . /etc/apk/apk.conf
- export APK_PATH
- export APK_PATH_MOUNTED=/media/$prefix/$subdir
-
-}
-
-# mount dev $2 with type $1 on /mnt
-mount_dev() {
- local fs=$1
- local dev=$2
- local i mountok
-
- # special handling for usb devices
- case $dev in
- usb*) # check for attatched devices
- if grep usb-storage /sys/class/scsi_host/host*/proc_name >/dev/null 2>&1 ; then
- ebegin "Waiting for usb-storage"
- for i in $(seq 0 9); do
- if mount -t $fs -o ro /dev/$dev /mnt >/dev/null 2>&1; then
- eend 0
- return 0
- else
- echo -n "."
- sleep 2
- fi
- done
- eend 1
- return 1 # timed out...
- fi
- ;;
- esac
- # not usb, just try to mount as normal
- mount -t $fs -o ro /dev/$dev /mnt >/dev/null 2>&1
- return
-}
-
-start() {
- local cfgdevs m
- # just in case...
- modprobe usb-storage 2>/dev/null
- modprobe sd_mod 2>/dev/null
- modprobe floppy 2>/dev/null
- modprobe cdrom 2>/dev/null
-
- set_apk_path
-
- cfgdevs=$( echo $( get_kopt cfg_dev ) | tr , ' ')
- for m in ${cfgdevs:-usba1:vfat fd0:vfat cdrom:iso9660}; do
- local dev fs skip_umount mnt loaded
-
- # split 'dev:fs'
- dev=${m%%:*}
- fs=${m##*:}
-
- # try to mount device on /mnt or abort
- mnt=$( awk '$1 ~ /^\/dev\/'$dev'/ { print $2 }' /proc/mounts )
- if [ x$mnt = x ] ; then
- skip_umount=""
- mount_dev $fs $dev || continue
- mnt=/mnt
- else
- skip_umount=yes
- fi
-
- # look for package listings and config overlays
- load_pkgs_and_config $dev $mnt && loaded=yes
-
- # lazy unmount
- [ "$skip_umount" = yes ] || umount -l $mnt
- [ "$loaded" = yes ] && break
- done
-
- # if there are no /etc/apk/apk.conf, create one
- if ! [ -f /etc/apk/apk.conf ] ; then
- mkdir -p /etc/apk
- echo "APK_PATH=$APK_PATH" > /etc/apk/apk.conf
- fi
-}
-
diff --git a/init.d/swap b/init.d/swap
deleted file mode 100755
index ff30719..0000000
--- a/init.d/swap
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/sbin/runscript
-
-start() {
- ebegin "Enabling swap"
- swapon -a
- echo -n $( awk '/^SwapTotal/ { print " (" $2 $3 ") " }' /proc/meminfo )
- eend $?
-}
-
-stop () {
- ebegin "Disabling swap"
- swapoff -a
- eend $?
-}