[7. June 2013] Youporn available now | [19. April 2013] A-400 Advanced Network Setup | [11 Jan. 2013] Customize your A-400 Home Screen

Firmware: A-400 [13 May 2013] | C-300 [30 Nov. 2012] | A-300 [30 Nov. 2012] | C-200 RC1 [13 June 2013] | A-200/A-210 RC1 [13 June 2013]

Just got your NMT | WIKI has the answers | Search the forum | Forum Rules/Policy | Firmware & Official NMT News | Popcornhour manuals


Post a New Reply
Reply to thread: NMT & CSI apps on USB, media on NTFS SATA, transmission downloads to SATA
Username:
Password:
Post Subject:
Post Icon:


Your Message:
Smilies
:) ;) :cool: :D
:P :rolleyes: :shy: :(
:lightbulb: :angry: :-/ (A)
:heart: :dodgy: :blush: :huh:
:my: :sleepy: :exclamation: :S
[get more]
Post Options:
Thread Subscription:
Specify the type of email notification and thread subscription you'd like to have to this thread. (Registered users only)





Thread Review (Newest First)
Posted by jve - 03-23-2013 06:46 AM
Sorry never seen iit work
Posted by Pericles - 03-18-2013 08:31 PM
Thanks for this. Very useful.
Posted by Jackerry - 01-10-2013 02:56 AM
(10-21-2012 05:07 AM)wta12 Wrote:  thanks for your guide
but i cant use ssh and webui pyload and transmission anymore after doing this work so i'm sticking with ext3 drive. it's seem that many user apps has not been configured to work with app on USB.

The same problem with youHuh
Posted by th14 - 01-06-2013 10:35 PM
I don't understand this tutorial. If I want to use my internal HDD for storage and the NMT Apps on a separate USB Stick I can just install the NMT Apps on that stick and then select the internal HDD as download destination for Transmission, right?
Posted by wta12 - 10-21-2012 05:07 AM
thanks for your guide
but i cant use ssh and webui pyload and transmission anymore after doing this work so i'm sticking with ext3 drive. it's seem that many user apps has not been configured to work with app on USB.
Posted by Mex - 06-17-2012 03:03 AM
Thank you this helped allot, but to be sure it is not possible! to seed torrents from 2 drives??
Posted by mmartine - 04-08-2012 03:30 PM
Forgot to mention, you need to stop the application (for example Transmission) thru CSI before editing settings file and start it again after you finish and save the file. It won't work otherwise.


P.S. I also changed this line from daemon.sh:

if [ ! -e /sata_disk_a1/Download ]; then
mkdir /sata_disk_a1/Download -m 777

to read:

if [ ! -e /share/Download ]; then
mkdir /share/Download -m 777

Seems to work either way with no difference whatsoever
Posted by chris57 - 04-08-2012 04:19 AM
Good guide for those that may need it.

For those thinking why cannot I simply go into NMT Setup Wizard and specify the SATA HDD as my Media Drive. Thereby making download folders on the SATA HDD for torrent and usenet downloads.

Answer is yes you can simply do it via that way, however if you use some CSI Apps then they are required to be on a standard setup where the Media Drive is also the location of your NMT Apps install. Thereby the need for a Guide.

We have had a guide that explains how to format the large storage partition from ext to NTFS and still allow CSI Apps to work but this one if for a different scenario with separate locations for the NMT Apps install and a NTFS formatted HDD.
Posted by mmartine - 04-01-2012 12:53 PM
HI! First I just wanna say that I am not an expert and I did this thru a lot of trial and error. I'm not 100% sure about what I did but it all works now on my C200 and it is very stable. NMT APPS & CSI are on a USB drive, all my files are on a NTFS formatted SATA HDD. Transmission downloads directly to SATA. You need Notepad++ text editor to do this(do not use wordpad or notepad);next, enable viewing hidden files( go to Folder options in control panel on Windows PC); make sure ftp&samba are enabled and you can connect with your PC; make backup of your files just in case...

First, I did as was written in this post (http://www.networkedmediatank.com/showth...tid=46463) and it worked until I had to restart NMT because it kept crashing.

It is very important that you go thru the lines of code I'll put here and change the appropriate lines to correspond to your settings(for example, my HDD is named "sata_disk_a1" and that is what is written im my daemon.sh file. If your HDD is named sata_disk_A2 or different you need to go thru it and change the names)

1. Unplug HDD and plug an USB key.(delete Application files and folders from HDD if you have them from before you take it out)
2. SETUP -> Maintenance -> NMT Setup Wizard menu.
Chose USB Update (which you need to download and place in the root of your USD) and Fresh install.
3. Download CSI, configure your device Popcorn Hour *200 (USB), and use CSI. Install transmission 2.50 and torrent expander and other programs you like and then turn the NMT off, put the HDD with your media back in.
4. On your PC, go to MY COMPUTER, then NETWORK(on the left side), then PCH200. Look which two links(folders) you have there. In my case, there are sata_disk_A1 and share.
4.then with notepad++ open start_app.sh which is located in the share folder.
5.Copy paste this on line 1
Code:
# symlink SATA to USB ! Artifex14
## Values to change

for folder in Download Music Photo Video;do  # you can change these values, they correspond to the HDD folder.

NUMBER=1 # Your HDD number, you can see it in the FTP or the samba share.

##

filecount()
{
  [ -e "$1" ] && numfiles=$# || numfiles=0
}
    
    rm /share/${folder} # It removes any old symlink.
    
    if [ -d "/share/${folder}/" ]; #it tries if the folder exists.
    then
        cnt=$(ls /share/${folder} | wc -l) # It exists then it verify if it got any folder/file in this folder.
        if [[ ! $cnt -ne 0 ]] ; then
            rm -r /share/${folder} # It doesn't got anything in the folder, so it deletes the folder (using rm -r).
        fi
    fi
    
    if [ -d "/opt/sybhttpd/localhost.drives/SATA_DISK_A$NUMBER" ]; #Verify if the HDD was plugged after or before boot
        then
        SATA=SATA_DISK_A$NUMBER # Before
        else
        SATA=SATA_DISK_B$NUMBER # After
    fi
    
    ln -s /$SATA/${folder} /share/    # Now it links the folder of the HDD to the share !
    echo "All right"
    
done
6. in the share directory, delete the Download Music Photo Video folders
7. on your NMT GUI, access your USB drive, restart the NMT and wait for a few minutes. Your Download Music Photo Video folders should be seen in the share folder looking on your PC. If they are not, restart the NMT again until they are. I am not sure why it happens.
8. open the .transmission folder on your share folder(it's hidden) and open settings.json with notepad++ and change the line to read "download-dir": "\/share\/\/Download",
save it and exit
9.open Transmission folder on share/aps and edit daemon.sh with notepad++ Change the appropriate lines to read like in my code or just replace the whole thing if you have c200 but make sure you change to correct names if yours are different(like sata_disk_A1 or A2 or A3 or share or Download etc.). This is my daemon.sh:
Code:
#!/bin/sh

is_glibc() {
    [ -f /lib/ld.so.1 ]
}

is_uclibc() {
    [ -f /lib/ld-uClibc.so.0 ]
}

start()
{    
    if [ -n "`ps | grep '/share/Apps/Transmission/bin/transmission-daemon' | grep -v 'grep'`" ]; then
        #don't start it twice
        echo "Transmission CSI already running"
        exit 0
    fi
    
    if [ -n "`ps | grep "transmission-daemon" | grep -v "Apps" | grep -v "grep"`" ]; then
        /nmt/apps/server/clutch stop >/dev/null 2>&1

        i=0
        while [ -n "`ps | grep "transmission-daemon" | grep -v "Apps" | grep -v "grep"`" ] && [ $i -le 5 ]; do
            i=$(( $i + 1 ))
            sleep 1
        done

        kill -9 `pidof transmission-daemon` >/dev/null 2>/dev/null
        sleep 2
    fi

    # Make sure we aren't already running
    ps | grep transmission-daemon | grep -v grep
    if [  "$?" != "1" ]; then
        echo "Can't stop existing running transmission."
        exit 1;
    fi
    
    if [ ! -f /share/Apps/Transmission/bin/transmission-daemon ]; then
        if is_glibc; then
            ln -s /share/Apps/Transmission/bin/transmission-daemon-glibc /share/Apps/Transmission/bin/transmission-daemon
        elif is_uclibc; then
            ln -s /share/Apps/Transmission/bin/transmission-daemon-uclibc /share/Apps/Transmission/bin/transmission-daemon
        else
            echo "Unknown C library."
            exit 1
        fi
    fi
    
    if [ ! -e /sata_disk_a1/Download ]; then
        mkdir /sata_disk_a1/Download -m 777
    fi

    if [ ! -e /share/Apps/Transmission/config/ ]; then
        mkdir /share/Apps/Transmission/config/ -m 777
    fi

    chmod +x /share/Apps/Transmission/bin/transmission-daemon
    
    if [ ! -f "/share/Apps/Transmission/config/settings.json" ]; then
        /share/Apps/Transmission/bin/transmission-daemon -a "127.0.0.1, *.*.*.*" -w /share/Download -p 9091 -ep -L 100 -l 20 -d 2> /share/Apps/Transmission/config/settings.json
        chmod 777 /share/Apps/Transmission/config/settings.json
    fi

    # Kernel optimalizations
    echo 524288 > /proc/sys/net/core/rmem_default
    echo 524288 > /proc/sys/net/core/rmem_max
    echo "16384 87380 87380" > /proc/sys/net/ipv4/tcp_rmem
    
    # Set ownerships
    chown -R nmt /share/Download
    chown -R nmt /share/Apps/Transmission
    
    # Set WebUI home
    export TRANSMISSION_WEB_HOME=/share/Apps/Transmission/transmission_web
    
    /share/Apps/Transmission/bin/start-stop-daemon -c nmt -x /share/Apps/Transmission/bin/transmission-daemon -S -- -g /share/Apps/Transmission/config -e /share/Apps/Transmission/daemon.log --log-error
    
    if [ $? -eq 0 ] ; then
        if [ "`pflash get btpdserv`" = "0" ] ; then
            pflash set btpdserv 1
        fi        
    else
        echo "Failed to start daemon."
    fi
}

stop()
{    
    if [ "`pflash get btpdserv`" == "1" ]; then
        pflash set btpdserv 0
    fi

    killall transmission-daemon 1>/dev/null 2>/dev/null

    i=0
    while [ -n "`ps | grep "transmission-daemon" | grep -v "grep"`" ] && [ $i -le 30 ]; do
        i=$(( $i + 1 ))
        sleep 1
    done

    if [ -n "`ps | grep "transmission-daemon" | grep -v "grep"`" ]; then
        kill -9 `pidof transmission-daemon` >/dev/null 2>/dev/null
        sleep 2
    fi
    
    if [ -f "/share/Apps/Transmission/config/settings.json" ] ; then
        chmod 666 "/share/Apps/Transmission/config/settings.json"
    fi
}

case "$1" in
    start)
    start
    ;;

    stop)
    stop
    ;;

    restart)
    stop
    sleep 1
    start
