Skip to content
Snippets Groups Projects
make-ubuntu-release-upgrader 12.83 KiB
#!/bin/sh
#
#    Copyright (C) 2008-2022  Ruben Rodriguez <ruben@trisquel.info>
#    Copyright (C)      2014  Santiago Rodriguez <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
#

# Note that you would need to publish and sign the upgrade tarball
# gpg -ba release_name.tar.gz
# Also, don't forget to update the meta-release files at archive and packages.t.i
# The "obsoletes" list from ubuntu has been removed

VERSION=13

. ./config

#%FSDG: Remove functions to deal with proprietary drivers
rm ./DistUpgrade/xorg_fix_proprietary.py
rm ./DistUpgrade/NvidiaDetector
sed s/self.checkForNvidia/#self.checkForNvidia/ DistUpgrade/DistUpgradeCache.py -i
sed '/_add_extras_repository/,/adding extras.ubuntu.com/d' -i DistUpgrade/DistUpgradeQuirks.py
sed 's/01ubuntu/01backports/' -i DistUpgrade/DistUpgradeController.py
rm tests/test-data/xorg.conf.fglrx

# Fix mirror checker
sed '/security.ubuntu.com" in entry.uri or/d' -i DistUpgrade/DistUpgradeController.py

#https://bugs.launchpad.net/ubuntu/+source/python-defaults/+bug/990740
cat << EOF >> DistUpgrade/DistUpgradeQuirks.py

    def from_taranisPostInitialUpdate(self):
        logging.debug("Setting APT::Immediate-Configure=false")
        apt.apt_pkg.config.set("APT::Immediate-Configure", "false")
        os.system("apt-get install --force-yes -y libblkid1 lzma dpkg")

    def from_taranisPostCleanup(self):
        logging.debug("Setting APT::Immediate-Configure=true")
        apt.apt_pkg.config.set("APT::Immediate-Configure", "true")
EOF


rm $(find . -name Ubuntu.info)
cat << EOF   > DistUpgrade/Trisquel.info
ChangelogURI: https://packages.trisquel.org/changelogs/pool/%s/%s/%s/%s_%s/%s

Suite: $CODENAME
RepositoryType: deb
BaseURI: https://archive.trisquel.org/trisquel/
Description: Trisquel $CODENAME
Component: main
Enabled: 1
CompDescription: Trisquel GNU/linux packages

Suite: $CODENAME-security
RepositoryType: deb
BaseURI: https://archive.trisquel.org/trisquel/
Description: Trisquel $CODENAME Security Updates
Component: main
Enabled: 1
CompDescription: Trisquel GNU/linux packages

Suite: $CODENAME-updates
RepositoryType: deb
BaseURI: https://archive.trisquel.org/trisquel/
Description: Trisquel $CODENAME Updates
Component: main
Enabled: 1
CompDescription: Trisquel GNU/linux packages

Suite: $CODENAME-backports
RepositoryType: deb
BaseURI: https://archive.trisquel.org/trisquel/
Description: Trisquel $CODENAME Backports
Component: main
Enabled: 0
CompDescription: Trisquel GNU/linux packages
EOF

rm DistUpgrade/ReleaseAnnouncement
cat << EOF >  DistUpgrade/ReleaseAnnouncement
= Welcome to Trisquel GNU/Linux $REVISION '$CODENAME' =

The Trisquel team is proud to announce Trisquel $REVISION '$CODENAME'.
We recommend to apply all pending updates to the system before upgrading.

Trisquel is a fully free operating system based in GNU/Linux, for domestic
users, small enterprises and educational centers.

We hope you enjoy Trisquel.

== Feedback and Helping ==

If you would like to help shape Trisquel, take a look at the list of 
ways you can participate at

  https://trisquel.info/en/wiki/how-help

Your comments, bug reports, patches and suggestions will help ensure
that our next release is the best release of Trisquel ever.  If you feel
that you have found a bug please send it to us via

  https://gitlab.trisquel.org/trisquel/package-helpers/-/issues

If you have a question, or if you think you may have found a bug but 
aren't sure, first try asking on the #trisquel IRC channel on Freenode,
on the Trisquel Users mailing list, or on the Trisquel forums:

 https://listas.trisquel.info/
 https://trisquel.info/forum

== More Information ==

You can find out more about Trisquel on our website, IRC channel and wiki.
If you're new to Trisquel, please visit:

  https://trisquel.info

To sign up for future Trisquel announcements, please subscribe to Trisquel's 
very low volume announcement list at:

  https://listas.trisquel.info/mailman/listinfo/trisquel-announce

EOF

rm DistUpgrade/DevelReleaseAnnouncement
cat << EOF >  DistUpgrade/DevelReleaseAnnouncement
This is a development release, do not install on production systems!

EOF

cat DistUpgrade/ReleaseAnnouncement >> DistUpgrade/DevelReleaseAnnouncement

rm DistUpgrade/EOLReleaseAnnouncement
cat << EOF >  DistUpgrade/EOLReleaseAnnouncement
= Trisquel GNU/Linux $REVISION '$CODENAME' is NO LONGER SUPPORTED! =

