Newer
Older
# Copyright (C) 2022 Luis Guzman <ark@switnet.org>
# Copyright (C) 2009-2017 Ruben Rodriguez <ruben@trisquel.info>
#
# 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
#
EXTERNAL='deb-src http://ftp.debian.org/debian bullseye main'
NETINST=true
. ./config
cat << EOF > debian/rules
#! /usr/bin/make -f
%:
dh \$@
EOF
rm debian/apt-mirror-setup.templates-ubuntu
# Remove multiarch support
sed '/chroot/,$d' generators/01setup -i
# getline "seed" file
getline(){
grep -n "$1" "$2" |cut -d: -f1
}
START=$(getline apt-setup/non-free debian/apt-mirror-setup.templates)
END=$(getline "Please choose whether you want to have it available anyway." debian/apt-mirror-setup.templates)
sed ${START},${END}d debian/apt-mirror-setup.templates -i
START=$(getline apt-setup/contrib debian/apt-mirror-setup.templates)
END=$(getline "Please choose whether you want this software to be made available to you." debian/apt-mirror-setup.templates)
sed ${START},${END}d debian/apt-mirror-setup.templates -i
/bin/sed '/canonical/d;
/Canonical/d;
s/main restricted universe multiverse/main/g;
s/dists restricted/dists/g;
s/archive.ubuntu.com/archive.trisquel.org/g;
s/security.ubuntu.com/archive.trisquel.org/g;
s/ports.ubuntu.com/archive.trisquel.org/g;
s/Ubuntu/Trisquel/g;
s/ubuntu/trisquel/g;
s/universe/main/g;
s/main main/main/g;
s:help.trisquel.com/community/UpgradeNotes:trisquel.info/wiki/:g;' generators/* -i
#Debian current (udeb)
/bin/sed '/previously on backports.debian.org/d;
/# To determine if non-free/,/done/d;
s/dists non-free/dists/g;
s/dists contrib/dists/g;
s/Debian/Trisquel/g;
s/debian/trisquel/g;' generators/* -i
#Ubuntu legacy (udeb)
replace "Default: /ubuntu" "Default: /trisquel" .
replace "security.ubuntu.com" "archive.trisquel.org" .
replace "archive.ubuntu.com" "archive.trisquel.org" .
#Debian current (udeb)
replace "Default: /debian" "Default: /trisquel" .
replace "security.debian.org" "archive.trisquel.org" .
replace "deb.debian.org" "archive.trisquel.org" .
replace "Debian" "Trisquel" .
mkdir release-files
cd release-files
rm -rf *
for DIST in $CODENAME $CODENAME-security $CODENAME-updates $CODENAME-backports
do
wget -r -l1 -np http://archive.trisquel.org/trisquel/dists/$DIST
find archive.trisquel.org/ |egrep '(index.html|robots.txt)'|xargs rm
cd ..
rm generators/9[1-9]* generators/50mirror generators/50mirror.ubuntu
sed -i '/generators\/9[1-9]*/d' debian/apt-setup-udeb.install
echo "generators/50mirror.trisquel usr/lib/apt-setup/generators
release-files/archive.trisquel.org usr/share/apt-setup/release-files" > debian/apt-mirror-setup.install
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
echo '#!/bin/sh
set -e
. /usr/share/debconf/confmodule
file="$1"
log() {
logger -t apt-setup "$@"
}
warning() {
log "warning: $@"
}
# Ask if a mirror should be used if the base system can be installed from CD
if [ -e /cdrom/.disk/base_installable ] || [ "$OVERRIDE_BASE_INSTALLABLE" ]; then
if ! search-path choose-mirror; then
warning "choose-mirror is not available; cannot offer network mirror"
exit 1
fi
# Default to false if no network selected in netcfg
if db_get netcfg/dhcp_options && \
[ "$RET" = "Do not configure the network at this time" ]; then
use_mirror=false
fi
# Set default if no value (see Debian mirror generator)
db_get apt-setup/use_mirror
[ "$RET" ] || db_set apt-setup/use_mirror true
# Text is variable for Debian
db_metaget apt-mirror/use/netinst_old description
db_subst apt-setup/use_mirror EXPLANATION "$RET"
db_input medium apt-setup/use_mirror || [ $? -eq 30 ]
db_go # or exit 10
db_get apt-setup/use_mirror
if [ "$RET" = false ]; then
exit 1
fi
if db_get cdrom/codename && [ "$RET" ]; then
db_set mirror/codename $RET
fi
if db_get cdrom/suite && [ "$RET" ]; then
db_set mirror/suite $RET
fi
choose-mirror -n # no progress bar
fi
db_input low apt-setup/backports || true
dists="main"
db_get mirror/protocol
protocol="$RET"
db_get mirror/codename
codename="$RET"
db_get mirror/$protocol/hostname
hostname="$RET"
db_get mirror/$protocol/directory
directory="/${RET#/}"
if [ "$protocol" = http ]; then
db_get mirror/$protocol/proxy
proxy="$RET"
if [ -n "$proxy" ]; then
if ! grep -iq "Acquire::$protocol::Proxy" $ROOT/etc/apt/apt.conf.new; then
echo "Acquire::$protocol::Proxy \"$proxy\";" >> $ROOT/etc/apt/apt.conf.new
fi
fi
fi
cat > $file <<EOF
# See http://trisquel.info/wiki/ for how to upgrade to
# newer versions of the distribution.
deb $protocol://$hostname$directory $codename $dists
deb-src $protocol://$hostname$directory $codename $dists
deb $protocol://$hostname$directory $codename-updates $dists
deb-src $protocol://$hostname$directory $codename-updates $dists
deb $protocol://$hostname$directory $codename-security $dists
deb-src $protocol://$hostname$directory $codename-security $dists
EOF
# Even if the backports repository is not enabled, we write example lines for
# it.
echo >> $file
if db_get apt-setup/backports && [ "$RET" = true ]; then
COMMENT=
else
cat >> $file <<EOF
EOF
COMMENT="# "
fi
cat >> $file <<EOF
# Uncomment this lines to enable the backports optional repository
${COMMENT}deb $protocol://$hostname$directory $codename-backports main
${COMMENT}deb-src $protocol://$hostname$directory $codename-backports main
EOF
#apt-setup-signed-release archive.trisquel.org "$file"
exit 0
' > generators/50mirror.trisquel
#sed '/The partner/,/^*/d; s/services-select-ubuntu/services-select-trisquel/' -i debian/apt-setup-udeb.templates
sed 's/services-select/services-select-trisquel/' -i debian/apt-setup-udeb.templates
chmod 755 generators/50mirror.trisquel
changelog "Rebranded and adapted for Trisquel"