esac

10. Change the settings.json line in the share\Apps\Transmission\config to read "download-dir": "/sata_disk_a1/Download",
(or A2, A3 etc) save and exit
11. open Torrentexpander folder on share/aps and edit setup.sh with notepad++ Change the appropriate lines to read like in my code or just replace the whole thing if you have c200 but make sure you change to correct names if yours are different(like sata_disk_A1 or A2 or A3 or share or Download etc.). This is my setup.sh:
Code:
#!/bin/sh

prepare()
{
    # Find hardware type
    echo -n "Found hardware type:"
    if [ -e "/nmt/apps" ]; then
        echo "Popcorn Hour 200/300 series"
        hw="new"
    else
        echo "Popcorn Hour 100 series"
        hw="old"
    fi
    
    # Try to correct paths list
    path_backup="$PATH";
    initial_path=":$PATH:";
    new_path="$PATH";
    for test_path in $(echo -e "/usr/local/sbin\n/usr/local/bin\n/usr/sbin\n/usr/bin\n/sbin\n/bin\n/usr/games\n/usr/bin\n/bin\n/usr/sbin\n/sbin\n/usr/local/bin\n/usr/X11/bin\n/Applications\n/opt/syb/sigma/bdj/jvm/bin\n/usr/bin/X11\n/opt/syb/app/bin\n/opt/syb/app/sbin\n/opt/syb/sigma/bin\n/nmt/apps"); do
        if [[ -d "$test_path" && "$initial_path" != *:$test_path:* ]]; then
            echo -e "Information: adding $test_path to your paths list";
            new_path="$new_path:$test_path";
        fi
    done
    PATH="$new_path";
    export PATH="$new_path";
    echo -e "Information: this is your current paths list:\n$PATH";
    
    # Check for Transmission
    if [ -d /share/Apps/Transmission ]; then
        echo 'Information: transmission is installed';
    else
        echo 'Error: transmission is not installed, you must install it from CSI before';
    fi
    # Check for opkg
    if [ -f "/usr/local/bin/opkg" ]; then
        echo 'Information: opkg is installed';
        # Check for an internet connection
        if [ "$(wget -qO- -T 5 http://repository.nmtinstaller.com/appinit_version)" != "" ]; then
            internet="yes"
            echo 'Information: internet connection avaiable';
        else
            internet="no"
            echo 'Warning: no internet connection';
        fi
        # Try to update opkg
            if [ "$internet" == "yes" ]; then
                echo 'Information: updating opkg';
                opkg update;
                wait
            else
                echo 'Warning: i can not update opkg without internet connection';
            fi
        # Check for unzip and try to install it
        if [ ! -f "/usr/local/bin/unzip" ]; then
            echo 'Information: unzip (CSI version) is not installed';
            if [ "$internet" == "yes" ]; then
                echo 'Installing unzip';
                opkg install unzip;
                wait;
            else
                echo 'Error: i can not install unzip without internet connection';
            fi
        else
            echo 'Information: unzip (CSI version) is already installed';
        fi
        # Check for unrar and try to install it
        if [ ! -f "/usr/local/bin/unrar" ]; then
            echo 'Information: unrar is not installed';
            if [ "$internet" == "yes" ]; then
                echo 'Installing unrar'
                opkg install unrar;
                wait;
            else
                echo 'Error: i can not install unrar without internet connection';
            fi
        else
            echo 'Information: unrar is already installed';
        fi
        # Check for wget and try to install it
        if [ ! -f "/usr/local/bin/wget" ]; then
            echo 'Information: wget (CSI version) is not installed';
            if [ "$internet" == "yes" ]; then
                echo 'Installing wget'
                opkg install wget;
                wait;
            else
                echo 'Error: i can not install wget without internet connection';
            fi
        else
            echo 'Information: wget (CSI version) is already installed';
        fi
        # Check for bash and try to install it
        if [ "$hw" == "old" ]; then
            if [ ! -f "/usr/local/bin/bash" ]; then
                echo 'Information: bash (CSI version) is not installed';
                    if [ "$internet" == "yes" ]; then
                    echo 'Installing bash'
                    opkg --force-overwrite --force-maintainer install bash;
                    wait;
                else
                    echo 'Error: i can not install bash without internet connection';
                fi
            else
                echo 'Information: bash (CSI version) is already installed';
            fi
        fi
        # Check for busybox and try to install it
        if [ ! -f "/usr/local/bin/busybox" ]; then
            echo 'Information: busybox is not installed';
            if [ "$internet" == "yes" ]; then
                echo 'Installing busybox'
                opkg install busybox;
                wait;
            else
                echo 'Error: i can not install busybox without internet connection';
            fi
        else
            echo 'Information: busybox is already installed';
        fi
        # Install Torrentexpander
        if [ "$(opkg status unzip)" != "" ] && [ "$(opkg status unrar)" != "" ] && [[ "$(opkg status wget)" != "" || -f "/bin/wget" ]] && [ "$(opkg status busybox)" != "" ] && [ -d /share/Apps/Transmission ]; then
            echo 'Information: torrentexpander setup started';
            install;
        else
            echo 'Error: torrentexpander setup aborted';            
            export PATH="$path_backup";
        fi
    else
        echo 'Error: opkg not avaiable, you must install local package from CSI before';
        export PATH="$path_backup";
    fi
}

