Skip to content

Instantly share code, notes, and snippets.

@Femtometer Femtometer/code.sh
Last active Jul 19, 2016

Embed
What would you like to do?
Command line PAC generate code for OSX
#!/bin/bash
// Generate gfwlist.js for ShadowsocksX
// Install gfwlist2pac in python2.7
// Download gfwlist.txt from github
// Use "sh code.sh" to generate.
PROXY="127.0.0.1:1080"
TXTROOT="/Users/USRNAME/desktop"
# 下载PAC与SH文件同级目录
check_module_installed()
{
pip2 list | grep gfwlist2pac &> /dev/null
if [ $? -eq 1 ]; then
echo "Installing gfwlist2pac."
pip2 install gfwlist2pac
fi
}
update_gfwlist()
{
ls | grep gfwlist.txt
cd ~/.ShadowsocksX || exit 1
if [ -f "gfwlist.js" ]; then
echo "Del old file."
mv gfwlist.js ~/.Trash
fi
gfwlist2pac \
--input $TXTROOT/gfwlist.txt \
--file ./gfwlist.js \
--proxy "SOCKS5 $PROXY; SOCKS $PROXY; DIRECT;" \
--precise
echo "PAC Updated."
}
check_module_installed
update_gfwlist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.