This script creates .deb archive packages for all the programs currently installed on a system. Download link: Pack Attack – Repackage Debian Archives
#!/usr/bin/env bash # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Pack Attack : generate Debian packages from running Debian system. # This should work on any distro with apt-get package manager. # This is useful to back up all your programs, reinstall, or install elsewhere. # # COPYRIGHT & LICENSE # # (c) 2021, nightbulb.net - Use of this software is subject to the BSD license. # ping the email autoresponder auto@nightbulb.net for contact information. # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # What this script does: # # 1. generates a list of all installed Debian packages; # 2. checks for installation of 'dpkg-repack' and installs if needed; # 3. creates a new directory; # 4. re-creates the Debian (.deb) archives in the new directory # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # USAGE INSTRUCTION # # 1. copy the script file to the desired directory # 2. run the terminal command 'chmod +x pack.attack.bash' on the file # 3. from terminal run the command './pack.attack.bash' # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # BEGIN # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # check for 'dpkg-repack' and install it if missing # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ echo "checking for program 'dpkg-repack'" rollcall="here" if [ ! -f /bin/dpkg-repack ] then if [ ! -f /usr/bin/dpkg-repack ] then rollcall="absent" fi fi if [ "$rollcall" = "absent" ] then echo "dpkg-repack must be installed to continue" sudo apt-get install dpkg-repack fi # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # make a temporary directory to avoid over-writing any existing files # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ pack_dir="pack.attack.$RANDOM$RANDOM$RANDOM$RANDOM$RANDOM" echo "making new work directory : $pack_dir" mkdir "$pack_dir" # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # switch to new directory # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ echo "moving to new work directory : $pack_dir" cd "$pack_dir" echo "moved to $PWD" # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # make list of all installed packages # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ echo "generating list of all packages installed on this system" apt list --installed | grep "\[installed\]" | cut -d '/' -f1 > "pack.attack.list" # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # repackage all the programs from the list into .deb files # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ echo "repackaging the list of programs ... this may take a long time ..." while read line do dpkg-repack "$line" done < "pack.attack.list" echo "" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "pack attack : job finished" echo "your Debian archive files are located in $PWD" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" # END
Leave a Reply
You must be logged in to post a comment.