Joined: 04 Jan 2009 Posts: 90 Location: Vilnius, Lithuania
Posted: Sat Jan 31, 2009 12:41 Post subject:
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
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 "."
# 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
# 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.
Thanks Amorphis for great Work _________________ WRT600N V1.1 - 12672_mega_WRT610N
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).
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.
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
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>.
Joined: 04 Jan 2009 Posts: 90 Location: Vilnius, Lithuania
Posted: Sat Jan 31, 2009 14:08 Post subject:
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> _________________ WRT600N V1.1 - 12672_mega_WRT610N
Joined: 04 Jan 2009 Posts: 90 Location: Vilnius, Lithuania
Posted: Sat Jan 31, 2009 14:18 Post subject:
<daemon.kill> and <daemon.load> I will try tonight later. If anybody try it, pleas share experience! _________________ WRT600N V1.1 - 12672_mega_WRT610N
Joined: 08 Jan 2009 Posts: 234 Location: Toronto, Ontario
Posted: Sat Jan 31, 2009 17:02 Post subject:
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
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.
Joined: 08 Jan 2009 Posts: 234 Location: Toronto, Ontario
Posted: Sat Jan 31, 2009 17:37 Post subject:
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
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?