install()
{
    /share/Apps/AppInit/appinit.cgi stop transmission
    /share/Apps/AppInit/appinit.cgi webserver_disable
    wait
    
    count=0
    while [ "$(pgrep transmission-daemon)" ] && [[ $count -lt 60 ]]; do
        echo 'Waiting for transmission stop'
        sleep 1;
        count=$(( count + 1 ));
    done
    
    count=0
    while [ "$(pgrep -f php5server)" ] && [[ $count -lt 60 ]]; do
        echo 'Waiting for php5server stop'
        sleep 1;
        count=$(( count + 1 ));
    done
    
    chmod -R 777 /share/Apps/TorrentExpander/
    chown -R nmt:nmt /share/Apps/TorrentExpander/bin/torrentexpander_settings.ini
    
    if [ ! -e /share/Download/Expanded ]; then
        mkdir -p /share/Download/Expanded
        chmod -R 777 /share/Download/Expanded
        chown -R nmt:nmt /share/Download/Expanded
    fi

    if [ ! -e /share/Video/Movies ]; then
        mkdir -p /share/Video/Movies
        chmod -R 777 /share/Video/Movies
        chown -R nmt:nmt /share/Video/Movies
    fi

    if [ ! -e /share/Video/Series ]; then
        mkdir -p /share/Video/Series
        chmod -R 777 /share/Video/Series
        chown -R nmt:nmt /share/Video/Series
    fi
    
    if [ -f "/share/Apps/Transmission/config/settings.json" ]; then
        echo 'Editing transmission config file'
            if [ "$hw" == "new" ]; then
                sed -i 's/^\( *\)\"script-torrent-done-enabled\"\: .*$/\1\"script-torrent-done-enabled\"\: true\,/g' /share/Apps/Transmission/config/settings.json
                sed -i 's/^\( *\)\"script-torrent-done-filename\"\: .*$/\1\"script-torrent-done-filename\"\: \"\/share\/Apps\/TorrentExpander\/bin\/torrentexpander.sh\"\,/g' /share/Apps/Transmission/config/settings.json
            fi
            if [ "$hw" == "old" ]; then
                sed -i 's/^\( *\)\"script-torrent-done-enabled\"\: .*$/\1\"script-torrent-done-enabled\"\: true\,/g' /share/Apps/Transmission/config/settings.json
                sed -i 's/^\( *\)\"script-torrent-done-filename\"\: .*$/\1\"script-torrent-done-filename\"\: \"\/usr\/local\/bin\/bash \/share\/Apps\/TorrentExpander\/bin\/torrentexpander.sh\"\,/g' /share/Apps/Transmission/config/settings.json
            fi
        chmod 666 /share/Apps/Transmission/config/settings.json
        chown nmt:nmt /share/Apps/Transmission/config/settings.json
    fi
    
    /share/Apps/AppInit/appinit.cgi start transmission
    /share/Apps/AppInit/appinit.cgi webserver_enable
    wait
}

uninstall()
{
    /share/Apps/AppInit/appinit.cgi stop transmission
    /share/Apps/AppInit/appinit.cgi webserver_disable
    wait;
    
    count=0
    while [ $(pgrep transmission-daemon) ] && [[ $count -lt 60 ]]; do
        # echo 'Waiting for transmission stop'
        sleep 1;
        count=$(( count + 1 ));
    done
    
    count=0
    while [ $(pgrep -f php5server) ] && [[ $count -lt 60 ]]; do
        # echo 'Waiting for php5server stop'
        sleep 1;
        count=$(( count + 1 ));
    done
    
    if [ -f /share/Apps/Transmission/config/settings.json ]; then
        # echo 'Editing transmission config file'
        sed -i 's/^\( *\)\"script-torrent-done-enabled\"\: .*$/\1\"script-torrent-done-enabled\"\: false\,/g' /share/Apps/Transmission/config/settings.json
        sed -i 's/^\( *\)\"script-torrent-done-filename\"\: .*$/\1\"script-torrent-done-filename\"\: \"\",/g' /share/Apps/Transmission/config/settings.json
        chmod 666 /share/Apps/Transmission/config/settings.json
        chown nmt.root /share/Apps/Transmission/config/settings.json
    fi
    
    /share/Apps/AppInit/appinit.cgi start transmission
    /share/Apps/AppInit/appinit.cgi webserver_enable
    wait;
}


