Skip to content

Instantly share code, notes, and snippets.

@yogendra
Last active January 28, 2016 16:46
Show Gist options
  • Save yogendra/4458d45aa1fe1017e2e7 to your computer and use it in GitHub Desktop.
Save yogendra/4458d45aa1fe1017e2e7 to your computer and use it in GitHub Desktop.
Vagrant scripts
$(docker ps -a -q -f status=exited) | xargs -r docker rm -v
docker rm -v $(docker ps -a -q -f status=exited)
docker rmi $(docker images -f "dangling=true" -q)
docker run -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker:/var/lib/docker --rm martin/docker-cleanup-volumes
echo 'DOCKER_OPTS="-H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock"' >> /etc/default/docker
restart docker
geoip=`curl -s 'http://freegeoip.net/csv/' `
country=`echo $geoip | awk -F, '{ print tolower($2) }'`
ip=`echo $geoip | awk -F, '{print $1}'`
release=`lsb_release -sc`
file="/etc/apt/sources.list"
old_file="/etc/apt/sources.list.$(date '+%Y%m%d%H%M%S')"
cp -f $file $old_file
printf "## Ubuntu Main Repos for $ip
deb http://$country.archive.ubuntu.com/ubuntu/ $release main restricted universe multiverse
deb-src http://$country.archive.ubuntu.com/ubuntu/ $release main restricted universe multiverse
## Ubuntu Update Repos for $ip
deb http://$country.archive.ubuntu.com/ubuntu/ $release-security main restricted universe multiverse
deb http://$country.archive.ubuntu.com/ubuntu/ $release-updates main restricted universe multiverse
deb-src http://$country.archive.ubuntu.com/ubuntu/ $release-security main restricted universe multiverse
deb-src http://$country.archive.ubuntu.com/ubuntu/ $release-updates main restricted universe multiverse
" > $file
apt-get update
apt-get dist-upgrade -u -y -qq
apt-get install -qq -y avahi-daemon
apt-get autoremove --purge -y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment