#!/bin/sh
#
# Extract key information from the current to try to generate a test
# suite script to demonstrate detected bugs.

echo "cat <<'EOF' > \$tmpdir\$insconf"
grep -v '#' /etc/insserv.conf |grep -v '^$'
echo "EOF"

for f in /etc/init.d/*; do
	name=$(basename $f)
	case $name in
	    README|rc|rcS|skeleton)
	        ;;
	    *)
		echo "addscript $name <<EOF"
		sed -n -r '/^### BEGIN INIT INFO/, /END INIT INFO/p' < $f
		echo "EOF"
		echo
		;;
	esac
done

cd /etc
for f in rc?.d/*; do
	case $f in
	    */README)
	        ;;
	    *)
		echo ln -s $(readlink $f) $f
		;;
	esac
done
