Install Optware on a CIFS/samba-share

When trying to install optware on my router (running on dd-wrt) I found the following manual describing how to loop-mount a ext2-fs-image on a remote cifs-server and use this as /opt for installing optware : Optware_on_CIFS_Partition_in_a_file

However it didnt seem right and it didnt work to me. To me it left the question why one cannot just use a cifs-share itself as /opt. And it works to me. Perfectly !! One only has to adapt the frater-optware-install a little bit :)

Step1 : mount /opt on CIFS-share

  • create a share on your sambaserver that has at least two subdirectories : jffs and opt
  • create a cifs-automount of this share in dd-wrt webgui. (administration->managment)
  • disable jffs in webgui and manually bind /jffs to the jffs-subdir in your cifs and enable jffs and update:
mount --bind /tmp/smbshare/jffs /jffs
nvram set sys_enable_jffs2=1
mkdir -p /jffs/tmp/ipkg
ipkg update 

  • mount the cifs-share as opt:
mount --bind /tmp/smbshare/opt /opt
  • if this works fine, then you create the following in the root-directory of your cifs-share (not in the jffs or opt-subdirectory) a type in the mountscript-field of cifs-automount-webdir.:

mount --bind /tmp/smbshare/jffs /jffs
nvram set sys_enable_jffs2=1
mount --bind /tmp/smbshare/opt /opt
  • reboot the router to see if cifs/jffs/opt are mounted as planned

Step2 : install optware on the new /opt using the frater-script

Frater has the best way to install optware on a dd-wrt (see frater in dd-wrt-forum for more information):

wget -O /tmp/prep_optware
sh /tmp/prep_optware

However this will fail on our cifs-opt-partition with the following error:

Error: /opt partition is not partitioned as ext2/ext3

I dont know why frater restricts his script to install optware not on anything else but a ext2-partition. Of course troubles will arise when the cifs-share is not available but nothing a modern linux-guy could not handle ;)

Ok. Its important to run the prep_optware-script until the mentioned error occures. Cause the script downloads the /tmp/ - script which not only triggers the error but is also important for the next step.

We avoid the error by modifying two scripts:

2010-12-17 - note that on newer version /tmp/prep-optware is now named prep_optware

  • vi /tmp/ and find the line where the above error is mentioned in a echo-command. disable the whole logical block. you could simply delete all lines between the else and the fi and enter a line like echo I was here :)
  • vi /tmp/prep-optware and find the line where is downloaded. Its a wget that pipes the downloaded version into the and its only one line. REMOVE THIS LINE !!! or the changes we did in this very same script in the previous step will be overwritten by the downloaded script as soon as we run again.

  • execute sh /tmp/prep-optware

And here you go !! Everything should be fine !!

Please note that I did the whole procedure yesterday and wrote it down today. So maybe I forgot one or two important steps :) Especially the file-permissions gave me some troubles on the way as far as I can remember. But easily solved.

knowwiki/howtos/optware_on_cifs.txt · Last modified: 2010/12/17 20:35 by peter