| Line 163: |
Line 163: |
| | </source> | | </source> |
| | === Check if a file exists === | | === Check if a file exists === |
| | + | <source lang="bash"> |
| | if [ -f $FILE1 ] | | if [ -f $FILE1 ] |
| | then | | then |
| Line 171: |
Line 172: |
| | fi | | fi |
| | fi | | fi |
| | + | </source> |
| | | | |
| | === Check if directory exists === | | === Check if directory exists === |
| Line 228: |
Line 230: |
| | === Check if variable is set === | | === Check if variable is set === |
| | if [ -z ${var+x} ]; then echo "var is unset"; else echo "var is set to '$var'"; fi | | if [ -z ${var+x} ]; then echo "var is unset"; else echo "var is set to '$var'"; fi |
| | + | |
| | + | === Ubuntu proxy setup === |
| | + | <source lang="bash"> |
| | + | #! /bin/bash |
| | + | HTTP_PROXY_HOST=proxy.example.com |
| | + | HTTP_PROXY_PORT=3128 |
| | + | HTTPS_PROXY_HOST=proxy.example.com |
| | + | HTTPS_PROXY_PORT=3128 |
| | + | |
| | + | gsettings set org.gnome.system.proxy mode manual |
| | + | gsettings set org.gnome.system.proxy.http host "$HTTP_PROXY_HOST" |
| | + | gsettings set org.gnome.system.proxy.http port "$HTTP_PROXY_PORT" |
| | + | gsettings set org.gnome.system.proxy.https host "$HTTPS_PROXY_HOST" |
| | + | gsettings set org.gnome.system.proxy.https port "$HTTPS_PROXY_PORT" |
| | + | |
| | + | sudo sed -i.bak '/http[s]::proxy/Id' /etc/apt/apt.conf |
| | + | sudo tee -a /etc/apt/apt.conf <<EOF |
| | + | Acquire::http::proxy "http://$HTTP_PROXY_HOST:$HTTP_PROXY_PORT/"; |
| | + | Acquire::https::proxy "http://$HTTPS_PROXY_HOST:$HTTPS_PROXY_PORT/"; |
| | + | EOF |
| | + | |
| | + | sudo sed -i.bak '/http[s]_proxy/Id' /etc/environment |
| | + | sudo tee -a /etc/environment <<EOF |
| | + | http_proxy="http://$HTTP_PROXY_HOST:$HTTP_PROXY_PORT/" |
| | + | https_proxy="http://$HTTPS_PROXY_HOST:$HTTPS_PROXY_PORT/" |
| | + | EOF |
| | + | </source> |