Fix Debian install symlink issue (#33124)

We were inadvertently changing the /usr/bin symlink to use `PACKAGE` (without
the channel name). However, Debian requires the symlink to specify the channel
name or the installer will actually fail:

  $ sudo dpkg -i brave-browser_1.88.0_amd64.deb
  [sudo] password for emerick:
  Selecting previously unselected package brave-browser.
  (Reading database ... 635629 files and directories currently installed.)
  Preparing to unpack brave-browser_1.88.0_amd64.deb ...
  Unpacking brave-browser (1.88.0) ...
  Setting up brave-browser (1.88.0) ...
  update-alternatives: using /usr/bin/brave-browser to provide /usr/bin/x-www-browser (x-www-browser) in auto mode
  update-alternatives: using /usr/bin/brave-browser to provide /usr/bin/gnome-www-browser (gnome-www-browser) in auto mode
  update-alternatives: <link> '/usr/bin/brave-browser' is the same as <path>

  Use 'update-alternatives --help' for program usage information.
  dpkg: error processing package brave-browser (--install):
   installed brave-browser package post-installation script subprocess returned error exit status 2
  Processing triggers for gnome-menus (3.36.0-1.1ubuntu3) ...
  Processing triggers for desktop-file-utils (0.27-2build1) ...
  Processing triggers for mailcap (3.70+nmu1ubuntu1) ...
  Processing triggers for man-db (2.12.0-4build2) ...
  Errors were encountered while processing:
   brave-browser
This commit is contained in:
Emerick Rogul
2026-01-11 17:06:37 -05:00
committed by GitHub
parent c1e0e25601
commit a9afef1230
@@ -25,13 +25,11 @@ def normalize_channel(original_function, channel):
# This override adds or modifies the following context values:
# - PACKAGEANDCHANNEL: required by our templates (drops channel name for stable)
# - USR_BIN_SYMLINK_NAME: required for docs (drops channel name for stable)
# - VERSION/VERSIONFULL: drops MAJOR from the version string
@override_utils.override_method(Installer)
def initialize(self, original_method):
original_method(self)
self.context["PACKAGEANDCHANNEL"] = self.context["PACKAGE"]
self.context["USR_BIN_SYMLINK_NAME"] = self.context["PACKAGE"]
self.context["VERSION"] = (f"{self.context['MINOR']}."
f"{self.context['BUILD']}."
f"{self.context['PATCH']}")