Installing optware on Dune HD-TV 102

Root access

First off, you need to obtain a retail model Dune HD-TV 102w (with ‘w’ postfix), this is the only model which has appropriate firmware for getting root access. Download dune_service_telnetd.dsf, copy it to usb-flash drive and insert into Dune. Power on device, go to Sources, find that file and press OK to execute it. Once this is done, telnetd service will be available until next reboot. To make it permanent, run the following: telnet root@dune_ip login: root password: <empty> tangox[~] touch /config/telnetd tangox[~] sync

HDD Partition

Connect USB-HDD disk drive to Dune to be able to install Optware and store torrents media. We’re going to re-format the disk and create 3 partitions. Here’s a sample list: tangox[~] fdisk -l /dev/sda Disk /dev/sda: 160.0 GB, 160041885696 bytes 255 heads, 63 sectors/track, 19457 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 1 499 4008186 83 Linux /dev/sda2 500 624 1004062+ 82 Linux swap /dev/sda3 625 19457 151276072+ 83 Linux As you can see we’re going to use sda1 to store Optware, sda2 for swap and sda3 for video content. To do that you may use fdisk, mkfs.ext3 and mkswap commands like this: # after fdisk partitioning tangox[~] mkswap /dev/sda2 tangox[~] mkfs.ext3 /dev/sda1 tangox[~] mkfs.ext3 /dev/sda3

Initialize swap

Dune a has special mechanism to autostart some services during initial boot. We’re going to put some preliminary startup work there. Create file /mnt/config/boot/bootstrap.sh and put following contents inside: #!/bin/sh # Turn on swap partition swapon /dev/sda2 Then, make sure that file is executable: tangox[~] chmod +x /mnt/config/boot/bootstrap.sh

Give nice names to HDD partitions

In order for HDD partitions to look nice in Dune GUI (sources menu section), will do some more tuning. First off, issue df command: tangox[~] df Filesystem Size Used Available Use% Mounted on tmpfs 92.7M 3.1M 89.6M 3% /tmp /dev/sda3 142.0G 57.8G 77.0G 43% /D /dev/mtdblock4 105.2M 75.6M 29.5M 72% /app /dev/loop0 262.3M 262.3M 0 100% /tango3 /dev/mtdblock5 100.0M 8.1M 91.9M 8% /mnt /dev/sda1 3.8G 132.3M 3.4G 4% /tmp/mnt/storage/34611c58-ba35-4256-b546-8038078575ab /dev/sda3 142.0G 57.8G 77.0G 43% /tmp/mnt/storage/566c9eb8-8239-4af5-9ea5-609ddc035e6f You’ll see those ugly long directory names, which we want to change. Go to /tmp/mnt/storage/34611c58-ba35-4256-b546-8038078575ab and create the file dune_folder.txt with the following contents: storage_name=opt system_files=* Because this is a system partition for our Optware we’re going to hide every file from being visible by end-user. Go to next directory and create similar file: tangox[~] cd /tmp/mnt/storage/566c9eb8-8239-4af5-9ea5-609ddc035e6f tangox[~] echo "storage_name=media" >> dune_folder.txt tangox[~] echo "system_files=*.part" >> dune_folder.txt This set of folder settings will make uncompleted torrent files hidden from Dune menus. Once you’re done, reboot, telnet again and run df command one more time: tangox[~] df Filesystem Size Used Available Use% Mounted on tmpfs 92.7M 3.1M 89.6M 3% /tmp /dev/sda3 142.0G 57.8G 77.0G 43% /D /dev/mtdblock4 105.2M 75.6M 29.5M 72% /app /dev/loop0 262.3M 262.3M 0 100% /tango3 /dev/mtdblock5 100.0M 8.1M 91.9M 8% /mnt /dev/sda1 3.8G 132.3M 3.4G 4% /tmp/mnt/storage/opt /dev/sda3 142.0G 57.8G 77.0G 43% /tmp/mnt/storage/media Things will look more nicer! Now, let’s make aliases for opt and media folders by symlinking them to root. Make sure your system don’t have any important data at /opt as we’re going to delete it. Now, open /mnt/config/boot/bootstrap.sh file and modify it to look as following: #!/bin/sh # Turn on swap partition swapon /dev/sda2 # symlink optware and media folders rm -rf /opt ln -s /tmp/mnt/storage/opt /opt ln -s /tmp/mnt/storage/media /media Now reboot, and ensure that there are valid /opt and /media symlinks at root path.

