summaryrefslogtreecommitdiff
path: root/scripts/pkg-get.pl
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/pkg-get.pl')
-rwxr-xr-xscripts/pkg-get.pl16
1 files changed, 12 insertions, 4 deletions
diff --git a/scripts/pkg-get.pl b/scripts/pkg-get.pl
index 3fe51e6..cb5ee10 100755
--- a/scripts/pkg-get.pl
+++ b/scripts/pkg-get.pl
@@ -35,6 +35,14 @@ GetOptions("do"=>\$download_only,
"f"=>\$force, "im"=>\$ignore_md5sum, "margs=s"=>\$unused,
"rargs=s"=>\$unused, "r=s"=>\$root);
+# use compression-mode defined in pkgmk.conf
+our $compress = "gz";
+open CONFIG, "/etc/pkgmk.conf" or die "Could not open /etc/pkgmk.conf";
+while (<CONFIG>) {
+ $compress = $1 if m/^PKGMK_COMPRESSION_MODE="(.*)"\n/;
+}
+close CONFIG;
+
if ($root) {
$LOCKFILE = $root.$LOCKFILE ;
$PKGDB = $root.$PKGDB;
@@ -156,10 +164,10 @@ sub parsepackage {
$name =~ s/\#.*$//;
my $version = $p[0];
$version =~ s/^.*\#//;
- $version =~ s/-\w*\.pkg\.tar\.gz//;
+ $version =~ s/-\w*\.pkg\.tar\.[gbx]z*//;
my $release = $p[0];
$release =~ s/^.*-//;
- $release =~ s/\.pkg\.tar\.gz//;
+ $release =~ s/\.pkg\.tar\.[gbx]z*//;
if (not $_[2]) {$_[2] = $_[1]};
$pkg{'name'} = $name;
$pkg{'version'} = $version;
@@ -497,7 +505,7 @@ sub getdependencies {
# Download given package (if needed), check md5sum
sub downloadpkg {
my %pkg = @_;
- my $fullpath = $pkg{'path'}."/".$pkg{'name'}."#".$pkg{'version'}."-".$pkg{'release'}.".pkg.tar.gz";
+ my $fullpath = $pkg{'path'}."/".$pkg{'name'}."#".$pkg{'version'}."-".$pkg{'release'}.".pkg.tar.$compress";
if (-f $fullpath) {
my $md5 = `md5sum $fullpath`; chomp;
$md5 =~ s/\s+.*$//;
@@ -538,7 +546,7 @@ sub installpkg {
if ($force){$aa = $aa."-f "};
if ($root) {$aa = $aa."-r ".$root." "};
if ($pkg{'pre_install'} eq "yes" and ($install_scripts or $pre_install)) {dopre(%pkg)};
- my $fullpath = $pkg{'path'}."/".$pkg{'name'}."#".$pkg{'version'}."-".$pkg{'release'}.".pkg.tar.gz";
+ my $fullpath = $pkg{'path'}."/".$pkg{'name'}."#".$pkg{'version'}."-".$pkg{'release'}.".pkg.tar.$compress";
print "pkg-get: /usr/bin/pkgadd $upgrade$aa$fullpath\n";
system ("/usr/bin/pkgadd $upgrade$aa$fullpath") == 0 or return 0;
if ($pkg{'post_install'} eq "yes" and ($install_scripts or $post_install)) {dopost(%pkg)};

Generated by cgit