tisdag 7 april 2015

linux - debian - dpkg --get-selections to install script
























#

#!/bin/bash
reset
cat /etc/apt/sources.list >> sources.list
dpkg --get-selections | awk '$2 ~ /^install$/ {print $1}' > installed
sort installed | uniq -u >> installed
awk '{print "apt-get --ignore-missing install  " $0}' < installed > installed-package-installer.sh
perl -pi -e 'print "cp sources.list /etc/apt/ && apt-get update\n" if $.==1'  installed-package-installer.sh
perl -pi -e 'print "#! /bin/bash\n" if $.==1'  installed-package-installer.sh
echo apt-get dist-upgrade >> installed-package-installer.sh
chmod u=rwx,g=rx,o=r installed-package-installer.sh
sleep 5
rm installed
echo echo "hynten@speed-mailer.com" >> installed-package-installer.sh

Skicka en kommentar