Skip to content

Instantly share code, notes, and snippets.

@DILL44 DILL44/backupApt
Created Oct 29, 2015

What would you like to do?
# recupère les programmes installés dans les logs de apt
sudo gzip -Nd /var/log/apt/history.log.*
file=`egrep 'apt-get install' /var/log/apt/history.log*`
# transforme en une commade d'install
file=`echo $file | sed 's/\/var\/log\/apt\/history.log[.]\?[0-9]*:Commandline: apt-get install//g'`
#demande le nom du fichier si il n'a pas été rentrer en paramètre
while [ X$configFile == X && -f $configFile ]
read -p "give file name (can-t be empty):" configFile
#écrit un fichier avec la version de la distrib, les sources des logiciels et la commande d'install
echo "#!/bin/bash">$configFile
uname -v>>$configFile
echo " ">>$configFile
cat /etc/apt/sources.list>>$configFile
echo " ">>$configFile
echo " apt-get intall $file">>$configFile
sudo gzip -N /var/log/apt/history.log.*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.