HDsamba Version 3 Available

Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware
Goto page Previous  1, 2, 3, ... 33, 34, 35  Next
Author Message
AtMi
DD-WRT User


Joined: 04 Jan 2009
Posts: 90
Location: Vilnius, Lithuania

PostPosted: Sat Jan 31, 2009 12:41    Post subject: Reply with quote
Modifed jffs.repair script and working on my mini build:
jffs.repair wrote:

# !/bin

#HDsamba2 V3.00 jffs Repair Script with heavy verification of each step
#By Amorphis
#January 2009

# Support for additional Libraries on Mini_usb_ftp
# addMiniLibs contains 1 for extra libraries or 0 for normal install
# For version 3.0 autodetection is disabled
para=$(echo $1 | tr [a-z] [A-Z])
if cat /tmp/loginprompt | tr [a-z] [A-Z] | grep 'V24 MINI' > /dev/null
then
NOaddMiniLibs=1 ; # Autodetection currently disabled
elif [ $para = "-MINI" ] ; #-Mini is specified as a parameter
then
addMiniLibs=1
else
addMiniLibs=0
fi


# Variables
timeout=30

# Info Message
date
echo "Repair Script - HDsamba2 v3.00"
echo "---------------------------------------------------------"
echo "."


# Do a quick check of to make sure there are 3 disc partitions
# New method, avoiding dmesg
if ls /dev/discs/disc0/ | grep 'part1' > /dev/null
then
if ls /dev/discs/disc0/ | grep 'part2' > /dev/null
then
if ls /dev/discs/disc0/ | grep 'part3' > /dev/null
then
echo " Testing Attached HD..."
echo " VERIFIED: part1, part2, part3"
echo "."
echo "."
else
echo " ERROR: Failed to detect /part1 /part2 /part3"
echo " ERROR: Please double check how you've partitioned your HD..."
echo " ERROR: If you're sure you partitioned correctly, try rebooting the router..."
echo " TERMINATING SCRIPT IMMEDIATELY"
exit
fi
else
echo " ERROR: Failed to detect /part1 /part2 /part3"
echo " ERROR: Please double check how you've partitioned your HD..."
echo " ERROR: If you're sure you partitioned correctly, try rebooting the router..."
echo " TERMINATING SCRIPT IMMEDIATELY"
exit
fi
else
echo " ERROR: Failed to detect /part1 /part2 /part3"
echo " ERROR: Please double check how you've partitioned your HD..."
echo " ERROR: If you're sure you partitioned correctly, try rebooting the router..."
echo " TERMINATING SCRIPT IMMEDIATELY"
exit
fi


# Make sure /mnt is mounted
n=0
while [ $n -lt $timeout ]
do
let n+=1
if mount | grep "/part1 on /mnt" >/dev/null
then
break
else
sleep 1
fi
done
if [ $n -eq $timeout ]
then
mount
echo " ERROR: /mnt is missing what's going on here?"
echo " TERMINATING SCRIPT IMMEDIATELY"
exit
fi


# Make sure /jffs is up
mkdir /jffs/etc
mkdir /jffs/etc/config
n=0
while [ $n -lt $timeout ]
do
let n+=1
if [ -d /jffs/etc/config ]
then
break
else
sleep 1
fi
done
if [ $n -eq $timeout ]
then
echo " ERROR: /jffs is missing..."
echo " ERROR: You should probably enable it in the web GUI..."
echo " TERMINATING SCRIPT IMMEDIATELY"
exit
fi


# OK, Begin Repairs to /jffs/

# Install swap-utils and ef2progs to /jffs
echo "TASK 1: Install packages to /jffs..."
mkdir -p /jffs/tmp/ipkg
ipkg update

# Add Libraries to Open-WRT wrapper only if necessary
if [ $addMiniLibs =1 ]
then
echo " INSTALLING: extra libraries for open-wrt support..."
cd /tmp
wget http://downloads.openwrt.org/whiterussian/packages/base-files-brcm_2_mipsel.ipk
wget http://downloads.openwrt.org/whiterussian/packages/base-files_9_mipsel.ipk
wget http://downloads.openwrt.org/whiterussian/packages/libgcc_3.4.4-9_mipsel.ipk
wget http://downloads.openwrt.org/whiterussian/packages/uclibc_0.9.27-9_mipsel.ipk
/bin/ipkg -force-depends install base-files-brcm_2_mipsel.ipk base-files_9_mipsel.ipk
/bin/ipkg -force-depends install libgcc_3.4.4-9_mipsel.ipk uclibc_0.9.27-9_mipsel.ipk
echo " Extra Libraries Installed..."
export PATH=/jffs/bin:/jffs/sbin:${PATH}
echo " Configuring Open-wrt wrapper..."

(
echo "#HDsamba2 V3.00 Open-WRT wrap script for small build support"
echo "#By Amorphis"
echo "#January 2009"
echo "#!/bin/sh"
echo
echo "export LD_LIBRARY_PATH=/jffs/lib:/jffs/usr/lib:/jffs/usr/local/lib "
echo "\$1 \$2 \$3 \$4 \$5 \$6 "
echo
echo "#Done"
) > /jffs/etc/config/openwrt-run.sh

chmod 777 /jffs/etc/config/openwrt-run.sh
cd /jffs
else
echo " Configuring Open-wrt wrapper in compatibillity mode...."
(
echo "#HDsamba2 V3.00 Open-WRT wrap script, for compatibillity only"
echo "#By Amorphis"
echo "#January 2009"
echo "#!/bin/sh"
echo
echo "\$1 \$2 \$3 \$4 \$5 \$6 "
echo
echo "#Done"
) > /jffs/etc/config/openwrt-run.sh
chmod 777 /jffs/etc/config/openwrt-run.sh
fi
# Install Open-WRT Packages, then Confirm Install
echo " INSTALLING: utilities to /jffs...."
ipkg install e2fsprogs
ipkg install swap-utils
echo " VERIFYING: Packages Installs...."
if [ -e /jffs/usr/sbin/swapon ]
then
echo " VERIFIED: swap-utils"
echo " WARNING: About to wipe Partition 2 of your HD to make a usable Swap..."
echo " WARNING: Are you absolutely sure there is no useful data stored there?"
echo " WARNING: Press Control-C to terminate the script if you are not sure!"
echo " WARNING: Press ENTER to proceed with swap creation..."
read
sh /jffs/etc/config/openwrt-run.sh /jffs/usr/sbin/mkswap /dev/discs/disc0/part2
echo " Swap Created!"
else
echo " ERROR: swap-utils not found on /jffs"
echo " ERROR: this might be a connection problem: try again in a bit."
echo " TERMINATING SCRIPT IMMEDIATELY"
exit
fi
if [ -e /jffs/sbin/e2fsck ]
then
echo " VERIFIED: e2fsprogs"
else
echo " ERROR: e2fsprogs not found on /jffs"
echo " ERROR: this might be a connection problem: try again in a bit."
echo " TERMINATING SCRIPT IMMEDIATELY"
exit
fi
echo "TASK 1: Done"
echo "---------------------------------------------------------"
echo "."

# Copy Scripts Set Permissions
echo "TASK 2: Configuring Installation..."
echo " Copying Scripts..."
cp /mnt/HDsamba/scripts/init.startup /jffs/etc/config/
cp /mnt/HDsamba/scripts/disk_health.usb /jffs/etc/config/
cp /mnt/HDsamba/scripts/unmount.usb /tmp
chmod 777 /jffs/etc/config/init.startup
chmod 700 /jffs/etc/config/disk_health.usb
echo "TASK 2: Done"
echo "."
echo "---------------------------------------------------------"


# Present Option to configure Radio Button
echo "TASK 3: Radio Button Option..."
echo " Do you want to use the radio button as a HD unmount button?"
echo " It would probably be a good idea so disable it as a radio control"
echo " in the web GUI if you choose this option."
echo " Type 'YES' in capitals to do so, anything else cancels this option."
echo " ."
radio_button_option="\0"
read radio_button_option
if [ -z $radio_button_option ]
then
echo "Radio Button will function normally."
rm /jffs/etc/config/unmount.sesbutton
elif [ $radio_button_option = "YES" ]
then
cp /mnt/HDsamba/scripts/unmount.sesbutton /jffs/etc/config/
chmod 777 /jffs/etc/config/unmount.sesbutton
echo "Radio Button will now unmount the HD!"
else
echo "Radio Button will function normally."
rm /jffs/etc/config/unmount.sesbutton
fi

echo "TASK 3: Done"
echo "."
echo "---------------------------------------------------------"


# Store the umount script in NVRAM to make it sure it always occur on reboot...
echo "TASK 4: Store /mnt/HDsamaba/scripts/unmount.usb as the default shutdown script..."
nvram set rc_shutdown="sh /tmp/unmount.usb"
echo " Writing NVRAM..."
nvram commit
n=0
while [ $n -lt $timeout]
do
let n+=1
if nvram get rc_shutdown | grep "sh /tmp/unmount.usb" > /dev/null
then
break
fi
sleep 1
done
if [ $n -eq $timeout ]
then
echo " ERROR: Router failed to write NVRAM."
echo " ERROR: There will be no automatic unmounting of your HD."
free
mount
nvram show
echo " TERMINATING SCRIPT IMMEDIATELY"
exit
fi
echo " MOUNTED: /mnt/opt on /opt"
echo "TASK 4: Done"
echo "---------------------------------------------------------"
echo "."

# Info Message
echo "Suggest you reboot your router... remember to use /tmp/unmount.usb"
echo "."
echo "Script Finished."
cd \

# done
I don't remember if it is all what I modifed and could be that not all modification is needed. But now it is working on my WRT600N mini build.
Very Happy
Thanks Amorphis for great Work Idea

_________________
WRT600N V1.1 - 12672_mega_WRT610N
Sponsor
AtMi
DD-WRT User


Joined: 04 Jan 2009
Posts: 90
Location: Vilnius, Lithuania

PostPosted: Sat Jan 31, 2009 12:45    Post subject: Reply with quote
MrAlvin wrote:
AtMi wrote:
/mnt/HDsamba/scripts/jffs.repair -mini

Might be a case of extensions, not shure, but try:
sh /mnt/HDsamba/scripts/jffs.repair -mini
I think you will get better results then.

Thanks MrAlvin but on my router it is not important, now it's working Very Happy

_________________
WRT600N V1.1 - 12672_mega_WRT610N
MrAlvin
DD-WRT User


Joined: 07 Jan 2007
Posts: 457
Location: Denmark

PostPosted: Sat Jan 31, 2009 12:58    Post subject: Reply with quote
AtMi wrote:
It is mistake in writing to "openwrt-run.sh". This script is writen like for mega build:
Quote:
#!/bin/sh
#HDsamba2 V3.00 Open-WRT wrap script, for compatibillity only
#By Amorphis
#January 2009

$1 $2 $3 $4 $5 $6

#Done


Try to edit in the v3install.HDsamba2 script in line 19, from NOaddMiniLibs=1 to addMiniLibs=1
This should make shure that mini options are used.


P.S. Have taken the liberty of adjusting the v3install.HDsamba script and the jffs.repair in the v3HDsamba2.tar.gz file now hosted at www.3iii.dk/linux/optware to work better with -mini install option, as I was the one to "mislead" Amorphis into dealing with this -mini issue in the first place.

So you could also try downloading those two files and test out the slightly adjusted jffs.reapir script (stored inside v3HDsamba2.tar.gz).
MrAlvin
DD-WRT User


