Part of the opposition to my proposed source packaging format is that it forces people to use dpkg, which must be run as root. I have demonstrated in the previous tutorial that it is possible to still use the packages in user space by using dpkg-deb --extract. I have since discovered that it is in fact possible to use dpkg in user space, via the magic of the fakeroot package. To start, you will need to create a directory for dpkg to put it's status files: $ cd ~/tmp # Choose where you want stuff $ mkdir -p var/lib/dpkg/info $ mkdir -p var/lib/dpkg/updates $ touch var/lib/dpkg/status $ touch var/lib/dpkg/available Create this little script and put it in your path: -- cut here -- ~/bin/mydpkg #! /bin/sh # mydpkg - wrapper for dpkg in local space fakeroot /bin/sh -c "dpkg --root=/home/jim/tmp $*" -- cut here -- Remember to chmod +x it and change the directory location to wherever you want the files. Now for the fun part: $ mydpkg -i src-orig-hello_1.3-1_all.deb Selecting previously deselected package src-orig-hello. (Reading database ... 0 files and directories currently installed.) Unpacking src-orig-hello (from src-orig-hello_1.3-1_all.deb) ... Setting up src-orig-hello (1.3-1) ... $ mydpkg -i src-deb-hello_1.3-1.1_all.deb Selecting previously deselected package src-deb-hello. (Reading database ... 6 files and directories currently installed.) Unpacking src-deb-hello (from src-deb-hello_1.3-1.1_all.deb) ... Setting up src-deb-hello (1.3-1.1) ... $ mydpkg -l Desired=Unknown/Install/Remove/Purge | Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed |/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad) ||/ Name Version Description +++-===============-==============-============================================ ii src-deb-hello 1.3-1.1 Debian-specific source code for GNU hello ii src-orig-hello 1.3-1 Upstream source code for GNU hello Cool! We got dpkg action, and we aren't even root! Now let's remove 'em. $ mydpkg --purge src-orig-hello dpkg: dependency problems prevent removal of src-orig-hello: src-deb-hello depends on src-orig-hello. dpkg: error processing src-orig-hello (--purge): dependency problems - not removing Errors were encountered while processing: src-orig-hello (Of course, there is a dependency) $ mydpkg --purge src-orig-hello src-deb-hello (Reading database ... 13 files and directories currently installed.) Removing src-deb-hello ... Removing src-orig-hello ... dpkg - warning: while removing src-orig-hello, unable to remove directory `/.': Operation not permitted - directory may be a mount point ? Cool it worked. I think the last error message is really a bug in dpkg - it isn't normal to delete every package on the system! Using dpkg this way is great for my proposed source packages, but it is also useful for any Debian package you might want to install in user space only. Cheers, - Jim
Attachment:
pgp_jHQU7qVak.pgp
Description: PGP signature