# $Id$ PNAME="busybox-initscripts" PVER="0.7.1.3" PBUILD="r1" PCATEGORIE="sys-apps" DESCRIPTION="Port of the Magellan Initscripts for busybox." HOMEPAGE="http://magellan-linux.net/" # the pkgs "coreutils, findutils, sed, gawk, bzip2, tar, rsync, wget" # are needed to fix the /etc/profile issue DEPEND=">= sys-apps/busybox-1.19 >= sys-apps/coreutils-8.12 >= sys-apps/findutils-4.4 >= virtual/grep >= virtual/sed >= sys-apps/gawk-3 >= virtual/bzip2 >= virtual/tar >= net-misc/rsync-3 >= virtual/wget >= virtual/which >= sys-apps/mage-release-0" SRCFILE="initscripts-${PVER}.tar.bz2" SRCDIR="${BUILDDIR}/initscripts-${PVER}" SRC_URI=( mirror://initscripts/${SRCFILE} ) src_prepare() { munpack ${SRCFILE} || die } src_install() { cd ${SRCDIR} make DESTDIR=${BINDIR} install_busybox || die # CONFIG_PROTECT_MASK for /etc/rc.d/init.d install -d ${BINDIR}/etc/env.d || die echo "CONFIG_PROTECT_MASK=\"/etc/rc.d/init.d\"" > ${BINDIR}/etc/env.d/01initscripts || die # always keep this files even if the user did not edited them local config_protect_ignore config_protect_ignore="/etc/fstab" config_protect_ignore+=" /etc/group" config_protect_ignore+=" /etc/hostname" config_protect_ignore+=" /etc/hosts" config_protect_ignore+=" /etc/inittab" config_protect_ignore+=" /etc/passwd" config_protect_ignore+=" /etc/shadow" config_protect_ignore+=" /etc/conf.d/net.eth0" config_protect_ignore+=" /etc/conf.d/net.routes" config_protect_ignore+=" /etc/modules.autoload.d/kernel-2.4" config_protect_ignore+=" /etc/modules.autoload.d/kernel-2.6" config_protect_ignore+=" /etc/modules.autoload" # add conf.d/kernel to protect current udev|mdev configuration config_protect_ignore+=" /etc/conf.d/kernel" echo "CONFIG_PROTECT_IGNORE=\"${config_protect_ignore}\"" >> ${BINDIR}/etc/env.d/01initscripts || die } postinstall() { # emulate seq; its needed to run rc-config # this fixes some annyoing warning when building # livecd or bootstrapping a system. # this hack will be removed when the toolchain is fixed if [ ! -f /usr/bin/seq ] then echo "Using fake 'seq' command ..." seq() { start=$1 end=$2 for ((i=start; i < end+1; i++)) do echo $i done } export -f seq fi # create service state dir mountpoint # needed by >=initscripts-0.3.2-r1 [ ! -d ${MROOT}/var/lib/init.d ] && install -d ${MROOT}/var/lib/init.d # mark this dir as undeletable touch ${MROOT}/var/lib/init.d/.keep echo "Creating Runlevels ..." local i for i in cleanfs \ loadkeys \ localnet \ modules \ mountfs \ network \ setclock \ swap do echo -e "\tAdded ${i} ..." ${MROOT}/sbin/rc-config del ${i} > /dev/null ${MROOT}/sbin/rc-config add ${i} > /dev/null done # delete these for i in checkfs do echo -e "\tDeleted ${i} ..." ${MROOT}/sbin/rc-config del ${i} > /dev/null done # # do not ask the user about following files # # if they exist let config_protect process them # but then remove the protected files, to keep only the original file # # file-root is ${MROOT}/etc local CONFIG_IGNORE="fstab group hostname hosts inittab passwd conf.d/net.eth0 modules.autoload.d/kernel-2.4 modules.autoload.d/kernel-2.6" local i file path for i in ${CONFIG_IGNORE} do file="$(basename ${i})" path="$(dirname ${i})/" [[ ${path} == ./ ]] && path="" rm -f ${MROOT}/etc/${path}._cfg????_${file} done # fix mtab if [[ ! -L ${MROOT}/etc/mtab ]] || [[ $(readlink ${MROOT}/etc/mtab) != /proc/mounts ]] then ln -snf /proc/mounts ${MROOT}/etc/mtab fi }