NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.

Forum Discussion

ajsym's avatar
ajsym
Aspirant
Sep 25, 2012

Install addon from command line

I am developing an addon and one of the functionality I am looking for is to be able to install it from command line.

So, if my addon is called: mynetaddon.bin then,
> command/script mynetaddon.bin -- would install it as if it is installed from the web interface.

Anyone know about any command/script in Netgear?

Thanks!

3 Replies

Replies have been turned off for this discussion
  • mdgm-ntgr's avatar
    mdgm-ntgr
    NETGEAR Employee Retired
    Is this for your Ultra?

    Take a look at e.g. http://www.readynas.com/forum/viewtopic.php?f=35&t=30455

    Once you have extracted the add-on to a directory (you should see four files: install.sh, remove.sh, addons.conf, files.tgz), change the working directory to that directory and run the install script

    e.g.

    cd /tmp/fred
    sh install.sh

    In the above example all the contents of /tmp/fred will be removed at the end of the add-on installation.

    Installing from the command line you might be able to put in some debug code that won't show via a Frontview installation but before releasing an add-on you should test installation via Frontview to confirm it works via that method.
  • FrontView installs it via compiled apache modules and binaries.

    You can see some clues by running strings on the files. strings can be installed with 'apt-get install binutils'

    # strings /frontview/lib/mod_addonhandler.so 
    libcrypto.so.0.9.8
    libssl.so.0.9.8
    libreadynas.so.0
    addonhandler_module
    ap_hook_handler
    _decode_inplace
    strlen
    memmove
    memcpy
    strstr
    apr_hash_make
    apr_strtok
    strchr
    ap_unescape_url
    apr_hash_set
    strip_cr
    apr_table_get
    strtol
    ap_log_rerror
    apr_brigade_create
    ap_get_brigade
    apr_bucket_type_eos
    apr_pmemdup
    apr_bucket_transient_create
    apr_palloc
    apr_brigade_flatten
    _check_tar_file_integrity
    apr_stat
    mmap
    munmap
    memcmp
    mkdir
    strrchr
    fopen
    _update_progress
    fprintf
    fflush
    fclose
    set_sock_timeout
    setsockopt
    _httpreq
    getpid
    __ctype_b_loc
    gethostbyname
    bzero
    bcopy
    htons
    socket
    realloc
    _httpsreq
    SSL_load_error_strings
    SSL_library_init
    SSLv23_client_method
    SSL_CTX_new
    SSL_new
    SSL_set_fd
    SSL_connect
    SSL_write
    SSL_read
    SSL_shutdown
    SSL_free
    ERR_free_strings
    SSL_CTX_free
    _permit_addon
    malloc
    _search_file
    fgets
    _monitor_progress
    ap_rprintf
    fread
    atoi
    _install_addon_xml
    asprintf
    system
    _extract_tar_xml
    chdir
    fwrite
    _get_value_from_index
    strncpy
    _extract_binary_file_xml
    snprintf
    toupper
    lseek
    _parse_uri
    strncasecmp
    strpbrk
    strcpy
    _get_value
    _get_element
    _selective_merge_xml
    strcmp
    _check_for_duplicate_urls
    remove_white_space
    _get_available_addons
    get_boot_info
    get_boot_info_as_int
    _get_str_from_url
    _get_xml_from_url
    _remove_files_in_directory
    opendir
    unlink
    readdir
    closedir
    _cleanup_residue
    apr_dir_open
    apr_file_remove
    apr_dir_close
    rmdir
    _cancel_download_xml
    kill
    _cleanup_addon_residue_xml
    _download_addon_xml
    _addon_not_permitted_xml
    ap_set_content_type
    apr_hash_get
    _edata
    __bss_start
    _end
    OPENSSL_0.9.8
    p[^]
    [^_]
    <#t"
    P[^]
    mod_addonhandler.c
    Content-Length
    Request too big (%d bytes; limit %d)
    failed to read form input
    Error in apr_bucket_read()
    Error (flatten) reading form data
    %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x
    /tmp/addons/%s/progress
    %s,%s,%s,%s
    STARTED
    DOWNLOAD
    ERROR
    HTTP/
    Content-Length:
    IN PROGRESS
    COMPLETED
    NONE
    /etc/default/services
    %s!!
    /etc/frontview/addons/addons.conf
    <?xml version="1.0" encoding="UTF-8"?><payload>
    <state>%s</state>
    <sub_state>%s</sub_state>
    <percentage>%s</percentage >
    <pid>%s</pid>
    <state>MISSING</state>
    </payload>
    /frontview/bin/install_addons "%s" "%s" "%s" "%s" "%s" "%s"
    <status>success</status></payload>
    <status>failure</status></payload>
    /tmp/addons/%s
    temp.tar
    /tmp/addons/%s/%s
    <status>success</status>
    <status>failure</status>
    /tmp
    /tmp/addons/%s/temp.bin
    name
    restartapache
    /tmp/addons/%s/temp.tar
    md5sum
    <apache_directive>restartapache</apache_directive>
    <apache_directive>norestartapache</apache_directive>
    <reason>ERROR_ADDON_NOT_PERMITTED</reason>
    <reason>ERROR_ADDON_EXTRACTION_FAILURE</reason>
    http://
    http
    https://
    https
    <%s>
    </%s>
    status
    available
    unavailable
    failure
    <?xml version="1.0" encoding="UTF-8" ?><payload>
    <status>available</status>
    <addon>
    addon
    <status>unavailable</status>
    serial
    model
    mode
    ?serial=%s&model=%s&mode=pro
    ?serial=%s&model=%s&mode=home
    http://www.readynas.com/app/get_addon_list
    %s%s
    /frontview/conf/available.conf
    GET /%s HTTP/1.0
    HOST: %s
    <status>failure</status><reason>ERROR_ADDON_PAYLOAD_EMPTY</reason></payload>
    <status>failure</status><reason>ERROR_HTTP_IMAGE_DOWNLOAD</reason><error_number>%d</error_number></payload>
    <status>failure</status><reason>ERROR_ADDON_DOWNLOAD_PROTOCOL_NOT_SUPPORTED</reason></payload>
    %s<status>failure</status><reason>ERROR_ADDON_PAYLOAD_EMPTY</reason></payload>
    %s<status>failure</status><reason>ERROR_HTTP_IMAGE_DOWNLOAD</reason><error_number>%d</error_number></payload>
    %s<status>failure</status><reason>ERROR_ADDON_DOWNLOAD_PROTOCOL_NOT_SUPPORTED</reason></payload>
    %s/%s
    <status>failure</status><reason>ERROR_ADDON_DIRECTORY_CLEANUP_FAILED</reason></payload>
    <status>failure</status><reason>ERROR_DOWNLOAD_TERMINATION_FAILED</reason></payload>
    <reason>ERROR_ADDONS_DIRECTORY_CREATION_FAILED</reason>
    addon::
    skipreboot
    <status>success</status><size>%d</size>
    <action>reboot</action>
    /.new_addons
    <action>skipreboot</action>
    <reason>INVALID_IMAGE</reason>
    <reason>ERROR_ADDON_DOWNLOAD_FAILED</reason>
    addonhandler
    addon_handler() handler=%s raw_uri=%s uri=%s bypass.
    text/xml; charset=utf-8
    command
    download
    /tmp/addons
    extract_binary
    extract_tar
    install_addon
    system_update_subject
    success_message
    failure_message
    apache_directive
    get_progress
    getAvailableAddons
    getAddonUpdateDetail
    cancel_download
    cleanup_addon_residue
    HAGI: done
    22PA


    # strings /frontview/bin/install_addons 
    /lib/ld-linux.so.2
    libreadynas.so.0
    __gmon_start__
    _Jv_RegisterClasses
    update_services
    _fini
    _init
    libc.so.6
    _IO_stdin_used
    setuid
    strcpy
    readdir
    closedir
    realloc
    getpid
    strspn
    strdup
    strlen
    strstr
    memcpy
    malloc
    strcat
    asprintf
    opendir
    system
    readlink
    atoi
    close
    access
    strcmp
    __libc_start_main
    snprintf
    free
    _edata
    __bss_start
    _end
    GLIBC_2.0
    PTRh
    QVhZ
    WVSQ
    Y[^_]
    [^_]
    /proc/
    0123456789
    /proc/%d/fd
    restartapache
    echo "sleep 5; start-stop-daemon -K -n apache-ssl -R5;apache-ssl -f /etc/frontview/apache/httpd.conf;" | (cd /; at NOW) >>/var/log/frontview/spool.log 2>>/var/log/frontview/spool.err ;
    killall -USR1 apache-ssl;
    source /frontview/bin/functions;cd /tmp/addons/%s;print_lcd_line2 'Installing addon' >/.update_success;sh install.sh >>/var/log/frontview/spool.log 2> /var/log/frontview/spool.err;RET=$?;if [ $RET -eq 0 ]; then %ssend_email_alert "%s" "%s" "" "%s";old_log_status "%s" "1";else send_email_alert "%s" "%s" "" "%s";old_log_status "%s" "1";fi;rm -f /.update_success;exit $RET;
    /etc/frontview/addons/bin/%s/running.sh
  • Thanks so much for quick response. This helps a lot.

NETGEAR Academy

Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology! 

Join Us!

ProSupport for Business

Comprehensive support plans for maximum network uptime and business peace of mind.

 

Learn More