Joined: 07 Jan 2007
Posts: 457
Location: Denmark

PostPosted: Sat Jan 31, 2009 13:01    Post subject: Reply with quote
Oh, we are both comming up with soulutions at the same time. I'll let Amorphis take a look at your changes, to see how they could be incorporated in his scripts.
MrAlvin
DD-WRT User


Joined: 07 Jan 2007
Posts: 457
Location: Denmark

PostPosted: Sat Jan 31, 2009 13:08    Post subject: Reply with quote
MrAlvin wrote:
AtMi wrote:
/mnt/HDsamba/scripts/jffs.repair -mini

Might be a case of extensions, not shure, but try:
sh /mnt/HDsamba/scripts/jffs.repair -mini
I think you will get better results then.


AtMi wrote:
MrAlvin wrote:
AtMi wrote:
/mnt/HDsamba/scripts/jffs.repair -mini

Might be a case of extensions, not shure, but try:
sh /mnt/HDsamba/scripts/jffs.repair -mini
I think you will get better results then.

Thanks MrAlvin but on my router it is not important, now it's working Very Happy


Ah.., I see how its a case of having #!/bin line at the beginning of the script.

To make sure Linux knows which script interpreter to use, the first line of the file must have the script indicator comment (#!/bin - #!/bin/sh), OR one must use the script interpreter command to call the file, like: sh script - php4 script - <engine> <script>.
AtMi
DD-WRT User


Joined: 04 Jan 2009
Posts: 90
Location: Vilnius, Lithuania

PostPosted: Sat Jan 31, 2009 14:08    Post subject: Reply with quote
MrAlvin wrote:
Ah.., I see how its a case of having #!/bin line at the beginning of the script.

To make sure Linux knows which script interpreter to use, the first line of the file must have the script indicator comment (#!/bin - #!/bin/sh), OR one must use the script interpreter command to call the file, like: sh script - php4 script - <engine> <script>.

I am novice to Linux, php and ... And I don't know how it's work, but for my this script began run only after ading space between # and !/bin on the first line in script (look in my moifikation http://www.dd-wrt.com/phpBB2/viewtopic.php?p=256849#256849).
For unmount script working both commands <sh /tmp/umount.usb> and </tmp/unmount.usb> Question

_________________
WRT600N V1.1 - 12672_mega_WRT610N
AtMi
DD-WRT User


Joined: 04 Jan 2009
Posts: 90
Location: Vilnius, Lithuania

PostPosted: Sat Jan 31, 2009 14:18    Post subject: Reply with quote
<daemon.kill> and <daemon.load> I will try tonight later. If anybody try it, pleas share experience!
_________________
WRT600N V1.1 - 12672_mega_WRT610N
Amorphis
DD-WRT User


Joined: 08 Jan 2009
Posts: 234
Location: Toronto, Ontario

PostPosted: Sat Jan 31, 2009 15:39    Post subject: Reply with quote
Nice fix Atmi and Mr. Alvin.
I'm not able to test to -mini installs myself, so I appreciate your help.

I'm going to incorporate your changes, and some little things I want to tweak into a package later today to update version 3.

Many heads are better than one!

_________________
WRT350N Eko Mega 11296 + HDsamba2 v4 beta
Amorphis
DD-WRT User


Joined: 08 Jan 2009
Posts: 234
Location: Toronto, Ontario

PostPosted: Sat Jan 31, 2009 16:25    Post subject: Reply with quote
Scripts are fixed, feel free to take MINI builds for a spin.
_________________
WRT350N Eko Mega 11296 + HDsamba2 v4 beta
romitchell
DD-WRT Novice


Joined: 15 Oct 2008
Posts: 14

PostPosted: Sat Jan 31, 2009 16:35    Post subject: Reply with quote
Sorry if this has been covered already, couldn't see when i gave the thread a quick scan.

If i download and run the script i can simply install over the old V2? Will it pick up any settings?
Thanks
Amorphis
DD-WRT User


Joined: 08 Jan 2009
Posts: 234
Location: Toronto, Ontario

PostPosted: Sat Jan 31, 2009 17:02    Post subject: Reply with quote
For those upgrading:
----------------

1) shutdown your existing HDsamba system. Putty in, run
$ sh /tmp/unmount.usb

2) Wait for shutdown to complete.