You are attempting to upgrade to a version of Trisquel that is no longer
supported. Since we do only keep upgrade packages for decomissioned releases
for a while, this upgrade may fail. Try the sandbox method first (by running
update-manager -s) or ask in our forums, lists or irc channels if you are
unsure about this procedure.

Even if the required upgrade packages for $CODENAME are still available, to 
get a currently supported release you  would need to upgrade at least once 
more after this procedure ends, so we recommend you to do a clean install 
using the latest LTS or STS edition.

== Feedback and Helping ==

If you would like to help shape Trisquel, take a look at the list of 
ways you can participate at

  https://trisquel.info/en/wiki/how-help

Your comments, bug reports, patches and suggestions will help ensure
that our next release is the best release of Trisquel ever.  If you feel
that you have found a bug please send it to us via

  https://gitlab.trisquel.org/trisquel/package-helpers/-/issues

If you have a question, or if you think you may have found a bug but 
aren't sure, first try asking on the #trisquel IRC channel on Freenode,
on the Trisquel Users mailing list, or on the Trisquel forums:

 https://listas.trisquel.info/
 https://trisquel.info/forum

== More Information ==

You can find out more about Trisquel on our website, IRC channel and wiki.
If you're new to Trisquel, please visit:

  https://trisquel.info

To sign up for future Trisquel announcements, please subscribe to Trisquel's 
very low volume announcement list at:

  https://listas.trisquel.info/mailman/listinfo/trisquel-announce

EOF

rm DistUpgrade/EOLReleaseAnnouncement.html DistUpgrade/ReleaseAnnouncement.html

perl $DATA/parsewiki DistUpgrade/EOLReleaseAnnouncement > DistUpgrade/EOLReleaseAnnouncement.html
perl $DATA/parsewiki DistUpgrade/ReleaseAnnouncement > DistUpgrade/ReleaseAnnouncement.html
perl $DATA/parsewiki DistUpgrade/DevelReleaseAnnouncement > DistUpgrade/DevelReleaseAnnouncement.html

cat <<EOF > data/removal_denylist.cfg
# blacklist of packages that should never be removed
trisquel-base
trisquel-minimal
trisquel-desktop-common
trisquel-mini
triskel
trisquel-sugar
# update-manager should not remove itself
update-manager
update-manager-core
trisquel-release-upgrader-core
# if for example postgresql-10 is purged the cluster can be dropped which we
# should prevent (LP: #871893, #1825563)
^postgresql-.*[0-9]\.[0-9].*
^postgresql-.*[0-9][0-9].*
# the upgrade runs in it
^screen$
# the upgrade might be run over ssh
^openssh-server$
EOF

rm data/mirrors.cfg
#https://mirmon.trisquel.org/conf.txt
cat << EOF > data/mirrors.cfg
https://mirror.fsf.org/trisquel/
https://mirror.cedia.org.ec/trisquel.packages/
https://mirrors.ustc.edu.cn/trisquel/
https://ftp.caliu.cat/pub/distribucions/trisquel/packages/
https://ftp.acc.umu.se/mirror/trisquel/packages/
https://mirrors.ocf.berkeley.edu/trisquel/
https://mirror.librelabucm.org/trisquel/
https://mirror.linux.pizza/trisquel/packages/
https://quantum-mirror.hu/mirrors/pub/trisquel/packages/
https://mirror.csclub.uwaterloo.ca/trisquel/packages/
https://ftpmirror1.infania.net/mirror/trisquel/packages/
https://mirrors.nju.edu.cn/trisquel/
https://mirror.math.princeton.edu/pub/trisquel-packages/
https://mirror.operationtulip.com/trisquel/packages/
https://mirrors.dotsrc.org/trisquel/
https://linkwithlinux.pw/trisquel-packages/
EOF

replace changelogs.ubuntu.com packages.trisquel.org .

