Results 1 to 7 of 7

Thread: Is this a script and how do i run it?

  1. #1

    Default Is this a script and how do i run it?

    http://suse-moblin.com/image-usb-stick

    I downloaded the usb suse-opensuse-moblin-preload.i686-0.0.2.raw.install.raw to my Desktop
    openSUSE Moblin Daily Builds

    I saved the script to my Desktop and added a .sh extension to it I ran terminal navigated to Desktop typed "sudo bash image-usb-stick.sh"
    didn't work I tried
    "sudo bash image-usb-stick.sh suse-opensuse-moblin-preload.i686-0.0.2.raw.install.raw"
    didn't work I tried
    "sudo bash image-usb-stick.sh suse-opensuse-moblin-preload.i686-0.0.2.raw.install.raw /dev/sdb1"

    What do I do?
    Thanks

    I'm running ubuntu netbook remix
    I have a 2.0Gb flash drive formatted to fat I tried it mounted and unmounted. The laser in my Dvd Burner gets stuck all the way on the outer edge when I try and boot from it so I'm trying the usb install. I know the open-suse might wipe my other os's so I made backup images of my partitions so I can restore them after it's installed.

  2. #2
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    32,340
    Blog Entries
    15

    Default Re: Is this a script and how do i run it?

    Quote Originally Posted by htdw3
    http://suse-moblin.com/image-usb-stick

    I downloaded the usb
    suse-opensuse-moblin-preload.i686-0.0.2.raw.install.raw to my Desktop
    'openSUSE Moblin Daily Builds' (http://suse-moblin.com/)

    I saved the script to my Desktop and added a .sh extension to it I ran
    terminal navigated to Desktop typed "sudo bash image-usb-stick.sh"
    didn't work I tried
    "sudo bash image-usb-stick.sh
    suse-opensuse-moblin-preload.i686-0.0.2.raw.install.raw"
    didn't work I tried
    "sudo bash image-usb-stick.sh
    suse-opensuse-moblin-preload.i686-0.0.2.raw.install.raw /dev/sdb1"

    What do I do?
    Thanks

    I'm running ubuntu netbook remix
    I have a 2.0Gb flash drive formatted to fat I tried it mounted and
    unmounted. The laser in my Dvd Burner gets stuck all the way on the
    outer edge when I try and boot from it so I'm trying the usb install. I
    know the open-suse might wipe my other os's so I made backup images of
    my partitions so I can restore them after it's installed.
    Hi
    Have a look here;
    http://en.opensuse.org/SUSE_Studio_Disc_Image_Howtos

    --
    Cheers Malcolm (Linux Counter #276890)
    SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.27.29-0.1-default
    up 1 day 0:11, 3 users, load average: 0.27, 0.09, 0.09
    GPU GeForce 8600 GTS Silent - Driver Version: 190.18


  3. #3

    Default Re: Is this a script and how do i run it?

    Thanks the dd way looks easy but I would like to use the script provided by author.

    None of the tutorials in the link mention a script. I don't understand how to run the script to write the *.raw to the usb drive.

    Is it "sudo bash image-usb-stick.sh"?

    Do the *.raw and the script have to be in the same directory?

    I know I have to point to the *.raw do I just type in the name "sudo bash image-usb-stick.sh open-suse.raw"?

    How do i point to the usb drive i want it wrote to is it "sudo bash image-usb-stick.sh open-suse.raw /dev/sdb1"?

    Device Not Found
    Device Not Found
    Device Not Found
    Device Not Found
    Device Not Found
    Device Not Found
    Device Not Found
    Device Not Found
    Device Not Found
    Device Not Found
    Do you want to list the 2000 possibilites y or n:
    wtf

  4. #4
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    32,340
    Blog Entries
    15

    Default Re: Is this a script and how do i run it?

    Quote Originally Posted by htdw3
    Thanks the dd way looks easy but I would like to use the script provided
    by author.

    None of the tutorials in the link mention a script. I don't understand
    how to run the script to write the *.raw to the usb drive.

    Is it "sudo bash image-usb-stick.sh"?

    Do the *.raw and the script have to be in the same directory?

    I know I have to point to the *.raw do I just type in the name "sudo
    bash image-usb-stick.sh open-suse.raw"?

    How do i point to the usb drive i want it wrote to is it "sudo bash
    image-usb-stick.sh open-suse.raw /dev/sdb1"?

    Device Not Found
    Device Not Found
    Device Not Found
    Device Not Found
    Device Not Found
    Device Not Found
    Device Not Found
    Device Not Found
    Device Not Found
    Device Not Found
    Do you want to list the 2000 possibilites y or n:
    wtf
    Hi
    It was the 1999th possibility Can you move the file off your Desktop
    on into your home directory and try running from there

    --
    Cheers Malcolm (Linux Counter #276890)
    SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.27.29-0.1-default
    up 1 day 9:24, 2 users, load average: 0.40, 0.93, 1.17
    GPU GeForce 8600 GTS Silent - Driver Version: 190.18


  5. #5

    Default Re: Is this a script and how do i run it?

    I moved the script and the raw to home, but I was typing "cd Desktop" before

    sen@sen-laptop:~$ dir
    Desktop examples.desktop Link\ to\ Desktop Pictures suse-opensuse-moblin-preload.i686-0.0.2.raw.install.raw Videos
    Documents image-usb-stick.sh Music Public Templates
    sen@sen-laptop:~$
    sen@sen-laptop:~$ sudo bash image-usb-stick.sh
    Usage: image-usb-stick.sh <usb-raw-image-file>
    sen@sen-laptop:~$
    sen@sen-laptop:~$ sudo bash image-usb-stick.sh suse-opensuse-moblin-preload.i686-0.0.2.raw.install.raw
    Available USB Disk Devices:
    device path not found
    device path not found
    device path not found
    device path not found
    /dev/N: sdb (DataTraveler_2.0
    DataTraveler\x202.0
    1603)
    device path not found
    device path not found
    device path not found
    device path not found
    Device node to image [/dev/N: sdb]:
    sen@sen-laptop:~$
    sen@sen-laptop:~$ df
    Filesystem 1K-blocks Used Available Use% Mounted on
    /dev/sda3 4736812 4033276 462904 90% /
    tmpfs 1353784 0 1353784 0% /lib/init/rw
    varrun 1353784 100 1353684 1% /var/run
    varlock 1353784 0 1353784 0% /var/lock
    udev 1353784 152 1353632 1% /dev
    tmpfs 1353784 84 1353700 1% /dev/shm
    lrm 1353784 2192 1351592 1% /lib/modules/2.6.28-15-generic/volatile
    /dev/sdb1 15752188 112332 15639856 1% /media/disk
    sen@sen-laptop:~$

    I'm using my 16gb now my other stick has ubuntu netbook remix on it.

  6. #6
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    32,340
    Blog Entries
    15

    Default Re: Is this a script and how do i run it?

    Quote Originally Posted by htdw3
    I moved the script and the raw to home, but I was typing "cd Desktop"
    before
    <snip>
    /dev/N: sdb (DataTraveler_2.0
    DataTraveler\x202.0
    1603)
    <snip>
    Device node to image [/dev/N: sdb]:
    <snip>
    /dev/sdb1 15752188 112332 15639856
    1% /media/disk/media/disk
    sen@sen-laptop:~$

    I'm using my 16gb now my other stick has ubuntu netbook remix on it.
    Hi
    So are you saying it's still not going? If so, umount the device;
    Code:
    sudo umount /media/disk
    chmod 700  image-usb-stick.sh
    sudo  image-usb-stick.sh suse-opensuse-moblin-preload.i686-0.0.2.raw
    There are permissions issues with the Desktop, so never try to run an
    app etc from there always in your home etc

    --
    Cheers Malcolm (Linux Counter #276890)
    SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.27.29-0.1-default
    up 1 day 10:37, 2 users, load average: 2.26, 3.14, 3.15
    GPU GeForce 8600 GTS Silent - Driver Version: 190.18


  7. #7

    Default Re: Is this a script and how do i run it?

    #!/bin/bash
    #
    # Script to image USB sticks in an easy and hopefully safe reassuring way
    # Aaron Bockover <abockover@novell.com>
    #

    function bail () {
    echo "Error: $@" 1>&2
    exit 1
    }

    function usage () {
    echo "Usage: $0 <usb-raw-image-file>" 1>&2
    exit 1
    }

    [[ $UID -eq 0 ]] || bail "You must be root"
    udevadm --version &>/dev/null || bail "Could not run udevadm"

    OPTION_IMAGE_FILE=$1
    [[ -z "$OPTION_IMAGE_FILE" ]] && usage
    [[ -e "$OPTION_IMAGE_FILE" ]] || bail "USB Raw Image file not found"

    FIRST_DEVICE=

    function list_usb_devices () {
    echo "Available USB Disk Devices:"

    for dev in $(/sbin/udevadm info --export-db | \
    awk '/^P:/{sub("^P:[[:space:]]*", "", $0); print}'); do
    if udevadm info --path="$dev" --query=all | grep -q ID_TYPE=disk; then
    if udevadm info --path="$dev" --query=all | grep -q ID_BUS=usb; then
    MODEL=$(udevadm info --path="$dev" --query=all | \
    awk -F= '/^E: ID_MODEL/{print $2}')
    ROOT=$(udevadm info --root)
    NODE=$(udevadm info --path="$dev" --query=all | \
    awk '/^N:/{sub("^N:[[:space:]]*", "", $0); print}')
    NODE="${ROOT}/${NODE}"

    if echo "$NODE" | grep -q "[0-9]$"; then
    continue
    fi

    if mount | grep -q "^${NODE}"; then
    echo " ${NODE} (${MODEL}) - MOUNTED"
    mount | grep "^${NODE}" | sed 's,type.*,,;s,^, ,'
    else
    echo " ${NODE} (${MODEL})"
    fi

    [[ -z "$FIRST_DEVICE" ]] && FIRST_DEVICE="$NODE"
    fi
    fi
    done

    [[ -z "$FIRST_DEVICE" ]] && return 1 || return 0
    }

    function unmount_device () {
    for mount in $(mount | grep "^${1}" | cut -f3 -d' '); do
    umount "$mount" || bail "Could not unmount ${mount} on ${1}"
    done
    }

    function image_device () {
    PROGRESS_FILE=$(mktemp)
    TOTAL_SIZE=$(stat -c%s "$2")
    [[ -e "$PROGRESS_FILE" ]] || bail "Could not create temp file"
    ( dd if="$2" of="$1" &>"$PROGRESS_FILE" &
    DD_PID=$!
    while ps -p $DD_PID &>/dev/null; do
    sleep 1
    kill -USR1 $DD_PID &>/dev/null
    COPIED=$(tail -n1 < "$PROGRESS_FILE" | cut -f1 -d' ')
    PERCENT=$(echo "" | \
    awk '{print int(('$COPIED'/'$TOTAL_SIZE') * 100)}')
    printf "\r${COPIED}/${TOTAL_SIZE} (%d%%) " $PERCENT
    done
    echo
    rm -f "$PROGRESS_FILE"
    ) || bail "Failed to image ${1}"
    }

    if ! list_usb_devices; then
    echo " No devices found."
    exit 1
    fi

    if [[ -z "$OPTION_DEVICE_NODE" ]]; then
    read -p "Device node to image [$FIRST_DEVICE]: " OPTION_DEVICE_NODE
    [[ -z "$OPTION_DEVICE_NODE" ]] && OPTION_DEVICE_NODE="$FIRST_DEVICE"
    fi

    [[ -e "$OPTION_DEVICE_NODE" ]] || \
    bail "Device node $OPTION_DEVICE_NODE not found"

    if mount | grep -q "^${OPTION_DEVICE_NODE}"; then
    if [[ -z "$OPTION_UNMOUNT" ]]; then
    read -p \
    "Device ${OPTION_DEVICE_NODE} is mounted. Unmount it? (Y/N) [Y]: " \
    OPTION_UNMOUNT
    [[ -z "$OPTION_UNMOUNT" ]] && OPTION_UNMOUNT="y"
    fi

    if [[ "$OPTION_UNMOUNT" = "y" || "$OPTION_UNMOUNT" = "Y" ]]; then
    echo "Unmounting ${OPTION_DEVICE_NODE}..."
    unmount_device "$OPTION_DEVICE_NODE"
    else
    bail "Cannot image ${OPTION_DEVICE_NODE} without unmounting it"
    fi
    fi

    echo "Imaging ${OPTION_DEVICE_NODE} with $(basename ${OPTION_IMAGE_FILE})..."
    image_device "${OPTION_DEVICE_NODE}" "${OPTION_IMAGE_FILE}"

    echo "Syncing..."
    sync

    echo "Ejecting..."
    eject "${OPTION_DEVICE_NODE}"

    echo "Done."



    This was a page on the website i downloaded the file but i wasn't sure if it was a .sh?
    I downloaded the raw they are both in my home directory what do I do?
    I don't know what to type into terminal my flash drive is unmounted
    Last edited by htdw3; 19-Sep-2009 at 00:51. Reason: adding

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •