Skip to content

Commit

Permalink
adding locale gen support
Browse files Browse the repository at this point in the history
  • Loading branch information
mcansky committed Apr 9, 2011
1 parent e77a462 commit e3fb161
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions config.yml
Expand Up @@ -4,6 +4,7 @@ specif: 0
loading: 1
dummy: 1
log: 1
locale: en_US.ISO-8859-15
log_dir: /var/jester/logs
build_dir: /var/jester/build
lv_size: 4G
Expand Down
20 changes: 20 additions & 0 deletions genvm.rb
Expand Up @@ -128,6 +128,7 @@ def create(name)
@kernel = "linux-image-2.6-amd64"
@base = "squeeze"
@mirror = config["mirror"]
@locale = config["locale"] || 'en_US.ISO-8859-15'
for_line = "for #{name} on #{storage}"
if config["dummy"] == 1
say "WARNING : Dummy mode !", :red
Expand Down Expand Up @@ -216,6 +217,25 @@ def create(name)
File.delete("#{@build_dir}/etc/hostname") if File.exist?("rm #{@build_dir}/etc/hostname")
create_file "#{@build_dir}/etc/hostname", name

# setting the locale
say "Setting the locale to #{@locale}", :green
File.delete("#{@build_dir}/etc/locale.gen") if File.exist?("#{@build_dir}/etc/locale.gen")
File.delete("#{@build_dir}/etc/default/locale") if File.exist?("#{@build_dir}/etc/default/locale")
# creating locale.gen
locale_gen = <<-EOF
#{@locale} #{@locale.split(".").last}
EOF
locale_gen.gsub!(/^\s*/,'')
create_file "#{@build_dir}/etc/locale.gen", locale_gen
# creating locale
locale_f = <<-EOF
LANG="#{@locale}"
EOF
locale_f.gsub!(/^\s*/,'')
create_file "#{@build_dir}/etc/default/locale", locale_f
# running the gen script
chroot_run("/usr/sbin/locale-gen")

# sources for apt
apt_sources = <<-EOF
deb http://mir1.ovh.net/debian/ #{@base} main contrib non-free
Expand Down

0 comments on commit e3fb161

Please sign in to comment.