#!/bin/sh
#
#    Copyright (C) 2012  Santiago Rodríguez  <santi@trisquel.info>
#    Copyright (C) 2019 Mason Hock <mason@masonhock.com>
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
#

VERSION=4

. ./config

cp $DATA/Trisquel-mirror.list debian/


sed 's/Debian or Ubuntu/Trisquel/' -i apt-mirror
sed 's/Debian/Trisquel/g' -i apt-mirror
sed 's/debian/trisquel/g' -i apt-mirror
sed "s/stable/$CODENAME/g" -i apt-mirror
sed 's/ contrib//g' -i apt-mirror
sed 's/ non-free//g' -i apt-mirror

# Set fixed Trisquel release variables for mirror.list
cat << EOF | patch --no-backup-if-mismatch -p1
diff --git a/debian/rules b/debian/rules_
index e9c85e9..b6c1c97 100755
--- a/debian/rules
+++ b/debian/rules_
@@ -1,7 +1,7 @@
 #!/usr/bin/make -f
 
-DIST ?= \$(shell lsb_release -si)
-CODENAME ?= \$(shell lsb_release -sc)
+DIST ?= Trisquel
+CODENAME ?= $CODENAME
 
 %:
        dh \$@
EOF

changelog "Added config and update manpage for Trisquel."

package

