示例#1
0
        data = f.read()
        f.seek(0)
        f.write(data.replace("ipv6.disable=1 ", ""))
        f.truncate()
    # update_grub()

    sysctl_cfg = "/etc/sysctl.conf"
    with open(sysctl_cfg, "r+") as f:
        data = f.read()
        f.seek(0)
        # Comment out lines
        f.write(re.sub(r'\n(.*disable_ipv6.*)', r'\n#\g<1>', data))
        f.truncate()
    sh("sysctl -p")


# Force root

if os.getuid() != 0:
    print("This program must be run as root")
    sys.exit(1)

# Identify the distribution

dist = identify_distribution()
if dist is None:
    supported = ", ".join([d.NAME for d in supported_distributions()])
    print("The installation script only supports %s" % supported)
    sys.exit(1)
dist.update()
示例#2
0
            if os.path.exists(link):
                os.remove(link)
            os.symlink(os.path.join(root, f), link)
        break


args = parse_args()
args.output_dir = os.path.normpath(os.path.abspath(args.output_dir))

if os.getuid() != 0:
    print("This program must be run as root")
    sys.exit(1)

# Identify the distribution

dist = identify_distribution()
if dist is None:
    print("The installation script only supports %s" % ", ".join([d.NAME for d in supported_distributions()]))
    sys.exit(1)
dist.update()

# Install dependencies

dist.install("python-pip")

if args.install_mininet:
    install_mininet()

if args.all or args.install_quagga:
    install_quagga()