# $Id$ PNAME="busybox-initscripts" PVER="0.7.0.3" PBUILD="r4" 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.17.4 >= sys-apps/coreutils-8.10 >= 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}" sminclude alx SRC_URI=( mirror://initscripts/${SRCFILE} mirror://initscripts/initscripts-${PVER}-update-copyright.patch mirror://initscripts/initscripts-${PVER}-mount-sys-only-if-required.patch mirror://initscripts/initscripts-${PVER}-rc_echo-missing-escapes.patch mirror://initscripts/initscripts-${PVER}-export-runlevel.patch mirror://initscripts/initscripts-${PVER}-exit-splash-at-shutdown-and-reboot.patch ) src_prepare() { munpack ${SRCFILE} || die cd ${SRCDIR} # update copyright to 2012 mpatch initscripts-${PVER}-update-copyright.patch || die # only mount /sys if not already mounted (like from initrd) mpatch initscripts-${PVER}-mount-sys-only-if-required.patch || die # fix missing escaping in the rc_echo() cmd mpatch initscripts-${PVER}-rc_echo-missing-escapes.patch || die # export runlevel variabl that every rc-script knows about the current runlevel mpatch initscripts-${PVER}-export-runlevel.patch || die # run splash_exit on runlevel shutdown and reboot mpatch initscripts-${PVER}-exit-splash-at-shutdown-and-reboot.patch || 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 # always use udev on alx sed -i 's:^\(RC_DEVICEMANAGER=\).*:\1udev:' ${BINDIR}/etc/conf.d/kernel || die # an extra package from now on if [[ -f ${BINDIR}/etc/mageversion ]] then rm ${BINDIR}/etc/mageversion || die fi if [[ -f ${BINDIR}/etc/system-release ]] then rm ${BINDIR}/etc/system-release || die fi } preinstall() { add_conf_prot_mask /etc/env.d /etc/modprobe.d /etc/rc.d/init.d /etc/profile /etc/inputrc \ /etc/shells /etc/issue /etc/DIR_COLORS /etc/inittab \ /etc/conf.d/net.sample /etc/conf.d/kernel /etc/conf.d/rc /etc/conf.d/network add_conf_prot_ignore /etc/fstab /etc/group /etc/hostname /etc/hosts /etc/modules.autoload \ /etc/passwd /etc/shadow /etc/conf.d/clock /etc/conf.d/editor /etc/conf.d/keymap \ /etc/conf.d/net.routes } 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 "\rDeleted ${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 # # don't do this if MAGE_BOOTSTRAP=true is set! if [[ ${MAGE_BOOTSTRAP} = true ]] then echo "bootstrap phase - ignoring autocleanup" else # 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 fi # fix mtab if [[ ! -L ${MROOT}/etc/mtab ]] || [[ $(readlink ${MROOT}/etc/mtab) != /proc/mounts ]] then ln -snf /proc/mounts ${MROOT}/etc/mtab fi # remove /etc/modprobe.conf if [[ -f ${MROOT}/etc/modprobe.conf ]] && [[ -d ${MROOT}/etc/modprobe.d ]] then rm ${MROOT}/etc/modprobe.conf fi # remove old alx initscripts local target for target in ${DEPRECATED_MAGE_TARGETS} do if [[ ! -z $(magequery -n initscripts-${target}) ]] then echo "removing deprecated mage-target 'initscripts-${target}'" mage uninstall initscripts-${target} || die fi done }