dpkg-repack/0000755000000000000000000000000011667440462010146 5ustar dpkg-repack/debian/0000755000000000000000000000000011667440471011370 5ustar dpkg-repack/debian/control0000644000000000000000000000155311643746501012774 0ustar Source: dpkg-repack Section: admin Priority: optional Build-Depends: debhelper (>= 7), dpkg (>= 1.9.0) Maintainer: Joey Hess Standards-Version: 3.9.2 Vcs-Git: git://git.kitenet.net/dpkg-repack Homepage: http://kitenet.net/~joey/code/dpkg-repack/ Package: dpkg-repack Architecture: all Depends: ${misc:Depends}, ${perl:Depends} Description: puts an unpacked .deb file back together dpkg-repack creates a .deb file out of a package that has already been installed. If any changes have been made to the package while it was unpacked (ie, files in /etc were modified), the new package will inherit the changes. . This utility can make it easy to copy packages from one computer to another, or to recreate packages that are installed on your system, but no longer available elsewhere, or to store the current state of a package before you upgrade it. dpkg-repack/debian/docs0000644000000000000000000000000711553105364012231 0ustar README dpkg-repack/debian/rules0000755000000000000000000000003511553105407012435 0ustar #!/usr/bin/make -f %: dh $@ dpkg-repack/debian/manpages0000644000000000000000000000001611553105400013063 0ustar dpkg-repack.1 dpkg-repack/debian/changelog0000644000000000000000000003574111667440367013260 0ustar dpkg-repack (1.37) unstable; urgency=low * Fix generation of conffiles list file. For some reason dpkg-query does not list this file, so it has to be generated when there's a Conffiles stanza in the package status. Closes: #651165 * Remove the Conffiles stanza from the generated package's control file; dpkg ignores it anyway. -- Joey Hess Tue, 06 Dec 2011 12:20:13 -0400 dpkg-repack (1.36) unstable; urgency=low * Fix check for non-installed packages to not misfire on a package that has no dpkg control files. Closes: #644619 -- Joey Hess Sat, 08 Oct 2011 00:08:54 -0400 dpkg-repack (1.35) unstable; urgency=low * Does not need to depend on dpkg-dev. Closes: #616318 * Fix dpkg-query call to support --rootdir. (Evan Dandresa) Closes: #630765 -- Joey Hess Fri, 17 Jun 2011 11:27:11 -0400 dpkg-repack (1.34) unstable; urgency=low * Only needs to build-depend on dpkg, not dpkg-dev. Closes: #616318 * Clean up rules file. -- Joey Hess Mon, 18 Apr 2011 15:04:11 -0400 dpkg-repack (1.33) unstable; urgency=low * Use dpkg-query --control-path rather than hardcoding dpkg path info. Will be needed for multiarch. -- Joey Hess Wed, 02 Mar 2011 15:16:04 -0400 dpkg-repack (1.32) unstable; urgency=low * Avoid adding a second Architecture field to the control file. Closes: #558135 -- Joey Hess Thu, 26 Nov 2009 12:19:39 -0500 dpkg-repack (1.31) unstable; urgency=low * Update the man page re ucf. -- Joey Hess Mon, 09 Mar 2009 22:52:37 -0400 dpkg-repack (1.30) unstable; urgency=low * Use debhelper v7; rules file minimisation. -- Joey Hess Tue, 22 Jul 2008 00:27:16 -0400 dpkg-repack (1.29) unstable; urgency=low * Apparently knoppix, dpkg -L does not individually list all parent directories of files in a package. So don't rely on the parent directories always having been made, and create any that are missing. -- Joey Hess Sun, 23 Mar 2008 20:33:14 -0400 dpkg-repack (1.28) unstable; urgency=low * dpkg-repack's repository has moved from subversion to git. * Current standards version. -- Joey Hess Fri, 19 Oct 2007 20:36:49 -0400 dpkg-repack (1.27) unstable; urgency=low * Update url to web page in README. * Remove installhook stuff in debian/rules no longer used. -- Joey Hess Mon, 04 Jun 2007 16:43:33 -0400 dpkg-repack (1.26) unstable; urgency=low * Update for 822-date deprecation. Closes: #415796 -- Joey Hess Thu, 22 Mar 2007 16:17:08 -0400 dpkg-repack (1.25) unstable; urgency=low * Skip obsolete conffiles, don't include in repacked debs. Closes: #397666 -- Joey Hess Wed, 8 Nov 2006 16:24:12 -0500 dpkg-repack (1.24) unstable; urgency=low * Typo. Closes: #367826 -- Joey Hess Thu, 18 May 2006 12:09:21 -0500 dpkg-repack (1.23) unstable; urgency=low * Man page typo. Closes: #362044 * Patch from Tomas Pospisek to use cp -a whe copying a named pipe, as cp -pd will read from the pipe. Closes: #287319 -- Joey Hess Mon, 15 May 2006 17:15:11 -0500 dpkg-repack (1.22) unstable; urgency=low * Add --generate option. Closes: #273468 -- Joey Hess Tue, 17 Jan 2006 15:58:38 -0500 dpkg-repack (1.21) unstable; urgency=low * chown conffiles and control after writing them, necessary so that in fakeroot -u these files are not recorded as owned by the user doing the packing. Closes: #320233 -- Joey Hess Thu, 28 Jul 2005 10:48:10 -0400 dpkg-repack (1.20) unstable; urgency=low * Use dpkg --print-architecture instead of now-deprecated --print-installation-architecture. How to reconcile this with the change in version 0.21, I don't know. -- Joey Hess Thu, 30 Jun 2005 18:21:03 -0400 dpkg-repack (1.19) unstable; urgency=low * Add missing dependency on dpkg-dev. -- Joey Hess Fri, 20 Aug 2004 13:42:03 +0100 dpkg-repack (1.18) unstable; urgency=low * Add a note that the package was produced by dpkg-repack to its description. Closes: #217377 -- Joey Hess Fri, 24 Oct 2003 13:50:13 -0400 dpkg-repack (1.17) unstable; urgency=low * Swtich from build-depend-indep to build-depends. -- Joey Hess Mon, 8 Sep 2003 20:45:07 -0400 dpkg-repack (1.16) unstable; urgency=low * Work again on packages _without_ conffiles. Closes: #193884 -- Joey Hess Mon, 19 May 2003 18:46:21 -0400 dpkg-repack (1.15) unstable; urgency=low * Trim missing conffiles from the conffiles list, since dpkg-deb requires all listed conffiles exist. Closes: #193393 * Skip over "diverts others" lines in dpkg -L. Closes: #193394 -- Joey Hess Thu, 15 May 2003 13:58:08 -0400 dpkg-repack (1.14) unstable; urgency=low * fakeroot's new -u flag should be used if using dpkg-repack with fakeroot. Otherwise permisions of non-root-owned files can be messed up. Warn about this if -u is not used. * Other minor changes. -- Joey Hess Sat, 10 May 2003 19:27:28 -0400 dpkg-repack (1.13) unstable; urgency=low * Chown directories after making them to deal with directories not owned by root. Closes: #191323 (There is still a bug in fakeroot that makes dpkg-repack not work under fakeroot, but I will file a separate bug for that.) -- Joey Hess Thu, 1 May 2003 10:47:38 -0400 dpkg-repack (1.12) unstable; urgency=low * Remove "L" from man page section. -- Joey Hess Tue, 29 Apr 2003 18:30:31 -0400 dpkg-repack (1.11) unstable; urgency=low * Rebuild w/o /usr/doc link. -- Joey Hess Fri, 15 Nov 2002 15:28:39 -0500 dpkg-repack (1.10) unstable; urgency=low * use dh_installman. -- Joey Hess Thu, 13 Jun 2002 18:26:31 -0400 dpkg-repack (1.9) unstable; urgency=low * Debhelper v4. -- Joey Hess Sat, 1 Jun 2002 16:41:04 -0400 dpkg-repack (1.8) unstable; urgency=low * Better error handling thanks to Bill Allombert. Closes: #141499 -- Joey Hess Sat, 6 Apr 2002 22:10:39 -0500 dpkg-repack (1.7) unstable; urgency=low * Fixed uninitalized value if the last item in a package's file list was a symlink to a directory that also exists in the package. Closes: #88978 * Removed the debstd-style output. * Use debhelper v3. -- Joey Hess Thu, 8 Mar 2001 16:18:26 -0800 dpkg-repack (1.6) unstable; urgency=low * Use debhelper v2. -- Joey Hess Mon, 25 Sep 2000 14:56:29 -0700 dpkg-repack (1.5) unstable; urgency=low * Documented a conffile problem I can do nothing about. Closes: #69009 -- Joey Hess Fri, 1 Sep 2000 16:55:52 -0700 dpkg-repack (1.4) unstable; urgency=low * Applied a cleaner fix for the mkdir problem, by David Lively , Closes: #64605 -- Joey Hess Wed, 24 May 2000 12:52:31 -0700 dpkg-repack (1.3) unstable; urgency=low * Don't bomb out if ran in a directory with the suid/sgid bit set. Closes: #64605 -- Joey Hess Wed, 24 May 2000 12:42:51 -0700 dpkg-repack (1.2) unstable; urgency=low * Removed more historical cautions in the man page. * Dragged screaming and kicking into the world of perl5. Now -w and use strict safe; lots of cleanups. Still needs a bit of a rewrite. * Can repack multiple packages in sequence now. -- Joey Hess Fri, 17 Dec 1999 19:00:07 -0800 dpkg-repack (1.1) unstable; urgency=low * Build deps. -- Joey Hess Sat, 4 Dec 1999 00:52:53 -0800 dpkg-repack (1.0) unstable; urgency=low * FHS * Integrated into my cvs build system. * It occurs to me that this is a pretty stable package, so I bumped the version number to 1.0. -- Joey Hess Fri, 10 Sep 1999 21:19:21 -0700 dpkg-repack (0.25) unstable; urgency=low * Depend on gcc, because it uses dpkg --build which brain-deadly requires dpkg be present (and of course dpkg doesn't depend on gcc..) (Closes: #40985) -- Joey Hess Thu, 8 Jul 1999 11:20:26 -0700 dpkg-repack (0.24) unstable; urgency=low * Now depends on perl5 | perl, I'll kill the | perl bit later on, but it seems to make sense for the transition. -- Joey Hess Sun, 4 Jul 1999 10:57:57 -0700 dpkg-repack (0.23) unstable; urgency=low * Quote another regexp (#39955). -- Joey Hess Tue, 22 Jun 1999 09:35:46 -0700 dpkg-repack (0.22) unstable; urgency=low * Added note to an error message that fakeroot may be used. -- Joey Hess Thu, 8 Apr 1999 21:16:22 -0700 dpkg-repack (0.21) unstable; urgency=low * Use --print-installation-architecture instead of --print-architecture (#31738) * Link to new homepage in the README. -- Joey Hess Mon, 11 Jan 1999 13:04:49 -0800 dpkg-repack (0.20) unstable; urgency=low * Changed how I disable locales when running dpkg -l - now set LC_ALL=C. -- Joey Hess Wed, 17 Jun 1998 12:27:16 -0700 dpkg-repack (0.19) unstable; urgency=low * Version 0.16 broke repacking packages that had diverted files in them, because of how dpkg -L shows that info. (#23339). It turns out that older versions of dpkg-repack packed up not the original file, but the file that was diverted to replace it. I've decided that is incorrect behavior, and changed it so if there is a diversion, the original file is placed in the repacked package. -- Joey Hess Sat, 13 Jun 1998 17:35:22 -0700 dpkg-repack (0.18) unstable; urgency=low * Removed some debugging output I accidentially put in the last version. * Workes now for packages that have filenames with spaces in them (like maelstrom). * Checged the descripton to remove the "attempts to". It should always work. (heh) -- Joey Hess Thu, 28 May 1998 06:14:27 -0400 dpkg-repack (0.17) unstable; urgency=low * Uses dpkg for querying the status file and getting the file list, rather than doing it by hand. However, dpkg-repack still accesses the dpkg database directly, becuase it copies maintainer scripts, etc, from there. There is no way to get that information via dpkg. * Fixed bug #22603 - a failure when eg. /usr is a symlink. . If the package contains a file, that locally looks like a symlink pointing to a directory that is not in the package, then change it to a real directory in the repacked package. This assummes that in this case, the symlink was a local change (eg, /usr is a symlink). . However, if the directory in question contains no files in the filelist for this package, don't do that, just preserve the symlink in the repacked package. This handles the case where a package contains a symlink to a directory elsewhere. -- Joey Hess Tue, 26 May 1998 07:02:14 -0400 dpkg-repack (0.16) frozen unstable; urgency=low * Handle directories that are symlinks properly (#20280). -- Joey Hess Thu, 26 Mar 1998 22:30:35 -0800 dpkg-repack (0.15) unstable; urgency=low * Fixed minor lintian errors. -- Joey Hess Sat, 14 Mar 1998 20:00:09 -0800 dpkg-repack (0.14) unstable; urgency=low * Updated fsf address. -- Joey Hess Mon, 9 Feb 1998 12:54:00 -0800 dpkg-repack (0.13) unstable; urgency=low * Depend on perl 5.004 or greater (For Getopt::Long). -- Joey Hess Sat, 17 Jan 1998 02:12:58 -0500 dpkg-repack (0.12) unstable; urgency=low * Added option to make it build a debian package of a different architecture than the default. (#17173) -- Joey Hess Fri, 16 Jan 1998 11:18:35 -0500 dpkg-repack (0.11) unstable; urgency=low * Fix bug #17053, the first package listed in the status file can be repacked now. -- Joey Hess Tue, 13 Jan 1998 14:16:17 -0500 dpkg-repack (0.10) unstable; urgency=low * Don't include file list file in package. (Removes "contained list as info file" error from dpkg when you install dpkg-repacked packages. -- Joey Hess Thu, 27 Nov 1997 23:26:07 -0500 dpkg-repack (0.9) unstable; urgency=low * Force the umask to 022 (#14516). * Use debhelper. * Be a bit more positive that the package will work in the description, since it seems to have worked pretty much ok for a year. -- Joey Hess Tue, 4 Nov 1997 01:08:39 -0500 dpkg-repack (0.8) unstable; urgency=low * Routine update of debian/rules: Fixed binary-indep target. -- Joey Hess Thu, 4 Sep 1997 19:30:13 -0400 dpkg-repack (0.7) unstable; urgency=low * Moved it into unstable. * Changed the program so it puts its temporary directory and the result .deb file into the current directory, instead of /tmp. This is the same as alien works, and I made this change mainly so you can repack some large package on a spare partition when it won't fit on the partition that contains /tmp. * Added --root= option, to make it operate on the filesystem rooted at . * Remove temporary directory when done. * Man page fixes. * Added proper error trapping and handling. * Added progress messages. * Routine update of debian/rules: Run dpkg-gencontrol after debstd, and delete substvars during clean. -- Joey Hess Thu, 26 Jun 1997 18:54:40 -0400 dpkg-repack (0.6) experimental; urgency=low * Fixed problem with packaging dangling symlinks. * Fixed permissions files when creating directories. * Add Architecture: field to the control file. * Removed some debugging info that was left in by mistake. * Routine update of debian/rules: Run dpkg-gencontrol after debstd, and delete substvars during clean. -- Joey Hess Sun, 6 Apr 1997 15:11:25 -0400 dpkg-repack (0.5) experimental; urgency=high * Oops! This package was not meant to be in unstable. It's supposed to be in experimental. -- Joey Hess Thu, 20 Mar 1997 01:59:04 -0500 dpkg-repack (0.4) unstable; urgency=low * Use /var/lib/dpkg/status, not /var/lib/dpkg/available. * Routine update of debian/rules: Clean up junk files in subdirs. -- Joey Hess Mon, 17 Mar 1997 16:39:05 -0500 dpkg-repack (0.3) unstable; urgency=low * New author/maintainer email address. -- Joey Hess Tue, 24 Dec 1996 15:30:21 -0500 dpkg-repack (0.2) experimental; urgency=low * Fixed bug where it did not install shlibs and other control files. * Routine update of debian/rules (now uses debmake). * Fixed problem with perl 5.003.07. -- Joey Hess Wed, 6 Nov 1996 22:28:20 -0500 dpkg-repack (0.1) experimental; urgency=low * First release. -- Joey Hess Fri, 18 Oct 1996 00:07:24 -0400 dpkg-repack/debian/copyright0000644000000000000000000000031411514341525013310 0ustar Format: http://dep.debian.net/deps/dep5/ Files: * Copyright: 1996-2009 Joey Hess License: GPL-2+ On Debian systems, the complete text of the GPL is in /usr/share/common-licenses/GPL dpkg-repack/debian/compat0000644000000000000000000000000211122033122012537 0ustar 7 dpkg-repack/debian/install0000644000000000000000000000002411553105357012750 0ustar dpkg-repack usr/bin dpkg-repack/dpkg-repack0000755000000000000000000002113111667440131012253 0ustar #!/usr/bin/perl -w # # This program puts humpty-dumpty back together again. # # dpkg-repack is Copyright (c) 1996-2006 by Joey Hess # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave., Cambridge, MA 02139, USA. use strict; use File::stat; use vars qw($error_flag $dirty_flag $build_dir $arch $rootdir $packagename $generate); sub Syntax { print STDERR <. --arch=arch Force the parch to be built for architecture . --generate Generate build directory but do not build deb. packagename The name of the package to attempt to repack. eof } sub Info { print "dpkg-repack: @_\n"; } sub Warn { print STDERR "dpkg-repack: @_\n"; } sub Error { Warn @_; $error_flag=1; } sub Die { Error('Fatal Error:',@_); CleanUp(); exit 1; } # Run a system command, and print an error message if it fails. sub SafeSystem { my $errormessage=pop @_; my $ret=system @_; if (int($ret/256) > 0) { $errormessage="Error running: ".join(' ', @_) if !$errormessage; Error($errormessage); } } # Make the passed directory, print an error message if it fails. sub SafeMkdir { my ($dir,$perms)=@_; mkdir $dir,$perms || Error("Unable to make directory, \"$dir\": $!"); # mkdir doesn't do sticky bits and suidness. chmod $perms, $dir || Error("Unable to change permissions on \"$dir\": $!"); } # This removes the temporary directory where we built the package. sub CleanUp { if ($dirty_flag) { SafeSystem("rm","-rf",$build_dir, "Unable to remove $build_dir ($!). Please remove it by hand."); } } # This makes the directories we will rebuild the package in. sub Make_Dirs { $dirty_flag=1; SafeMkdir $build_dir,0755; SafeMkdir "$build_dir/DEBIAN",0755; } # Get package control file via dpkg -s. sub Extract_Control { my @control=`dpkg --root=$rootdir/ -s $packagename`; chomp foreach @control; # Add something to the Description to mention dpkg-repack. my $indesc=0; my $x; for ($x=0; $x < @control; $x++) { if ($control[$x] =~/^(\S+):/) { last if $indesc; # end of description $indesc=1 if lc $1 eq "description"; } } if ($indesc) { my $date=`date -R`; chomp $date; $control[$x-1]=$control[$x-1]." .\n"." (Repackaged on $date by dpkg-repack.)"; } if ($arch) { @control=grep { !/^Architecture:/ } @control; push @control, "Architecture: $arch\n"; } if (! grep { /^Status:\s+.*\s+installed/ } @control) { Die "Package $packagename not fully installed"; } @control=grep { !/^Status:\s+/ } @control; return join("\n", @control)."\n"; } # Install the control file. Pass it the text of the file. sub Install_Control { my @control=split("\n", shift); open (CONTROL,">$build_dir/DEBIAN/control") || Die "Can't write to $build_dir/DEBIAN/control"; my $control; my $skip=0; foreach (@control) { # Remove the Conffiles stanza if (/^(\S+):/) { $skip = lc $1 eq "conffiles"; } print CONTROL "$_\n" unless $skip; } close CONTROL; SafeSystem "chown","0:0","$build_dir/DEBIAN/control",""; } # Install all the files in the DEBIAN directory. (Except control file and # file list file.) sub Install_DEBIAN { my @conffiles=@_; my @control_files; open (Q, "dpkg-query --admindir=$rootdir/var/lib/dpkg --control-path $packagename 2>/dev/null |") || die "dpkg-query failed: $!"; while (my $fn=) { chomp $fn; push @control_files, $fn; } close Q; foreach my $fn (@control_files) { my ($basename)=$fn=~m/^.*\.(.*?)$/; if ($basename ne 'list' && $basename ne 'conffiles') { SafeSystem "cp","-p",$fn,"$build_dir/DEBIAN/$basename",""; } } # Conffiles have to be handled specially, because # dpkg-query --control-path does not list the conffiles file. # Also, we need to generate one that only control conffiles # that are still present on the filesystem. if (@conffiles) { open (OUT, ">$build_dir/DEBIAN/conffiles") || Die "write conffiles: $!"; foreach (@conffiles) { print OUT "$_\n"; } close OUT; SafeSystem "chown","0:0","$build_dir/DEBIAN/conffiles", ""; } } # This looks at the list of files in this package, and places them # all on the directory tree. sub Install_Files { my $control=shift; # There are two types of conffiles. Obsolete conffiles should be # skipped, while other conffiles should be included if present. my @conffiles=(); my @obsolete_conffiles; my $in_conffiles=0; foreach my $line (split /\n/,$control) { if ($line=~/^Conffiles:/) { $in_conffiles=1; } elsif ($in_conffiles && $line=~/^ (.*)\s+([^\s]+)\s+obsolete$/) { push @obsolete_conffiles, $1; } elsif ($in_conffiles && $line=~/^ (.*)\s+([^\s]+)$/) { push @conffiles, $1; } else { $in_conffiles=0; } } # I need a list of all the files, for later lookups # when I test to see where symlinks point to. # Note that because I parse the output of the command (for # diversions, below) it's important to make sure it runs with English # language output. my $lc_all=$ENV{LC_ALL}; $ENV{LC_ALL}='C'; my @filelist=split /\n/,`dpkg --root=$rootdir/ -L $packagename`; $ENV{LC_ALL}=$lc_all if defined $lc_all; # important to reset it. # Set up a hash for easy lookups. my %filelist = map { $_ => 1 } @filelist; my $fn; for (my $x=0;$x<=$#filelist;$x++) { my $origfn=$filelist[$x]; # dpkg -L spits out extra lines to report diversions. # we have to parse those (ugly..), to find out where the # file was diverted to, and use the diverted file. if (defined $filelist[$x+1] && ($filelist[$x+1]=~m/locally diverted to: (.*)/ || $filelist[$x+1]=~m/diverted by .*? to: (.*)/)) { $fn="$rootdir/$1"; $x++; # skip over that line. } elsif ($origfn=~m/package diverts others to: (.*)/) { # not a file at all, skip over it next; } else { $fn=$rootdir.$origfn; } if (grep { $_ eq $fn } @obsolete_conffiles) { Warn "Skipping obsolete conffile $fn\n"; next; } if (!-e $fn && !-l $fn) { Error "File not found: $fn" unless grep { $_ eq $fn } @conffiles; } elsif ((-d $fn and !-l $fn) or (-d $fn and -l $fn and !$filelist{readlink($fn)} and ($x+1 <= $#filelist and $filelist[$x+1]=~m/^\Q$origfn\E\//))) { # See the changelog for version 0.17 for an # explanation of what I'm doing above with # directory symlinks. I rely on the order of the # filelist listing parent directories first, and # then their contents. # There has to be a better way to do this! my $f=""; foreach my $dir (split(m/\/+/, $origfn)) { $f.="/$dir"; next if -d $build_dir.$f; my $st=stat($rootdir.$f); SafeMkdir "$build_dir/$f",$st->mode; chown($st->uid, $st->gid, "$build_dir/$f"); } } elsif (-p $fn) { # Copy a named pipe with cp -a. SafeSystem "cp","-a",$fn,"$build_dir/$origfn",""; } else { SafeSystem "cp","-pd",$fn,"$build_dir/$origfn",""; } } return @conffiles; } # Parse parameters. use Getopt::Long; $rootdir=''; my $ret=&GetOptions( "root|r=s", \$rootdir, "arch|a=s", \$arch, "generate|g" , \$generate, ); if (!@ARGV || !$ret) { Syntax(); exit 1; } $build_dir="./dpkg-repack-$$"; # Some sanity checks. if ($> ne 0) { Die "This program should be run as root (or you could use fakeroot -u). Aborting." } if (exists $ENV{FAKED_MODE} && $ENV{FAKED_MODE} ne 'unknown-is-real') { Warn "fakeroot run without its -u flag may corrupt some file permissions."; } foreach $packagename (@ARGV) { my $control=Extract_Control(); if (!$control) { Die "Unable to locate $packagename in the package list." } # If the umask is set wrong, the directories will end up with the wrong # perms. (Is this still needed?) umask 022; # Generate the directory tree. Make_Dirs(); my @conffiles=Install_Files($control); Install_DEBIAN(@conffiles); Install_Control($control); # Stop here? if ($generate) { Info "dpkg-repack: created $build_dir for $packagename"; next; } # Let dpkg do its magic. SafeSystem("dpkg","--build",$build_dir,".",""); # Finish up. CleanUp(); if ($error_flag) { Error("Problems were encountered in processing."); Error("The package may be broken."); $error_flag=0; } } dpkg-repack/README0000644000000000000000000000135411122033122011002 0ustar dpkg-repack creates a .deb file out of a debian package that has already been installed on your system. If any changes have been made to the package while it was unpacked (ie, files in /etc modified), the new package will inherit the changes. This utility can make it easy to copy packages from one computer to another, or to recreate packages that are installed on your system, but no longer available elsewhere, or to save the state of a package before you upgrade it or make some other change that you fear may break the package. If there are ever cases where this program fails to work, please report them to the author of dpkg-repack, Joey Hess . dpkg-repack's homepage is http://kitenet.net/~joey/code/dpkg-repack/ dpkg-repack/dpkg-repack.10000644000000000000000000000552311151131574012412 0ustar .TH DPKG-REPACK 1 "Debian Utilities" "DEBIAN" .SH NAME dpkg-repack \- put an unpacked .deb file back together .SH SYNOPSIS \fBdpkg-repack\fP [\fB--root=dir\fP] [\fB--arch=architecture\fP] [\fB--generate\fP] \fBpackagename\fP [\fBpackagename ...\fP] .br .SH DESCRIPTION .I dpkg-repack creates a .deb file out of a Debian package that has already been installed on your system. If any changes have been made to the package while it was unpacked (ie, conffiles files in /etc modified), the new package will inherit the changes. (There are exceptions to this, including changes to configuration files that are not conffiles, including those managed by ucf.) This utility can make it easy to copy packages from one computer to another, or to recreate packages that are installed on your system, but no longer available elsewhere. Note: .I dpkg-repack will place the created package in the current directory. .SH OPTIONS .TP .I --root=dir Take package from filesystem rooted on . This is useful if, for example, you have another computer nfs mounted on /mnt, then you can use --root=/mnt to reassemble packages from that computer. .TP .I --arch=architecture Make the package be for a different architecture. .I dpkg-repack cannot tell if an installed package is architecture all or is specific to the system's architecture, so by default it uses .B dpkg --print-architecture to determine the build architecture. If you know the package is architecture all, you can use this option to force .I dpkg-repack to use the right architecture. .TP .I --generate Generate a temporary directory suitable for building a package from, but do not actually create the package. This is useful if you want to move files around in the package before building it. The package can be built from this temporary directory by running "dpkg --build", passing it the generated directory. .TP .I packagename The name of the package to attempt to repack. Multiple packages can be listed. .SH BUGS This program accesses the dpkg database directly in places, querying for data that cannot be gotten via dpkg. .P There is a tricky situation that can occur if you dpkg-repack a package that has modified conffiles. The modified conffiles are packed up. Now if you install the package, dpkg does not realize that the conffiles in it are modified. So if you later upgrade to a new version of the package, dpkg will believe that the old (repacked) package has older conffiles than the new version, and will silently replace the conffiles with those in the package you are upgrading to. .P While dpkg-repack can be run under fakeroot and will work most of the time, fakeroot -u must be used if any of the files to be repacked are owned by non-root users. Otherwise the package will have them owned by root. dpkg-repack will warn if you run it under fakeroot without the -u flag. .SH AUTHOR Joey Hess dpkg-repack/GPL0000644000000000000000000004311011122033122010463 0ustar GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License.