Last active
August 29, 2015 14:05
-
-
Save upbit/8d8b784f03c88ccec427 to your computer and use it in GitHub Desktop.
MacOS用的imouto.host自动更新脚本
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
IMOUTO_HOST="https://www.dropbox.com/sh/lw0ljk3sllmimpz/AAC-n6LmtWbdlKQRbdEa0QUoa/imouto.host.7z?dl=1" | |
# download hosts file | |
curl -L -o imouto.host.7z ${IMOUTO_HOST} | |
# unzip | |
./7za x imouto.host.7z imouto.host.txt | |
awk '{ if (NR==1) sub(/^\xef\xbb\xbf/,""); print }' imouto.host.txt > imouto.host.txt | |
tr -d '\r' < imouto.host.txt > imouto.host.txt | |
# deploy to /etc/hosts | |
echo ">>" | |
echo ">> may be you want INPUT your sudo password to continue." | |
echo ">>" | |
sudo cp imouto.host.txt /etc/hosts | |
#sudo cat /etc/hosts.other >> /etc/hosts | |
rm imouto.host.7z imouto.host.txt | |
cat /etc/hosts | head -n 2 | tail -n 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment