diff options
author | Matthias Hentges <oe@hentges.net> | 2007-03-28 22:13:05 +0000 |
---|---|---|
committer | Matthias Hentges <oe@hentges.net> | 2007-03-28 22:13:05 +0000 |
commit | 2992d24c5ad56361a793281566b1ff7c76aa2836 (patch) | |
tree | 5c34807a2a39f0893cbfa9677a614aacc8fbe5c1 /packages/altboot/files/altboot-menu/Advanced | |
parent | 7e18fbe25e35f1801955ee150622761a07c8b8f1 (diff) |
altboot:
- Drop files/* and altboot_0.0.0.bb
- Add altboot_svn.bb
- Add README.txt explaining what the different versions do
Diffstat (limited to 'packages/altboot/files/altboot-menu/Advanced')
9 files changed, 0 insertions, 1109 deletions
diff --git a/packages/altboot/files/altboot-menu/Advanced/.mtn2git_empty b/packages/altboot/files/altboot-menu/Advanced/.mtn2git_empty deleted file mode 100644 index e69de29bb2..0000000000 --- a/packages/altboot/files/altboot-menu/Advanced/.mtn2git_empty +++ /dev/null diff --git a/packages/altboot/files/altboot-menu/Advanced/30-bootUSB-Stick b/packages/altboot/files/altboot-menu/Advanced/30-bootUSB-Stick deleted file mode 100644 index b573e7a10c..0000000000 --- a/packages/altboot/files/altboot-menu/Advanced/30-bootUSB-Stick +++ /dev/null @@ -1,47 +0,0 @@ -# !/bin/sh -# -# Copyright Matthias Hentges (c) 2005 -# -# License: GPL (see http://www.gnu.org/licenses/gpl.txt for a copy of the GPL) - - -M_TITLE="Boot USB Storage" - -test "$USB_HOST_AVAILABLE" = "yes" || exit 0 - -# This function is activated by init.altboot by calling this script with the "run" option -run_module() { - - test -e /etc/altboot.func && . /etc/altboot.func || die "ERROR: /etc/altboot.func not found. Check your installation!" - - # Mount /proc, etc - init_rootfs - - echo "Starting USB..." - - for module in $USB_STORAGE_MODULES - do - echo -en "\t - $module: " - modprobe "$module" >/dev/null 2>&1 && echo ok || die "Failed to modprobe [$module]" - done - - echo -n "Mounting $USB_STORAGE_PARTITION..." >/dev/tty0 - - mkdir -p /media/usb-storage >/dev/null 2>&1 - - sleep "$USB_STORAGE_WAIT" - - /bin/mount -t auto -o defaults,noatime $USB_STORAGE_PARTITION /media/usb-storage >/dev/null 2>&1 && echo ok >/dev/tty0|| die "/bin/mount -t auto -o defaults,noatime $SD_DEVICE $SD_MOUNTPOINT failed" - - echo "" - - # Check for a real fs and loop-images. - check_target "/media/usb-storage" >/dev/tty0 -} - - -case "$1" in -title) echo "$M_TITLE";; -run) run_module "$2";; -esac - diff --git a/packages/altboot/files/altboot-menu/Advanced/40-bootNFS b/packages/altboot/files/altboot-menu/Advanced/40-bootNFS deleted file mode 100644 index 4f5c195be2..0000000000 --- a/packages/altboot/files/altboot-menu/Advanced/40-bootNFS +++ /dev/null @@ -1,110 +0,0 @@ -#! /bin/sh -# -# Copyright Matthias Hentges <devel@hentges.net> (c) 2006 -# License: GPL (see http://www.gnu.org/licenses/gpl.txt for a copy of the license) -# -# Filename: 40-bootNFS -# Date: 14-Apr-06 - - -M_TITLE="Boot from NFS" - -test "$DISABLE_NFS_BOOT" = yes && exit 0 - -# This function is activated by init.altboot by calling this script with the "run" option -run_module() { - - test -e /etc/altboot.func && . /etc/altboot.func || die "ERROR: /etc/altboot.func not found. Check your installation!" - - # Mount /proc, etc - init_rootfs - - nfs_host="`cat /etc/fstab | grep -v ^# | grep nfs | awk '{print $1}'|sed -n "s/\(.*\)\:\(.*\)/\1/p" `" - nfs_mounts="`cat /etc/fstab | grep -v ^# | grep nfs | awk '{print $1}'`" - nfs_mountpoints="`cat /etc/fstab | grep -v ^# | grep nfs | awk '{print $2}'`" - - start_networking "$nfs_host" - - if test -z "$nfs_host" - then - mdie "${C_RED}No configured NFS drives found in /etc/fstab$C_RESET" - - fi - - - if test "` echo "$nfs_mountpoints" |wc -l | tr -d " "`" -gt 1 - then - echo -e "Please select your NFS root:\n" - - cnt=1 - for nfs_mount in $nfs_mountpoints - do - echo -e "\t[$cnt] $nfs_mount" - let cnt=$cnt+1 - done - - echo "" - - while test -z "$selection" - do - stty echo - echo -n "Boot NFS root: " - - if test "$AUTOBOOT" != "yes" - then - read junk < /dev/tty1 - else - if test -e /etc/.altboot-bootNFS-source.last - then - junk="`cat /etc/.altboot-bootNFS-source.last`" - test -z "$junk" && read junk < /dev/tty1 || echo "$junk (autoboot)" - else - read junk < /dev/tty1 - fi - fi - - - cnt=1 - for nfs_mount in $nfs_mounts - do - if test "$junk" = "$cnt" - then - selection="$nfs_mount" - echo "$junk" > /etc/.altboot-bootNFS-source.last - fi - let cnt=$cnt+1 - done - - done - else - test -z "$nfs_mounts" && die "No NFS mounts configured in /etc/fstab!" - selection="$nfs_mounts" - fi - - mkdir -p /media/nfsroot || mdie "mkdir -p /media/nfsroot failed!" - - echo -n "Mounting NFS root..." - - if ( mount | grep -q "/media/nfsroot" ) - then - echo "/media/nfsroot already used, tying to umount..." - umount /media/image - losetup -d /dev/loop0 - umount /media/nfsroot || die "umount failed!" - fi - - mount -t nfs "$selection" /media/nfsroot && echo ok || mdie "mount -t nfs "$selection" /media/nfsroot failed!" - - # Use configured resolv.conf in the pivoted rootfs - #echo -n "Copying resolv.conf..." - #cp /etc/resolv.conf /media/nfsroot/etc && echo ok || echo "FAILED" - - check_target "/media/nfsroot" bootNFS - -} - -case "$1" in -title) echo "$M_TITLE";; -run) run_module "$2";; -esac - diff --git a/packages/altboot/files/altboot-menu/Advanced/55-bin-sh b/packages/altboot/files/altboot-menu/Advanced/55-bin-sh deleted file mode 100644 index e4fe99ebae..0000000000 --- a/packages/altboot/files/altboot-menu/Advanced/55-bin-sh +++ /dev/null @@ -1,27 +0,0 @@ -# !/bin/sh -M_TITLE="init=/bin/sh" - -test "$DISABLE_BINSH_BOOT" = yes && exit 0 - -run_module() { - - test -e /etc/altboot.func && . /etc/altboot.func || die "ERROR: /etc/altboot.func not found. Check your installation!" - - test "$ASK_PW_ON_BOOT" != "yes" && verify_master_pw >/dev/$OUT_TTY - - # Mount /proc, etc - init_rootfs - - echo -e "\nBoot system with 'exec /sbin/init 5'\n" - while true - do - exec $SH_SHELL </dev/$OUT_TTY >/dev/$OUT_TTY 2>&1 - echo "WARNING: Shell was killed!" - done -} - -case "$1" in -title) echo "$M_TITLE";; -run) run_module;; -esac - diff --git a/packages/altboot/files/altboot-menu/Advanced/60-orig-init b/packages/altboot/files/altboot-menu/Advanced/60-orig-init deleted file mode 100644 index ad9f2c78e1..0000000000 --- a/packages/altboot/files/altboot-menu/Advanced/60-orig-init +++ /dev/null @@ -1,20 +0,0 @@ -# !/bin/sh -M_TITLE="Boot original INIT" - -exit 0 - -run_module() { - - test -e /etc/altboot.func && . /etc/altboot.func || die "ERROR: /etc/altboot.func not found. Check your installation!" - - echo "altboot: Using real init [$REAL_INIT] [$INIT_RUNLEVEL] *" >/dev/tty1 - exec $REAL_INIT $INIT_RUNLEVEL - exit 0 - -} - -case "$1" in -title) echo "$M_TITLE";; -run) run_module;; -esac - diff --git a/packages/altboot/files/altboot-menu/Advanced/70-install-tgz b/packages/altboot/files/altboot-menu/Advanced/70-install-tgz deleted file mode 100644 index b6e5d94d5d..0000000000 --- a/packages/altboot/files/altboot-menu/Advanced/70-install-tgz +++ /dev/null @@ -1,266 +0,0 @@ -#!/bin/sh -M_TITLE="Install RootFS from tar.gz" -M_FLAGS="noRemember" - -test "$DISABLE_INSTTGZ_BOOT" = yes && exit 0 - -run_module(){ - test -e /etc/altboot.func && . /etc/altboot.func || die "ERROR: /etc/altboot.func not found. Check your installation!" - - # Mount /proc, etc - init_rootfs - - # Mount - mount_sd ingore_errors - mount_cf - mount_home - - for source in /home /media/card /media/cf - do - #echo "source: [$source]" - rootfs_files="`ls -1 $source | grep "rootfs.tar.gz"`" - - #echo "rootfs_file: [$rootfs_files]" - if test "`echo "$rootfs_files" | wc -l | tr -d " "`" -gt 1 - then - echo "Multiple rootfs files not supported, yet" - else - if test -n "$rootfs_files" - then - rootfs_source="$source/$rootfs_files" - echo "Using [$rootfs_source]" - break - fi - fi - done - - test -z "$rootfs_source" && die "No rootfs.tar.gz found" - - echo -e "\nPlease choose the target of this installation:\n" - - echo -e "\t [1] SD / MMC" - echo -e "\t [2] Compact Flash" - - echo "" - while true - do - echo -n "Your target: " - read junk - - case "$junk" in - 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 - - echo -e "\nPlease choose the type of this installation:\n" - - echo -e "\t [1] Imagefile (loopfile)" - echo -e "\t [2] Direct Install" - - echo "" - while true - do - echo -n "Install type: " - read junk - - case "$junk" in - 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 - - case "$rootfs_type" in - image) install_rootfs_image "$rootfs_target";; - direct) install_rootfs_direct "$rootfs_target";; - esac -} - -clear_directories(){ - test "$1" = "/" -o "$1" = "/ " && die "clear_directories(): You don't want to do that." - - ! test -d "$1" && die "clear_directories(): [$1] not found." - - for d in bin dev media proc sys usr boot etc lib mnt sbin tmp var - do - if test -d "$1/$d" - then - echo "Removing [$1/$d]..." - rm -rf "$1/$d" - fi - 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 "Remove old directories? [Y|n] " - read junk </dev/tty0 >/dev/tty0 2>&1 - - case "$junk" in - Y|y|"") clear_directories "$1"; break ;; - esac - done - - echo "Please press <ENTER> to begin the installation" - read junk </dev/tty0 >/dev/tty0 2>&1 - - test -d "$1" || die "Directory [$1] not found" - - echo -n "Installing rootfs, please wait..." - tar -xzf "$rootfs_source" -C "$1" >/dev/null 2>&1 && echo ok || die "tar -xzf \"$rootfs_source\" -C \"$1\" failed!" - - echo -n "Syncing drives..." - sync - echo "done" - -# umount "$1" - - echo "Press <ENTER> to bring up the altboot menu" - read junk </dev/tty0 >/dev/tty0 2>&1 - exec /sbin/init.altboot -force - -} - -install_rootfs_image(){ - - mount | grep -q "$1 " || die "Installation target [$1] not mounted" - - echo "" - echo "Please enter a name for the image file." - echo "Do not use the <space> character" - echo "" - - - while true - do - echo -n "Image name: " - read junk - - if test -n "$junk" - then - if test -e "$1/boot-images/${junk}-rootfs.bin" - then - echo -e "\nFile [$1/boot-images/${junk}-rootfs.bin] already exists." - - while true - do - echo -n "Overwrite? [y|N] " - read junk2 - - case "$junk2" in - Y|y) break;; - n|N|"") install_rootfs_image "$1" - exit 0;; - esac - done - rootfs_image_name="${junk}-rootfs.bin" - break - else - echo -n "Use [$junk] as name? [Y|n] " - read junk2 - - case "$junk2" in - "Y"|"y"|"") rootfs_image_name="${junk}-rootfs.bin" - break ;; - *) echo "err ]$junk]";; - esac - fi - fi - done - - echo "" - echo "Please enter the image size in MegaBytes" - echo "Must be at least 30Mb" - echo "" - - while true - do - echo -n "Image size: " - read junk - - junk="`echo "$junk" | sed "s/[a-zA-Z]//g"`" - - if test -n "$junk" - then - if test "$junk" -gt 29 - then - echo -n "Is [${junk}Mb] correct? [Y|n] " - read junk2 - - case "$junk2" in - Y|y|"") rootfs_image_size="$junk" - break ;; - esac - - else - echo "Image size of [${junk}Mb] is too small!" - fi - fi - done - - test -z "$rootfs_image_name" -o -z "$rootfs_image_size" && die "DEBUG: Empty VAR in install_rootfs_image()" - - echo "" - echo "Creating [$rootfs_image_name] (${rootfs_image_size}Mb) on [$1]" - echo "Please wait..." - mkdir -p "$1/boot-images" - - dd if=/dev/zero of="$1/boot-images/$rootfs_image_name" bs=1024k count=$rootfs_image_size >/dev/null - - echo -n "Creating an ext2 filesystem on $rootfs_image_name..." - losetup /dev/loop0 "$1/boot-images/$rootfs_image_name" || die "losetup /dev/loop0 \"$1/boot-images/$rootfs_image_name\" failed!" - mkfs.ext2 -m0 /dev/loop0 >/dev/null 2>&1 && echo done || die "mkfs.ext2 -m0 /dev/loop0 failed!" - - echo -n "Mounting loopfile..." - mkdir -p /media/image - mount /dev/loop0 /media/image && echo ok || die "mount /dev/loop0 /media/image failed!" - - echo -n "Installing rootfs, please wait..." - tar -xzf "$rootfs_source" -C "/media/image" >/dev/null 2>&1 && echo ok || die "tar -xzf \"$rootfs_source\" -C \"$1\" failed!" - - echo -n "Syncing drives..." - sync - echo "done" - - umount "/media/image" && losetup -d /dev/loop0 - - echo "Press <ENTER> to bring up the altboot menu" - read junk </dev/tty0 >/dev/tty0 2>&1 - exec /sbin/init.altboot -force - -} - - - -#run_module - -case "$1" in -title) echo "$M_TITLE";; -flags) echo "$M_FLAGS";; -run) run_module "$2";; -esac diff --git a/packages/altboot/files/altboot-menu/Advanced/70-setKernel b/packages/altboot/files/altboot-menu/Advanced/70-setKernel deleted file mode 100644 index 50f61d034f..0000000000 --- a/packages/altboot/files/altboot-menu/Advanced/70-setKernel +++ /dev/null @@ -1,68 +0,0 @@ -# !/bin/sh -M_TITLE="Choose kernel for next boot" - -# Deprecated due to altbootctl -exit 0 - -# Only kernel 2.6 offers kexec support -uname -r | grep -q "^2.6" || exit 0 - -run_module() { - - test -e /etc/altboot.func && . /etc/altboot.func || die "ERROR: /etc/altboot.func not found. Check your installation!" - - test -z "$KEXEC_KERNEL_DIR" && KEXEC_KERNEL_DIR="/boot" - test -x "$KEXEC_BIN" || mdie "kexec-tools not found [$KEXEC_BIN]" - - # Mount /proc, etc - # init_rootfs - - if test `ls -1 $KEXEC_KERNEL_DIR | grep -v "kexec.cfg" | wc -l | tr -d " "` -gt 1 - then - echo -e "\nSelect the kernel for use of the next boot:\n" - - cnt=1 ; reset_pref "kexec_klist" - for k in `ls -1 $KEXEC_KERNEL_DIR/zImage* | grep -v "kexec.cfg" ` - do - echo -e "\t[$cnt] $k" - set_pref "kexec_klist" "$cnt" "$k" - - let cnt=$cnt+1 - done - - echo "" - - while true - do - echo -n "Select a kernel: " - read junk - - #echo_pref kexec_klist - - get_pref "kexec_klist" "$junk" KEXEC_SELECTED_KERNEL && break - - done - else - KEXEC_SELECTED_KERNEL="`ls -1 $KEXEC_KERNEL_DIR/zImage* | grep -v "kexec.cfg" `" - fi - - echo -e "\nUsing [$KEXEC_SELECTED_KERNEL]" - - if ! test -e "$KEXEC_SELECTED_KERNEL.kexec.cfg" - then - echo -e "\nWARNING: This kernel has not been configured." - echo -e "It will only boot correctly if CMDLINE is compiled in.\n" - fi - - export USE_KEXEC_ON_NEXT_BOOT=yes - export KEXEC_SELECTED_KERNEL - show_menu -} - - - -case "$1" in -title) echo "$M_TITLE";; -run) run_module;; -esac - diff --git a/packages/altboot/files/altboot-menu/Advanced/80-configure-kexec b/packages/altboot/files/altboot-menu/Advanced/80-configure-kexec deleted file mode 100644 index 1b8fc6e547..0000000000 --- a/packages/altboot/files/altboot-menu/Advanced/80-configure-kexec +++ /dev/null @@ -1,248 +0,0 @@ -# !/bin/sh -M_TITLE="Configure kexec CMDLINE" - -# Deprecated due to altbootctl -exit 0 - - -# Only kernel 2.6 offers kexec support -uname -r | grep -q "^2.6" || exit 0 - -run_module() { - - test -e /etc/altboot.func && . /etc/altboot.func || die "ERROR: /etc/altboot.func not found. Check your installation!" - - test -z "$KEXEC_KERNEL_DIR" && KEXEC_KERNEL_DIR="/boot" - test -x "$KEXEC_BIN" || mdie "kexec-tools not found [$KEXEC_BIN]" - - # Mount /proc, etc - init_rootfs - - if test `ls -1 $KEXEC_KERNEL_DIR | grep -v "kexec.cfg" | wc -l | tr -d " "` -gt 1 - then - echo -e "\nPlease select the kernel you want to configure:\n" - - cnt=1 ; reset_pref "kexec_klist" - for k in `ls -1 $KEXEC_KERNEL_DIR/zImage* | grep -v "kexec.cfg" ` - do - echo -e "\t[$cnt] $k" - set_pref "kexec_klist" "$cnt" "$k" - - let cnt=$cnt+1 - done - - echo "" - - while true - do - echo -n "Select a kernel: " - read junk - - get_pref "kexec_klist" "$junk" KEXEC_KERNEL && break - - done - else - KEXEC_KERNEL="`ls -1 $KEXEC_KERNEL_DIR/zImage* | grep -v "kexec.cfg" `" - fi - - echo -e "\nUsing [$KEXEC_KERNEL]" - - configure_rootdev - configure_roottype - configure_verbose - configure_custom - - CMDLINE="console=ttyS0,115200n8 console=tty1 dyntick=enable fbcon=rotate:1 noinitrd root=$KERNEL_ROOTDEV rootfstype=$KERNEL_ROOTFSTYPE $KERNEL_VERBOSE $KERNEL_CUSTOM" - - echo -en "\nWriting CMDLINE to $KEXEC_KERNEL.kexec.cfg..." - echo "$CMDLINE" > $KEXEC_KERNEL.kexec.cfg && echo ok || mdie FAILED - - show_menu -} - -configure_rootdev() { - - echo -e "\nPlease choose a root device (root=*):\n" - - cnt=1 ; reset_pref "kexec_rootdev" - for root in /dev/mtdblock2 /dev/hda1 "Manual Entry" - do - echo -e "\t[$cnt] $root" - set_pref kexec_rootdev "$cnt" "$root" - let cnt=cnt+1 - done - - echo "" - - while true - do - echo -n "Select a root device: " - read junk - - get_pref kexec_rootdev "$junk" KERNEL_ROOTDEV && break - done - - if test "$KERNEL_ROOTDEV" = "Manual Entry" - then - echo "" - - KERNEL_ROOTDEV="" - - while test -z "$KERNEL_ROOTDEV" - do - while true - do - echo -n "Enter the root device: " - read junk - test -n "$junk" && break - done - - echo -en "\nIs [$junk] correct? [Y|n] " - read junk2 - while true - do - if test "$junk2" = y -o "$junk2" = Y -o -z "$junk2" - then - KERNEL_ROOTDEV="$junk" - break - fi - - break - done - done - fi - - echo "Using [$KERNEL_ROOTDEV] as root device" -} - -configure_roottype() { - - echo -e "\nPlease choose a rootfs type (rootfs=*):\n" - - cnt=1 ; reset_pref "kexec_rootfstype" - for root in jffs2 ext2 ext3 "Manual Entry" - do - echo -e "\t[$cnt] $root" - set_pref kexec_rootfstype "$cnt" "$root" - let cnt=cnt+1 - done - - echo "" - - while true - do - echo -n "Select a rootfs type: " - read junk - - get_pref kexec_rootfstype "$junk" KERNEL_ROOTFSTYPE && break - done - - if test "$KERNEL_ROOTFSTYPE" = "Manual Entry" - then - echo "" - - KERNEL_ROOTFSTYPE="" - - while test -z "$KERNEL_ROOTFSTYPE" - do - while true - do - echo -n "Enter the rootfs type: " - read junk - test -n "$junk" && break - done - - echo -en "\nIs [$junk] correct? [Y|n] " - read junk2 - while true - do - if test "$junk2" = y -o "$junk2" = Y -o -z "$junk2" - then - KERNEL_ROOTFSTYPE="$junk" - break - fi - - break - done - done - fi - - echo "Using [$KERNEL_ROOTFSTYPE] as rootfs type" -} - -configure_verbose() { - echo -e "\nDo you want to see kernel messages? ([quiet | debug]):\n" - - echo -e "\t[1] Yes" - echo -e "\t[2] No" - - echo "" - - while true - do - echo -n "Select one of the above: " - read junk - - test "$junk" = 1 -o "$junk" = 2 && break - done - - test "$junk" = 1 && KERNEL_VERBOSE="debug" || KERNEL_VERBOSE="quiet" - -} - -configure_custom() { - echo -e "\nDo you want to set custom kernel options?\n" - - echo -e "\t[1] Yes" - echo -e "\t[2] No" - - echo "" - - while true - do - echo -n "Select one of the above: " - read junk - - test "$junk" = 1 -o "$junk" = 2 && break - done - - if test "$junk" = 1 - then - - echo "" - - KERNEL_CUSTOM="" - - while test -z "$KERNEL_CUSTOM" - do - while true - do - echo -n "Enter kernel options: " - read junk - test -n "$junk" && break - done - - echo -en "\nIs [$junk] correct? [Y|n] " - read junk2 - while true - do - if test "$junk2" = y -o "$junk2" = Y -o -z "$junk2" - then - KERNEL_CUSTOM="$junk" - break - fi - - break - done - done - fi - - echo "Using [$KERNEL_CUSTOM] as custom kernel options" - -} - -case "$1" in -title) echo "$M_TITLE";; -run) run_module;; -esac - diff --git a/packages/altboot/files/altboot-menu/Advanced/80-copyrootfs b/packages/altboot/files/altboot-menu/Advanced/80-copyrootfs deleted file mode 100644 index 2d305e349f..0000000000 --- a/packages/altboot/files/altboot-menu/Advanced/80-copyrootfs +++ /dev/null @@ -1,323 +0,0 @@ -# !/bin/sh -M_TITLE="Copy rootfs to SD/CF" -M_FLAGS="noRemember" - -# Unfinished script. -exit 0 - -ask_target() { - available_disks="`mount | grep "/media" | grep -v ram | awk '{print $3}'`" - - if test -z "$available_disks" - then - die "No mounted targets found!" - fi - - cnt=1 - for d in $available_disks - do - echo -e "\t[$cnt] $d" - let cnt=$cnt+1 - done - - while test -z "$ROOTFS_TARGET" - do - echo -n "Target: " - read junk </dev/tty1 - - x=1 - for d in $available_disks - do - if test "$junk" = "$x" - then - ROOTFS_TARGET="$d" - break - fi - let x=$x+1 - done - - - done - - ROOTFS_TARGET_DEV="`mount | grep "$ROOTFS_TARGET " | awk '{print $1}'`" - ROOTFS_TARGET_FS="`mount | grep "$ROOTFS_TARGET " | awk '{print $5}'`" - - echo "Using [$ROOTFS_TARGET] on [$ROOTFS_TARGET_DEV] with [$ROOTFS_TARGET_FS] filesystem" -} - -ask_format() { - if test "$ROOTFS_TARGET_FS" != ext2 - then - echo -e "\nYou are not using the ext2 filesystem on your target ($ROOTFS_TARGET_FS)$.\nYou now have two choices:" - echo -e "\t[1] Reformat to ext2" - echo -e "\t[2] Use an image-file ontop of the existing filesystem" - - while true - do - echo -n "Your choice: " - read junk </dev/tty1 - - case "$junk" in - 1) ROOTFS_TARGET_TYPE="ext2" - break ;; - 2) ROOTFS_TARGET_TYPE="image" - break ;; - esac - done - - echo "Mode: [$ROOTFS_TARGET_TYPE]" - else - echo -e "\nYou are using the ext2 filesystem on your target.\nYou now have two choices:" - echo -e "\t[1] Install to the target directly" - echo -e "\t[2] Use an image-file ontop of the existing filesystem\n" - - while true - do - echo -n "Your choice: " - read junk </dev/tty1 - - case "$junk" in - 1) ROOTFS_TARGET_TYPE="direct" - break ;; - 2) ROOTFS_TARGET_TYPE="image" - break ;; - esac - done - - echo "Mode: [$ROOTFS_TARGET_TYPE]" - - fi -} - -ask_confirm() { - echo -e "\nYour choices are:" - echo -e "\tTarget:\t$ROOTFS_TARGET_DEV (currently mounted as $ROOTFS_TARGET)" - case "$ROOTFS_TARGET_TYPE" in - direct) echo -e "\tType:\t${C_RED}direct install, reformat if required${C_RESET}";; - image) echo -e "\tType:\tinstall into image-file";; - esac - - while true - do - echo -n "Continue? [y|n] " - read junk </dev/tty1 - - case "$junk" in - y) break ;; - n) exit 1 - esac - done -} - -direct_install() { - - #format_target - - echo -n "Creating temporary directory..." - mkdir -p /media/temp && echo ok || die "mkdir -p /media/temp failed!" - - echo -n "Mounting [$ROOTFS_TARGET_DEV] as /media/temp..." - mount "$ROOTFS_TARGET_DEV" /media/temp && echo "ok" || die "mount "$ROOTFS_TARGET_DEV" /media/temp FAILED" - - copy_files -} - -format_target() { - echo -e "\n\nI'm about to format your target ($ROOTFS_TARGET_DEV) to the ext2 filesystem\n" - echo -e "${C_RED}YOU WILL LOSE ALL DATA ON YOUR TARGET IF YOU CONTINUE${C_RESET}\n" - - while true - do - echo -n "Continue? [y|n] " - read junk </dev/tty1 - - case "$junk" in - y) break ;; - n) die "User aborted mkfs" - break ;; - esac - done - - echo -n "Umounting $ROOTFS_TARGET_DEV..." - umount "$ROOTFS_TARGET_DEV" && echo "ok" || die "umount $ROOTFS_TARGET_DEV failed!" - - - echo "Formatting..." - /sbin/mkfs.ext2 -m0 "$ROOTFS_TARGET_DEV" && echo -e "\nmkfs.ext2 finished" || die "\nmkfs.ext2 FAILED" - } - -image_install() { - flash_size="` df -h | grep "/"$| awk '{print $3}'| sed s/M//`" - - echo -e "\nHow many MB do you want to configure for the image file?" - echo -e "It is generally a good idea to use 2.5x the used flash size ($flash_size)\n" - - while test -z "$ROOTFS_IMAGE_SIZE" - do - echo -n "Size in MegaBytes: " - read junk - - # test fails if $junk isn't a number - if test "$junk" -gt 0 >/dev/null 2>&1 - then - echo -n "Use [$junk]MB? [y|n] " - read junk2 - if test "$junk2" = y - then - ROOTFS_IMAGE_SIZE="$junk" - fi - fi - done - - echo -e "\nPlease enter a name for the image file." - echo "The name must _not_ contain whitespaces or the '-' sign." - - while test -z "$ROOTFS_IMAGE_NAME" - do - echo -n "File name: " - read junk - - if ! test -z "$junk" - then - echo -n "Use [$junk] as image name? [y|n] " - read junk2 - - if test "$junk2" = y - then - ROOTFS_IMAGE_NAME="$junk" - fi - fi - done - - echo -e "\nDo you want to format [$ROOTFS_TARGET_DEV] to the ext2 filesystem?" - - while true - do - echo -n "Format to ext2? [y|n] " - read junk - case "$junk" in - y) format_target - break ;; - n) break ;; - esac - done - - /etc/init.d/devices start - - echo -en "\nCreating image file [$ROOTFS_TARGET/$IMAGE_PATH/$ROOTFS_IMAGE_NAME-rootfs.bin] (${ROOTFS_IMAGE_SIZE}MB)..." - mkdir -p "$ROOTFS_TARGET/$IMAGE_PATH" - - dd if=/dev/zero of="$ROOTFS_TARGET/$IMAGE_PATH/$ROOTFS_IMAGE_NAME-rootfs.bin" bs=1024k count=$ROOTFS_IMAGE_SIZE >/dev/null 2>&1 && echo ok || die "FAILED" - losetup /dev/loop1 "$ROOTFS_TARGET/$IMAGE_PATH/$ROOTFS_IMAGE_NAME-rootfs.bin" - - echo -n "Creating filesystem..." - mkfs.ext2 -m0 /dev/loop1 >/dev/null 2>&1 && echo ok || die FAILED - - mkdir -p /media/temp - mount /dev/loop1 /media/temp || die "mount /dev/loop1 /media/temo FAILED!" - - copy_files - -} - -copy_files() { - echo -e "\nCopying files..." - - exclude_list="tmp sys proc var dev media root" - mkdir_list="var proc sys dev media/card media/cf /media/hdd" - - if (cat /etc/fstab | grep -q "/home") - then - echo "Note: /home appears to be mounted on a different flash partition: not copying /home" - exclude_list="$exclude_list home" - mkdir_list="$mkdir_list home/root" - - fi - - - - source_dirs="`ls -1 /`" - - echo -n "Excluding [" - for d in $exclude_list - do - echo -n "$d " - source_dirs="`echo "$source_dirs" | grep -v "$d"`" - done - echo "] from copy" - - - cd / - for dir in $source_dirs - do - if test -d "$dir" - then - echo -n "Copying [$dir]..." - cp -a $dir /media/temp && echo ok || echo FAILED - fi - done - - for dir in $mkdir_list - do - mkdir -p /media/temp/$dir - done - - rm /media/temp/etc/rcS.s/S39sd - -} -run_module() { - - test -e /etc/altboot.func && . /etc/altboot.func || die "ERROR: /etc/altboot.func not found. Check your installation!" - - echo -e "${C_RED}* * * * * WARNING * * * * *${C_RESET}" - echo -e "${C_RED}Continueing will delete the content of the selected target device.\nTHIS IS NO JOKE. If you do now know what this menu-item does, exit NOW${C_RESET}" - - mount -o remount,rw / - - while true - do - echo -en "\nContinue? [y|n] " - read junk </dev/tty1 - - if test "$junk" = n - then - exit 0 - fi - - if test "$junk" = y - then - break - fi - done - -# echo -n "Trying to activate PCMCIA..." -# cardmgr -o >/dev/null 2>&1 && echo ok || echo "FAILED" -# -# echo -n "Trying to mount SD card..." -# /etc/init.d/sd start >/dev/null 2>&1 -# sleep 3 -# /etc/sdcontrol insert >/dev/null 2>&1 && echo ok || echo "FAILED" - - #exit 0 - echo -e "\nPlease select the target device:" - - # Sets ROOTFS_TARGET* - ask_target - - # Sets ROOTFS_TARGET_TYPE ([direct | image] - ask_format - - # Ask confirmation - ask_confirm - - case "$ROOTFS_TARGET_TYPE" in - direct) direct_install;; - image) image_install;; - esac -} - -case "$1" in -title) echo "$M_TITLE";; -flags) echo "$M_FLAGS";; -run) run_module;; -esac |