Tiny Core Linux

Tiny Core Base => TCB Bugs => Topic started by: dalazyman on June 03, 2010, 07:13:55 AM

Title: problem with awk in autoscan
Post by: dalazyman on June 03, 2010, 07:13:55 AM
Hi there,

I think I found a bug within etc/init.d/tc_functions. On startup, I used bootlocal.sh to execute some mounts. This worked well until TC 2.7 ... recently I upgraded to 2.11 and all my mounts were gone. So I looked for the problem and after a lot of headaches I found out that the awk expression in the autoscan() function needs to be updated in order to work properly.

Here's a helpful link:
http://www.gnu.org/manual/gawk/html_node/Field-Separators.html#Field-Separators (http://www.gnu.org/manual/gawk/html_node/Field-Separators.html#Field-Separators)

So, instead of

" `grep "/mnt/" /etc/fstab | grep -vf /etc/init.d/tc_noscan.lst | awk 'FS="/" {print $3}'` "

it should be modified to:

" `grep "/mnt/" /etc/fstab | grep -vf /etc/init.d/tc_noscan.lst | awk 'BEGIN {FS="/"}; {print $3}'` "

That worked for me and now all mounts are available after boot.

Kind regards.
Title: Re: problem with awk in autoscan
Post by: roberts on June 03, 2010, 03:22:46 PM
Agreed. Updated. Thanks.