Optware installation

Finally we’re ready to install additional software. Create optware installation script at /opt/install.sh: #!/bin/sh # Source code: http://www.nslu2-linux.org/wiki/Optware/HomePage feed=http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/unstable/ # install ipkg ipk_name=`wget -qO- $feed/Packages | awk '/^Filename: ipkg-opt/ {print $2}'` /usr/bin/wget "$feed/$ipk_name" /bin/tar -xOvzf $ipk_name ./data.tar.gz | tar -C / -xzvf - mkdir -p /opt/etc/ipkg echo "src cross $feed" > /opt/etc/ipkg/feeds.conf # install uc-libC ipk_name=`wget -qO- $feed/Packages | awk '/^Filename: uclibc-opt/ {print $2}'` /usr/bin/wget "$feed/$ipk_name" /bin/tar -xOvzf $ipk_name ./data.tar.gz | tar -C / -xzvf - To do that you may should use vi editor which is available by default. Ensure that the file is executable and run it: tangox[~] chmod +x /opt/install.sh # run it tangox[opt] ./install.sh Connecting to ipkg.nslu2-linux.org (140.211.169.161:80) ipkg-opt_0.99.163-10 100% |*************************************************************************************************************| 75831 00:00:00 ETA ./ ./opt/ ./opt/bin/ ./opt/bin/ipkg ./opt/bin/ipkg-opt ./opt/bin/update-alternatives ./opt/etc/ ./opt/etc/ipkg.conf ..................................... Connecting to ipkg.nslu2-linux.org (140.211.169.161:80) uclibc-opt_0.9.28-13 100% |*************************************************************************************************************| 832k 00:00:00 ETA ./ ./opt/ ./opt/etc/ ./opt/lib/ ./opt/lib/ld-uClibc-0.9.28.so ./opt/lib/ld-uClibc.so.0 ./opt/lib/libc.so ...................................................... If you’ve been observing messages above chances are high that you now have a working skeleton of optware system. Let’s check this by typing: tangox[opt] /opt/bin/ipkg --version ipkg version 0.99.163 This means that package management system has been installed and works fine. From this time on you have the ability to install tons of additional linux software precompiled for MIPS architecture! You may get the list of available software by typing ipkg --list, and we’ll continue our tuning process.

Fix PATH variable

Let’s make using optware more convenient, open /mnt/config/boot/bootstrap.sh and add following lines: # fix PATH for new packages echo "export PATH=/opt/bin:/opt/sbin:/bin:/sbin:/usr/bin:/usr/bin/X11:/usr/local/bin" >> /root/.bashrc echo "export PATH=/opt/bin:/opt/sbin:/bin:/sbin:/usr/bin:/usr/bin/X11:/usr/local/bin" >> /etc/profile

Optware autostart hack

In order to autostart all neccessary services we’re going to do some additional hacking. At first, it seems that adding call of autostart script to /mnt/config/boot/bootstrap.sh will do the trick, but after numeruos attempts to do just that things didn’t work. My guess is that at /mnt/config/boot/ stage external storage is not mounted yet, so everything under /opt is not available. To overcome that, I’ve managed to create a bit ugly, but working solution, i.e. to autostart services using crond, which is available by default on device. The idea is simple: start optware only once, and if it is started already just do nothing. Let’s write some scripts to achieve that. Create /opt/etc/rc.optware file with following contents: #!/bin/sh # Start all init scripts in /opt/etc/init.d # executing them in numerical order. for i in /opt/etc/init.d/* ;do # Ignore dangling symlinks (if any). [ ! -f "$i" ] && continue case "$i" in *.sh) # Source shell script for speed. ( trap - INT QUIT TSTP set start . $i ) ;; *) # No sh extension, so fork subprocess. $i start ;; esac done Create /opt/etc/optware-cron.sh with following contents: #!/bin/sh # After reboot this file will be absent! FLAG_FILE=/var/run/optware.started # if file not found, run optware if [ ! -f $FLAG_FILE ]; then touch $FLAG_FILE /opt/etc/rc.optware fi Make sure both files are executable: tangox[opt] chmod +x optware-cron.sh rc.optware Open our /mnt/config/boot/bootstrap.sh file and add following lines: killall crond echo "*/1 * * * * /opt/etc/optware-cron.sh" >> /tmp/cron/crontabs/root /usr/sbin/crond This will modify crond config during startup and will make sure that optware-cron.sh file will be launched once per every minute. Reboot your dune and ensure that everything works fine. Next, we’re going to add some useful software like transmission!

