/auth/firmware_upgrade.pl
Forum » Forum / My Book World Edition (blue rings) » /auth/firmware_upgrade.pl
Started by: takaidestakaides
On: 1189321049|%e %b %Y, %H:%M %Z|agohover
Number of posts: 6
rss icon RSS: New posts
/auth/firmware_upgrade.pl
takaidestakaides 1189321049|%e %b %Y, %H:%M %Z|agohover

I was curious to ask if anyone could post the "/auth/firmware_upgrade.pl" file. It may help users (such as myself) who can't currently use Hinner's code.

unfold /auth/firmware_upgrade.pl by takaidestakaides, 1189321049|%e %b %Y, %H:%M %Z|agohover
Re: /auth/firmware_upgrade.pl
chaydenchayden 1189703056|%e %b %Y, %H:%M %Z|agohover

#

  1. Checks for a firmware upgrade on the 'net, and optionally downloads
  2. and installs.

#

  1. Ian Steel
  2. November 2006

#
package nas::firmware_upgrade;

use Exporter;
@ISA=qw(nasCore);

use strict;

use nasCommon;
use Service::Storage;
use Service::RAIDStatus;

sub main($$$) {

my ($self, $cgi, $config) = @_;

if ( $config->val('general','system_type') !~ /1nc/i ) {
# It's not a 1nc, so check that the status is ok before continuing
my $status = Service::Storage->driveStatusCode( $config );
if ($status ne Service::RAIDStatus::OK) {
$self->outputTemplate('firmware_faulty.tpl', {
tabon => 'general',
});
return;
}
}

# Check that no shares are in use
if ( # Short circuit if internal fails. external is less likely to happen
system( 'sudo '.nasCommon->nas_nbin."shareControl.sh check_internal" ) ||
system( 'sudo '.nasCommon->nas_nbin."shareControl.sh check_external" )
) {
# Mount point was probably busy or something happened.
$self->outputTemplate('firmware_busy.tpl', {
tabon => 'general',
});
return;
}

my $vars = { tabon => 'general' };

if ( -r '/tmp/active_upgrade' ) {
print $cgi->redirect('/auth/firmware_progress.pl');
return;
}

if ($cgi->param('submit')) {
$self->getAndApply($cgi, $config);
return;
}
open (DEF, "</etc/default-settings") or die "Cannot open default-settings: $!\n";
my ($dev, $dev_mode) = ();
my ($sys, $sys_type) = ();
while (<DEF>) {
chomp;
if (/developer_mode/im) {
($dev, $dev_mode) = split /=/;
next;
}
if (/default_system_type/im) {
($sys, $sys_type) = split /=/;
next;
}
}
close DEF;
if (($dev_mode=~/yes/i) && (!$cgi->param('fwserver'))) {
$self->outputTemplate('firmware_mode.tpl', $vars);
return SUCCESS;
}
my $fws = "websupport.wdc.com/firmware/list.asp";
if ($cgi->param('fwserver')) {
$fws = $cgi->param('fwserver') . "/list.asp";
}
$self->checkForUpgrade($cgi, $config, $fws, $sys_type);
}
#

  1. Check for firmware upgrade being available

#
sub checkForUpgrade {

my ($self, $cgi, $config, $fws, $sys_type) = @_;

my $vars = { tabon => 'general' };
my $error = 0;

open(FWV, "</var/lib/current-version") || return $self->fatalError($config, 'f00029');
my $fwVersion = <FWV>;
chomp $fwVersion;
close FWV;

sudo("$nbin/wget.sh /var/upgrade/fwv.tmp http://${fws}?type=${sys_type}+fw=${fwVersion}");

unless ( -r '/var/upgrade/fwv.tmp' ) {
$self->fatalError($config, 'f00030');
return FAILURE;
}

my $tmp=$/;
undef $/;
open(FWV, "</var/upgrade/fwv.tmp") || return $self->fatalError($config, 'e18003');
my $fwv=<FWV>;
close FWV || die "failed to close";
$/=$tmp;

# Is there a later version available?
#
debug("DAYWAN: " . $fwv);
if ($fwv =~ /no upgrade available/im) {
$self->outputTemplate('firmware_upd_notavail.tpl', $vars);
return SUCCESS;
}

# Extract the url which points to the latest firmware
#
;

if ($fwv =~ /.*href="([^"]+)"/is) {
$vars->{frm}->{url} = $1;
$self->outputTemplate('firmware_upd_avail.tpl', $vars);
debug("DAYWAN: " . $1);
}
else
{
$self->outputTemplate('firmware_upd_notavail.tpl', $vars);
}

return SUCCESS;
}

