View Single Post
coderus's Avatar
Posts: 6,436 | Thanked: 12,701 times | Joined on Nov 2011 @ Ängelholm, Sweden
#14
modified aptbackup script to be more flexible
aptbackup.sh automatically changing file extension to .deb before copying
/etc/apt/apt.conf.d/02backup
Code:
Dpkg::Pre-Install-Pkgs {"while read pkg; do /home/user/aptbackup.sh $pkg; done"};
/home/user/aptbackup.sh
Code:
#!/bin/sh

PKG=$1
BKPDIR=/home/user/MyDocs/AptBackup
FNAME=$(echo $PKG | sed -re "s/.*(\/)([^\/]*$).*/\2/" | sed -e "s/\.[^\.]*$/.deb/")
mkdir -p $BKPDIR
cp -f $PKG $BKPDIR/$FNAME;
dont forget to chmod +x aptbackup.sh
__________________
Telegram | Openrepos | GitHub | Revolut donations

Last edited by coderus; 2013-06-24 at 19:00.
 

The Following 2 Users Say Thank You to coderus For This Useful Post: