OSDN Git Service

The new installer. Supported filesystems are
authorChih-Wei Huang <cwhuang@linux.org.tw>
Mon, 17 Aug 2009 11:25:41 +0000 (19:25 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Mon, 17 Aug 2009 11:25:41 +0000 (19:25 +0800)
* ext2
* ext3
* ntfs
* fat32

You can also install to an existing partition. No need to format it.

30 files changed:
Android.mk
boot/isolinux/android-x86.png [moved from boot/isolinux/splash.png with 81% similarity]
boot/isolinux/isolinux.cfg
initrd/init
initrd/lib/libntfs-3g.so.31 [new file with mode: 0644]
initrd/lib/libpthread.so.0 [new file with mode: 0644]
initrd/lib/librt.so.1 [new file with mode: 0644]
initrd/sbin/mount.ntfs-3g [new file with mode: 0755]
initrd/scripts/0-auto-detect
initrd/scripts/1-install
initrd/scripts/2-mount
install/bin/cfdisk [moved from initrd/bin/cfdisk with 100% similarity]
install/bin/dialog [moved from initrd/bin/dialog with 100% similarity]
install/bin/pv [new file with mode: 0755]
install/grub/android-x86.xpm.gz [new file with mode: 0644]
install/grub/e2fs_stage1_5 [new file with mode: 0644]
install/grub/fat_stage1_5 [new file with mode: 0644]
install/grub/iso9660_stage1_5 [new file with mode: 0644]
install/grub/ntfs_stage1_5 [new file with mode: 0644]
install/grub/stage1 [new file with mode: 0644]
install/grub/stage2 [new file with mode: 0644]
install/grub/stage2_eltorito [new file with mode: 0644]
install/lib/libncursesw.so.5 [moved from initrd/lib/libncursesw.so.5 with 100% similarity]
install/lib/libntfs.so.10 [new file with mode: 0644]
install/lib/libtinfo.so.5 [moved from initrd/lib/libtinfo.so.5 with 100% similarity]
install/lib/libuuid.so.1 [new file with mode: 0644]
install/lib/terminfo/l/linux [moved from initrd/lib/terminfo/l/linux with 100% similarity]
install/sbin/grub [new file with mode: 0755]
install/sbin/mkntfs [new file with mode: 0755]
install/scripts/1-install [new file with mode: 0644]

index 73ccc67..f873f0d 100644 (file)
@@ -2,6 +2,8 @@ ifeq ($(TARGET_ARCH),x86)
 LOCAL_PATH := $(call my-dir)
 include $(CLEAR_VARS)
 
+VER ?= $(shell date +"%F")
+
 LOCAL_MODULE := newinstaller
 LOCAL_MODULE_TAGS := system_builder
 
@@ -26,22 +28,26 @@ $(INITRD_RAMDISK): $(initrd_bin) | $(ACP) $(MKBOOTFS)
        rm -rf $(TARGET_INSTALLER_OUT)
        $(ACP) -pr $(initrd_dir) $(TARGET_INSTALLER_OUT)
        ln -s /bin/ld-linux.so.2 $(TARGET_INSTALLER_OUT)/lib
-       mkdir -p $(addprefix $(TARGET_INSTALLER_OUT)/,android mnt proc sys tmp sfs)
+       mkdir -p $(addprefix $(TARGET_INSTALLER_OUT)/,android mnt proc sys tmp sfs hd)
+       echo "VER=$(VER)" > $(TARGET_INSTALLER_OUT)/scripts/10-ver
        $(MKBOOTFS) $(TARGET_INSTALLER_OUT) | gzip -9 > $@
 
+INSTALL_RAMDISK := $(PRODUCT_OUT)/install.img
+$(INSTALL_RAMDISK): $(wildcard $(LOCAL_PATH)/install/*/*) | $(MKBOOTFS)
+       $(MKBOOTFS) $(dir $(dir $(<D))) | gzip -9 > $@
+
 boot_dir := $(PRODUCT_OUT)/boot
 $(boot_dir): $(wildcard $(LOCAL_PATH)/boot/isolinux/*) | $(ACP)
        rm -rf $@
        $(ACP) -pr $(dir $(<D)) $@
-       $(hide) sed -i "s|CMDLINE|$(BOARD_KERNEL_CMDLINE)|" $@/isolinux/isolinux.cfg
 
-BUILT_IMG := $(addprefix $(PRODUCT_OUT)/,ramdisk.img system.$(if $(MKSQUASHFS),sfs,img) initrd.img)
+BUILT_IMG := $(addprefix $(PRODUCT_OUT)/,system.$(if $(MKSQUASHFS),sfs,img) ramdisk.img initrd.img install.img)
 BUILT_IMG += $(if $(TARGET_PREBUILT_KERNEL),$(TARGET_PREBUILT_KERNEL),$(PRODUCT_OUT)/kernel)
 
 ISO_IMAGE := $(PRODUCT_OUT)/$(TARGET_PRODUCT).iso
 $(ISO_IMAGE): $(boot_dir) $(BUILT_IMG)
        @echo ----- Making iso image ------
-       $(hide) sed -i "s|DATE|`date +"%F"`|" $</isolinux/isolinux.cfg
+       $(hide) sed -i "s|VER|$(VER)|; s|CMDLINE|$(BOARD_KERNEL_CMDLINE)|" $</isolinux/isolinux.cfg
        genisoimage -vJURT -b isolinux/isolinux.bin -c isolinux/boot.cat \
                -no-emul-boot -boot-load-size 4 -boot-info-table \
                -input-charset utf-8 -V "Android LiveCD" -o $@ $^
similarity index 81%
rename from boot/isolinux/splash.png
rename to boot/isolinux/android-x86.png
index 8ed3627..9d69914 100644 (file)
Binary files a/boot/isolinux/splash.png and b/boot/isolinux/android-x86.png differ
index 1e681c1..052a61b 100644 (file)
@@ -1,33 +1,32 @@
 default vesamenu.c32
-#prompt 1
 timeout 600
 
-menu background splash.png
-menu title Android Live & Installation CD (DATE)
+menu background android-x86.png
+menu title Android Live & Installation CD VER
 menu color border 0 #ffffffff #00000000
-menu color sel 7 #ffffffff #ff000000
+menu color sel 7 #ffffff00 #ff000000
 menu color title 0 #ffffffff #00000000
 menu color tabmsg 0 #ffffffff #00000000
 menu color unsel 0 #ffffffff #00000000
-menu color hotsel 0 #ff000000 #ffffffff
-menu color hotkey 7 #ffffffff #ff000000
+menu color hotsel 0 #ffffff00 #ff000000
+menu color hotkey 7 #ffffff00 #00000000
 
 label live
-       menu label Live CD - Run Android without installation
+       menu label Live CD - ^Run Android without installation
        kernel /kernel
        append initrd=/initrd.img CMDLINE quiet SRC= DATA= SDCARD=
 
 label vesa
-       menu label Live CD - VESA mode
+       menu label Live CD - ^VESA mode
        kernel /kernel
        append initrd=/initrd.img CMDLINE quiet vga=788 SRC= DATA= SDCARD=
 
 label debug
-       menu label Live CD - Debug mode
+       menu label Live CD - ^Debug mode
        kernel /kernel
        append initrd=/initrd.img CMDLINE vga=788 DEBUG=1 SRC= DATA= SDCARD=
 
 label install
-       menu label Installation - Install Android to harddisk
+       menu label Installation - ^Install Android to harddisk
        kernel /kernel
-       append initrd=/initrd.img CMDLINE vga=788 INSTALL=1
+       append initrd=/initrd.img CMDLINE INSTALL=1 DEBUG=
index b953ffe..46768e4 100755 (executable)
@@ -24,7 +24,7 @@ busybox --install -s
 
 export PATH=$PATH:/system/bin
 
-if [ -n "$DEBUG" ]; then
+if [ -n "$DEBUG" -o -n "$INSTALL" ]; then
        mknod /dev/tty2 c 4 2 && openvt
        mknod /dev/tty3 c 4 3 && openvt
 fi
@@ -35,9 +35,13 @@ while [ 1 ]; do
        mdev -s
 
        for device in /dev/sr* /dev/sd[a-z]*; do
-               mount -o ro $device /mnt || continue
+               # FIXME: any way to mount ntfs gracefully?
+               mount -o ro $device /mnt || \
+                       mount.ntfs-3g -o rw $device /mnt || \
+                       continue
                cd /mnt/$SRC
                if [ ! -e ramdisk.img -o ! \( -e system.img -o -e system.sfs \) ]; then
+                       cd /
                        umount /mnt
                        continue
                fi
@@ -64,6 +68,11 @@ ln -s android/system /
 
 ln -s ../system/lib/modules /lib
 
+if [ -n "$INSTALL" ]; then
+       cd /
+       zcat /mnt/$SRC/install.img | cpio -iud > /dev/null
+fi
+
 if [ -n "$DEBUG" -o -n "$BUSYBOX" ]; then
        mv /bin /lib .
        system/bin/ln -s android/lib /lib
@@ -86,10 +95,10 @@ for s in `ls /scripts/* /mnt/$SRC/scripts/*`; do
        source $s
 done
 
-load_modules
-
-[ -n "$INSTALL" ] && install_hd
+detect_hardware
+do_install
 
+load_modules
 mount_data
 mount_sdcard
 
@@ -104,4 +113,4 @@ else
        exec switch_root /android /init
 fi
 
-sh # aviod kernel panic
+sh # avoid kernel panic
diff --git a/initrd/lib/libntfs-3g.so.31 b/initrd/lib/libntfs-3g.so.31
new file mode 100644 (file)
index 0000000..0bc7e0d
Binary files /dev/null and b/initrd/lib/libntfs-3g.so.31 differ
diff --git a/initrd/lib/libpthread.so.0 b/initrd/lib/libpthread.so.0
new file mode 100644 (file)
index 0000000..14940ca
Binary files /dev/null and b/initrd/lib/libpthread.so.0 differ
diff --git a/initrd/lib/librt.so.1 b/initrd/lib/librt.so.1
new file mode 100644 (file)
index 0000000..f59ae36
Binary files /dev/null and b/initrd/lib/librt.so.1 differ
diff --git a/initrd/sbin/mount.ntfs-3g b/initrd/sbin/mount.ntfs-3g
new file mode 100755 (executable)
index 0000000..e92da35
Binary files /dev/null and b/initrd/sbin/mount.ntfs-3g differ
index e421ea8..9cbee73 100644 (file)
@@ -1,6 +1,6 @@
 #
 # By Chih-Wei Huang <cwhuang@linux.org.tw>
-# Last updated 2009/07/18
+# Last updated 2009/08/14
 #
 # License: GNU Public License
 # We explicitely grant the right to use the scripts
@@ -27,7 +27,7 @@ auto_detect()
 # PREDEV: any module the drivers depend on but can't be loaded automatically
 # EXTMOD: any other module
 
-get_asus_info()
+asus_info()
 {
        # common for all Eee PC models
        [ -c /dev/fb0 ] || FB0DEV=i915
@@ -79,36 +79,48 @@ get_asus_info()
        esac
 }
 
-get_vbox_info()
+vbox_info()
 {
        LANDEV=pcnet32
        SNDDEV="snd-sb16 isapnp=0 irq=5"
+       VESA=1
 }
 
-get_qemu_info()
+qemu_info()
 {
        LANDEV=8139cp
        SNDDEV=snd-ens1370
 }
 
-get_vmware_info()
+vmware_info()
 {
        LANDEV=pcnet32
        SNDDEV=snd-ens1371
 }
 
-check_product()
-{
-       grep -q "$1" /sys/class/dmi/id/uevent
-}
-
 detect_hardware()
 {
-       check_product ASUSTeK && get_asus_info && return 0
-       check_product Acer.*AO && get_ao_info && return 0
-       check_product VirtualBox && get_vbox_info && return 0
-       check_product QEMU && get_qemu_info && return 0
-       check_product VMware && get_vmware_info && return 0
+       [ "$AUTO" = "1" ] && return
+       case "`cat /sys/class/dmi/id/uevent`" in
+               *ASUSTeK*)
+                       get_info=asus_info
+                       ;;
+               *Acer*AO*)
+                       get_info=ao_info
+                       ;;
+               *VirtualBox*)
+                       get_info=vbox_info
+                       ;;
+               *QEMU*)
+                       get_info=qemu_info
+                       ;;
+               *VMware*)
+                       get_info=vmware_info
+                       ;;
+               *)
+                       ;;
+       esac
+       [ -n "$get_info" ] && $get_info && FOUND=1
 }
 
 find_wifi_dev_name()
@@ -125,8 +137,7 @@ find_wifi_dev_name()
 
 load_modules()
 {
-       [ -z "$AUTO" ] && detect_hardware
-       if [ $? -eq 0 ]; then
+       if [ -n "$FOUND" ]; then
                for m in $PREDEV $EXTMOD; do
                        modprobe $m
                done
@@ -140,6 +151,7 @@ load_modules()
        fi
 
        mdev -s
+       [ -c /dev/video0 ] || modprobe vivi
        [ -d /proc/asound/card0 ] || modprobe snd-dummy
        [ -c /dev/fb0 ] || modprobe uvesafb mode_option=${UVESA_MODE:-800x600}-16 ${UVESA_OPTION:-mtrr=3 scroll=ywrap}
 
index 0c66daa..9ba86f3 100644 (file)
@@ -1,13 +1,14 @@
 #
 # By Chih-Wei Huang <cwhuang@linux.org.tw>
-# Last updated 2009/07/18
+# Last updated 2009/08/17
 #
 # License: GNU Public License
 # We explicitely grant the right to use the scripts
 # with Android-x86 project.
 #
 
-install_hd()
+do_install()
 {
+       [ -z "$INSTALL" ] && return
        dialog --title " WARNING " --msgbox '\n  Installation is not implemented yet.\n  Press OK to run live version.' 8 45
 }
index d2c15a9..447514e 100644 (file)
@@ -1,6 +1,6 @@
 #
 # By Chih-Wei Huang <cwhuang@linux.org.tw>
-# Last updated 2009/07/21
+# Last updated 2009/08/13
 #
 # License: GNU Public License
 # We explicitely grant the right to use the scripts
@@ -9,6 +9,7 @@
 
 mount_data()
 {
+       mountpoint -q data && return
        if [ -b "$DATA" ]; then
                mount $DATA data
        elif [ -b "/dev/$DATA" ]; then
@@ -23,6 +24,7 @@ mount_data()
 
 mount_sdcard()
 {
+       mountpoint -q sdcard && return
        if [ -n "$SDCARD" ]; then
                [ -b "$SDCARD" ] && SDCARD=`echo $SDCARD | sed "s|/dev/||g"`
                if [ -b "/dev/$SDCARD" ]; then
similarity index 100%
rename from initrd/bin/cfdisk
rename to install/bin/cfdisk
similarity index 100%
rename from initrd/bin/dialog
rename to install/bin/dialog
diff --git a/install/bin/pv b/install/bin/pv
new file mode 100755 (executable)
index 0000000..07c591a
Binary files /dev/null and b/install/bin/pv differ
diff --git a/install/grub/android-x86.xpm.gz b/install/grub/android-x86.xpm.gz
new file mode 100644 (file)
index 0000000..946dbe6
Binary files /dev/null and b/install/grub/android-x86.xpm.gz differ
diff --git a/install/grub/e2fs_stage1_5 b/install/grub/e2fs_stage1_5
new file mode 100644 (file)
index 0000000..9fd6c3c
Binary files /dev/null and b/install/grub/e2fs_stage1_5 differ
diff --git a/install/grub/fat_stage1_5 b/install/grub/fat_stage1_5
new file mode 100644 (file)
index 0000000..f9a5384
Binary files /dev/null and b/install/grub/fat_stage1_5 differ
diff --git a/install/grub/iso9660_stage1_5 b/install/grub/iso9660_stage1_5
new file mode 100644 (file)
index 0000000..2261b4a
Binary files /dev/null and b/install/grub/iso9660_stage1_5 differ
diff --git a/install/grub/ntfs_stage1_5 b/install/grub/ntfs_stage1_5
new file mode 100644 (file)
index 0000000..ded9f4f
Binary files /dev/null and b/install/grub/ntfs_stage1_5 differ
diff --git a/install/grub/stage1 b/install/grub/stage1
new file mode 100644 (file)
index 0000000..e5c292c
Binary files /dev/null and b/install/grub/stage1 differ
diff --git a/install/grub/stage2 b/install/grub/stage2
new file mode 100644 (file)
index 0000000..e49b305
Binary files /dev/null and b/install/grub/stage2 differ
diff --git a/install/grub/stage2_eltorito b/install/grub/stage2_eltorito
new file mode 100644 (file)
index 0000000..9c1685a
Binary files /dev/null and b/install/grub/stage2_eltorito differ
diff --git a/install/lib/libntfs.so.10 b/install/lib/libntfs.so.10
new file mode 100644 (file)
index 0000000..7a186bf
Binary files /dev/null and b/install/lib/libntfs.so.10 differ
diff --git a/install/lib/libuuid.so.1 b/install/lib/libuuid.so.1
new file mode 100644 (file)
index 0000000..64a0302
Binary files /dev/null and b/install/lib/libuuid.so.1 differ
diff --git a/install/sbin/grub b/install/sbin/grub
new file mode 100755 (executable)
index 0000000..80457f4
Binary files /dev/null and b/install/sbin/grub differ
diff --git a/install/sbin/mkntfs b/install/sbin/mkntfs
new file mode 100755 (executable)
index 0000000..47dfd40
Binary files /dev/null and b/install/sbin/mkntfs differ
diff --git a/install/scripts/1-install b/install/scripts/1-install
new file mode 100644 (file)
index 0000000..1151b37
--- /dev/null
@@ -0,0 +1,210 @@
+#
+# By Chih-Wei Huang <cwhuang@linux.org.tw>
+# Last updated 2009/08/14
+#
+# License: GNU Public License
+# We explicitely grant the right to use the scripts
+# with Android-x86 project.
+#
+
+tempfile=/tmp/temp-$$
+menufile=/tmp/menu-$$
+
+rebooting()
+{
+       dialog --title " Rebooting... " --nocancel --pause "" 8 41 1
+       sync
+       umount -a
+       reboot -f
+}
+
+choose()
+{
+       dialog --clear --title " $1 " \
+               --menu "$2" 20 71 13 --file $menufile 2> $tempfile
+
+       retval=$?
+       choice=`cat $tempfile`
+}
+
+select_dev()
+{
+       fdisk -l | grep ^/dev | cut -b6-12,55- | awk '{
+               if (!match($2, "Extended")) {
+                       printf("\"%-28s", $0)
+                       system("echo -n `cat /sys/block/*/"$1"/../device/model`")
+                       printf("\" \"\"\n")
+               }
+       } END {
+               printf("\"Create/Modify partitions\" \"\"\n\"Detect devices\" \"\"")
+       }' > $menufile
+       choose "Choose Partition" "Please select a partition to install Android-x86:"
+       return $retval
+}
+
+progress_bar()
+{
+       dialog --clear --title " $1 " --gauge "\n $2" 8 70
+}
+
+format_fs()
+{
+       local cmd
+       echo -e '"Do not format" ""\next3 ""\next2 ""\nntfs ""\nfat32 ""' > $menufile
+       choose "Choose filesystem" "Please select a filesystem to format $1:"
+       case "$choice" in
+               ext3)
+                       cmd="mke2fs -jL"
+                       ;;
+               ext2)
+                       cmd="mke2fs -L"
+                       ;;
+               ntfs)
+                       cmd="mkntfs -fL"
+                       ;;
+               fat32)
+                       cmd="mkdosfs -vn"
+                       ;;
+               *)
+                       ;;
+       esac
+       if [ -n "$cmd" ]; then
+               dialog --title " Confirm " --no-label Skip --yesno \
+                       "\n You chose to format $1 to $choice.\n All data in that partition will LOSE.\n\n Are you sure to format the partition $1?" 10 51
+               [ $? -ne 0 ] && return 1
+               $cmd Android-x86 /dev/$1 | awk '{
+                       # FIXME: very imprecise progress
+                       if (match($0, "done"))
+                               printf("%d\n", i+=33)
+               }' | progress_bar "Formatting" "Formatting partition $1..."
+       fi
+}
+
+create_entry()
+{
+       title=$1
+       shift
+       echo -e "title $title\n\tkernel /$asrc/kernel$vga $@ SRC=/$asrc\n\tinitrd /$asrc/initrd.img\n" >> $menulst
+}
+
+create_menulst()
+{
+       menulst=/hd/grub/menu.lst
+       [ -n "$VESA" ] && vga=" vga=788"
+       echo -e "default=0\ntimeout=6\nroot (hd0,$1)\nsplashimage=/grub/android-x86.xpm.gz\n" > $menulst
+       cmdline=`cat /proc/cmdline | sed "s|\(initrd.*img *\)||; s|\(INSTALL=$INSTALL *\)||; s|\(SRC=$SRC *\)||; s|\(DEBUG=$DEBUG *\)||; s|\(BOOT_IMAGE.*\)||"`
+
+       create_entry "Android-x86 $VER" quiet $cmdline
+       create_entry "Android-x86 $VER (Debug mode)" $cmdline DEBUG=1
+}
+
+install_to()
+{
+       mountpoint -q /hd && umount /hd
+       while [ 1 ]; do
+               format_fs $1
+               for m in mount /sbin/mount.*; do
+                       # FIXME: how to mount fuse filesystem automatically?
+                       $m /dev/$1 /hd && break
+               done
+               [ $? -eq 0 ] && break
+               dialog --clear --title " Error " --defaultno --yesno \
+                       "\n Cannot mount /dev/$1\n Do you want to format it?" 8 37
+               [ $? -ne 0 ] && return 255
+       done
+
+       fs=`cat /proc/mounts | grep /dev/$1 | awk '{ print $3 }'`
+       if [ "$fs" = "vfat" ]; then
+               dialog --title " Warning " --yesno \
+                       "\nYou are going to install Android-x86 to a fat32 partition. Though this is possible, android cannot save user data to that partition. So data will be save to a RAMDISK(tmpfs), and lose after power off.\n\nAre you sure to continue?" 12 63
+               [ $? -ne 0 ] && return 1
+       fi
+
+       asrc=android-$VER
+       dialog --title " Confirm " --no-label Skip --yesno \
+               "\n Do you want to install boot loader GRUB?" 7 47
+       if [ $? -eq 0 ]; then
+               cp -af /grub /hd
+               d=0
+               while [ 1 ]; do
+                       h=`echo $d | awk '{ printf("%c", $1+97) }'`
+                       [ -d /sys/block/[sh]d$h/$1 ] && break
+                       d=$(($d+1))
+               done
+               p=$((`echo $1 | sed "s/sd$h//"`-1))
+               create_menulst $p
+               echo "setup (hd$d) (hd$d,$p)" | grub > /dev/tty5
+               [ $? -ne 0 ] && return 255
+       fi
+
+       cd /mnt/$SRC
+       files="kernel initrd.img ramdisk.img system.*"
+       size=0
+       for s in `ls -ks $files | awk '{print $1}'`; do
+               size=$(($size+$s))
+       done
+       mkdir /hd/$asrc
+       ( ls $files | cpio -H newc -o | pv -ns ${size}k | ( cd /hd/$asrc; cpio -iud > /dev/null; echo $? > /tmp/result )) 2>&1 \
+               | progress_bar "Installing Android-x86" "Expect to write $size KB..."
+
+       chmod 644 /hd/$asrc/*
+       chown 0.0 /hd/$asrc/*
+       [ "$fs" != "vfat" ] && mkdir /hd/$asrc/data
+       sync
+
+       return $((`cat /tmp/result`*255))
+}
+
+install_hd()
+{
+       mdev -s
+       select_dev || rebooting
+       retval=1
+       case "$choice" in
+               [sh]d*)
+                       install_to $choice
+                       retval=$?
+                       ;;
+               Create*)
+                       cfdisk
+                       ;;
+               Detect*)
+                       dialog --title " Detecting... " --nocancel --pause "" 8 41 1
+                       ;;
+       esac
+       return $retval
+}
+
+do_install()
+{
+       echo "0 0 0 0" > /proc/sys/kernel/printk
+       until install_hd; do
+               if [ $retval -eq 255 ]; then
+                       dialog --title ' Error! ' --yes-label Retry --no-label Reboot \
+                               --yesno '\n      Installation failed!' 7 35
+                       [ $? -eq 1 ] && rebooting
+               fi
+       done
+
+       echo -e '"Run Android-x86" ""\n"Reboot" ""' > $menufile
+       dialog --clear --title ' Congratulations! ' \
+               --menu "\n Android-x86 is installed successfully.\n " 11 51 13 \
+               "Run Android-x86" "" "Reboot" "" 2> $tempfile
+       case "`cat $tempfile`" in
+               Run*)
+                       cd /android
+                       umount system
+                       if mountpoint -q /sfs; then
+                               umount /sfs
+                               mount -o loop /hd/$asrc/system.sfs /sfs
+                               mount -o loop /sfs/system.img system
+                       else
+                               mount -o loop /hd/$asrc/system.img system
+                       fi
+                       [ -d /hd/$asrc/data ] && mount --bind /hd/$asrc/data data
+                       ;;
+               Reboot)
+                       rebooting
+                       ;;
+       esac
+}