# $Id$ PNAME="busybox-initscripts" PVER="0.1.8" PBUILD="r1" PCATEGORIE="sys-apps" STATE="unstable" 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.10 >= sys-apps/coreutils-5 >= sys-apps/findutils-4 >= net-misc/rsync-2" SRCFILE="${PNAME}-${PVER}.tar.bz2" SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" sminclude cvs rsync alx # available options are source/rsync METHOD=source # fixes mageversion; # the makefile uses the date as version number # but for release we want to use the release version RELEASE_MAGEVERSION= case ${METHOD} in cvs) SDEPEND=">= dev-util/cvs-1.11" ;; rsync) SDEPEND=">= net-misc/rsync-2.6.9" ;; source) SDEPEND="" ;; esac [[ ${METHOD} = source ]] && SRC_URI=( mirror://${PNAME}/${SRCFILE} ) src_prepare() { [[ ${METHOD} = source ]] && { munpack ${SRCFILE} || die; } if [[ ${METHOD} = rsync ]] then RSYNC_URI="rsync://magellan-linux.de/${PNAME}-${PVER}-${PBUILD}" rsync_fetch_source || die fi if [[ ${METHOD} = cvs ]] then MY_CVS_MODULE="magellan-src/busybox-initscripts" # $PVER must be eg 0_3_3 MY_CVS_OPTS="-r busybox-init-$(echo ${PVER}| sed -e "s|\.|\_|g")-${PBUILD}" export CVSROOT=:pserver:anonymous:@magellan-linux.de:/magellan-cvs cvs_fetch_source || die fi } src_install() { cd ${SRCDIR} make DESTDIR=${BINDIR} install || 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 overwrite /etc/mageversion echo 'CONFIG_PROTECT_MASK="/etc/mageversion"' >> ${BINDIR}/etc/env.d/01initscripts || die # always keep this files even if the user 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/conf.d/net.eth0" 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" echo "CONFIG_PROTECT_IGNORE=\"${config_protect_ignore}\"" >> ${BINDIR}/etc/env.d/01initscripts || die # fix mageversion if any release version is given if [[ ! -z ${RELEASE_MAGEVERSION} ]] then echo "${RELEASE_MAGEVERSION}" > ${BINDIR}/etc/mageversion || die fi } 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 # # 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 }