mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-10-05 18:50:09 +02:00
makebuildserver: allow setting apt mirror from command line
On some setups, using a custom apt mirror is essential, so this adds a command line flag to override the default one: http://ftp.uk.debian.org/debian/ For example, someone who runs a local mirror for offline and low bandwidth situations. This uses a % rather than a .format() to avoid escaping { and }, which have meaning when using .format().
This commit is contained in:
parent
4b0a6ed29f
commit
f47677ef36
@ -1,5 +1,10 @@
|
|||||||
|
|
||||||
user = node[:settings][:user]
|
user = node[:settings][:user]
|
||||||
|
debian_mirror = node[:settings][:debian_mirror]
|
||||||
|
|
||||||
|
execute 'set_debian_mirror' do
|
||||||
|
command "sed -i 's,http://ftp.uk.debian.org/debian/,#{debian_mirror},g' /etc/apt/sources.list"
|
||||||
|
end
|
||||||
|
|
||||||
execute "apt-get-update" do
|
execute "apt-get-update" do
|
||||||
command "apt-get update"
|
command "apt-get update"
|
||||||
|
@ -41,6 +41,8 @@ parser.add_option("-v", "--verbose", action="store_true", default=False,
|
|||||||
help="Spew out even more information than normal")
|
help="Spew out even more information than normal")
|
||||||
parser.add_option("-c", "--clean", action="store_true", default=False,
|
parser.add_option("-c", "--clean", action="store_true", default=False,
|
||||||
help="Build from scratch, rather than attempting to update the existing server")
|
help="Build from scratch, rather than attempting to update the existing server")
|
||||||
|
parser.add_option("--debian-mirror", default="http://ftp.uk.debian.org/debian/",
|
||||||
|
help="Use the specified Debian mirror in the box's /etc/apt/sources.list.")
|
||||||
options, args = parser.parse_args()
|
options, args = parser.parse_args()
|
||||||
|
|
||||||
config = {}
|
config = {}
|
||||||
@ -199,6 +201,7 @@ if 'aptproxy' in config and config['aptproxy']:
|
|||||||
vagrantfile += """
|
vagrantfile += """
|
||||||
config.vm.provision :shell, :inline => 'sudo echo "Acquire::http {{ Proxy \\"{0}\\"; }};" > /etc/apt/apt.conf.d/02proxy && sudo apt-get update'
|
config.vm.provision :shell, :inline => 'sudo echo "Acquire::http {{ Proxy \\"{0}\\"; }};" > /etc/apt/apt.conf.d/02proxy && sudo apt-get update'
|
||||||
""".format(config['aptproxy'])
|
""".format(config['aptproxy'])
|
||||||
|
|
||||||
vagrantfile += """
|
vagrantfile += """
|
||||||
config.vm.provision :chef_solo do |chef|
|
config.vm.provision :chef_solo do |chef|
|
||||||
chef.cookbooks_path = "cookbooks"
|
chef.cookbooks_path = "cookbooks"
|
||||||
@ -207,6 +210,7 @@ vagrantfile += """
|
|||||||
:settings => {
|
:settings => {
|
||||||
:sdk_loc => "/home/vagrant/android-sdk",
|
:sdk_loc => "/home/vagrant/android-sdk",
|
||||||
:ndk_loc => "/home/vagrant/android-ndk",
|
:ndk_loc => "/home/vagrant/android-ndk",
|
||||||
|
:debian_mirror => "%s",
|
||||||
:user => "vagrant"
|
:user => "vagrant"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -217,7 +221,7 @@ vagrantfile += """
|
|||||||
chef.add_recipe "kivy"
|
chef.add_recipe "kivy"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
"""
|
""" % (options.debian_mirror)
|
||||||
|
|
||||||
# Check against the existing Vagrantfile, and if they differ, we need to
|
# Check against the existing Vagrantfile, and if they differ, we need to
|
||||||
# create a new box:
|
# create a new box:
|
||||||
|
Loading…
Reference in New Issue
Block a user