Install transmission

tangox[opt] ipkg install transmission Let’s create startup script for Transmission daemon, open /opt/etc/init.d/S60transmission and type in: #!/bin/sh # Exit if the package is not installed test -f /opt/bin/transmission-daemon || exit 0 function start_daemon() { /sbin/start-stop-daemon --start --quiet --exec /opt/bin/transmission-daemon --auth --config-dir=/opt/etc/transmission/ --username="your_username" --password="your_password" --download-dir=/media/ --allowed=* --logfile=/opt/var/log/transmissiond.log } case "$1" in start) echo "Starting transmission-daemon" start_daemon ;; stop) echo "Stopping transmission-daemon" /sbin/start-stop-daemon --stop --quiet --exec /opt/bin/transmission-daemon ;; restart) echo -n "Stopping transmission-daemon" /sbin/start-stop-daemon --stop --quiet --exec /opt/bin/transmission-daemon for i in 1 2 3 ; do sleep 1 echo -n "." done echo "Restarting transmission-daemon" start_daemon ;; *) echo "Usage: /opt/etc/init.d/S60transmission {start|stop|restart}" exit 1 esac exit 0 Don’t forget to make this script executable and make sure you provide valid your_username and your_password. Verify that transmission daemon works by typing in the terminal: tangox[opt] /opt/etc/init.d/S60transmission start tangox[opt] ps -Af | grep trans 1500 root 0:04 /opt/bin/transmission-daemon --auth --config-dir=/opt/etc/transmission/ --username="your_username" --password="your_password" --download-dir=/media/ --allowed=* --logfile=/opt/var/log/transmissiond.log If everything went fine the last command should output transmission process running in the background, you might also observe it by running top command. Reboot your dune once again, open your favorite web browser and point it to http://dune_ip:9091 you should see basic auth dialog from your Transmission web interface. From this point you’re free to download any torrent media which will be instantly accessible for playback once completed.

Some useful tips

1) I would highly recommend desktop client for transmission called Transmission Remote GUI it has more control and features than default web interface. 2) Find out power management section in main dune menu and set sleep mode to never. You need your device to be online 7×24 don’t you? 3) Install openssh tools, setup public key based authentication and turn off passwordless telnet to increase security

Links

Page 2 of 2 | Previous page

  • Jean-Guy de Testa

    Bravo Andrew, Simple clear and effective, even if I am using another Dune piece of hardware, the main files are there: Thanks a lot

  • jassim

    okay nice , but i have issue with password.. seems my Dune HD ask me for password after i talent using user as root ,, i already instaled dune_service_telnetd.dsf

    hmmmmm
    i guss i need another .dsf for removing or changing the password

  • http://addforums.com IK

    1. for root passwds use ( dune_service_exec.dsf ) on a flashdrive with a file similar to this named dune_exec next to the dsf ( run the same as telnet enabler from GUI );
    #____________ dune_exec ________________
    echo “rat::0:0:root:/root:/bin/sh” >> /etc/passwd
    echo “rat::10933:0:99999:7:::” >> /etc/shadow

    then login as rat or whatever you changed it to…… to make persistent; login via enabled telnet as rat or alike

    # mkdir /mnt/config/boot
    # touch /mnt/config/boot/adduser.sh
    # chmod +x /mnt/config/boot/adduser.sh

    add the two user lines above to that file

    :)

    2. You also might need to do ipkg update before installing transmission step….

    To the author of this hackadelic article, peace, and thanks! ;)

  • Dmitry Kravchenko

    You said “Power on device, go to Sources” in the second paragraph. What did you mean by “GO” there? Shouldn’t I connect to device by telnet prior I am able to “GO” somewhere?

    • http://webapp.org.ua Andrew Druchenko

      I’m referring to stock Dune GUI, which has ‘Sources’ menu. For example, you might put downloaded service file on a flash drive, insert it to USB, power on your device, open attached USB drive, select that file using your remote and execute it. You can’t use telnet before this is done