Usability - Productivity - Business - The web - Singapore & Twins

Share your application setup

There are situations where you want to document or share (eventually with yourself) the list of all applications packages you have installed on your Ubuntu Linux system. To do that you have a 2 step process: document the packages and document the repositories. A sensible approach is to do that in a "ready to install" way. With a little help from AskUbuntu, here is the solution:
#! /bin/sh
# Run this on the source system
sudo dpkg --get-selections > ~ /Desktop /packages

# Run this on the target system (after copying the packages list and activating the repository
sudo dpkg --set-selections < ~ /Desktop /packages && sudo apt-get -u dselect-upgrade
And for the list of repositories:
#! /bin/sh
# listrepositories - script to get all the repositories incl ppa installed on a system
# ready to be reloaded using apt-add-repository
for APT in ` find /etc /apt / -name *.list `; do
    grep -Po "(?<=^deb\s).*?(?=#|$)" $APT | while read ENTRY ; do
        HOST= ` echo $ENTRY | cut -d / -f3 `
        USER= ` echo $ENTRY | cut -d / -f4 `
        PPA= ` echo $ENTRY | cut -d / -f5 `
        #echo sudo apt-add-repository ppa:$USER/$PPA
        if [ "ppa.launchpad.net" = "$HOST" ]; then
            echo sudo apt-add-repository ppa: $USER / $PPA
            echo sudo apt-add-repository \' ${ENTRY} \'
You need to listrepositories > addrep.sh to get the script to copy to the target system
As usual YMMV
References: Packages, Repositories

Posted by on 12 June 2012 | Comments (0) | categories: Linux


  1. No comments yet, be the first to comment