sub getAndApply($$$) {

my ($self, $cgi, $config) = @_;

my $vars = { tabon => 'general' };
my $error = 0;

my $rc=system( 'sudo '.nasCommon->nas_nbin."shareControl.sh stop" );
if ($rc==0) {
# Submit to the background shell script to download and apply new
# firmware.
# give myself access to lock files and remove.
#
my $url = $cgi->param('url');

sudo ( "$nbin/chmod.sh 0777 /var/upgrade");
sudo ( "$nbin/chmod.sh 0666 /var/upgrade/latestfw.sh");
unlink '/var/upgrade/latestfw.sh' ;
sudo ("$nbin/chmod.sh 0666 /var/upgrade/fwdownloaded");
unlink '/var/upgrade/fwdownloaded' ;
sudo ("$nbin/chmod.sh 0666 /var/upgrade/fwinstalled");
unlink '/var/upgrade/fwinstalled' ;

sudo("$nbin/getandapplyfw.sh $url");

print $cgi->redirect('/auth/firmware_progress.pl');
sleep(1);
} else {
# Mount point was probably busy or something happened.
$self->outputTemplate('firmware_busy.tpl', {
tabon => 'general',
});
return;
}

return SUCCESS;

}

1;

last edited on 1189703199|%e %b %Y, %H:%M %Z|agohover by chayden + show more
unfold Re: /auth/firmware_upgrade.pl by chaydenchayden, 1189703056|%e %b %Y, %H:%M %Z|agohover
Re: /auth/firmware_upgrade.pl
ionoffionoff 1191469191|%e %b %Y, %H:%M %Z|agohover

I just thought I would mention that the firmware_upgrade.pl is really a include located at:
/usr/www/lib/nas/firmware_upgrade.pm

unfold Re: /auth/firmware_upgrade.pl by ionoffionoff, 1191469191|%e %b %Y, %H:%M %Z|agohover
Re: /auth/firmware_upgrade.pl
sTssTs 1189332480|%e %b %Y, %H:%M %Z|agohover

I am not sure where the file you refer to is … but there is this series of files I have found:
-rwxr-xr-x 1 root root 77 Mar 26 13:24 firmware_busy.tpl
-rwxr-xr-x 1 root root 171 Mar 26 13:24 firmware_downloading.tpl
-rwxr-xr-x 1 root root 77 Mar 26 13:24 firmware_faulty.tpl
-rwxr-xr-x 1 root root 467 Mar 26 13:24 firmware_mode.tpl
-rwxr-xr-x 1 root root 125 Mar 26 13:24 firmware_progress.tpl
-rwxr-xr-x 1 root root 330 Mar 26 13:24 firmware_upd_avail.tpl
-rwxr-xr-x 1 root root 83 Mar 26 13:24 firmware_upd_notavail.tpl
If you want a copy of any of these then just ask and I will e-mail it over since I haven't sussed attachments on this site system yet.

unfold Re: /auth/firmware_upgrade.pl by sTssTs, 1189332480|%e %b %Y, %H:%M %Z|agohover
Re: /auth/firmware_upgrade.pl (The drive is currently busy. Please stop using all shares and try again)
nschembrnschembr 1190921726|%e %b %Y, %H:%M %Z|agohover

This is a copy of the wd forum just in case.

http://websupport.wdc.com/forum/topic.asp?TOPIC_ID=5535&whichpage=6

Posted - 09/20/2007 : 11:46:06 AM

quote:
I purchased a wd mybook 500 world with 01.01.18. I added the admin passwd and created an account called bill. I then when to the Firmware upgrade page. I get "Applying new firmware

The drive is currently busy. Please stop using all shares and try again."

Has anyone else seen this error on new units as of 9 /20/2007.
wd case number 092007-524-5152

Unit number two:
I have the same error as unit one.
I used hardware hack to start sshd.

/usr/www/lib/nas/firmware_upgrade.pm calls :
if ( # Short circuit if internal fails. external is less likely to happen
system( 'sudo '.nasCommon->nas_nbin."shareControl.sh check_internal" ) ||
system( 'sudo '.nasCommon->nas_nbin." shareControl.sh check_external" )
) {

  1. Mount point was probably busy or something happened.

$self->outputTemplate('firmware_busy.tpl', {
tabon => 'general',
});
return;
}

ssh into unit, become root:

[root@MyBookWorld /]# /usr/www/nbin/shareControl.sh check_internal
WARNING: No path in service dummy-2 - making it unavailable!
WARNING: No path in service dummy-3 - making it unavailable!
[root@MyBookWorld /]#

Note: I have not configured any shares at this point.

Hello Level 1 Support,
Can anyone at WD address this error. I have two new units that can not upgrade firmware. wd case number 092007-524-5152

Re: /auth/firmware_upgrade.pl (The drive is currently busy. Please stop using all shares and try again)
ionoffionoff 1191471142|%e %b %Y, %H:%M %Z|agohover

Yes I receive that also
WARNING: No path in service dummy-2 - making it unavailable!
WARNING: No path in service dummy-3 - making it unavailable!

The error is also passed to console when going to firmware update page in web interface (except it shows the 2 messages repeated twice)

It may have something to do with the fact that
http://websupport.wdc.com/firmware/list.asp?type=wdg1nc&fw=01.00.0
shows no upgrade availiable for all versions tried.

As for your first error of
The drive is currently busy. Please stop using all shares and try again."

you need to disconenct any users on your drive using fileshare method //ip_or_hostname
or have the drive mapped to a letter or remotely mounted.

last edited on 1191471312|%e %b %Y, %H:%M %Z|agohover by ionoff + show more
New post
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License