Created
          August 6, 2012 08:30 
        
      - 
      
- 
        Save radimk/3272289 to your computer and use it in GitHub Desktop. 
    NetBeans offline module downloader to install modules without running the IDE/platform
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/bin/bash | |
| get_modules () { | |
| TARGET_DIR=`pwd` | |
| WORKDIR=`mktemp -d` | |
| pushd $WORKDIR >/dev/null | |
| AUC="$1" | |
| echo "Download catalog from $AUC" | |
| wget -q $AUC/catalog.xml | |
| shift 1 | |
| for module in $* | |
| do | |
| echo "Module: $module" | |
| NBM_PATH=`xmlstarlet sel -t -m "/module_updates/module_group/module[@codenamebase='$module']" -v @distribution <catalog.xml` | |
| CLUSTER=`xmlstarlet sel -t -m "/module_updates/module_group/module[@codenamebase='$module']" -v @targetcluster <catalog.xml` | |
| if [ -z "$NBM_PATH" -o -z "$CLUSTER" ]; then | |
| echo "Cannot get the module data" >/dev/stderr | |
| else | |
| echo "File $NBM_PATH, cluster $CLUSTER" >/dev/stderr | |
| wget -q $AUC/$NBM_PATH | |
| if [ ! $? ]; then | |
| echo "Cannot get the module" >/dev/stderr | |
| else | |
| NBM_FILE=`basename $NBM_PATH` | |
| if [ ! -d $TARGET_DIR/$CLUSTER ]; then | |
| mkdir $TARGET_DIR/$CLUSTER | |
| fi | |
| unzip $NBM_FILE | |
| rm Info/info.xml | |
| if [ -d Info/locale ]; then | |
| rm -r Info/locale | |
| fi | |
| rmdir Info | |
| rm META-INF/NB_IDE.DSA | |
| rm META-INF/NB_IDE.SF | |
| rm META-INF/MANIFEST.MF | |
| rmdir META-INF | |
| for EXT_LINK in `find netbeans -name "*.pack.gz" -print` | |
| do | |
| echo "Unpack $EXT_LINK" | |
| unpack200 $EXT_LINK ${EXT_LINK%%\.pack\.gz} | |
| rm $EXT_LINK | |
| done | |
| for EXT_LINK in `find netbeans -name "*.external" -print` | |
| do | |
| echo "Download real file for $EXT_LINK" | |
| EXT_FILE=${EXT_LINK%%\.external} | |
| wget -O $EXT_FILE `grep URL:http: $EXT_LINK | cut -d: -f2-` | |
| rm $EXT_LINK | |
| done | |
| cp -r netbeans/* $TARGET_DIR/$CLUSTER | |
| rm -rf netbeans | |
| rm $NBM_FILE | |
| fi | |
| fi | |
| done | |
| rm catalog.xml | |
| popd >/dev/null | |
| rmdir $WORKDIR | |
| } | |
| get_modules http://updates.netbeans.org/netbeans/updates/7.2/uc/final/distribution \ | |
| org.netbeans.modules.nbjunit | |
| get_modules http://updates.netbeans.org/netbeans/updates/7.2/uc/final/certified \ | |
| org.netbeans.libs.junit4 org.netbeans.modules.apisupport.tc.cobertura | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment