This repository has been archived on 2022-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
prezto/modules/dpkg/functions/deb-clone

27 lines
589 B
Plaintext
Raw Normal View History

2012-01-31 23:37:51 -05:00
#
# Generates a script that can be used to duplicate a dpkg-based system.
#
# Authors:
# Daniel Bolton <danielbarrettbolton@gmail.com>
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
local clone_script="${0}.sh"
local package_list=$(
perl \
-m 'AptPkg::Cache' \
-e '
$c=AptPkg::Cache->new;
for (keys %$c) {
push @a, $_ if $c->{$_}->{'CurrentState'} eq 'Installed';
}
print "$_ " for sort @a;
'
)
2011-10-11 23:13:58 -04:00
rm "$clone_script"
print '#!/bin/sh\n' > "$clone_script"
print "aptitude install ${package_list}\n" >> "$clone_script"
chmod +x "$clone_script"
2011-10-11 23:13:58 -04:00