# $Id$ PNAME="busybox-initscripts" PVER="0.1.15" 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.17.4 >= sys-apps/coreutils-8.10 >= sys-apps/findutils-4.4 >= net-misc/rsync-3" SRCFILE="${PNAME}-${PVER}.tar.bz2" SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" # fixes mageversion; # the makefile uses the date as version number # but for release we want to use the release version RELEASE_MAGEVERSION= sminclude alx SRC_URI=( mirror://${PNAME}/${SRCFILE} ) src_prepare() { munpack ${SRCFILE} || die } 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 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 # fix mageversion if any release version is given if [[ ! -z ${RELEASE_MAGEVERSION} ]] then echo "${RELEASE_MAGEVERSION}" > ${BINDIR}/etc/mageversion || die fi } preinstall() { add_conf_prot_mask /etc/env.d /etc/modules.d /etc/rc.d/init.d /etc/profile /etc/inputrc \ /etc/shells /etc/issue /etc/DIR_COLORS /etc/mageversion /etc/inittab \ /etc/conf.d/net.sample /etc/conf.d/kernel /etc/conf.d/rc 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 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 }