summaryrefslogtreecommitdiffstats
path: root/rescue/Flash/scripts/rescue_common
diff options
context:
space:
mode:
authorMageia SVN-Git Migration <svn-git-migration@mageia.org>2011-02-06 22:37:08 +0000
committerMageia SVN-Git Migration <svn-git-migration@mageia.org>2011-02-06 22:37:08 +0000
commitd9cc095760861d869d2e2ccf05f94454dad32f00 (patch)
treeade69986b2f99e113c95009736399966d4a3d511 /rescue/Flash/scripts/rescue_common
parent368f416649ed34557702a946ec8c0cec2fd45294 (diff)
downloaddrakx-backup-do-not-use-d9cc095760861d869d2e2ccf05f94454dad32f00.tar
drakx-backup-do-not-use-d9cc095760861d869d2e2ccf05f94454dad32f00.tar.gz
drakx-backup-do-not-use-d9cc095760861d869d2e2ccf05f94454dad32f00.tar.bz2
drakx-backup-do-not-use-d9cc095760861d869d2e2ccf05f94454dad32f00.tar.xz
drakx-backup-do-not-use-d9cc095760861d869d2e2ccf05f94454dad32f00.zip
Synthesized commit during git-svn import combining previous Mandriva history with Magiea.
This commit consitsts of the following subversion commits: ------------------------------------------------------------------------ r431 | dmorgan | 2011-02-06 01:58:02 +0000 (Sun, 06 Feb 2011) | 1 line Add drakx structure on the SVN ------------------------------------------------------------------------ r432 | dmorgan | 2011-02-06 01:59:38 +0000 (Sun, 06 Feb 2011) | 1 line Import cleaned advertising ------------------------------------------------------------------------ r446 | dmorgan | 2011-02-06 22:37:08 +0000 (Sun, 06 Feb 2011) | 1 line Import Clean perl-install ------------------------------------------------------------------------ r448 | dmorgan | 2011-02-06 23:02:36 +0000 (Sun, 06 Feb 2011) | 1 line Add cleaned files ------------------------------------------------------------------------ r449 | dmorgan | 2011-02-06 23:03:52 +0000 (Sun, 06 Feb 2011) | 1 line Import cleaned kernel ------------------------------------------------------------------------ r450 | dmorgan | 2011-02-06 23:23:30 +0000 (Sun, 06 Feb 2011) | 1 line Import cleaned tools ------------------------------------------------------------------------ r451 | dmorgan | 2011-02-07 00:01:56 +0000 (Mon, 07 Feb 2011) | 1 line Import stage1 ------------------------------------------------------------------------ r473 | dmorgan | 2011-02-07 11:20:50 +0000 (Mon, 07 Feb 2011) | 1 line Import images ------------------------------------------------------------------------ r497 | ennael | 2011-02-09 21:02:06 +0000 (Wed, 09 Feb 2011) | 2 lines readd missing file ------------------------------------------------------------------------ r502 | pterjan | 2011-02-09 23:30:32 +0000 (Wed, 09 Feb 2011) | 1 line Import rescue ------------------------------------------------------------------------ r603 | ennael | 2011-02-24 13:32:54 +0000 (Thu, 24 Feb 2011) | 2 lines import cleaned rescue for Mageia ------------------------------------------------------------------------ r2061 | tv | 2011-10-20 20:32:19 +0100 (Thu, 20 Oct 2011) | 1 line import (cleaned) doc ------------------------------------------------------------------------
Diffstat (limited to 'rescue/Flash/scripts/rescue_common')
-rw-r--r--rescue/Flash/scripts/rescue_common205
1 files changed, 0 insertions, 205 deletions
diff --git a/rescue/Flash/scripts/rescue_common b/rescue/Flash/scripts/rescue_common
deleted file mode 100644
index 77435e6da..000000000
--- a/rescue/Flash/scripts/rescue_common
+++ /dev/null
@@ -1,205 +0,0 @@
-#!/bin/bash
-
-function detect_version() {
- version=""
- if has_label Share; then
- version="1.0"
- elif has_label MDVUSBROOT; then
- version="1.05"
- elif has_label Mdv_Flash; then
- version="2.0"
- elif has_label MDV_FLASH; then
- version="2.05"
- fi
- usbroot_device=$_device
- source_version_variables
-
- [ -n "$version" ]
-}
-
-function source_version_variables {
- local _version
- _version=$1
- [ -z "$_version" ] && _version=$version
- if [ "$_version" = "1.0" ]; then
- label=MDVUSBROOT
- boot_rel="/boot"
- loopbacks_rel="/loopbacks"
- elif [ "$_version" = "1.05" ]; then
- label=MDVUSBROOT
- boot_rel="/.boot"
- loopbacks_rel="/.loopbacks"
- elif [ "$_version" = "2.0" ]; then
- label=Mdv_Flash
- boot_rel="/.boot"
- loopbacks_rel="/.loopbacks"
- elif [ "$_version" = "2.05" ]; then
- label=MDV_FLASH
- boot_rel="/.boot"
- loopbacks_rel="/.loopbacks"
- fi
-}
-
-function has_label() {
- local _label _tmpdir
- _label=$1
-
- _tmpdir="/tmp/$$"
-
- mkdir -p $_tmpdir
-
- nash --force > /dev/null 2>&1 <<EOF
-mount -t vfat LABEL=$_label $_tmpdir
-EOF
-
- rc=$?
-
- _device=`perl -ne 'my @l = split; $l[1] eq "'$_tmpdir'" and print "$l[0]\n"' /proc/mounts`
- [ -z "$_device" ] && rc=1
-
- umount $_tmpdir 2> /dev/null
- rmdir $_tmpdir 2> /dev/null
-
- return $rc
-}
-
-function check_vendor() {
-
- # list of supported vendors/models
-
- # mandriva flash 1.0 (france)
- vendors[0]="13fe"
- models[0]="1a00"
- # mandriva flash 1.0 (brazil)
- vendors[1]="0930"
- models[1]="653e"
- # mandriva flash 4GB (france)
- vendors[2]="13fe"
- models[2]="1d00"
-
- rc=1
-
- mount -t usbfs none /proc/bus/usb 2> /dev/null
-
- i=0
- while [ ! -z "${vendors[$i]}" ]; do
-
- grep "P:" /proc/bus/usb/devices | grep -q \
- "Vendor=${vendors[$i]} ProdID=${models[$i]}"
- if [ $? -eq 0 ]; then
- rc=0
- break
- fi
-
- let i++
- done
-
- umount /proc/bus/usb 2> /dev/null
-
- return $rc
-}
-
-function insert_pendrive() {
-
- _tmpdir="/tmp/rescue-temp"
- mkdir -p $_tmpdir
-
- modprobe usb-storage > /dev/null 2>&1
- modprobe vfat > /dev/null 2>&1
-
- echo
- echo -n 'Please insert your Mandriva Flash pen drive and press ENTER when ready: '
- read READY
- echo
- echo -n 'Detecting pen drive: '
-
- for ((i=0; $i <= 15 ; i++)); do
- detect_version && nash --force > /dev/null 2>&1 <<EOF
-mount -t vfat LABEL=$label $_tmpdir
-EOF
- if [ $? -ne 0 ]; then
- echo -n '.'
- sleep 1
- else
- echo -n ' found!'
-
- if ! check_vendor; then
- echo
- echo "This is not an official Mandriva Flash key!"
- echo
- fi
-
- cat /proc/mounts | grep $_tmpdir | cut -d' ' -f1 | \
- sed 's/[0-9]*$//g' > /tmp/rescue-device
- umount $_tmpdir
- rmdir $_tmpdir 2> /dev/null
-
- return 0
- fi
- done
-
- rmdir $_tmpdir 2> /dev/null
-
- echo
- echo
- echo "Couldn't detect Mandriva Flash pen drive!"
- echo
-
- return 1
-}
-
-function mount_usbroot() {
-
- nash --force > /dev/null 2>&1 <<EOF
-mount -t vfat LABEL=$label $1
-EOF
- if [ $? -ne 0 ]; then
- echo "Error mounting device labeled $label"
- return 1
- fi
-
- return 0
-}
-
-function mount_sharedroot() {
-
- nash --force > /dev/null 2>&1 <<EOF
-mount -t vfat LABEL=Share $1
-EOF
- if [ $? -ne 0 ]; then
- echo "Error mounting device labeled Share"
- return 1
- fi
-
- return 0
-}
-
-function progress() {
-
- echo -ne '\b|'
- usleep 100000
- echo -ne '\b/'
- usleep 100000
- echo -ne '\b-'
- usleep 100000
- echo -ne '\b\\'
- usleep 100000
-}
-
-function lumount() {
- local dir=$1
- loop=$(perl -ne '@l = split; if ($l[1] eq "'$dir'") { print $l[0]; exit }' /proc/mounts)
- umount $dir
- losetup -d $loop
-}
-
-function set_sfs_loop() {
- local dir=$1
- sfs_loop_std="$dir$loopbacks_rel/distrib.sqfs"
- sfs_loop_lzma="$dir$loopbacks_rel/distrib-lzma.sqfs"
- if [ -e $sfs_loop_lzma ]; then
- sfs_loop=$sfs_loop_lzma
- else
- sfs_loop=$sfs_loop_std
- fi
-}