Removing frog.
[maemian] / unpack / unpack-binpkg-l2
1 #!/usr/bin/perl
2 # unpack-binpkg-l2 -- maemian unpack script (binary packages level 2)
3 #
4 # syntax: unpack-binpkg-l <base-dir>
5
6 # Copyright (C) 1998 Christian Schwarz and Richard Braakman
7 #
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
12 #
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program.  If not, you can find it on the World Wide
20 # Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free
21 # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
22 # MA 02110-1301, USA.
23
24 use strict;
25 use vars qw($verbose);
26
27 ($#ARGV == 0) or fail("syntax: unpack-binpkg-l2 <base-dir>");
28 my $base_dir = shift;
29
30 use lib "$ENV{'MAEMIAN_ROOT'}/lib";
31 use Maemian::Command qw(spawn);
32 use Util;
33
34 print "N: Unpacking binary packages in directory $base_dir ...\n" if $verbose;
35 mkdir("$base_dir/unpacked", 0777) or fail();
36
37 # avoid using dpkg-deb -x; this pipeline is far faster.  I got a factor 2
38 # improvement on large debs, and factor 1.5 on small debs.  I heard
39 # it's because dpkg-deb syncs while writing.  -- Richard
40
41 spawn({ fail => 'error', err => "$base_dir/unpacked-errors" },
42       ['dpkg-deb', '--fsys-tarfile', "$base_dir/deb"],
43       '|', ['tar', 'xf', '-', '-C', "$base_dir/unpacked"]);
44
45 # fix permissions
46 spawn({ fail => 'error' },
47       ['chmod', '-R', 'u+rwX,go-w', "$base_dir/unpacked"]);