Thursday, September 19, 2013

Show only "Free" software in Ubuntu Software Center

In other words, "How to prevent paid software from being listed in Ubuntu Software Center"


Follow three simple steps as root:

1. In the file
/usr/share/software-center/softwarecenter/db/update.py
 
somewhere near line 480 find the following lines and add the highlighted line:
 
        doc = self.make_doc(cache)
        if not doc:
            LOG.debug("%r.index_app_info: returned invalid doc %r, ignoring.",
                      self.__class__.__name__, doc)
            return
        name = doc.get_data()

        if doc.get_value(XapianValues.PRICE) not in (""): return
        if name in seen:
            LOG.debug("%r.index_app_info: duplicated name %r (%r)",
                      self.__class__.__name__, name, self.desktopf)
        LOG.debug("%r.index_app_info: indexing %r",
                  self.__class__.__name__, name)
        seen.add(name)
  
2. In the file 
/usr/share/software-center/softwarecenter/backend/channel_impl/aptchannels.py
 
find the following lines and commentize the highlighted lines:

        if partner_channel is not None:
            channels.append(partner_channel)
        #if get_distro().PURCHASE_APP_URL:
        #    channels.append(for_purchase_channel)
        if new_apps_channel is not None:
            channels.append(new_apps_channel) 
3. Issue the command:
# update-software-center
 
4. Also disable "multiverse" from "Software and Updates" settings panel.