rpl 11\.04 5\.0 DistUpgrade/*.ui
rpl 11\.04 5\.0 po/* -R
rpl 11\.10 5\.5 DistUpgrade/*.ui
rpl 11\.10 5\.5 po/* -R
rpl 12\.04 6\.0 DistUpgrade/*.ui
rpl 12\.04 6\.0 po/* -R
rpl 14\.04 7\.0 po/* -R
rpl 14\.04 7\.0 DistUpgrade/*.ui -R
replace '14.04' '7.0'
rpl 16\.04 8\.0 po/* -R
rpl 16\.04 8\.0 DistUpgrade/*.ui -R
replace '16.04' '8.0'
rpl 18\.04 9\.0 po/* -R
rpl 18\.04 9\.0 DistUpgrade/*.ui -R
replace '18.04' '9.0'
rpl 20\.04 10\.0 po/* -R
rpl 20\.04 10\.0 DistUpgrade/*.ui -R
replace '20.04' '10.0'
rpl $UPSTREAM $CODENAME . -R
rpl oneiric brigantia . -R
rpl natty dagda . -R
rpl maverick slaine . -R
rpl lucid taranis . -R
rpl karmic awen . -R
rpl jaunty dwyn . -R
rpl hardy robur . -R
rpl lucid taranis . -R
rpl precise toutatis . -R
rpl trusty belenos . -R
rpl xenial flidas . -R
rpl bionic etiona . -R
rpl focal nabia . -R

rm data/DistUpgrade.cfg*
cp $DATA/DistUpgrade.cfg* data/

cat << EOF >> data/demoted.cfg
notification-daemon
resolvconf
eom
EOF

sed 's|.ubuntu-bug ubuntu-release-upgrader-core. in a terminal|https://gitlab.trisquel.org/trisquel/package-helpers in a browser.|' DistUpgrade/DistUpgradeCache.py -i
replace "https*://launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+filebug" "https://gitlab.trisquel.org/trisquel/package-helpers/-/issues" .
replace "https*://launchpad.net/ubuntu/+source/ubuntu-release-upgrader" "https://gitlab.trisquel.org/trisquel/package-helpers/" .
replace "https*://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+filebug" "https://gitlab.trisquel.org/trisquel/package-helpers/-/issues" .
find -type f |xargs rename 's/ubuntu-release-upgrader/trisquel-release-upgrader/g'
replace  "ubuntu-release-upgrader" "trisquel-release-upgrader" .
mv kubuntu-devel-release-upgrade triskel-devel-release-upgrade
#mv tests/test-data-cdrom/ubuntu tests/test-data-cdrom/trisquel
replace old-releases.ubuntu.com oldarchive.trisquel.org

rpl "edubuntu" "trisquel-edu" . -R
rpl "kubuntu" "triskel" . -R
rpl "Kubuntu" "Triskel" . -R
rpl " Ubuntu " " Trisquel " . -R
rpl "Ubuntu " "Trisquel " . -R
rpl " Ubuntu" " Trisquel" . -R
rpl " ubuntu " " trisquel " . -R
rpl "ubuntu " "trisquel " . -R
rpl " ubuntu" " trisquel" . -R
rpl archive.ubuntu.com/ubuntu archive.trisquel.org/trisquel . -R
rpl security.ubuntu.com/ubuntu archive.trisquel.org/trisquel . -R
rpl archive.ubuntu.com archive.trisquel.org . -R
rpl security.ubuntu.com archive.trisquel.org . -R

sed 's/"main", "restricted", "universe", "multiverse"/"main"/g' DistUpgrade/DistUpgradeController.py -i utils/demotions.py
sed '/restricted/d' -i utils/demotions.py
sed 's/"main", "restricted"/"main"/g' DistUpgrade/DistUpgradeController.py -i
rpl "main restricted" "main" DistUpgrade -R
sed 's/,"restricted"//g' DistUpgrade/DistUpgradeController.py -i
#sed 's/","restricted"/\\n"/g' DistUpgrade/DistUpgradeController.py -i
#rpl '10.04' $REVISION DistUpgrade po -R
replace Ubuntu Trisquel
replace Canonical Trisquel
replace "https*://www.ubuntu.com/" "https://trisquel.info" .
replace "https*://wiki.ubuntu.com/X/Bugs/" "https://gitlab.trisquel.org/trisquel/package-helpers/-/issues" .
replace "https*://wiki.ubuntu.com/" "https://trisquel.info/wiki" .
replace "https*://help.ubuntu.com/community" "https://trisquel.info/wiki" .


/bin/sed -i 's/kubuntu/triskel/g; s/xubuntu/trisquel-mini/g; s/�~Lubuntu/�~Ltrisquel/g; s/被ubuntu/被trisquel/g; s#http://launchpad.net/ubuntu/+source/%s/%s/+changelog#https://gitlab.trisquel.org/trisquel/package-helpers#g; s/<.*@ubuntu.com/<info@trisquel.info/g; s/ ubuntu\n/ trisquel\n/g; s/ubuntu\ /trisquel\ /g; s/\ ubuntu/\ trisquel/g; s/Ubuntu/Trisquel/g; s/ubuntu-desktop/trisquel-/g; s/www.ubuntu.com/trisquel.info/g; s/www.ubuntulinux.org/trisquel.info/g ' po/*.po $(find -type f | grep py$) $(find -type f | grep '\.glade$')
replace Trisquel-Gettext Ubuntu-Gettext

sed '1s/trisquel/ubuntu/' debian/control -i
sed '/drivers/d' debian/control -i

for i in core gtk qt; do
  sed "/Package: trisquel-release-upgrader-$i/ s/$/\nProvides: ubuntu-release-upgrader-$i/" -i debian/control
done

sed 's/ubuntu-release-upgrader-core/ubuntu-release-upgrader-core (= ${source:Version})/' -i debian/control

# Fix meta-release file
cat << MR-FILE > data/meta-release
# default location for the meta-release file

[METARELEASE]
URI = https://archive.trisquel.org/trisquel/meta-release
URI_LTS = https://archive.trisquel.org/trisquel/meta-release
URI_UNSTABLE_POSTFIX = -development
URI_PROPOSED_POSTFIX = -proposed
MR-FILE

changelog "Compiled for Trisquel"

PARALLEL=false compile