2 # unpack-binpkg-l2 -- maemian unpack script (binary packages level 2)
4 # syntax: unpack-binpkg-l <base-dir>
6 # Copyright (C) 1998 Christian Schwarz and Richard Braakman
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.
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.
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,
25 use vars qw($verbose);
27 ($#ARGV == 0) or fail("syntax: unpack-binpkg-l2 <base-dir>");
30 use lib "$ENV{'MAEMIAN_ROOT'}/lib";
31 use Maemian::Command qw(spawn);
34 print "N: Unpacking binary packages in directory $base_dir ...\n" if $verbose;
35 mkdir("$base_dir/unpacked", 0777) or fail();
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
41 spawn({ fail => 'error', err => "$base_dir/unpacked-errors" },
42 ['dpkg-deb', '--fsys-tarfile', "$base_dir/deb"],
43 '|', ['tar', 'xf', '-', '-C', "$base_dir/unpacked"]);
46 spawn({ fail => 'error' },
47 ['chmod', '-R', 'u+rwX,go-w', "$base_dir/unpacked"]);