read junk
case "$junk" in
- 1) rootfs_target="/media/card"; break ;;
- 2) rootfs_target="/media/cf" ; break ;;
+ 1) if (mount | grep -q "/media/card ")
+ then
+ rootfs_target="/media/card"; break
+ else
+ echo -e "\nInstallation target [/media/card] not mounted\n"
+ fi ;;
+ 2) if (mount | grep -q "/media/cf ")
+ then
+ rootfs_target="/media/cf"; break
+ else
+ echo -e "\nInstallation target [/media/cf] not mounted\n"
+ fi ;;
esac
done
read junk
case "$junk" in
- 1) rootfs_type="image"; break ;;
+ 1) if test -x /sbin/mkfs.ext2
+ then
+ rootfs_type="image"
+ break
+ else
+ echo -e "\nNOTE: mkfs.ext2 (from e2fsprogs-mke2fs) not found, loop-images not supported\n"
+ fi ;;
2) rootfs_type="direct" ; break ;;
esac
done
install_rootfs_direct(){
+ mount | grep -q "$1 " || die "Installation target [$1] not mounted"
+
echo -e "Do you want to remove existing directories from [$1]\n before installing the new rootfs?"
echo ""
while true
do
- echo -n "Overwrite? [N|y] "
+ echo -n "Overwrite? [y|N] "
read junk2
case "$junk2" in
elif [ -e /sbin/e2fsck ]; then
FSCK="/sbin/e2fsck"
fi
- FSCK="$FSCK -p"
+ test -n "$FSCK" && FSCK="$FSCK -p"
;;
vfat)
if [ -e /sbin/dosfsck ]; then
if mount | grep -q "/media/cf "
then
echo "Note: /media/cf is already mounted"
- else
- /etc/init.d/pcmcia start || die "/etc/init.d/pcmcia/start failed!"
+ else
+ /etc/init.d/pcmcia status | grep -q running || /etc/init.d/pcmcia start && echo "Note: cardmgr already active"
echo ""
echo "Note: /home is already mounted"
else
- if ( grep -q "/home " /etc/fstab )
+ if ( cat /etc/fstab | grep -v "^#" | grep "/home " )
then
echo "Mounting /home"
home_fstab="`grep "/home " /etc/fstab`"