Created
          October 20, 2012 20:00 
        
      - 
      
 - 
        
Save neuni/3924586 to your computer and use it in GitHub Desktop.  
    Script for deploy and run qt-pi-pograms with qtCreator
  
        
  
    
      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 | |
| CONFIG_FILE=$(cd `dirname "${BASH_SOURCE[0]}"` && pwd)/piConfig.cfg; | |
| source $CONFIG_FILE | |
| rm -fR deploy | |
| mkdir deploy | |
| cp * deploy/ | |
| cd deploy | |
| for var in "$@" | |
| do | |
| cp -R "$var" ./ | |
| done | |
| mv $(ls -F | grep '*') $remote_progName | |
| echo "#!/bin/bash" > start.sh | |
| echo "export LD_LIBRARY_PATH=/usr/local/qt5pi/lib" >> start.sh | |
| echo "./$remote_progName" >> start.sh | |
| chmod a+x start.sh | |
| cd .. | |
| ssh $remote_user@$remote_ip "rm -R $remote_dir" | |
| scp -r deploy $remote_user@$remote_ip:$remote_dir | |
| rm -R deploy | 
  
    
      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
    
  
  
    
  | remote_ip="192.168.99.56" | |
| remote_user="pi" | |
| remote_progName="myQtProg" | |
| remote_dir="/home/pi/qtDeploy" | 
  
    
      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 | |
| CONFIG_FILE=$(cd `dirname "${BASH_SOURCE[0]}"` && pwd)/piConfig.cfg; | |
| source $CONFIG_FILE | |
| trap "{ ssh $remote_user@$remote_ip 'killall -q $remote_progName'; }" EXIT | |
| ssh $remote_user@$remote_ip "killall -q $remote_progName" | |
| ssh $remote_user@$remote_ip "cd $remote_dir; chmod a+x start.sh; ./start.sh" | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment