FreeNAS Code
This project has moved to github - see https://github.com/freenas
Brought to you by:
cochard,
mattolander
#!/bin/sh # Copyright (c) 2007-2009 Volker Theile (votdev@gmx.de) # All rights reserved. # # Set proxy environment variables in shell settings file (/root/.cshrc). # # PROVIDE: proxy # BEFORE: LOGIN . /etc/rc.subr . /etc/configxml.subr # Defaults cshrc_config=${cshrc_config:-"/root/.cshrc"} # Remove proxy settings (HTTP_PROXY, HTTP_PROXY_AUTH, FTP_PROXY and FTP_PROXY_AUTH) if [ -e ${cshrc_config} ]; then /usr/bin/sed -i "" '/^.*[HTTP|FTP]_PROXY[_AUTH]*.*$/d' ${cshrc_config} fi # Set proxy settings /usr/local/bin/xml sel -t \ -m "//system/proxy/http" \ -i "count(enable) > 0" -n -v "concat('setenv HTTP_PROXY \"',address,':',port,'\"')" \ -i "count(auth) > 0" -n -v "concat('setenv HTTP_PROXY_AUTH \"basic:*:',username,':',password,'\"')" -b \ -b \ -b \ -m "//system/proxy/ftp" \ -i "count(enable) > 0" -n -v "concat('setenv FTP_PROXY \"',address,':',port,'\"')" \ -i "count(auth) > 0" -n -v "concat('setenv FTP_PROXY_AUTH \"basic:*:',username,':',password,'\"')" -b \ -b \ -b \ ${configxml_file} | /usr/local/bin/xml unesc >> ${cshrc_config}