X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=make%2Fcommon.pm;fp=make%2Fcommon.pm;h=f0174e0b3bd8ab79b7af95a79c924001417d9ead;hb=c185edf71cdd9aa4b72ffd9059534d8ac0cb1249;hp=d5a2f06c73c0cb8537fb03a910875d840efe0f7c;hpb=64273cc51bcd7efb60e7c1636ee75696a791db22;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/make/common.pm b/make/common.pm index d5a2f06c7..f0174e0b3 100644 --- a/make/common.pm +++ b/make/common.pm @@ -31,10 +31,13 @@ use Exporter qw(import); use File::Path qw(mkpath); use File::Spec::Functions qw(rel2abs); +use make::console; + our @EXPORT = qw(create_directory get_cpu_count get_version read_config_file + write_config_file module_installed); sub create_directory($$) { @@ -121,4 +124,15 @@ sub read_config_file($) { return %config; } +sub write_config_file($%) { + my $path = shift; + my %config = @_; + open(my $fh, '>', $path) or print_error "unable to write to $path: $!"; + while (my ($key, $value) = each %config) { + $value //= ''; + say $fh "$key $value"; + } + close $fh; +} + 1;