blob: 4f5e302c244609ca02e9d40a86eaf49207afe1ee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#!/bin/bash
# orig: http://askubuntu.com/a/630674
# make this into a Haskell program that sorts this info in a sensible
# way (e.g. by date). and possibly excludes packages installed by
# propellor.
# List of all packages currently installed
current=$(dpkg -l | awk '{print $2}' | sort | uniq)
# List of all packages that were installed with the system
pre=$(cat /var/log/installer/status | sed -n 's/^Package: //p' | sort | uniq)
# List of packages that don't depend on any other package
manual=$(apt-mark showmanual | sort | uniq)
# (Current - Pre) ∩ (Manual)
packages=$(comm -12 <(comm -23 <(echo "$current") <(echo "$pre")) <(echo "$manual") )
for pack in $packages; do
packname=$(echo $pack | cut -f 1 -d ":")
desc=$(apt-cache search "^$packname$" | sed -E 's/.* - (.*)/\1/')
date=$(date -r /var/lib/dpkg/info/$pack.list)
echo "# $desc"
echo "# $date"
echo "sudo apt-get install $pack"
echo -e ""
done
|