New Paste

 

Recent Pastes

Administrate




Pastebin on p.luis.im

PasteID: 5mw
Pasted by Anonymous, 2020-01-15 10:41:45 GMT
Expires Never
Paste size 1.28 Kb
Tools Raw   Download
 
  1. #!/bin/bash -e  
  2. ######################################################################  
  3. # Charles Proxy startup script  
  4. #  
  5.   
  6. # Find Charles lib directory  
  7. if [ -z "$CHARLES_LIB"]; then  
  8.     CHARLES_LIB="$(dirname "$(readlink -f "$0")")"/../lib  
  9.     if [ ! -f "$CHARLES_LIB/charles.jar" ]; then  
  10.         CHARLES_LIB="/usr/lib/charles-proxy"  
  11.     fi  
  12.     if [ ! -f "$CHARLES_LIB/charles.jar" ]; then  
  13.         CHARLES_LIB="/usr/share/java/charles"  
  14.     fi  
  15. fi  
  16.   
  17. if [ ! -f "$CHARLES_LIB/charles.jar" ]; then  
  18.     echo >&2 "Charles lib directory not found. Expected it in $CHARLES_LIB."  
  19.     exit 1  
  20. fi  
  21.   
  22. # Check if we have the included JDK  
  23. if [ -d "$CHARLES_LIB/jdk" ]; then  
  24.     export JAVA_HOME="$CHARLES_LIB/jdk"  
  25. fi  
  26.   
  27. # Find Java binary  
  28. if [ -z "$JAVA_HOME" ]; then  
  29.     hash java 2>^- || { echo >&2 "Charles couldn't start: java not found. Please install java to use Charles."; exit 1; }  
  30.     JAVA=java  
  31. else  
  32.     JAVA="$JAVA_HOME/bin/java"  
  33. fi  
  34.   
  35. # HiDPI  
  36. if [ -x /usr/bin/gsettings ]; then  
  37.     GDK_SCALE=$(/usr/bin/gsettings get org.gnome.desktop.interface scaling-factor | awk '{print $2}')  
  38.     export GDK_SCALE  
  39. fi  
  40.   
  41. # Launch Charles  
  42. $JAVA -Xmx1024M -Dcharles.config="~/.charles.config" -Djava.library.path="$CHARLES_LIB" -jar $CHARLES_LIB/charles.jar $*  
  43.  
 
 
 
 
Written by Xan Manning, 2010.