ubiquity: setup custom support for deb822 format
This commit is contained in:
parent
46ebef52f1
commit
7f5176c32f
3 changed files with 112 additions and 54 deletions
77
helpers/DATA/ubiquity/99trisquel
Executable file
77
helpers/DATA/ubiquity/99trisquel
Executable file
|
|
@ -0,0 +1,77 @@
|
||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
file="$1"
|
||||||
|
|
||||||
|
# Trisquel: Deb822-first, keep legacy clean
|
||||||
|
: "${ROOT:=/target}"
|
||||||
|
SD="$ROOT/etc/apt/sources.list.d"
|
||||||
|
SF="$SD/trisquel.sources"
|
||||||
|
LEGACY="$ROOT/etc/apt/sources.list"
|
||||||
|
MSG="# Trisquel sources have moved to /etc/apt/sources.list.d/trisquel.sources"
|
||||||
|
mkdir -p "$SD"
|
||||||
|
|
||||||
|
FASTEST=https://archive.trisquel.org/trisquel/
|
||||||
|
SPEED=1000000000000
|
||||||
|
|
||||||
|
if nm-online -xq
|
||||||
|
then
|
||||||
|
for i in $(grep '//' /usr/share/python-apt/templates/Trisquel.mirrors | sed 's|/$||')
|
||||||
|
do
|
||||||
|
echo Testing $i
|
||||||
|
TIME=$(date +%s%N)
|
||||||
|
wget --no-check-certificate -t 1 -T 5 --max-redirect=0 -o /dev/null -O /dev/null $i/speedtest || continue
|
||||||
|
TIME2=$(date +%s%N)
|
||||||
|
ELAPSED=$(expr $TIME2 - $TIME)
|
||||||
|
echo Time: $ELAPSED
|
||||||
|
if [ $ELAPSED -lt $SPEED ]
|
||||||
|
then
|
||||||
|
FASTEST=$i
|
||||||
|
SPEED=$ELAPSED
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Selected mirror: $FASTEST"
|
||||||
|
|
||||||
|
MIRROR=$FASTEST
|
||||||
|
RELEASE=$(lsb_release -c | cut -f 2)
|
||||||
|
|
||||||
|
# Ensure MIRROR ends with a single trailing slash for Deb822 URIs
|
||||||
|
case "$MIRROR" in
|
||||||
|
*/) : ;;
|
||||||
|
*) MIRROR="$MIRROR/";;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Use keyring in /usr/share/keyrings
|
||||||
|
SIGNED_BY="/usr/share/keyrings/trisquel-archive-keyring.gpg"
|
||||||
|
|
||||||
|
# Write Deb822 sources file in the requested structure
|
||||||
|
cat << EOF > "$SF"
|
||||||
|
# Trisquel repositories for supported software and updates
|
||||||
|
Types: deb
|
||||||
|
URIs: ${MIRROR}
|
||||||
|
Suites: ${RELEASE} ${RELEASE}-updates ${RELEASE}-security
|
||||||
|
Components: main
|
||||||
|
Signed-By: ${SIGNED_BY}
|
||||||
|
|
||||||
|
# Source package repositories
|
||||||
|
Types: deb-src
|
||||||
|
URIs: ${MIRROR}
|
||||||
|
Suites: ${RELEASE} ${RELEASE}-updates ${RELEASE}-security
|
||||||
|
Components: main
|
||||||
|
Signed-By: ${SIGNED_BY}
|
||||||
|
|
||||||
|
# Optional backports repository
|
||||||
|
Enabled: no
|
||||||
|
Types: deb deb-src
|
||||||
|
URIs: ${MIRROR}
|
||||||
|
Suites: ${RELEASE}-backports
|
||||||
|
Components: main
|
||||||
|
Signed-By: ${SIGNED_BY}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Keep the legacy file and the pipeline temp file as a single breadcrumb line
|
||||||
|
printf '%s\n' "$MSG" > "$LEGACY"
|
||||||
|
printf '%s\n' "$MSG" > "$file"
|
||||||
|
exit 0
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
diff --git a/d-i/source/apt-setup/generators/01setup b/d-i/source/apt-setup/generators/01setup
|
||||||
|
index b4b0ea40..c4933286 100755
|
||||||
|
--- a/d-i/source/apt-setup/generators/01setup
|
||||||
|
+++ b/d-i/source/apt-setup/generators/01setup
|
||||||
|
@@ -5,6 +5,25 @@ set -e
|
||||||
|
|
||||||
|
file="$1"
|
||||||
|
|
||||||
|
+# Ensure ROOT default; allow override
|
||||||
|
+: "${ROOT:=/target}"
|
||||||
|
+
|
||||||
|
+# If Deb822 sources already exist in the target, keep legacy minimal and clean.
|
||||||
|
+if [ -d "$ROOT/etc/apt/sources.list.d" ] && ls "$ROOT/etc/apt/sources.list.d/"*.sources >/dev/null 2>&1; then
|
||||||
|
+ msg="# Trisquel sources have moved to /etc/apt/sources.list.d/trisquel.sources"
|
||||||
|
+ # Temp file consumed by the generators pipeline (must exist, but keep it clean)
|
||||||
|
+ printf '%s\n' "$msg" > "$file"
|
||||||
|
+ # Ensure the target legacy file exists and contains only the breadcrumb
|
||||||
|
+ printf '%s\n' "$msg" > "$ROOT/etc/apt/sources.list"
|
||||||
|
+else
|
||||||
|
+ # Fallback: add old file as comments (tolerant if missing)
|
||||||
|
+ if [ -r "$ROOT/etc/apt/sources.list" ]; then
|
||||||
|
+ sed 's/^/# /' < "$ROOT/etc/apt/sources.list" | sed 's/^# # */# /' > "$file"
|
||||||
|
+ else
|
||||||
|
+ : > "$file"
|
||||||
|
+ fi
|
||||||
|
+fi
|
||||||
|
+
|
||||||
|
# add old file as comments
|
||||||
|
sed 's/^/# /' < $ROOT/etc/apt/sources.list | sed 's/^# # */# /' > $file
|
||||||
|
|
||||||
|
|
@ -19,19 +19,14 @@
|
||||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
VERSION=42
|
VERSION=43
|
||||||
|
|
||||||
. ./config
|
. ./config
|
||||||
|
|
||||||
Mirrors_masterlist_git="trisquel-packages/-/raw/master/extra/mirrors/Mirrors.masterlist"
|
Mirrors_masterlist_git="trisquel-packages/-/raw/master/extra/mirrors/Mirrors.masterlist"
|
||||||
|
|
||||||
## Apply patches upfront
|
## Apply patches upfront
|
||||||
# Avoid the need for a custom cdrom:// repo - 001-grub-installer.patch
|
# Please look for DATA/ubiquity/patch_changes for more info on applied patches by function:
|
||||||
truncate -s 0 d-i/source/apt-setup/generators/40cdrom
|
|
||||||
# Disable confirmation popups, as they are innacurate and buggy - 002-no_confrirmation_when_crypto.patch
|
|
||||||
# Fix some gtk labels for Orca - 003-a11y.patch
|
|
||||||
# Point ubiquity crash to trisquel's forge. - 004-crash_report_point_to_trisquel_forge.patch
|
|
||||||
# Prevent ubiquity-dm to error out due missing settings - 005-prevent_ubiquity-dm_error_due_missing_gsettings.patch
|
|
||||||
apply_patch_changes
|
apply_patch_changes
|
||||||
|
|
||||||
# Remove test_timezone to prevent error out future builds on different daylight time.
|
# Remove test_timezone to prevent error out future builds on different daylight time.
|
||||||
|
|
@ -81,7 +76,7 @@ sed 's:\(targetdb)\):\1\n os.system("sudo chmod 644 /target/var/cache/deb
|
||||||
# Fix https://bugs.launchpad.net/ubuntu/+source/ubiquity/+bug/1080701
|
# Fix https://bugs.launchpad.net/ubuntu/+source/ubiquity/+bug/1080701
|
||||||
sed '/from ubiquity import osextras/s/$/\nos.system("sudo swapoff -a")/' bin/ubiquity-wrapper -i
|
sed '/from ubiquity import osextras/s/$/\nos.system("sudo swapoff -a")/' bin/ubiquity-wrapper -i
|
||||||
|
|
||||||
for i in $(ls -1 d-i/source/apt-setup/generators |grep -v 01setup|grep -v 40cdrom) canonical.com security.ubuntu.com extras.ubuntu.com
|
for i in $(ls -1 d-i/source/apt-setup/generators |grep -v 01setup) canonical.com security.ubuntu.com extras.ubuntu.com
|
||||||
do
|
do
|
||||||
/bin/sed /$i/d -i debian/ubiquity.install-any d-i/source/apt-setup/debian/*.install
|
/bin/sed /$i/d -i debian/ubiquity.install-any d-i/source/apt-setup/debian/*.install
|
||||||
done
|
done
|
||||||
|
|
@ -91,52 +86,8 @@ echo "d-i/source/apt-setup/generators/99trisquel usr/lib/ubiquity/apt-setup/gene
|
||||||
cp $DATA/trisquel.png data/ubiquity.png
|
cp $DATA/trisquel.png data/ubiquity.png
|
||||||
|
|
||||||
# remove Ubuntu apt setup for the installer
|
# remove Ubuntu apt setup for the installer
|
||||||
find d-i/source/apt-setup/generators -type f | grep -v 01setup |grep -v 40cdrom| xargs -r rm
|
find d-i/source/apt-setup/generators -type f | grep -v 01setup | xargs -r rm
|
||||||
cat << EOF1 > d-i/source/apt-setup/generators/99trisquel
|
cp $DATA/99trisquel d-i/source/apt-setup/generators/
|
||||||
#!/bin/sh
|
|
||||||
set -e
|
|
||||||
|
|
||||||
file="\$1"
|
|
||||||
|
|
||||||
FASTEST=https://archive.trisquel.org/trisquel/
|
|
||||||
SPEED=1000000000000
|
|
||||||
|
|
||||||
if nm-online -xq
|
|
||||||
then
|
|
||||||
for i in \$(grep '//' /usr/share/python-apt/templates/Trisquel.mirrors | sed 's|/$||')
|
|
||||||
do
|
|
||||||
echo Testing \$i
|
|
||||||
TIME=\$(date +%s%N)
|
|
||||||
wget --no-check-certificate -t 1 -T 5 --max-redirect=0 -o /dev/null -O /dev/null \$i/speedtest || continue
|
|
||||||
TIME2=\$(date +%s%N)
|
|
||||||
ELAPSED=\$(expr \$TIME2 - \$TIME)
|
|
||||||
echo Time: \$ELAPSED
|
|
||||||
if [ \$ELAPSED -lt \$SPEED ]
|
|
||||||
then
|
|
||||||
FASTEST=\$i
|
|
||||||
SPEED=\$ELAPSED
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Selected mirror: \$FASTEST"
|
|
||||||
|
|
||||||
MIRROR=\$FASTEST
|
|
||||||
RELEASE=\$(lsb_release -c | cut -f 2)
|
|
||||||
|
|
||||||
cat << EOF > \$file
|
|
||||||
# Trisquel repositories for supported software and updates
|
|
||||||
deb \$MIRROR \$RELEASE main
|
|
||||||
deb-src \$MIRROR \$RELEASE main
|
|
||||||
deb \$MIRROR \$RELEASE-security main
|
|
||||||
deb-src \$MIRROR \$RELEASE-security main
|
|
||||||
deb \$MIRROR \$RELEASE-updates main
|
|
||||||
deb-src \$MIRROR \$RELEASE-updates main
|
|
||||||
#deb \$MIRROR \$RELEASE-backports main
|
|
||||||
#deb-src \$MIRROR \$RELEASE-backports main
|
|
||||||
EOF
|
|
||||||
EOF1
|
|
||||||
chmod 755 d-i/source/apt-setup/generators/99trisquel
|
|
||||||
|
|
||||||
# Redirect ports.ubuntu.com
|
# Redirect ports.ubuntu.com
|
||||||
sed '/ports.ubuntu.com/d' -i ./d-i/source/apt-setup/debian/apt-mirror-setup.install
|
sed '/ports.ubuntu.com/d' -i ./d-i/source/apt-setup/debian/apt-mirror-setup.install
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue