#!/bin/bash
# $Id:$
# Copyright (c) 2006 SUSE LINUX GmbH, Germany. All rights reserved.
# GNU Public License.

case $1 in
	-h|--help)
		echo -e "\nusage:	$(basename $0) <min_loop> <max_loop>"
		echo "	min_loop	number of loop device to start with (def. 7)"
		echo -e "	max_loop	max. number of loop devices (max. 63)\n"
		echo "/boot/grub/menu.lst or /etc/modprobe.conf.local has to be changed manually."
		exit
	;;
esac

I=${1:-8}
IMAX=${2:-63}

cd /dev

while [ $I -le $IMAX ]; do
	mknod -m 640 loop$I b 7 $I
	(( I++ ))
done

chgrp disk loop{?,??}
ls -l loop{?,??}

cd $OLDPWD

echo -e "\nPlease change  max_loop=$IMAX  in /boot/grub/menu.lst ,"
echo "or  option max_loop=$IMAX  in /etc/modprobe.conf.local ."
echo -e "\nThe change will take effect after the next reboot."
#