3) JFFS is a bit tricky. The installer wants to see 400kb of free space.
If you don't have extra packages installed, just wipe everything in jffs
If you want to keep everything, try running the install script leaving your stuff
If you get stuck with a low space warning, post a message, there is a way
around this- but I think this is a very rare scenario.

3) Mount your disc manually so we can take a look:
$ mount -t ext3 /dev/discs/disc0/part1 /mnt

4) Now we deal with optware:

If you want to keep your existing setup, just leave it alone. Skip this step.
The installer will make backup copies of your configs which you can copy
back later manually. Once your samba is up and running you can find these
backup copies in /opt/etc and samba and xinetd subfolders.

When I am testing new builds I generally just wipe optware clean, saves
any potential conflicts.

5) that's it. wget and install.


To summarize,
decide if you want to wipe jffs.
decide if you want to wipe opt.

install.


NOTE: If enough people request it, I can write a routine to automate some of this in the install script.... but as of right now, it should install over older versions without issue. SETTINGS FROM YOUR OLD CONFIG ARE STORED AS BACKUP FILES ONLY.

_________________
WRT350N Eko Mega 11296 + HDsamba2 v4 beta
Amorphis
DD-WRT User


Joined: 08 Jan 2009
Posts: 234
Location: Toronto, Ontario

PostPosted: Sat Jan 31, 2009 17:16    Post subject: Reply with quote
I re-read what I wrote...

shorter answer.

You can install over it, no problem.
It will not use your current settings, but it will keep backups of them.

Better answer. Smile

_________________
WRT350N Eko Mega 11296 + HDsamba2 v4 beta
romitchell
DD-WRT Novice


Joined: 15 Oct 2008
Posts: 14

PostPosted: Sat Jan 31, 2009 17:32    Post subject: Reply with quote
Thanks,
Just did that, had to restore the smb.conf file as the newly generated one wouldn't allow me to write to my share.

Im pretty sure that i told it to force user = root however this seems to missing from the new file. Could be me, will give it a play later see if i can reproduce it.



smb.conf.txt
 Description:

Download
 Filename:  smb.conf.txt
 Filesize:  625 Bytes
 Downloaded:  769 Time(s)


smb.conf.old.txt
 Description:

Download
 Filename:  smb.conf.old.txt
 Filesize:  600 Bytes
 Downloaded:  696 Time(s)

Amorphis
DD-WRT User


Joined: 08 Jan 2009
Posts: 234
Location: Toronto, Ontario

PostPosted: Sat Jan 31, 2009 17:37    Post subject: Reply with quote
Check it out, I'm a bit hesitant to believe that however, as that part of network.usb was never changed... and both these files were generated by swat, not HDsamba2

For what it's worth, network.usb behaves as it always did for Force User on my setup - you need to type YES in all capitals to enable root force.

Remember to add Hosts Allow, if you want to continue to use your orginal smb.conf - make it secure for your subnet. This is generated correctly by the new network.usb.

_________________
WRT350N Eko Mega 11296 + HDsamba2 v4 beta
romitchell
DD-WRT Novice


Joined: 15 Oct 2008
Posts: 14

PostPosted: Sat Jan 31, 2009 17:59    Post subject: Reply with quote
Unsurprisingly you were right, tried it again and seemed to work perfectly!
Thanks again spent literally days faffing with this stuff over the summer but eventually gave up.

You were talking in a different thread about getting the HD to spin down, have you been getting anywhere with this?
Goto page Previous  1, 2, 3, ... 33, 34, 35  Next Display posts from previous:    Page 2 of 35
Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum