DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2009-02-17 22:17:57

Marijom
Member
From: Sweden
Registered: 2007-07-06
Posts: 54

Queston about usb_all.sh - why isn't variable working at boottime

On Wiki ffp there is a usb_all.sh script to mount disk at startup.
http://dns323.kood.org/howto:ffp      see start/usbdisk.sh (Mount external USB disk):  section
http://dns323.kood.org/forum/t1963-fonz … rives.html

in usb_all_start() at that script variables are used.

  driveslinux=`fdisk -l | grep -i 'Linux' | grep -v 'sda' | grep -v 'sdb' | awk -F '/| ' '{print $3}'`

  # mount NTFS Drives
  for drive in $drivesntfs; do
    mkdir -p "/mnt/HD_a2/$drive"
    echo "Mounting /dev/$drive on /mnt/HD_a2/$drive"
    mount -t ntfs -o umask=0222 /dev/$drive /mnt/HD_a2/$drive > /mnt/HD_a2/$drive/mount-error.txt 2>&1
    if [ $? -ne 0 ]; then
      echo "Failed"
      cat /mnt/HD_a2/$drive/mount-error.txt
    fi
  done

if above is run from the prompt everything gets mounted but on boot nothing is mounted.

I added following to get information in the logg

    fdisk -l | grep -i 'Linux' | grep -v 'sda' | grep -v 'sdb'
   
    echo "mount Linux Drives"
    echo $driveslinux

now the ffp.log contains following information

/dev/sdf1               1       60801   488384001  83 Linux
/dev/sdc1               1      121601   976760001  83 Linux
/dev/sde1               1       60801   488384001  83 Linux
/dev/sdf1               1       60801   488384001  83 Linux
mount Linux Drives

Last line is blank.

running it from prompt.

/dev/sdf1               1       60801   488384001  83 Linux
/dev/sdc1               1      121601   976760001  83 Linux
/dev/sde1               1       60801   488384001  83 Linux
/dev/sdf1               1       60801   488384001  83 Linux
mount Linux Drives
sdc1 sde1 sdf1

I'm now replacing the drivesntfs variable with its value.
  for drive in $drivesntfs; do
is changed to
for drive in `fdisk -l | grep -i 'Linux' | grep -v 'sda' | grep -v 'sdb' | awk -F '/| ' '{print $3}'`; do

and everything is mounted on boot.

curious as I am my question are
why isn't the drivesntfs variable functioning at boot when it's working from prompt?

Offline

 

#2 2009-02-17 23:06:30

gort
New member
Registered: 2009-02-17
Posts: 1

Re: Queston about usb_all.sh - why isn't variable working at boottime

hi there.
loading the usb module (usb-storage) takes some time.

for me a very brutal sleep 7 in the init script works (between the "insmod usb-storage.ko" and the mount).
but if you want a more elgant solution you can build something like :
dmesg | grep "usb-storage: device scan complete1" | wc -l
in a loop if you like that more.

Last edited by gort (2009-02-17 23:06:55)

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB