tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

system-setup.sh (2118B)


      1 #!/bin/bash
      2 
      3 set -ex
      4 
      5 SNAP_BASE=$1
      6 
      7 # Limit cross compilation support to core24 because it's not working before
      8 if [ "${SNAP_BASE}" != "core24" ]; then
      9    echo "Cross-compilation not supported before core24 base"
     10    exit 0
     11 fi;
     12 
     13 # Remove snapshot.ubuntu.com configuration for now.
     14 rm -f /etc/apt/apt.conf.d/99snapshot
     15 
     16 # GPG: we need to do it here otherwhise snapcraft tries to do it as user and fails
     17 CROSS_GPG_KEYID="F6ECB3762474EDA9D21B7022871920D1991BC93C"
     18 KEYRING_FILENAME="/etc/apt/keyrings/craft-$(echo "${CROSS_GPG_KEYID}" | rev | cut -c 1-8 | rev | tr -d '\n').gpg"
     19 gpg --batch --no-default-keyring --with-colons --keyring gnupg-ring:"${KEYRING_FILENAME}" --homedir /tmp --keyserver keyserver.ubuntu.com --recv-keys "${CROSS_GPG_KEYID}"
     20 chmod 0444 "${KEYRING_FILENAME}"
     21 
     22 sed -ri 's/^deb http/deb [arch=amd64] http/g' /etc/apt/sources.list
     23 
     24 # snapcraft 8.8+ looks for ports.ubuntu.com
     25 # > 2025-04-15 06:31:53.558 Reading sources in '/etc/apt/sources.list.d/ubuntu.sources' looking for 'ports.ubuntu.com/'
     26 sed -ri "s|URIs: http://archive.ubuntu.com/ubuntu/|URIs: http://archive.ubuntu.com/ubuntu/\nArchitectures: amd64|g" /etc/apt/sources.list.d/ubuntu.sources
     27 sed -ri "s|URIs: http://security.ubuntu.com/ubuntu/|URIs: http://security.ubuntu.com/ubuntu/\nArchitectures: amd64|g" /etc/apt/sources.list.d/ubuntu.sources
     28 
     29 # This needs to exactly match what snapcraft will produce at https://github.com/canonical/craft-archives/blob/015bbe59d53cad5e262ab7fddba3a6080cb90391/craft_archives/repo/apt_sources_manager.py#L161-L165
     30 # If it's not the case then the file will be re-generated, and snapcraft will try to do things with .sources files and dpkg architecture that will badly break
     31 cat <<EOF > /etc/apt/sources.list.d/craft-http_ports_ubuntu_com.sources
     32 Types: deb
     33 URIs: http://ports.ubuntu.com
     34 Suites: noble noble-updates noble-security noble-backports
     35 Components: main multiverse universe
     36 Architectures: arm64
     37 Signed-By: ${KEYRING_FILENAME}
     38 EOF
     39 
     40 # snapcraft 8.8+ will want both and will rewrite ubuntu.sources
     41 dpkg --add-architecture "arm64"
     42 apt-get update
     43 apt-get --fix-broken install -y
     44 apt-get upgrade -y