User:Armenzg:scripts

From MozillaWiki
Jump to: navigation, search

I am going to list in here different type of scripts

Install python, zope and buildbot

https://wiki.mozilla.org/ReferencePlatforms/Mac-10.5#Buildbot

Generate multiple repositories without an apache or lighthttp server

#!/bin/bash
set -ex
sudo mkdir -p /var/hg/l10n-central
sudo chown -R armenzg /var/hg
sudo cat << MARKER > /var/hg/hgweb.config
[collections]
l10n-central/ = l10n-central/
MARKER
cd /var/hg/
hg init l10n-central/af
hg init l10n-central/de
hg serve --webdir-conf /var/hg/hgweb.config

Generates a buildbot master and a slave

buildbot create-master master
buildbot create-slave slave localhost:9989 bot1name bot1passwd

Print all-locales from cvs

#!/tools/python/bin/python

import subprocess

def getLocales():
    """ 
    It returns a list with all locales from all-locales in the repository
    """
    # communicate() returns a tuple - stdio, stderr
    # the output of cvs has a '\n' element at the end
    # a last '' string is generated that we get rid of
    return subprocess.Popen(
        ['cvs', '-q', '-d', ':pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot',
         'co', '-p', 'mozilla/browser/locales/all-locales'],
        stdout=subprocess.PIPE).communicate()[0].split('\n')[0:-1]

for locale in getLocales():
    print locale

Restart connection

I have not used it personally myself but bhearsum suggested it to me when we were having trouble connecting with my mac or for tunnelblick, I can't remember

#!/bin/sh
for i in 0 1 2; do
 scutil <<EOF
 open
 d.init
 remove State:/Network/Service/openvpn-tun${i}/IPv4
 remove State:/Network/Service/openvpn-tun${i}/DNS
EOF
done