mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-09 18:45:54 +02:00
pakfire: Automatically compose $version
The tree in which pakfire is looking for packages and Core Updates has been hardcoded into /opt/pakfire/etc/pakfire.conf. This patch adds a new function which reads the system release from /etc/system-release. Signed-off-by: Michael Tremer <michael.tremer@ipfire.org> Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
This commit is contained in:
committed by
Arne Fitzenreiter
parent
d8f7b45f35
commit
e6f4991be2
@@ -70,6 +70,9 @@ my $bfile;
|
||||
my %pakfiresettings = ();
|
||||
&General::readhash("${General::swroot}/pakfire/settings", \%pakfiresettings);
|
||||
|
||||
# Make version
|
||||
$Conf::version = &make_version();
|
||||
|
||||
sub message {
|
||||
my $message = shift;
|
||||
|
||||
@@ -946,4 +949,42 @@ sub status {
|
||||
exit 1;
|
||||
}
|
||||
|
||||
sub get_arch() {
|
||||
# Append architecture
|
||||
my ($sysname, $nodename, $release, $version, $machine) = POSIX::uname();
|
||||
|
||||
# We only support armv5tel for all 32 bit arches
|
||||
if ($machine =~ m/armv[567]/) {
|
||||
return "armv5tel";
|
||||
|
||||
# We only support i586 for 32 bit x86
|
||||
} elsif ($machine =~ m/i[0-9]86/) {
|
||||
return "i586";
|
||||
}
|
||||
|
||||
return $machine;
|
||||
}
|
||||
|
||||
sub make_version() {
|
||||
my $version = "";
|
||||
|
||||
# Open /etc/system-release
|
||||
open(RELEASE, "</etc/system-release");
|
||||
my $release = <RELEASE>;
|
||||
close(RELEASE);
|
||||
|
||||
# Add the main relase
|
||||
if ($release =~ m/IPFire ([\d\.]+)/) {
|
||||
$version .= $1;
|
||||
}
|
||||
|
||||
# Append architecture
|
||||
my $arch = &get_arch();
|
||||
if ($arch ne "i586") {
|
||||
$version .= "-${arch}";
|
||||
}
|
||||
|
||||
return $version;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
|
||||
package Conf;
|
||||
|
||||
$version = "@VERSION@";
|
||||
|
||||
$mainserver = "pakfire.ipfire.org";
|
||||
|
||||
$cachedir = "/opt/pakfire/cache";
|
||||
|
||||
Reference in New Issue
Block a user