count drives by type, ignoring serial number
[sysadmin-cookbook] / recepies / debian / apt-sources.sh
1 #!/bin/sh -x
2
3 path=/etc/apt/sources.list
4 tmp=/tmp/sources.list
5
6 cp $path $tmp
7
8 function append() {
9         if ! grep "$1" $path ; then
10                 echo "$1" >> $tmp
11         fi
12 }
13
14 append "deb http://debian.rot13.org binary/"
15 append "deb http://debian.pkgs.cpan.org/debian unstable main"
16 #append "deb http://debian.rot13.org/debian unstable main"
17
18 if ! diff -uw $path $tmp ; then
19         cp $path $path.old && mv $tmp $path
20         apt-get update
21 fi