Configurar apt-proxy en portátiles

De WikiEducator
Saltar a: navegación, buscar



Icon objectives.jpg

Apt-cache en equipos que cambian de red

Icon present.gif




Para las aulas configuramos el proxy:

 echo 'Acquire::http::Proxy "http://172.30.160.92:3142";' | sudo tee /etc/apt/apt.conf.d/01proxy

Pero los alumnos que usan portátiles tienen problemas para actualizar el software en casa.

Solución: Crear /etc/NetworkManager/dispatcher.d/99SetAptProxy

#!/bin/bash
ip=172.30.160.92
nc -w 1 $ip 3142
proxy_file="/etc/apt/apt.conf.d/02local_proxy"
if [ $? -eq 0 ]; then
    echo "Acquire::http { Proxy \"http://$ip\"; };" > $proxy_file
    echo 'Acquire::https { Proxy "false"; };' >> $proxy_file
else
    rm -f $proxy_file
fi

Cambiar permisos:

 sudo chmod +x /etc/NetworkManager/dispatcher.d/99SetAptProxy