33-aptsetup: improve perl regex to work with backports and perl 5.14
authorMichael Prokop <mika@grml.org>
Mon, 22 Jun 2015 11:52:46 +0000 (13:52 +0200)
committerMichael Prokop <mika@grml.org>
Mon, 22 Jun 2015 11:59:52 +0000 (13:59 +0200)
The perl command line which is responsible for replacing
ftp.debian.org with the according snapshot.debian.org entry
produced an invalid sources.list entry with perl v5.14.2,
e.g. generating:

|  deb     http://snapshot.debian.org/archive/debian/20150622/ main   deb-src http://snapshot.debian.org/archive/debian/20150622/ main

with the following input:

|  deb     http://ftp.debian.org/debian/ jessie-backports main
|  deb-src http://ftp.debian.org/debian/ jessie-backports main

etc/grml/fai/config/scripts/GRMLBASE/33-aptsetup

index 10f5879..234bd1a 100755 (executable)
@@ -11,7 +11,7 @@ set -e
 # use snapshot.debian.org based on build date for release
 if ifclass RELEASE ; then
   set -u
-  perl -pi -e 'BEGIN { $d="'$(date +%Y%m%d)'"; } s#^(\s+)(deb.* )(.*://ftp.debian.org.*?)\s+(\w+)\s+(.*)$#$1$2http://snapshot.debian.org/archive/debian/$d/ $4 $5#' \
+  perl -pi -e 'BEGIN { $d="'$(date +%Y%m%d)'"; } s#^(\s+)(deb.* )(.*://ftp.debian.org.*?)\s+([a-z-]+)\s+(.*)$#$1$2http://snapshot.debian.org/archive/debian/$d/ $4 $5#' \
     "${target}/etc/apt/sources.list.d/debian.list"
 fi