diff options
Diffstat (limited to 'packages/altboot')
35 files changed, 0 insertions, 1974 deletions
diff --git a/packages/altboot/.mtn2git_empty b/packages/altboot/.mtn2git_empty deleted file mode 100644 index e69de29bb2..0000000000 --- a/packages/altboot/.mtn2git_empty +++ /dev/null diff --git a/packages/altboot/altboot.bb b/packages/altboot/altboot.bb deleted file mode 100644 index a322dacdd9..0000000000 --- a/packages/altboot/altboot.bb +++ /dev/null @@ -1,96 +0,0 @@ -DESCRIPTION = "A text-based bootmanager allowing a Zaurus to boot from SD or CF. \ -Tested machines: Collie, Poodle, Akita, Spitz" -SECTION = "base" -PRIORITY = "optional" -MAINTAINER = "Matthias 'CoreDump' Hentges <oe@hentges.net>" -LICENSE = "GPL" - - -PR = "r8" - - -SRC_URI = "file://altboot-menu \ - file://altboot.rc \ - file://altboot.func \ - file://init.altboot \ - file://altboot.cfg" - -# S = "${WORKDIR}/files" - -do_install() { - install -d ${D}/sbin - install -d ${D}/etc/altboot-menu - install -d ${D}/etc/altboot-menu/Advanced - install -d ${D}/etc/altboot.rc - install -d ${D}/usr/share/doc/altboot - - install -m 0644 ${WORKDIR}/altboot.cfg ${D}/etc - install -m 0644 ${WORKDIR}/altboot.func ${D}/etc -# install -m 0644 ${WORKDIR}/docs/altboot/*.txt ${D}/usr/share/doc/altboot - install -m 0755 ${WORKDIR}/init.altboot ${D}/sbin - install -m 0755 ${WORKDIR}/altboot-menu/*-* ${D}/etc/altboot-menu - install -m 0755 ${WORKDIR}/altboot-menu/Advanced/*-* ${D}/etc/altboot-menu/Advanced -} - - - -pkg_postinst() { - update-alternatives --install /sbin/init init /sbin/init.altboot 55 -} - -pkg_postinst_spitz() { - # Note: Spitz support is a royal pain in the ass. - # Since Spitz pivot_roots by default, there is no real way - # a user can install an altboot.ipk into the flash FS. - # So we need to do that manually (*SIGH*) - - # /l/m only exists on the HDD on spitz - if test -d /lib/modules - then - if [ -e /media/realroot/sbin/init ]; then - ROOT_MOUNT_POINT="/media/realroot" - elif [ -e /media/ROM/sbin/init ]; then - ROOT_MOUNT_POINT="/media/ROM" - fi - if [ ! "$ROOT_MOUNT_POINT" = "" ]; then - ROOT_MOUNT_DEVICE=`cat /proc/mounts | grep $ROOT_MOUNT_POINT | grep jffs2 | cut -d " " -f 1` - if [ ! "$ROOT_MOUNT_DEVICE" = "" ]; then - mount -oremount,rw $ROOT_MOUNT_DEVICE $ROOT_MOUNT_POINT - cp -R /etc/altboot* $ROOT_MOUNT_POINT/etc - cp /sbin/init.altboot $ROOT_MOUNT_POINT/sbin - if [ -f $ROOT_MOUNT_POINT/sbin/init ]; then - mv $ROOT_MOUNT_POINT/sbin/init $ROOT_MOUNT_POINT/sbin/init.orig - fi - ln -s /sbin/init.altboot $ROOT_MOUNT_POINT/sbin/init - fi - fi - fi -} - -pkg_postrm() { - update-alternatives --remove init /sbin/init.altboot -} - -pkg_postrm_spitz() { - if test -d /lib/modules - then - if [ -e /media/realroot/sbin/init ]; then - ROOT_MOUNT_POINT="/media/realroot" - elif [ -e /media/ROM/sbin/init ]; then - ROOT_MOUNT_POINT="/media/ROM" - fi - if [ ! "$ROOT_MOUNT_POINT" = "" ]; then - ROOT_MOUNT_DEVICE=`cat /proc/mounts | grep $ROOT_MOUNT_POINT | grep jffs2 | cut -d " " -f 1` - if [ ! "$ROOT_MOUNT_DEVICE" = "" ]; then - mount -oremount,rw $ROOT_MOUNT_DEVICE $ROOT_MOUNT_POINT - if [ -f $ROOT_MOUNT_POINT/sbin/init.orig ]; then - rm $ROOT_MOUNT_POINT/sbin/init - rm $ROOT_MOUNT_POINT/sbin/init.altboot - mv $ROOT_MOUNT_POINT/sbin/init.orig $ROOT_MOUNT_POINT/sbin/init - else - echo "$ROOT_MOUNT_POINT/sbin/init.orig not found, not uninstalling altboot!" - fi - fi - fi - fi -} diff --git a/packages/altboot/files/.mtn2git_empty b/packages/altboot/files/.mtn2git_empty deleted file mode 100644 index e69de29bb2..0000000000 --- a/packages/altboot/files/.mtn2git_empty +++ /dev/null diff --git a/packages/altboot/files/akita/.mtn2git_empty b/packages/altboot/files/akita/.mtn2git_empty deleted file mode 100644 index e69de29bb2..0000000000 --- a/packages/altboot/files/akita/.mtn2git_empty +++ /dev/null diff --git a/packages/altboot/files/akita/altboot.cfg b/packages/altboot/files/akita/altboot.cfg deleted file mode 100644 index 8361b28f2a..0000000000 --- a/packages/altboot/files/akita/altboot.cfg +++ /dev/null @@ -1,19 +0,0 @@ -# Handled by /sbin/init.altboot -# Allow booting images from SD or CF instead of booting -# the ROM. -ENABLE_ALTBOOT="yes" -TIMEOUT="3" -REAL_INIT="/sbin/init.sysvinit" -SH_SHELL="/bin/sh" -IMAGE_PATH="boot-images" -IMAGE_TYPE="ext2" -FSCK_IMAGES="yes" -SD_DEVICE="/dev/mmcda1" -SD_KERNEL_MODULE="/lib/modules/2.4.20/kernel/drivers/block/sharp_mmcsd_m.o" -INIT_RUNLEVEL="5" -NO_GUI_RL="2" -MASTER_PASSWORD="" -ASK_PW_ON_BOOT="no" - -SD_MOUNTPOINT="/media/card" -CF_MOUNTPOINT="/media/cf" diff --git a/packages/altboot/files/altboot-menu/.mtn2git_empty b/packages/altboot/files/altboot-menu/.mtn2git_empty deleted file mode 100644 index e69de29bb2..0000000000 --- a/packages/altboot/files/altboot-menu/.mtn2git_empty +++ /dev/null diff --git a/packages/altboot/files/altboot-menu/00-Default b/packages/altboot/files/altboot-menu/00-Default deleted file mode 100644 index 9d29fdae2a..0000000000 --- a/packages/altboot/files/altboot-menu/00-Default +++ /dev/null @@ -1,14 +0,0 @@ -# !/bin/sh -M_TITLE="Normal Boot" - - -run_module() { - 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/10-noGui b/packages/altboot/files/altboot-menu/10-noGui deleted file mode 100644 index 57141d498d..0000000000 --- a/packages/altboot/files/altboot-menu/10-noGui +++ /dev/null @@ -1,14 +0,0 @@ -# !/bin/sh -M_TITLE="Don't launch GUI" - - -run_module() { - clear ; exec $REAL_INIT "$NO_GUI_RL" - exit 0 -} - -case "$1" in -title) echo "$M_TITLE";; -run) run_module;; -esac - diff --git a/packages/altboot/files/altboot-menu/15-bootSD b/packages/altboot/files/altboot-menu/15-bootSD deleted file mode 100644 index 60d9da4339..0000000000 --- a/packages/altboot/files/altboot-menu/15-bootSD +++ /dev/null @@ -1,48 +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 SD card" - -die() { - echo "ERROR: $1" >/dev/tty0 - exec $SH_SHELL </dev/tty0 >/dev/tty0 2>&1 -} - -# 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!" - - echo -n "Mounting rootfs rw..." >/dev/tty0 - mount -o remount,rw / >/dev/tty0 2>&1 && echo ok >/dev/tty0|| die "mount -o remount,rw / failed" - - echo -n "Generating device files..." >/dev/tty0 - /etc/init.d/devices start && echo ok >/dev/tty0|| die "FAILED" - - - echo -n "Loading SD kernel module..." - /sbin/insmod $SD_KERNEL_MODULE >/dev/null 2>&1 && echo ok || die "insmod failed" - - echo -n "Mounting $SD_MOUNTPOINT..." >/dev/tty0 - /bin/mount -t auto -o defaults,noatime $SD_DEVICE $SD_MOUNTPOINT >/dev/null 2>&1 && echo ok >/dev/tty0|| die "/bin/mount -t auto -o defaults,noatime $SD_DEVICE $SD_MOUNTPOINT failed" - - echo "" - - # Give the SD and CF mounting some time. This is a must for SD - sleep 2 - - # Check for a real fs and loop-images. - check_target "$SD_MOUNTPOINT" >/dev/tty0 - -} - - -case "$1" in -title) echo "$M_TITLE";; -run) run_module "$2";; -esac - diff --git a/packages/altboot/files/altboot-menu/20-bootCF b/packages/altboot/files/altboot-menu/20-bootCF deleted file mode 100644 index 931e46995c..0000000000 --- a/packages/altboot/files/altboot-menu/20-bootCF +++ /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 CF card" - -die() { - echo "ERROR: $1" >/dev/tty0 - exec $SH_SHELL </dev/tty0 >/dev/tty0 2>&1 -} - -# 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!" - - echo -n "Mounting rootfs rw..." >/dev/tty0 - mount -o remount,rw / >/dev/tty0 2>&1 && echo ok >/dev/tty0|| die "mount -o remount,rw / failed" - - echo -n "Generating device files..." >/dev/tty0 - /etc/init.d/devices start && echo ok >/dev/tty0|| die "FAILED" - - - echo -n "Mounting /proc..." >/dev/tty0 - mount /proc >/dev/tty0 2>&1 && echo ok >/dev/tty0|| die "mount /proc failed!" - - /etc/init.d/pcmcia start || die "/etc/init.d/pcmcia/start failed!" - - echo "" - - # Give the SD and CF mounting some time. This is a must for SD - sleep 2 - - # Check for a real fs and loop-images. - check_target "$CF_MOUNTPOINT" - -} - - -case "$1" in -title) echo "$M_TITLE";; -run) run_module "$2";; -esac - diff --git a/packages/altboot/files/altboot-menu/99-ownScripts-example b/packages/altboot/files/altboot-menu/99-ownScripts-example deleted file mode 100644 index 61c0645176..0000000000 --- a/packages/altboot/files/altboot-menu/99-ownScripts-example +++ /dev/null @@ -1,81 +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) - - -# This file will teach you how to implement your own scripts while using existing altboot -# code. - -# /sbin/init.altboot searches /etc/altboot-menu for scripts. It will only list scripts which -# return a title when run with the "title" parameter. -# Script which do not return a title will never be shown in the boot menu! -# -M_TITLE="altboot sample" - -# We can use that to deactivate certain scripts: -exit 0 - -# The "title" parameter is implemented at the end of this script so it will never be reached -# and the script will simply be ignored by altboot. - - -# The die() function aborts the boot if something goes wrong and sets STDIN / STDERR / STDOUT -# correctly. -die() { - echo "ERROR: $1" >/dev/tty0 - exec $SH_SHELL </dev/tty0 >/dev/tty0 2>&1 -} - -# This function is activated by init.altboot by calling this script with the "run" option -run_module() { - - # altboot.func contains re-useable code. If you intend to use check_target (see below) - # you must keep this line. If not, delete it. - test -e /etc/altboot.func && . /etc/altboot.func || die "ERROR: /etc/altboot.func not found. Check your installation!" - - - # The only thing you'll have to do is get your medium mounted. - # The following lines mount a SD card on 2.4-series kernels on a Zaurus - - ########################################## - - - echo -n "Mounting rootfs rw..." >/dev/tty0 - mount -o remount,rw / >/dev/tty0 2>&1 && echo ok >/dev/tty0|| die "mount -o remount,rw / failed" - - echo -n "Generating device files..." >/dev/tty0 - /etc/init.d/devices start && echo ok >/dev/tty0|| die "FAILED" - - - echo -n "Loading SD kernel module..." - /sbin/insmod $SD_KERNEL_MODULE >/dev/null 2>&1 && echo ok || die "insmod failed" - - echo -n "Mounting $SD_MOUNTPOINT..." >/dev/tty0 - /bin/mount -t auto -o defaults,noatime $SD_DEVICE $SD_MOUNTPOINT >/dev/null 2>&1 && echo ok >/dev/tty0|| die "/bin/mount -t auto -o defaults,noatime $SD_DEVICE $SD_MOUNTPOINT failed" - - echo "" - - # Give the SD and CF mounting some time. This is a must for SD - sleep 2 - ########################################## - - # Once the medium (be it a CF or SD card, or even a NFS drive) is mounted somewhere, - # just call check_target with the mountpoint as parameter. - # check_target searches the medium for a real filesystem and loop-images and - # asks the user what to boot if there are several choices. - - # Check for a real fs and loop-images. - check_target "$SD_MOUNTPOINT" >/dev/tty0 - - # Done :) - -} - - -case "$1" in -title) echo "$M_TITLE";; -run) run_module "$2";; -esac - 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/40-bootNFS b/packages/altboot/files/altboot-menu/Advanced/40-bootNFS deleted file mode 100644 index 33e869bbe1..0000000000 --- a/packages/altboot/files/altboot-menu/Advanced/40-bootNFS +++ /dev/null @@ -1,125 +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 from NFS" - -die() { - echo "ERROR: $1" >/dev/tty0 - exec $SH_SHELL </dev/tty0 >/dev/tty0 2>&1 -} - -# 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!" - - echo -n "Mounting rootfs rw..." >/dev/tty0 - mount -o remount,rw / >/dev/tty0 2>&1 && echo ok >/dev/tty0|| die "mount -o remount,rw / failed" - - echo -n "Generating device files..." >/dev/tty0 - /etc/init.d/devices start && echo ok >/dev/tty0|| die "FAILED" - - echo -n "Mounting /proc..." >/dev/tty0 - mount /proc >/dev/tty0 2>&1 && echo ok >/dev/tty0 || echo failed - - # Needed for NFS - /etc/init.d/portmap start >/dev/tty1 2>&1 || die "/etc/init.d/portmap start failed!" - - # For some reason NFS mounts hang if /e/i/networking is not run. - # For the time beeing I'm too lazy to investigate ;) - /etc/init.d/networking start || die "/etc/init.d/networking start failed!" - - sleep 2 - - # After the PCMCIA service is started, an inserted WLAN card should automatically - # activate itself. - /etc/init.d/pcmcia start || die "/etc/init.d/pcmcia/start failed!" - - 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}'`" - - - # WLAN with DHCP needs some time to get a lease, set up the routing, etc. - echo -n "Waiting for WLAN" - cnt=0 - while true - do - if (ping -c 1 $nfs_host) >/dev/null 2>&1 - then - echo " found" - break - else - if test "$cnt" = 30 -o "$cnt" = 60 - then - echo "" - echo "WARNING: WLAN didn't activate in $cnt seconds!" - - if test "$cnt" = 30 - then - echo "Restarting udhcpc" - killall udhcpc - udhcpc -i wlan0 -H `cat /etc/hostname` - else - die "Failed to activate WLAN!" - break - fi - else - echo -n "." - let cnt=$cnt+1 - fi - fi - sleep 1 - done - - 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 - echo -n "Boot NFS root: " - read junk < /dev/tty1 - - cnt=1 - for nfs_mount in $nfs_mounts - do - if test "$junk" = "$cnt" - then - selection="$nfs_mount" - 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 || die "mkdir -p /media/nfsroot failed!" - - echo -n "Mounting NFS root..." - mount -t nfs "$selection" /media/nfsroot && echo ok || die "mount -t nfs "$selection" /media/nfsroot failed!" - - check_target "/media/nfsroot" - -} - -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 6db4adaf3a..0000000000 --- a/packages/altboot/files/altboot-menu/Advanced/55-bin-sh +++ /dev/null @@ -1,23 +0,0 @@ -# !/bin/sh -M_TITLE="init=/bin/sh" - - -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/tty0 - - echo -e "\nBoot system with 'exec /sbin/init 5'\n" - while true - do - exec $SH_SHELL </dev/tty0 >/dev/tty0 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/80-copyrootfs b/packages/altboot/files/altboot-menu/Advanced/80-copyrootfs deleted file mode 100644 index 1949f20b48..0000000000 --- a/packages/altboot/files/altboot-menu/Advanced/80-copyrootfs +++ /dev/null @@ -1,324 +0,0 @@ -# !/bin/sh -M_TITLE="Copy rootfs to SD/CF" - - -die() { - echo "ERROR: $1" >/dev/tty0 - exec $SH_SHELL </dev/tty0 >/dev/tty0 2>&1 -} - -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.\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* |
