#!/bin/sh
while [ 0 ]; do
rm -f /tmp/SeTDS /tmp/SeTmount

while [ 0 ]; do
 cat << EOF > /tmp/tmpmsg

ϡɥǥľܥ󥹥ȡ뤹ˤϡPlamo LinuxΥ֡
ȥǥʳγƥǥб֥ǥ쥯ȥĥ
ƥ󤬤ʤФʤޤ㤨СPlamo Linux
/tmpmnt/plamoˤȤȡ/tmpmnt/plamo/a1Ȥ/tmpmnt/plamo/ap1
ʤɤΡ줾бǥƤޤǥ쥯ȥ꤬ɬ
פǤDOSHPFS뤤Linuxѡƥ󤫤饤󥹥ȡ
뤳ȤǤޤPlamo Linux¸ߤѡƥ
ƤѡƥꥹȤ򸫤ˤ[enter]
Ƥ \n
EOF
 dialog --title "ѡƥλ" --inputbox \
"`cat /tmp/tmpmsg`" 20 70 2> /tmp/source.part
 if [ $? = 1 -o $? = 255 ]; then
  rm -f /tmp/source.part /tmp/tmpmsg
  exit
 fi
 rm -f /tmp/tmpmsg
 SLACK_DEVICE="`cat /tmp/source.part`"
 rm -f /tmp/source.part
 if [ "$SLACK_DEVICE" = "" ]; then
  dialog --title "ѡƥꥹ" --msgbox "`probe -l | fgrep -v cylind | fgrep dev 2> /dev/null`" 22 75
  continue;
 fi
 break;
done

dialog --title "󥹥ȡ븵ǥ쥯ȥ" --inputbox \
"\n\
ΥѡƥΤɤPlamo LinuxΥΤ\n\
ꤷƤʸġΥǥ륵֥ǥ쥯\n\
ȥ꤬¸ߤǥ쥯ȥǤ\n\
ѡƥƬǥ쥯ȥ꤫Хǥ쥯ȥ\n\
ǻꤹɬפޤ㤨СΥѡƥ/usr \n\
β˥ޥȤϡѥƬ/usrޤƤ\n\
ޤ \n\n\
ɤPlamo LinuxΥޤ \n" \
19 65 2> /tmp/source.dir
if [ $? = 1 -o $? = 255 ]; then
 rm -f /tmp/source.dir
 exit
fi
SLACK_SOURCE_LOCATION="`cat /tmp/source.dir`"
rm -f /tmp/source.dir
if mount | fgrep $SLACK_DEVICE 1> /dev/null 2> /dev/null ; then
 # This partition is already mounted, so we will have to
 # tweak things funny.
 rm -f /var/adm/mount 2> /dev/null
 rmdir /var/adm/mount 2> /dev/null
 PREFIX="`mount | fgrep $SLACK_DEVICE`"
 PREFIX="`echo "$PREFIX" | cut -b14-`"
 end_of_line="1"
 while [ 0 ]; do
  end_of_line="`expr $end_of_line + 1`"
  if [ "`echo "$PREFIX" | cut -b$end_of_line`" = " " ]; then  # Found it!
   end_of_line="`expr $end_of_line - 1`"
   break;
  fi
 done
 PREFIX="`echo "$PREFIX" | cut -b1-$end_of_line`"
 ln -sf $PREFIX /var/adm/mount 
else
 SUCCESS=false
 for type in msdos ext2 hpfs ; do
   mount -t $type $SLACK_DEVICE /var/adm/mount 1> /dev/null 2> /dev/null
   if [ $? = 0 ]; then # mounted successfully 
     SUCCESS=true
     break;
   fi
 done
 if [ ! $SUCCESS = true ]; then # there was a mount error
  cat << EOF > /tmp/tmpmsg
ѡƥޥȤݤ˥顼ȯޤ\n\
ɤޤ

EOF
  dialog --title "ޥȥ顼" --menu "`cat /tmp/tmpmsg`" 10 68 2 \
"Restart" "ľ" \
"Ignore " "顼̵뤷Ʒ³" 2> /tmp/dowhat
  if [ $? = 1 -o $? = 255 ]; then
   rm -f /tmp/dowhat
   exit
  fi
  DOWHAT="`cat /tmp/dowhat`"
  rm -f /tmp/dowhat
  if [ "$DOWHAT" = "Restart" ]; then
   umount /var/adm/mount 2> /dev/null
   continue;
  fi
  echo
 fi # mount error
fi

if [ -d /var/adm/mount/$SLACK_SOURCE_LOCATION ]; then
 echo "/var/adm/mount/$SLACK_SOURCE_LOCATION" > /tmp/SeTDS
 echo "-source_mounted" > /tmp/SeTmount
 echo "/dev/null" > /tmp/SeTsource
 exit
else
 cat << EOF > /tmp/tmpmsg

ޤǥ쥯ȥ$SLACK_SOURCE_LOCATIONϥѡƥ
$SLACK_DEVICEˤ¸ߤޤ

ľޤ
EOF
 dialog --title "󥹥ȡ븵ǥ쥯ȥ꤬Ĥޤ" --yesno "`cat /tmp/tmpmsg`" 10 70
 if [ $? = 1 -o $? = 255 ]; then
  rm -f /tmp/tmpmsg
  exit
 fi
 rm -r /tmp/tmpmsg
fi

done