case "$1" in
    install)
    prepare
    ;;
    
    uninstall)
    uninstall
    ;;
esac
save and exit
12.restart the NMT and then open the start.app again.
Replace the whole thing with this code if you have c200 or edit appropriately. This is my start.app code:
Code:
#!/bin/sh
#

PATH=/share/Apps/Telnetd/bin:/share/bin:/share/Apps/AppInit:$PATH
HOME=/share
export TERM="xterm"
alias mc="mc -c"

#Copy waitimages when they are available
if [ -n "`ls -Al /share/Photo/_waitimages_/*.jpg 2>/dev/null`" ]; then
    cp /share/Photo/_waitimages_/* /bin
fi

#For some NMT hardware (like Popcorn B-110) compatibility may go up when creating a
#symbolic link HARD_DISK to SATA_DISK
if [ ! -d "/opt/sybhttpd/localhost.drives/HARD_DISK" ]; then
    ln -s /opt/sybhttpd/localhost.drives/USB_DRIVE /opt/sybhttpd/localhost.drives/HARD_DISK
fi

#cleanup old files
rm -f /share/busybox 2>&1 >/dev/null
rm -f /share/commands.cgi 2>&1 >/dev/null
#M_A_R_K_E_R_do_not_remove_me

exit 0
I'm not sure whether you need to edit the start.app.bak too but anyway, mine is exactly the same as start.app file.
restart the nmt and it should all work. CSI can install apps, torrent downloads to HDD and all media is on HDD

If you use nzbget, I think you should edit its settings like you just did for transmission and torrentexpander for it to work and to download to HDD.

Once again, I am not an expert, I did this thru trial and error and I'm just posting how I did it. I hope it helps everyone who wants to use CSI and APPS and MEDIA as I do. And please, If someone has a better and easier idea, please share. Ciao