#!/bin/sh
#####################################################################
#
# chgramimg
#
# Shell script to change ramdisk image on flash memory
#
# ver 0.1 2002/09/27
#
# Usage: chgramimg imgfile
#
##################################################################### 

# Check argument
if [ $# -lt 1 ]; then
	echo "Usage: chgramimg imgfile"
	exit 1
fi

gunzip -t $1 > /dev/null 2>&1
if [ $? -ne 0 ]; then
	echo "$1 may be damaged, cancel update."
	exit 1
fi

# Detemine image file
echo "$1" | grep / >& /dev/null
if [ $? -eq 0 ]; then
	IMGFILE="$1"
else
	IMGFILE="`pwd`/$1"
fi

# Update a image on flash
echo "Changing a ramdisk image on flash memory"
/usr/sbin/fuc -sd ri $IMGFILE
