# SliTaz package receipt.

PACKED_SIZE="32.0K"
UNPACKED_SIZE="140.0K"
PACKAGE="slitaz-boot-scripts"
VERSION="475"
CATEGORY="base-system"
SHORT_DESC="Provide all the initialisation scripts used at boot time."
MAINTAINER="pankso@slitaz.org"
LICENSE="GPL3"
WEB_SITE="http://www.slitaz.org/"

TARBALL="$PACKAGE-$VERSION.tar.gz"
WGET_URL="http://hg.slitaz.org/$PACKAGE/archive/$VERSION.tar.gz"
HOST_ARCH="i486 arm"

CONFIG_FILES="
/etc/inittab
/etc/init.d/local.sh
/etc/rcS.conf
/etc/network.conf"

# Needed to fetch the keymaps and test the filesystem.
DEPENDS="busybox e2fsprogs kbd-base slitaz-tools"

current_version()
{
	wget -O - http://hg.slitaz.org/$PACKAGE/ 2>/dev/null | \
	sed '/^Changeset/!d;s|.*">|http://hg.slitaz.org/'$PACKAGE'/rev/|;s|<.*||' | \
	xargs wget -O - 2>/dev/null | sed '/rev /!d;s|.*rev ||;s| .*||'
}

# Rules to gen a SliTaz package suitable for Tazpkg.
#
# This package is all build by genpkg, it provides the boot scripts to be found
# in /etc/init.d with the main configuration file: /etc/rcS.conf. It provides also
# the default inittab and the network configuration file used with network.sh
#
genpkg_rules()
{
	cp -a $src/etc		$fs
	cp -a $src/usr		$fs
	cp -a $src/init		$fs

	chown -R root.root	$fs
	chmod 755		$fs/etc/init.d/*.sh
	chmod 755		$fs/etc/init.d/rc*
	chmod 755		$fs/init

	case "$ARCH" in
		arm*)
			# Provided by slitaz-arm-configs
			rm \
				$fs/etc/rcS.conf \
				$fs/etc/inittab \
				$fs/etc/init.d/rcS \
				$fs/etc/init.d/rc.shutdown \
				$fs/etc/init.d/system.sh ;;
	esac
}

# Post install commands.
#
post_install()
{
	case "$SLITAZ_ARCH" in
		(i?86)
			echo
			chroot "$1/" /usr/bin/rcSconf up
			;;
		(arm)
			if [ ! -d "/var/lib/tazpkg/installed/slitaz-arm-configs" ]
			  then
				spk-add slitaz-arm-configs
			fi
			;;
	esac
}
